You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
372 lines
1.0 MiB
372 lines
1.0 MiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[73,5,7,16],{"+NIl":function(vt,Te,Q){(function(ie){ie(Q("VrN/"))})(function(ie){"use strict";ie.defineMode("stex",function($,O){"use strict";function V(p,g){p.cmdState.push(g)}function I(p){return p.cmdState.length>0?p.cmdState[p.cmdState.length-1]:null}function M(p){var g=p.cmdState.pop();g&&g.closeBracket()}function W(p){for(var g=p.cmdState,b=g.length-1;b>=0;b--){var o=g[b];if(o.name=="DEFAULT")continue;return o}return{styleIdentifier:function(){return null}}}function N(p,g,b){return function(){this.name=p,this.bracketNo=0,this.style=g,this.styles=b,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var P={};P.importmodule=N("importmodule","tag",["string","builtin"]),P.documentclass=N("documentclass","tag",["","atom"]),P.usepackage=N("usepackage","tag",["atom"]),P.begin=N("begin","tag",["atom"]),P.end=N("end","tag",["atom"]),P.label=N("label","tag",["atom"]),P.ref=N("ref","tag",["atom"]),P.eqref=N("eqref","tag",["atom"]),P.cite=N("cite","tag",["atom"]),P.bibitem=N("bibitem","tag",["atom"]),P.Bibitem=N("Bibitem","tag",["atom"]),P.RBibitem=N("RBibitem","tag",["atom"]),P.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function R(p,g){p.f=g}function d(p,g){var b;if(p.match(/^\\[a-zA-Z@]+/)){var o=p.current().slice(1);return b=P.hasOwnProperty(o)?P[o]:P.DEFAULT,b=new b,V(g,b),R(g,w),b.style}if(p.match(/^\\[$&%#{}_]/))return"tag";if(p.match(/^\\[,;!\/\\]/))return"tag";if(p.match("\\["))return R(g,function(s,l){return f(s,l,"\\]")}),"keyword";if(p.match("\\("))return R(g,function(s,l){return f(s,l,"\\)")}),"keyword";if(p.match("$$"))return R(g,function(s,l){return f(s,l,"$$")}),"keyword";if(p.match("$"))return R(g,function(s,l){return f(s,l,"$")}),"keyword";var i=p.next();if(i=="%")return p.skipToEnd(),"comment";if(i=="}"||i=="]"){if(b=I(g),b)b.closeBracket(i),R(g,w);else return"error";return"bracket"}else return i=="{"||i=="["?(b=P.DEFAULT,b=new b,V(g,b),"bracket"):/\d/.test(i)?(p.eatWhile(/[\w.%]/),"atom"):(p.eatWhile(/[\w\-_]/),b=W(g),b.name=="begin"&&(b.argument=p.current()),b.styleIdentifier())}function f(p,g,b){if(p.eatSpace())return null;if(b&&p.match(b))return R(g,d),"keyword";if(p.match(/^\\[a-zA-Z@]+/))return"tag";if(p.match(/^[a-zA-Z]+/))return"variable-2";if(p.match(/^\\[$&%#{}_]/))return"tag";if(p.match(/^\\[,;!\/]/))return"tag";if(p.match(/^[\^_&]/))return"tag";if(p.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(p.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var o=p.next();return o=="{"||o=="}"||o=="["||o=="]"||o=="("||o==")"?"bracket":o=="%"?(p.skipToEnd(),"comment"):"error"}function w(p,g){var b=p.peek(),o;return b=="{"||b=="["?(o=I(g),o.openBracket(b),p.eat(b),R(g,d),"bracket"):/[ \t\r]/.test(b)?(p.eat(b),null):(R(g,d),M(g),d(p,g))}return{startState:function(){var p=O.inMathMode?function(g,b){return f(g,b)}:d;return{cmdState:[],f:p}},copyState:function(p){return{cmdState:p.cmdState.slice(),f:p.f}},token:function(p,g){return g.f(p,g)},blankLine:function(p){p.f=d,p.cmdState.length=0},lineComment:"%"}}),ie.defineMIME("text/x-stex","stex"),ie.defineMIME("text/x-latex","stex")})},"+ua5":function(vt,Te,Q){},"/cxE":function(vt,Te,Q){"use strict";Q.d(Te,"e",function(){return O}),Q.d(Te,"f",function(){return V}),Q.d(Te,"g",function(){return I}),Q.d(Te,"d",function(){return W}),Q.d(Te,"a",function(){return N}),Q.d(Te,"b",function(){return P}),Q.d(Te,"c",function(){return R});var ie=function(){function d(){this.listeners=[],this.unexpectedErrorHandler=function(f){setTimeout(function(){throw f.stack?new Error(f.message+`
|
|
|
|
`+f.stack):f},0)}}return d.prototype.emit=function(f){this.listeners.forEach(function(w){w(f)})},d.prototype.onUnexpectedError=function(f){this.unexpectedErrorHandler(f),this.emit(f)},d.prototype.onUnexpectedExternalError=function(f){this.unexpectedErrorHandler(f)},d}(),$=new ie;function O(d){W(d)||$.onUnexpectedError(d);return}function V(d){W(d)||$.onUnexpectedExternalError(d);return}function I(d){if(d instanceof Error){var f=d.name,w=d.message,p=d.stacktrace||d.stack;return{$isError:!0,name:f,message:w,stack:p}}return d}var M="Canceled";function W(d){return d instanceof Error&&d.name===M&&d.message===M}function N(){var d=new Error(M);return d.name=d.message,d}function P(d){return d?new Error("Illegal argument: "+d):new Error("Illegal argument")}function R(d){return d?new Error("Illegal state: "+d):new Error("Illegal state")}},"19Vz":function(vt,Te,Q){(function(ie){ie(Q("VrN/"))})(function(ie){ie.defineOption("placeholder","",function(N,P,R){var d=R&&R!=ie.Init;if(P&&!d)N.on("blur",I),N.on("change",M),N.on("swapDoc",M),ie.on(N.getInputField(),"compositionupdate",N.state.placeholderCompose=function(){V(N)}),M(N);else if(!P&&d){N.off("blur",I),N.off("change",M),N.off("swapDoc",M),ie.off(N.getInputField(),"compositionupdate",N.state.placeholderCompose),$(N);var f=N.getWrapperElement();f.className=f.className.replace(" CodeMirror-empty","")}P&&!N.hasFocus()&&I(N)});function $(N){N.state.placeholder&&(N.state.placeholder.parentNode.removeChild(N.state.placeholder),N.state.placeholder=null)}function O(N){$(N);var P=N.state.placeholder=document.createElement("pre");P.style.cssText="height: 0; overflow: visible",P.style.direction=N.getOption("direction"),P.className="CodeMirror-placeholder CodeMirror-line-like";var R=N.getOption("placeholder");typeof R=="string"&&(R=document.createTextNode(R)),P.appendChild(R),N.display.lineSpace.insertBefore(P,N.display.lineSpace.firstChild)}function V(N){setTimeout(function(){var P=!1,R=N.getInputField();R.nodeName=="TEXTAREA"?P=!R.value:N.lineCount()==1&&(P=!/[^\u200b]/.test(R.querySelector(".CodeMirror-line").textContent)),P?O(N):$(N)},20)}function I(N){W(N)&&O(N)}function M(N){var P=N.getWrapperElement(),R=W(N);P.className=P.className.replace(" CodeMirror-empty","")+(R?" CodeMirror-empty":""),R?O(N):$(N)}function W(N){return N.lineCount()===1&&N.getLine(0)===""}})},"1eCo":function(vt,Te,Q){(function(ie){ie(Q("VrN/"))})(function(ie){"use strict";var $={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},O={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ie.defineMode("xml",function(V,I){var M=V.indentUnit,W={},N=I.htmlMode?$:O;for(var P in N)W[P]=N[P];for(var P in I)W[P]=I[P];var R,d;function f(u,A){function S(j){return A.tokenize=j,j(u,A)}var T=u.next();if(T=="<")return u.eat("!")?u.eat("[")?u.match("CDATA[")?S(g("atom","]]>")):null:u.match("--")?S(g("comment","-->")):u.match("DOCTYPE",!0,!0)?(u.eatWhile(/[\w\._\-]/),S(b(1))):null:u.eat("?")?(u.eatWhile(/[\w\._\-]/),A.tokenize=g("meta","?>"),"meta"):(R=u.eat("/")?"closeTag":"openTag",A.tokenize=w,"tag bracket");if(T=="&"){var _;return u.eat("#")?u.eat("x")?_=u.eatWhile(/[a-fA-F\d]/)&&u.eat(";"):_=u.eatWhile(/[\d]/)&&u.eat(";"):_=u.eatWhile(/[\w\.\-:]/)&&u.eat(";"),_?"atom":"error"}else return u.eatWhile(/[^&<]/),null}f.isInText=!0;function w(u,A){var S=u.next();if(S==">"||S=="/"&&u.eat(">"))return A.tokenize=f,R=S==">"?"endTag":"selfcloseTag","tag bracket";if(S=="=")return R="equals",null;if(S=="<"){A.tokenize=f,A.state=l,A.tagName=A.tagStart=null;var T=A.tokenize(u,A);return T?T+" tag error":"tag error"}else return/[\'\"]/.test(S)?(A.tokenize=p(S),A.stringStartCol=u.column(),A.tokenize(u,A)):(u.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function p(u){var A=function(S,T){for(;!S.eol();)if(S.next()==u){T.tokenize=w;break}return"string"};return A.isInAttribute=!0,A}function g(u,A){return function(S,T){for(;!S.eol();){if(S.match(A)){T.tokenize=f;break}S.next()}return u}}function b(u){return function(A,S){for(var T;(T=A.next())!=null;){if(T=="<")return S.tokenize=b(u+1),S.tokenize(A,S);if(T==">")if(u==1){S.tokenize=f;break}else return S.tokenize=b(u-1),S.tokenize(A,S)}return"meta"}}function o(u,A,S){this.prev=u.context,this.tagName=A,this.indent=u.indented,this.startOfLine=S,(W.doNotIndent.hasOwnProperty(A)||u.context&&u.context.noIndent)&&(this.noIndent=!0)}function i(u){u.context&&(u.context=u.context.prev)}function s(u,A){for(var S;;){if(!u.context)return;if(S=u.context.tagName,!W.contextGrabbers.hasOwnProperty(S)||!W.contextGrabbers[S].hasOwnProperty(A))return;i(u)}}function l(u,A,S){return u=="openTag"?(S.tagStart=A.column(),C):u=="closeTag"?m:l}function C(u,A,S){return u=="word"?(S.tagName=A.current(),d="tag",L):W.allowMissingTagName&&u=="endTag"?(d="tag bracket",L(u,A,S)):(d="error",C)}function m(u,A,S){if(u=="word"){var T=A.current();return S.context&&S.context.tagName!=T&&W.implicitlyClosed.hasOwnProperty(S.context.tagName)&&i(S),S.context&&S.context.tagName==T||W.matchClosing===!1?(d="tag",v):(d="tag error",k)}else return W.allowMissingTagName&&u=="endTag"?(d="tag bracket",v(u,A,S)):(d="error",k)}function v(u,A,S){return u!="endTag"?(d="error",v):(i(S),l)}function k(u,A,S){return d="error",v(u,A,S)}function L(u,A,S){if(u=="word")return d="attribute",E;if(u=="endTag"||u=="selfcloseTag"){var T=S.tagName,_=S.tagStart;return S.tagName=S.tagStart=null,u=="selfcloseTag"||W.autoSelfClosers.hasOwnProperty(T)?s(S,T):(s(S,T),S.context=new o(S,T,_==S.indented)),l}return d="error",L}function E(u,A,S){return u=="equals"?y:(W.allowMissing||(d="error"),L(u,A,S))}function y(u,A,S){return u=="string"?c:u=="word"&&W.allowUnquoted?(d="string",L):(d="error",L(u,A,S))}function c(u,A,S){return u=="string"?c:L(u,A,S)}return{startState:function(u){var A={tokenize:f,state:l,indented:u||0,tagName:null,tagStart:null,context:null};return u!=null&&(A.baseIndent=u),A},token:function(u,A){if(!A.tagName&&u.sol()&&(A.indented=u.indentation()),u.eatSpace())return null;R=null;var S=A.tokenize(u,A);return(S||R)&&S!="comment"&&(d=null,A.state=A.state(R||S,u,A),d&&(S=d=="error"?S+" error":d)),S},indent:function(u,A,S){var T=u.context;if(u.tokenize.isInAttribute)return u.tagStart==u.indented?u.stringStartCol+1:u.indented+M;if(T&&T.noIndent)return ie.Pass;if(u.tokenize!=w&&u.tokenize!=f)return S?S.match(/^(\s*)/)[0].length:0;if(u.tagName)return W.multilineTagIndentPastTag!==!1?u.tagStart+u.tagName.length+2:u.tagStart+M*(W.multilineTagIndentFactor||1);if(W.alignCDATA&&/<!\[CDATA\[/.test(A))return 0;var _=A&&/^<(\/)?([\w_:\.-]*)/.exec(A);if(_&&_[1])for(;T;)if(T.tagName==_[2]){T=T.prev;break}else if(W.implicitlyClosed.hasOwnProperty(T.tagName))T=T.prev;else break;else if(_)for(;T;){var j=W.contextGrabbers[T.tagName];if(j&&j.hasOwnProperty(_[2]))T=T.prev;else break}for(;T&&T.prev&&!T.startOfLine;)T=T.prev;return T?T.indent+M:u.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:W.htmlMode?"html":"xml",helperType:W.htmlMode?"html":"xml",skipAttribute:function(u){u.state==y&&(u.state=L)},xmlCurrentTag:function(u){return u.tagName?{name:u.tagName,close:u.type=="closeTag"}:null},xmlCurrentContext:function(u){for(var A=[],S=u.context;S;S=S.prev)S.tagName&&A.push(S.tagName);return A.reverse()}}}),ie.defineMIME("text/xml","xml"),ie.defineMIME("application/xml","xml"),ie.mimeModes.hasOwnProperty("text/html")||ie.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"24hK":function(vt,Te,Q){"use strict";Q.d(Te,"a",function(){return O});var ie=Q("JYp7"),$=function(){function V(I){this.element=I,this.next=V.Undefined,this.prev=V.Undefined}return V.Undefined=new V(void 0),V}(),O=function(){function V(){this._first=$.Undefined,this._last=$.Undefined,this._size=0}return Object.defineProperty(V.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),V.prototype.isEmpty=function(){return this._first===$.Undefined},V.prototype.clear=function(){this._first=$.Undefined,this._last=$.Undefined,this._size=0},V.prototype.unshift=function(I){return this._insert(I,!1)},V.prototype.push=function(I){return this._insert(I,!0)},V.prototype._insert=function(I,M){var W=this,N=new $(I);if(this._first===$.Undefined)this._first=N,this._last=N;else if(M){var P=this._last;this._last=N,N.prev=P,P.next=N}else{var R=this._first;this._first=N,N.next=R,R.prev=N}this._size+=1;var d=!1;return function(){d||(d=!0,W._remove(N))}},V.prototype.shift=function(){if(this._first===$.Undefined)return;var I=this._first.element;return this._remove(this._first),I},V.prototype.pop=function(){if(this._last===$.Undefined)return;var I=this._last.element;return this._remove(this._last),I},V.prototype._remove=function(I){if(I.prev!==$.Undefined&&I.next!==$.Undefined){var M=I.prev;M.next=I.next,I.next.prev=M}else I.prev===$.Undefined&&I.next===$.Undefined?(this._first=$.Undefined,this._last=$.Undefined):I.next===$.Undefined?(this._last=this._last.prev,this._last.next=$.Undefined):I.prev===$.Undefined&&(this._first=this._first.next,this._first.prev=$.Undefined);this._size-=1},V.prototype.iterator=function(){var I,M=this._first;return{next:function(){return M===$.Undefined?ie.c:(I?I.value=M.element:I={done:!1,value:M.element},M=M.next,I)}}},V.prototype.toArray=function(){for(var I=[],M=this._first;M!==$.Undefined;M=M.next)I.push(M.element);return I},V}()},"3Rgl":function(vt,Te,Q){"use strict";Q.r(Te);var ie=Q("+L6B"),$=Q("2/Rp"),O=Q("6UJt"),V=Q("DFOY"),I=Q("/zsF"),M=Q("PArb"),W=Q("5NDa"),N=Q("5rEg"),P=Q("OaEy"),R=Q("2fM7"),d=Q("14J3"),f=Q("BMrR"),w=Q("jCWc"),p=Q("kPKH"),g=Q("sPJy"),b=Q("bE4q"),o=Q("miYZ"),i=Q("tsqr"),s=Q("k1fw"),l=Q("9og8"),C=Q("y8nQ"),m=Q("Vl3Y"),v=Q("tJVT"),k=Q("PpiC"),L=Q("B9cy"),E=Q("Ol7k"),y=Q("lUTK"),c=Q("BvKs"),u=Q("WmNS"),A=Q.n(u),S=Q("q1tI"),T=Q.n(S),_=Q("Ot1p"),j=Q("Ty5D"),z=Q("9kvl"),Z=Q("55Ip"),K=Q("gJ3r"),F=Q("m7e3"),ee=Q.n(F),se=c.a.SubMenu,he=E.a.Content,Ce=E.a.Sider,Ue=function(Me){var ce,ve,le,ne,Le,xe,Ie,Re=Me.graduation,ae=Me.globalSetting,oe=Me.loading,be=Me.user,Ae=Me.dispatch,Ne=Object(k.a)(Me,["graduation","globalSetting","loading","user","dispatch"]),_e=Object(j.i)(),We=Object(j.h)(),Fe=be.userInfo,et=m.a.useForm(),Je=Object(v.a)(et,1),Qe=Je[0],Ye=Re.addTopicData,dt=function(){var $e=Object(l.a)(A.a.mark(function tt(){var Oe,Ze,at;return A.a.wrap(function(Ke){for(;;)switch(Ke.prev=Ke.next){case 0:return Oe=Qe.getFieldsValue(),Ze=Object(s.a)({},Oe),Ze.city&&(Ze.province=Ze.city[0],Ze.city=Ze.city[1]),Ke.next=5,Ae({type:"graduation/addTopic",payload:{coursesId:_e.coursesId,attachment_ids:[],graduation_topic:Ze}});case 5:at=Ke.sent,at.status?i.b.error(at.message):z.d.push("/classrooms/".concat(_e.coursesId,"/graduation_topics/").concat(_e.categoryId));case 7:case"end":return Ke.stop()}},tt)}));return function(){return $e.apply(this,arguments)}}();return Object(S.useEffect)(function(){Ae({type:"graduation/addTopicDefaultData",payload:Object(s.a)({},_e)})},[_e.coursesId]),T.a.createElement("section",{className:"edu-container"},T.a.createElement("section",{className:"animated fadeIn"},T.a.createElement("aside",{className:"mt10"},Fe&&T.a.createElement(b.a,{separator:">"},T.a.createElement(b.a.Item,null,T.a.createElement(Z.a,{to:"".concat(Fe.first_category_url)},Fe==null||((ce=Fe.course)===null||ce===void 0)?void 0:ce.course_name)),T.a.createElement(b.a.Item,null,T.a.createElement(Z.a,{to:"/classrooms/".concat(_e.coursesId,"/graduation_topics/").concat(_e.categoryId)},"\u6BD5\u8BBE\u9009\u9898")),T.a.createElement(b.a.Item,null,"\u65B0\u5EFA"))),T.a.createElement("aside",{className:[ee.a.title,"mt20"].join(" ")},T.a.createElement(f.a,{style:{width:"100%"}},T.a.createElement(p.a,{flex:"1"},T.a.createElement("strong",{className:"font20 ml5"},"\u65B0\u5EFA\u6BD5\u8BBE\u9009\u9898")),T.a.createElement(p.a,null,T.a.createElement(Z.a,{className:"font16 c-light-black",to:"/classrooms/".concat(_e.coursesId,"/exercise")},"\u8FD4\u56DE"))))),T.a.createElement("section",{className:[ee.a.bg,"pt30","pl30","pr30","pb30","mt20"].join(" ")},T.a.createElement(m.a,{layout:"vertical",form:Qe,scrollToFirstError:!0,onFinish:function(){var $e=Object(l.a)(A.a.mark(function tt(Oe){return A.a.wrap(function(at){for(;;)switch(at.prev=at.next){case 0:dt();case 1:case"end":return at.stop()}},tt)}));return function(tt){return $e.apply(this,arguments)}}()},T.a.createElement(m.a.Item,{name:"tea_id",label:"\u6307\u5BFC\u8001\u5E08\uFF1A",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u6307\u5BFC\u8001\u5E08"}]},T.a.createElement(R.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u6307\u5BFC\u8001\u5E08",style:{width:200}},(ve=Ye.teacher_list)===null||ve===void 0?void 0:ve.map(function($e,tt){return T.a.createElement(R.a.Option,{value:$e.id,key:tt},$e.name)}))),T.a.createElement(m.a.Item,{name:"name",label:"\u9009\u9898\u540D\u79F0\uFF1A",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u8BD5\u5377\u6807\u9898"}]},T.a.createElement(N.a,{maxLength:60,size:"large",placeholder:"\u8BD5\u5377\u6807\u9898\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26"})),T.a.createElement(M.a,null),T.a.createElement(m.a.Item,{label:"\u9009\u9898\u7B80\u4ECB",name:"description",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5185\u5BB9"}]},T.a.createElement(_.a,{watch:!0,placeholder:"\u8BF7\u7B80\u8981\u8BF4\u660E\u9009\u9898\u5185\u5BB9\uFF0C\u6700\u5927\u9650\u52365000\u4E2A\u5B57\u7B26"})),T.a.createElement(f.a,{gutter:[20,0]},T.a.createElement(p.a,{flex:"1"},T.a.createElement(m.a.Item,{name:"topic_type"},T.a.createElement(R.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u9009\u9898\u7C7B\u578B"},(le=Ye.topic_type)===null||le===void 0?void 0:le.map(function($e,tt){return T.a.createElement(R.a.Option,{value:$e.id,key:tt},$e.name)})))),T.a.createElement(p.a,{flex:"1"},T.a.createElement(m.a.Item,{name:"topic_source"},T.a.createElement(R.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u9009\u9898\u6765\u6E90"},(ne=Ye.topic_source)===null||ne===void 0?void 0:ne.map(function($e,tt){return T.a.createElement(R.a.Option,{value:$e.id,key:tt},$e.name)})))),T.a.createElement(p.a,{flex:"1"},T.a.createElement(m.a.Item,{name:"topic_property_first"},T.a.createElement(R.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u9009\u9898\u6027\u8D281"},(Le=Ye.topic_property_first)===null||Le===void 0?void 0:Le.map(function($e,tt){return T.a.createElement(R.a.Option,{value:$e.id,key:tt},$e.name)})))),T.a.createElement(p.a,{flex:"1"},T.a.createElement(m.a.Item,{name:"topic_property_second"},T.a.createElement(R.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u9009\u9898\u6027\u8D282"},(xe=Ye.topic_property_second)===null||xe===void 0?void 0:xe.map(function($e,tt){return T.a.createElement(R.a.Option,{value:$e.id,key:tt},$e.name)})))),T.a.createElement(p.a,{flex:"150px"})),T.a.createElement(M.a,null),T.a.createElement(m.a.Item,{name:"source_unit",label:"\u9009\u9898\u6765\u6E90\u5355\u4F4D\uFF1A"},T.a.createElement(N.a,{width:"200",size:"large",style:{width:200},placeholder:"\u8BF7\u586B\u5199\u6765\u6E90\u5355\u4F4D"})),T.a.createElement(m.a.Item,{name:"topic_repeat",label:"\u9009\u9898\u91CD\u590D\u60C5\u51B5\uFF1A"},T.a.createElement(R.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u91CD\u590D\u60C5\u51B5",style:{width:200}},(Ie=Ye.topic_repeat)===null||Ie===void 0?void 0:Ie.map(function($e,tt){return T.a.createElement(R.a.Option,{value:$e.id,key:tt},$e.name)}))),T.a.createElement(m.a.Item,{name:"city",label:"\u8C03\u7814\u6216\u5B9E\u4E60\u5730\u70B9\uFF1A"},T.a.createElement(V.a,{size:"large",style:{width:200},options:K.a,placeholder:"\u8BF7\u9009\u62E9\u6240\u5728\u5730"})))),T.a.createElement("aside",{className:ee.a.btns},T.a.createElement($.a,{type:"primary",onClick:function(){Qe.submit()}},"\u4FDD\u5B58"),T.a.createElement(Z.a,{to:"/classrooms/".concat(_e.coursesId,"/graduation_topics/").concat(_e.categoryId)},"\u53D6\u6D88")))};Te.default=Object(z.a)(function(ke){var Me=ke.graduation,ce=ke.loading,ve=ke.user,le=ke.globalSetting;return{graduation:Me,globalSetting:le,user:ve,loading:ce.effects}})(Ue)},"55Ip":function(vt,Te,Q){"use strict";Q.d(Te,"a",function(){return s}),Q.d(Te,"b",function(){return L});var ie=Q("Ty5D"),$=Q("dI71"),O=Q("q1tI"),V=Q.n(O),I=Q("YS25"),M=Q("17x9"),W=Q.n(M),N=Q("wx14"),P=Q("zLVn"),R=Q("9R94"),d=function(y){Object($.a)(c,y);function c(){for(var A,S=arguments.length,T=new Array(S),_=0;_<S;_++)T[_]=arguments[_];return A=y.call.apply(y,[this].concat(T))||this,A.history=Object(I.a)(A.props),A}var u=c.prototype;return u.render=function(){return V.a.createElement(ie.c,{history:this.history,children:this.props.children})},c}(V.a.Component),f=function(y){Object($.a)(c,y);function c(){for(var A,S=arguments.length,T=new Array(S),_=0;_<S;_++)T[_]=arguments[_];return A=y.call.apply(y,[this].concat(T))||this,A.history=Object(I.b)(A.props),A}var u=c.prototype;return u.render=function(){return V.a.createElement(ie.c,{history:this.history,children:this.props.children})},c}(V.a.Component),w=function(c,u){return typeof c=="function"?c(u):c},p=function(c,u){return typeof c=="string"?Object(I.c)(c,null,null,u):c},g=function(c){return c},b=V.a.forwardRef;typeof b=="undefined"&&(b=g);function o(y){return!!(y.metaKey||y.altKey||y.ctrlKey||y.shiftKey)}var i=b(function(y,c){var u=y.innerRef,A=y.navigate,S=y.onClick,T=Object(P.a)(y,["innerRef","navigate","onClick"]),_=T.target,j=Object(N.a)({},T,{onClick:function(Z){try{S&&S(Z)}catch(K){throw Z.preventDefault(),K}!Z.defaultPrevented&&Z.button===0&&(!_||_==="_self")&&!o(Z)&&(Z.preventDefault(),A())}});return g!==b?j.ref=c||u:j.ref=u,V.a.createElement("a",j)}),s=b(function(y,c){var u=y.component,A=u===void 0?i:u,S=y.replace,T=y.to,_=y.innerRef,j=Object(P.a)(y,["component","replace","to","innerRef"]);return V.a.createElement(ie.e.Consumer,null,function(z){z||Object(R.a)(!1);var Z=z.history,K=p(w(T,z.location),z.location),F=K?Z.createHref(K):"",ee=Object(N.a)({},j,{href:F,navigate:function(){var he=w(T,z.location),Ce=S?Z.replace:Z.push;Ce(he)}});return g!==b?ee.ref=c||_:ee.innerRef=_,V.a.createElement(A,ee)})});if(!1)var l,C;var m=function(c){return c},v=V.a.forwardRef;typeof v=="undefined"&&(v=m);function k(){for(var y=arguments.length,c=new Array(y),u=0;u<y;u++)c[u]=arguments[u];return c.filter(function(A){return A}).join(" ")}var L=v(function(y,c){var u=y["aria-current"],A=u===void 0?"page":u,S=y.activeClassName,T=S===void 0?"active":S,_=y.activeStyle,j=y.className,z=y.exact,Z=y.isActive,K=y.location,F=y.sensitive,ee=y.strict,se=y.style,he=y.to,Ce=y.innerRef,Ue=Object(P.a)(y,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return V.a.createElement(ie.e.Consumer,null,function(ke){ke||Object(R.a)(!1);var Me=K||ke.location,ce=p(w(he,Me),Me),ve=ce.pathname,le=ve&&ve.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),ne=le?Object(ie.f)(Me.pathname,{path:le,exact:z,sensitive:F,strict:ee}):null,Le=!!(Z?Z(ne,Me):ne),xe=Le?k(j,T):j,Ie=Le?Object(N.a)({},se,{},_):se,Re=Object(N.a)({"aria-current":Le&&A||null,className:xe,style:Ie,to:ce},Ue);return m!==v?Re.ref=c||Ce:Re.innerRef=Ce,V.a.createElement(s,Re)})});if(!1)var E},"746U":function(vt,Te,Q){"use strict";Q.d(Te,"d",function(){return $}),Q.d(Te,"j",function(){return O}),Q.d(Te,"i",function(){return V}),Q.d(Te,"h",function(){return I}),Q.d(Te,"e",function(){return M}),Q.d(Te,"k",function(){return W}),Q.d(Te,"l",function(){return N}),Q.d(Te,"a",function(){return P}),Q.d(Te,"f",function(){return d}),Q.d(Te,"g",function(){return f}),Q.d(Te,"m",function(){return w}),Q.d(Te,"c",function(){return b}),Q.d(Te,"b",function(){return o}),Q.d(Te,"n",function(){return i}),Q.d(Te,"o",function(){return s});var ie={number:"number",string:"string",undefined:"undefined",object:"object",function:"function"};function $(l){return Array.isArray?Array.isArray(l):!!(l&&typeof l.length===ie.number&&l.constructor===Array)}function O(l){return typeof l===ie.string||l instanceof String}function V(l){return typeof l===ie.object&&l!==null&&!Array.isArray(l)&&!(l instanceof RegExp)&&!(l instanceof Date)}function I(l){return(typeof l===ie.number||l instanceof Number)&&!isNaN(l)}function M(l){return l===!0||l===!1}function W(l){return typeof l===ie.undefined}function N(l){return W(l)||l===null}function P(l,C){if(!l)throw new Error(C?"Unexpected type, expected '"+C+"'":"Unexpected type")}var R=Object.prototype.hasOwnProperty;function d(l){if(!V(l))return!1;for(var C in l)if(R.call(l,C))return!1;return!0}function f(l){return typeof l===ie.function}function w(l,C){for(var m=Math.min(l.length,C.length),v=0;v<m;v++)p(l[v],C[v])}function p(l,C){if(O(C)){if(typeof l!==C)throw new Error("argument does not match constraint: typeof "+C)}else if(f(C)){try{if(l instanceof C)return}catch(m){}if(!N(l)&&l.constructor===C)return;if(C.length===1&&C.call(void 0,l)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function g(l){for(var C=[],m=Object.getPrototypeOf(l);Object.prototype!==m;)C=C.concat(Object.getOwnPropertyNames(m)),m=Object.getPrototypeOf(m);return C}function b(l){for(var C=[],m=0,v=g(l);m<v.length;m++){var k=v[m];typeof l[k]=="function"&&C.push(k)}return C}function o(l,C){for(var m=function(y){return function(){var c=Array.prototype.slice.call(arguments,0);return C(y,c)}},v={},k=0,L=l;k<L.length;k++){var E=L[k];v[E]=m(E)}return v}function i(l){return l===null?void 0:l}function s(l){return typeof l=="undefined"?null:l}},"7Cbv":function(vt,Te,Q){"use strict";var ie=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),$=new Uint8Array(16);function O(){if(!ie)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ie($)}var V=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function I(w){return typeof w=="string"&&V.test(w)}for(var M=I,W=[],N=0;N<256;++N)W.push((N+256).toString(16).substr(1));function P(w){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,g=(W[w[p+0]]+W[w[p+1]]+W[w[p+2]]+W[w[p+3]]+"-"+W[w[p+4]]+W[w[p+5]]+"-"+W[w[p+6]]+W[w[p+7]]+"-"+W[w[p+8]]+W[w[p+9]]+"-"+W[w[p+10]]+W[w[p+11]]+W[w[p+12]]+W[w[p+13]]+W[w[p+14]]+W[w[p+15]]).toLowerCase();if(!M(g))throw TypeError("Stringified UUID is invalid");return g}var R=P;function d(w,p,g){w=w||{};var b=w.random||(w.rng||O)();if(b[6]=b[6]&15|64,b[8]=b[8]&63|128,p){g=g||0;for(var o=0;o<16;++o)p[g+o]=b[o];return p}return R(b)}var f=Te.a=d},"7ahc":function(vt,Te,Q){"use strict";Q.d(Te,"a",function(){return C});var ie=Q("k1fw"),$=Q("0Owb"),O=Q("+L6B"),V=Q("2/Rp"),I=Q("y8nQ"),M=Q("Vl3Y"),W=Q("tJVT"),N=Q("OaEy"),P=Q("2fM7"),R=Q("q1tI"),d=Q.n(R),f=Q("VrN/"),w=Q.n(f),p=Q("p77/"),g=Q.n(p),b=Q("c5Ni"),o=Q.n(b),i=P.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},l={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};Te.b=function(m){var v=m.callback,k=m.onCancel,L=Object(R.useState)("python"),E=Object(W.a)(L,2),y=E[0],c=E[1];function u(S){c(l[S][1])}function A(S){v(S)}return d.a.createElement(M.a,Object($.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:A}),d.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},d.a.createElement(P.a,{onChange:u},Object.keys(l).map(function(S){return d.a.createElement(i,{key:S,value:S},l[S][0])}))),d.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},d.a.createElement(C,{mode:y})),d.a.createElement("div",{className:"flex-container flex-end"},d.a.createElement(V.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),d.a.createElement(V.a,{type:"ghost",onClick:k},"\u53D6\u6D88")))};function C(m){var v=m.value,k=m.onChange,L=m.mode,E=m.options,y=E===void 0?{}:E,c=Object(R.useRef)(),u=Object(R.useState)(),A=Object(W.a)(u,2),S=A[0],T=A[1];return Object(R.useEffect)(function(){if(S){function _(j){var z=j.getValue();k&&k(z)}return S.on("change",_),function(){S.off("change",_)}}},[S,k]),Object(R.useEffect)(function(){S&&S.setOption("mode",L)},[S,L]),Object(R.useEffect)(function(){S&&((v!==S.getValue()||v==="")&&setTimeout(function(){S.setValue(v||" ")},300))},[S,v]),Object(R.useEffect)(function(){if(c.current&&!S){var _=w.a.fromTextArea(c.current,Object(ie.a)({mode:L,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},y));T(_)}},[c.current,S]),d.a.createElement("div",{className:"my-codemirror-container"},d.a.createElement("textarea",{ref:c}))}},"8EBN":function(vt,Te,Q){(function(ie){ie(Q("VrN/"))})(function(ie){"use strict";ie.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var $=0;$<ie.modeInfo.length;$++){var O=ie.modeInfo[$];O.mimes&&(O.mime=O.mimes[0])}ie.findModeByMIME=function(V){V=V.toLowerCase();for(var I=0;I<ie.modeInfo.length;I++){var M=ie.modeInfo[I];if(M.mime==V)return M;if(M.mimes){for(var W=0;W<M.mimes.length;W++)if(M.mimes[W]==V)return M}}if(/\+xml$/.test(V))return ie.findModeByMIME("application/xml");if(/\+json$/.test(V))return ie.findModeByMIME("application/json")},ie.findModeByExtension=function(V){V=V.toLowerCase();for(var I=0;I<ie.modeInfo.length;I++){var M=ie.modeInfo[I];if(M.ext){for(var W=0;W<M.ext.length;W++)if(M.ext[W]==V)return M}}},ie.findModeByFileName=function(V){for(var I=0;I<ie.modeInfo.length;I++){var M=ie.modeInfo[I];if(M.file&&M.file.test(V))return M}var W=V.lastIndexOf("."),N=W>-1&&V.substring(W+1,V.length);if(N)return ie.findModeByExtension(N)},ie.findModeByName=function(V){V=V.toLowerCase();for(var I=0;I<ie.modeInfo.length;I++){var M=ie.modeInfo[I];if(M.name.toLowerCase()==V)return M;if(M.alias){for(var W=0;W<M.alias.length;W++)if(M.alias[W].toLowerCase()==V)return M}}}})},"8HAY":function(vt,Te,Q){"use strict";Q.d(Te,"a",function(){return M}),Q.d(Te,"b",function(){return W});var ie=Q("pmY6"),$=Q("MI8n"),O=function(){var N=function(P,R){return N=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,f){d.__proto__=f}||function(d,f){for(var w in f)f.hasOwnProperty(w)&&(d[w]=f[w])},N(P,R)};return function(P,R){N(P,R);function d(){this.constructor=P}P.prototype=R===null?Object.create(R):(d.prototype=R.prototype,new d)}}(),V=function(N,P,R,d){function f(w){return w instanceof R?w:new R(function(p){p(w)})}return new(R||(R=Promise))(function(w,p){function g(i){try{o(d.next(i))}catch(s){p(s)}}function b(i){try{o(d.throw(i))}catch(s){p(s)}}function o(i){i.done?w(i.value):f(i.value).then(g,b)}o((d=d.apply(N,P||[])).next())})},I=function(N,P){var R={label:0,sent:function(){if(w[0]&1)throw w[1];return w[1]},trys:[],ops:[]},d,f,w,p;return p={next:g(0),throw:g(1),return:g(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function g(o){return function(i){return b([o,i])}}function b(o){if(d)throw new TypeError("Generator is already executing.");for(;R;)try{if(d=1,f&&(w=o[0]&2?f.return:o[0]?f.throw||((w=f.return)&&w.call(f),0):f.next)&&!(w=w.call(f,o[1])).done)return w;(f=0,w)&&(o=[o[0]&2,w.value]);switch(o[0]){case 0:case 1:w=o;break;case 4:return R.label++,{value:o[1],done:!1};case 5:R.label++,f=o[1],o=[0];continue;case 7:o=R.ops.pop(),R.trys.pop();continue;default:if(!(w=R.trys,w=w.length>0&&w[w.length-1])&&(o[0]===6||o[0]===2)){R=0;continue}if(o[0]===3&&(!w||o[1]>w[0]&&o[1]<w[3])){R.label=o[1];break}if(o[0]===6&&R.label<w[1]){R.label=w[1],w=o;break}if(w&&R.label<w[2]){R.label=w[2],R.ops.push(o);break}w[2]&&R.ops.pop(),R.trys.pop();continue}o=P.call(N,R)}catch(i){o=[6,i],f=0}finally{d=w=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}},M=function(N){O(P,N);function P(R,d,f,w,p){d===void 0&&(d=""),f===void 0&&(f=""),w===void 0&&(w=!0);var g=N.call(this)||this;return g._onDidChange=g._register(new $.a),g.onDidChange=g._onDidChange.event,g._enabled=!0,g._checked=!1,g._id=R,g._label=d,g._cssClass=f,g._enabled=w,g._actionCallback=p,g}return Object.defineProperty(P.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(P.prototype,"label",{get:function(){return this._label},set:function(R){this._setLabel(R)},enumerable:!0,configurable:!0}),P.prototype._setLabel=function(R){this._label!==R&&(this._label=R,this._onDidChange.fire({label:R}))},Object.defineProperty(P.prototype,"tooltip",{get:function(){return this._tooltip||""},set:function(R){this._setTooltip(R)},enumerable:!0,configurable:!0}),P.prototype._setTooltip=function(R){this._tooltip!==R&&(this._tooltip=R,this._onDidChange.fire({tooltip:R}))},Object.defineProperty(P.prototype,"class",{get:function(){return this._cssClass},set:function(R){this._setClass(R)},enumerable:!0,configurable:!0}),P.prototype._setClass=function(R){this._cssClass!==R&&(this._cssClass=R,this._onDidChange.fire({class:R}))},Object.defineProperty(P.prototype,"enabled",{get:function(){return this._enabled},set:function(R){this._setEnabled(R)},enumerable:!0,configurable:!0}),P.prototype._setEnabled=function(R){this._enabled!==R&&(this._enabled=R,this._onDidChange.fire({enabled:R}))},Object.defineProperty(P.prototype,"checked",{get:function(){return this._checked},set:function(R){this._setChecked(R)},enumerable:!0,configurable:!0}),P.prototype._setChecked=function(R){this._checked!==R&&(this._checked=R,this._onDidChange.fire({checked:R}))},P.prototype.run=function(R,d){return this._actionCallback?this._actionCallback(R):Promise.resolve(!0)},P}(ie.a),W=function(N){O(P,N);function P(){var R=N!==null&&N.apply(this,arguments)||this;return R._onDidBeforeRun=R._register(new $.a),R.onDidBeforeRun=R._onDidBeforeRun.event,R._onDidRun=R._register(new $.a),R.onDidRun=R._onDidRun.event,R}return P.prototype.run=function(R,d){return V(this,void 0,void 0,function(){var f,w;return I(this,function(p){switch(p.label){case 0:if(!R.enabled)return[2,Promise.resolve(null)];this._onDidBeforeRun.fire({action:R}),p.label=1;case 1:return p.trys.push([1,3,,4]),[4,this.runAction(R,d)];case 2:return f=p.sent(),this._onDidRun.fire({action:R,result:f}),[3,4];case 3:return w=p.sent(),this._onDidRun.fire({action:R,error:w}),[3,4];case 4:return[2]}})})},P.prototype.runAction=function(R,d){var f=d?R.run(d):R.run();return Promise.resolve(f)},P}(ie.a)},"8hTe":function(vt,Te,Q){vt.exports={button:"button___1wy9m"}},"9Bee":function(vt,Te,Q){"use strict";var ie=Q("DYRE"),$=Q("zeV3"),O=Q("+L6B"),V=Q("2/Rp"),I=Q("k1fw"),M=Q("9og8"),W=Q("tJVT"),N=Q("WmNS"),P=Q.n(N),R=Q("q1tI"),d=Q.n(R),f=Q("vg9a"),w=Q("DlQD"),p=Q.n(w),g=Q("rUJ1");function b(H,h){var x=H.match(/^(\s+)(?:```)/);if(x===null)return h;var U=x[1];return h.split(`
|
|
`).map(function(X){var G=X.match(/^\s+/);if(G===null)return X;var ge=Object(W.a)(G,1),Ge=ge[0];return Ge.length>=U.length?X.slice(U.length):X}).join(`
|
|
`)}var o=[],i=["<ul>"],s=new p.a.Renderer,l=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function C(){o.length=0,i=["<ul>"]}var m={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function v(H,h,x,U){if(h>=H.length||H[h].level<=x)return h;var X=H[h];U.push("<li><a href='#"+X.anchor+"'>"+X.text+"</a>"),h++;var G=[];return h=v(H,h,X.level,G),G.length>0&&(U.push("<ul>"),G.forEach(function(ge){U.push(ge)}),U.push("</ul>")),U.push("</li>"),h=v(H,h,x,U),h}function k(){return v(o,0,0,i),i.push("</ul>"),i.join("")}var L={heading:function(h){var x=l.exec(h);if(x)return{type:"heading",raw:x[0],depth:x[1].length,text:x[2]}},fences:function(h){var x=this.rules.block.fences.exec(h);if(x){var U=x[0],X=b(U,x[3]||""),G=x[2]?x[2].trim():x[2];if(["latex","katex","math"].indexOf(G)>=0){var ge=c(),Ge=X;X=ge,u[ge]={type:"block",expression:Ge}}return{type:"code",raw:U,lang:G,text:X}}}},E=/(?:\${2})([^\n`]+?)(?:\${2})/gi,y=0,c=function(){return"__special_katext_id_".concat(y++,"__")},u={};function A(){return u}function S(){y=0,u={}}function T(H){return H=H.replace(E,function(h,x){var U=c();return u[U]={type:"inline",expression:x},U}),H}var _=s.listitem;s.listitem=function(H){return _(T(H))};var j=s.paragraph;s.paragraph=function(H){return j(T(H))};var z=s.tablecell;s.tablecell=function(H,h){return z(T(H),h)},s.code=function(H,h,x){var U=(h||"").match(/\S*/)[0];return U?["latex","katex","math"].indexOf(U)>=0?"<p class='editormd-tex'>".concat(H,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(h,'">').concat(x?H:Object(g.escape)(H,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(x?H:Object(g.escape)(H,!0))+"</code></pre>"},s.heading=function(H,h,x){var U=this.options.headerPrefix+x.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return o.push({anchor:U,level:h,text:H}),"<h"+h+' id="'+U+'">'+H+"</h"+h+">"},p.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),p.a.use({tokenizer:L,renderer:s});var Z=p.a,K=Q("SJMd"),F=Q("ulZh"),ee=Q.n(F),se=Q("m3rI"),he=Q("Oy/b"),Ce=Q("p5ED"),Ue=Q("ErOA");/*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */var ke=function(H,h){return(ke=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(x,U){x.__proto__=U}||function(x,U){for(var X in U)Object.prototype.hasOwnProperty.call(U,X)&&(x[X]=U[X])})(H,h)};function Me(H,h){function x(){this.constructor=H}ke(H,h),H.prototype=h===null?Object.create(h):(x.prototype=h.prototype,new x)}function ce(H,h,x,U){return new(x||(x=Promise))(function(X,G){function ge(pt){try{rt(U.next(pt))}catch(Ve){G(Ve)}}function Ge(pt){try{rt(U.throw(pt))}catch(Ve){G(Ve)}}function rt(pt){var Ve;pt.done?X(pt.value):(Ve=pt.value,Ve instanceof x?Ve:new x(function(Lt){Lt(Ve)})).then(ge,Ge)}rt((U=U.apply(H,h||[])).next())})}function ve(H,h){var x,U,X,G,ge={label:0,sent:function(){if(1&X[0])throw X[1];return X[1]},trys:[],ops:[]};return G={next:Ge(0),throw:Ge(1),return:Ge(2)},typeof Symbol=="function"&&(G[Symbol.iterator]=function(){return this}),G;function Ge(rt){return function(pt){return function(Ve){if(x)throw new TypeError("Generator is already executing.");for(;ge;)try{if(x=1,U&&(X=2&Ve[0]?U.return:Ve[0]?U.throw||((X=U.return)&&X.call(U),0):U.next)&&!(X=X.call(U,Ve[1])).done)return X;switch(U=0,X&&(Ve=[2&Ve[0],X.value]),Ve[0]){case 0:case 1:X=Ve;break;case 4:return ge.label++,{value:Ve[1],done:!1};case 5:ge.label++,U=Ve[1],Ve=[0];continue;case 7:Ve=ge.ops.pop(),ge.trys.pop();continue;default:if(!(X=ge.trys,(X=X.length>0&&X[X.length-1])||Ve[0]!==6&&Ve[0]!==2)){ge=0;continue}if(Ve[0]===3&&(!X||Ve[1]>X[0]&&Ve[1]<X[3])){ge.label=Ve[1];break}if(Ve[0]===6&&ge.label<X[1]){ge.label=X[1],X=Ve;break}if(X&&ge.label<X[2]){ge.label=X[2],ge.ops.push(Ve);break}X[2]&&ge.ops.pop(),ge.trys.pop();continue}Ve=h.call(H,ge)}catch(Lt){Ve=[6,Lt],U=0}finally{x=X=0}if(5&Ve[0])throw Ve[1];return{value:Ve[0]?Ve[1]:void 0,done:!0}}([rt,pt])}}}function le(){for(var H=0,h=0,x=arguments.length;h<x;h++)H+=arguments[h].length;var U=Array(H),X=0;for(h=0;h<x;h++)for(var G=arguments[h],ge=0,Ge=G.length;ge<Ge;ge++,X++)U[X]=G[ge];return U}var ne=function(){function H(){}return H.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},H.setAttributes=function(h,x){for(var U=0,X=x;U<X.length;U++){var G=X[U],ge=G[0],Ge=G[1];h.setAttribute(ge,Ge)}},H.createRect=function(h,x,U){var X=document.createElementNS("http://www.w3.org/2000/svg","rect");return X.setAttribute("width",h.toString()),X.setAttribute("height",x.toString()),U&&H.setAttributes(X,U),X},H.createLine=function(h,x,U,X,G){var ge=document.createElementNS("http://www.w3.org/2000/svg","line");return ge.setAttribute("x1",h.toString()),ge.setAttribute("y1",x.toString()),ge.setAttribute("x2",U.toString()),ge.setAttribute("y2",X.toString()),G&&H.setAttributes(ge,G),ge},H.createPolygon=function(h,x){var U=document.createElementNS("http://www.w3.org/2000/svg","polygon");return U.setAttribute("points",h),x&&H.setAttributes(U,x),U},H.createCircle=function(h,x){var U=document.createElementNS("http://www.w3.org/2000/svg","circle");return U.setAttribute("cx",(h/2).toString()),U.setAttribute("cy",(h/2).toString()),U.setAttribute("r",h.toString()),x&&H.setAttributes(U,x),U},H.createEllipse=function(h,x,U){var X=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return X.setAttribute("cx",(h/2).toString()),X.setAttribute("cy",(x/2).toString()),X.setAttribute("rx",(h/2).toString()),X.setAttribute("ry",(x/2).toString()),U&&H.setAttributes(X,U),X},H.createGroup=function(h){var x=document.createElementNS("http://www.w3.org/2000/svg","g");return h&&H.setAttributes(x,h),x},H.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},H.createMarker=function(h,x,U,X,G,ge,Ge){var rt=document.createElementNS("http://www.w3.org/2000/svg","marker");return H.setAttributes(rt,[["id",h],["orient",x],["markerWidth",U.toString()],["markerHeight",X.toString()],["refX",G.toString()],["refY",ge.toString()]]),rt.appendChild(Ge),rt},H.createText=function(h){var x=document.createElementNS("http://www.w3.org/2000/svg","text");return x.setAttribute("x","0"),x.setAttribute("y","0"),h&&H.setAttributes(x,h),x},H.createTSpan=function(h,x){var U=document.createElementNS("http://www.w3.org/2000/svg","tspan");return U.textContent=h,x&&H.setAttributes(U,x),U},H.createImage=function(h){var x=document.createElementNS("http://www.w3.org/2000/svg","image");return h&&H.setAttributes(x,h),x},H.createPoint=function(h,x){var U=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return U.x=h,U.y=x,U},H.createPath=function(h,x){var U=document.createElementNS("http://www.w3.org/2000/svg","path");return U.setAttribute("d",h),x&&H.setAttributes(U,x),U},H}(),Le=function(){function H(){}return H.addKey=function(h){H.key=h},Object.defineProperty(H,"isLicensed",{get:function(){return!!H.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(H.key)},enumerable:!1,configurable:!0}),H}(),xe=function(){function H(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return H.prototype.rasterize=function(h,x,U){var X=this;return new Promise(function(G){var ge=U!==void 0?U:document.createElement("canvas");h===null&&(X.markersOnly=!0,X.naturalSize=!1);var Ge=document.createElementNS("http://www.w3.org/2000/svg","svg");Ge.setAttribute("xmlns","http://www.w3.org/2000/svg"),Ge.setAttribute("width",x.width.baseVal.valueAsString),Ge.setAttribute("height",x.height.baseVal.valueAsString),Ge.setAttribute("viewBox","0 0 "+x.viewBox.baseVal.width.toString()+" "+x.viewBox.baseVal.height.toString()),Ge.innerHTML=x.innerHTML,X.naturalSize===!0?(Ge.width.baseVal.value=h.naturalWidth,Ge.height.baseVal.value=h.naturalHeight):X.width!==void 0&&X.height!==void 0&&(Ge.width.baseVal.value=X.width,Ge.height.baseVal.value=X.height),ge.width=Ge.width.baseVal.value,ge.height=Ge.height.baseVal.value;var rt=Ge.outerHTML,pt=ge.getContext("2d");X.markersOnly!==!0&&pt.drawImage(h,0,0,ge.width,ge.height);var Ve=window.URL,Lt=new Image(ge.width,ge.height);Lt.setAttribute("crossOrigin","anonymous");var It=new Blob([rt],{type:"image/svg+xml"}),er=Ve.createObjectURL(It);Lt.onload=function(){pt.drawImage(Lt,0,0),Ve.revokeObjectURL(er);var zr=ge.toDataURL(X.imageType,X.imageQuality);G(zr)},Lt.src=er})},H}(),Ie=function(){},Re=function(){function H(h){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+h+"_"}return Object.defineProperty(H.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#ffffff",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarColor:"#eeeeee",toolbarHeight:40,toolboxColor:"#eeeeee",toolboxAccentColor:"#3080c3",undoButtonVisible:!0,redoButtonVisible:!1,zoomButtonVisible:!1,zoomOutButtonVisible:!1,clearButtonVisible:!1,resultButtonBlockVisible:!0,logoPosition:"left"}},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),H.prototype.addClass=function(h){return this.styleSheet===void 0&&this.addStyleSheet(),h.name=""+this.classNamePrefix+h.localName,this.classes.push(h),this.styleSheet.sheet.insertRule("."+h.name+" {"+h.style+"}",this.styleSheet.sheet.cssRules.length),h},H.prototype.addRule=function(h){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(h),this.styleSheet.sheet.insertRule(h.selector+" {"+h.style+"}",this.styleSheet.sheet.cssRules.length)},H.prototype.addStyleSheet=function(){var h;this.styleSheet=document.createElement("style"),((h=this.styleSheetRoot)!==null&&h!==void 0?h:document.head).appendChild(this.styleSheet),this.addRule(new ae("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new ae("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new ae("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new oe("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new oe("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},H.prototype.removeStyleSheet=function(){var h;this.styleSheet&&(((h=this.styleSheetRoot)!==null&&h!==void 0?h:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},H}(),ae=function(H,h){this.selector=H,this.style=h},oe=function(H,h){this.localName=H,this.style=h},be=function(){function H(h,x,U,X,G){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=h,this.displayMode=x,this.markerItems=U,this.uiStyleSettings=X,this.styles=G,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return H.prototype.show=function(h){var x=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=h,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var U=document.createElement("div");U.className=this.toolbarBlockStyleClass.name,U.style.whiteSpace="nowrap",this.uiContainer.appendChild(U),this.addActionButton(U,'<svg viewBox="0 0 24 24"><path d="M10.07 14.27a.997.997 0 011.33.48l2.3 4.99 1.8-.85-2.31-4.98c-.24-.5-.02-1.1.48-1.33l.28-.08 2.3-.45L8 5.12V15.9l1.82-1.47.25-.16m3.57 7.7a.99.99 0 01-1.33-.47l-2.18-4.74-2.51 2.02c-.17.14-.38.22-.62.22a1 1 0 01-1-1V3a1 1 0 011-1c.24 0 .47.09.64.23l.01-.01 11.49 9.64a1.001 1.001 0 01-.44 1.75l-3.16.62 2.2 4.73c.26.5.02 1.09-.48 1.32l-3.62 1.69z"/></svg>',"select"),this.addActionButton(U,'<svg viewBox="0 0 24 24"><path d="M9 3v1H4v2h1v13a2 2 0 002 2h10a2 2 0 002-2V6h1V4h-5V3H9M7 6h10v13H7V6m2 2v9h2V8H9m4 0v9h2V8h-2z"/></svg>',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(U,'<svg viewBox="0 0 24 24"><path d="M19.36 2.72l1.42 1.42-5.72 5.71c1.07 1.54 1.22 3.39.32 4.59L9.06 8.12c1.2-.9 3.05-.75 4.59.32l5.71-5.72M5.93 17.57c-2.01-2.01-3.24-4.41-3.58-6.65l4.88-2.09 7.44 7.44-2.09 4.88c-2.24-.34-4.64-1.57-6.65-3.58z"/></svg>',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(U,'<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(U,'<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 017.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(U,'<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(U,'<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 009.5 3 6.5 6.5 0 003 9.5 6.5 6.5 0 009.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5 1.5-1.5-5-5m-6 0C7 14 5 12 5 9.5S7 5 9.5 5 14 7 14 9.5 12 14 9.5 14M7 9h5v1H7V9z"/></svg>',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(U,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(G){var ge=document.createElement("div");ge.className=""+x.toolbarButtonStyleClass.name,ge.setAttribute("data-type-name",G.typeName),ge.innerHTML=G.icon,ge.addEventListener("click",function(){x.markerToolbarButtonClicked(ge,G)}),x.buttons.push(ge),x.markerButtons.push(ge)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var X=document.createElement("div");X.className=this.toolbarBlockStyleClass.name,X.style.whiteSpace="nowrap",X.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(X),this.addActionButton(X,'<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"render"),this.addActionButton(X,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},H.prototype.addButtonClickListener=function(h){this.buttonClickListeners.push(h)},H.prototype.removeButtonClickListener=function(h){this.buttonClickListeners.indexOf(h)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(h),1)},H.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},H.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var h=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var x=0;x<this.markerButtons.length;x++)x<h||x===h&&this.markerButtons.length-1===h?this.markerButtonBlock.appendChild(this.markerButtons[x]):(x===h&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[x]))}},H.prototype.overflowButtonClicked=function(){this.markerButtonOverflowBlock.style.display!=="none"?(this.markerButtonOverflowBlock.className=this.markerButtonOverflowBlock.className.replace(this.styles.fadeInAnimationClassName,""),this.markerButtonOverflowBlock.style.display="none"):(this.markerButtonOverflowBlock.className+=" "+this.styles.fadeInAnimationClassName,this.markerButtonOverflowBlock.style.top=this.uiContainer.offsetTop+this.overflowButton.offsetHeight+"px",this.markerButtonOverflowBlock.style.right=this.uiContainer.offsetWidth-this.overflowButton.offsetLeft-this.overflowButton.offsetWidth+2*this.uiContainer.offsetLeft+"px",this.markerButtonOverflowBlock.style.display="inline-block")},H.prototype.resetButtonStyles=function(){var h=this;this.buttons.forEach(function(x){x.className=x.className.replace(h.uiStyleSettings.toolbarButtonStyleColorsClassName?h.uiStyleSettings.toolbarButtonStyleColorsClassName:h.toolbarButtonStyleColorsClass.name,"").trim(),x.className=x.className.replace(h.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?h.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:h.toolbarActiveButtonStyleColorsClass.name,"").trim(),x.className+=" "+(h.uiStyleSettings.toolbarButtonStyleColorsClassName?h.uiStyleSettings.toolbarButtonStyleColorsClassName:h.toolbarButtonStyleColorsClass.name)})},H.prototype.addActionButton=function(h,x,U){var X=this,G=document.createElement("div");switch(G.className=""+this.toolbarButtonStyleClass.name,G.innerHTML=x,G.setAttribute("data-action",U),G.addEventListener("click",function(){X.actionToolbarButtonClicked(G,U)}),U){case"select":G.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":G.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":G.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":G.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":G.style.fill=this.uiStyleSettings.closeButtonColor}h.appendChild(G),this.buttons.push(G)},H.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new oe("toolbar",`
|
|
width: 100%;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-between;
|
|
height: `+this.uiStyleSettings.toolbarHeight+`px;
|
|
box-sizing: content-box;
|
|
`+(this.displayMode==="inline"?"border-top-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
`+(this.displayMode==="inline"?"border-top-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
overflow: hidden;
|
|
`)),this.toolbarStyleColorsClass=this.styles.addClass(new oe("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new oe("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new oe("toolbar-overflow-block",`
|
|
position: absolute;
|
|
top: `+this.uiStyleSettings.toolbarHeight+`px;
|
|
max-width: `+2*this.uiStyleSettings.toolbarHeight+`px;
|
|
z-index: 10;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleColorsClass=this.styles.addClass(new oe("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var h=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new oe("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*h)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*h)+`px;
|
|
padding: `+h+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new oe("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new oe("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new ae("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new ae("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},H.prototype.markerToolbarButtonClicked=function(h,x){this.setActiveButton(h),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(U){return U("marker",x)}),this.markerButtonOverflowBlock.style.display="none"},H.prototype.actionToolbarButtonClicked=function(h,x){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(U){return U("action",x)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},H.prototype.setActiveButton=function(h){this.resetButtonStyles(),h.className=h.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),h.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},H.prototype.setActiveMarkerButton=function(h){var x=this.markerButtons.find(function(U){return U.getAttribute("data-type-name")===h});x&&this.setActiveButton(x)},H.prototype.setCurrentMarker=function(h){var x=this;this.currentMarker=h,this.buttons.filter(function(U){return/delete|notes/.test(U.getAttribute("data-action"))}).forEach(function(U){x.currentMarker===void 0?(U.style.fillOpacity="0.4",U.style.pointerEvents="none"):(U.style.fillOpacity="1",U.style.pointerEvents="all")})},H}(),Ae=function(){function H(h,x,U,X){this.panels=[],this.panelButtons=[],this.markerjsContainer=h,this.displayMode=x,this.uiStyleSettings=U,this.styles=X,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return H.prototype.addStyles=function(){var h;this.toolboxStyleClass=this.styles.addClass(new oe("toolbox",`
|
|
width: 100%;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
font-family: sans-serif;
|
|
`+(this.displayMode==="popup"?"height:"+2.5*this.uiStyleSettings.toolbarHeight+"px;":"")+`
|
|
box-sizing: content-box;
|
|
`+(this.displayMode==="popup"?"background-color: "+this.uiStyleSettings.canvasBackgroundColor+";":"")+`
|
|
`+(this.displayMode==="inline"?"border-bottom-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
`+(this.displayMode==="inline"?"border-bottom-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
overflow: hidden;
|
|
`)),this.toolboxStyleColorsClass=this.styles.addClass(new oe("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var x=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new oe("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new oe("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new oe("toolbox-panel-row",`
|
|
display: flex;
|
|
`+(this.displayMode==="inline"?"position: absolute;":"")+`
|
|
`+(this.displayMode==="inline"?"bottom: "+this.uiStyleSettings.toolbarHeight+"px;":"")+`
|
|
cursor: default;
|
|
height: `+1.5*this.uiStyleSettings.toolbarHeight+`px;
|
|
`+(this.displayMode==="inline"?"width: 100%;":"")+`
|
|
box-sizing: content-box;
|
|
`)),this.toolboxPanelRowStyleColorsClass=this.styles.addClass(new oe("toolbox-panel-row_colors",`
|
|
background-color: `+((h=this.uiStyleSettings.toolboxBackgroundColor)!==null&&h!==void 0?h:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new oe("toolbox_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*x)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*x)+`px;
|
|
padding: `+x+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new oe("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new oe("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new ae("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new ae("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`))},H.prototype.show=function(h){var x;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=h,this.uiContainer.className=this.toolboxStyleClass.name+" "+((x=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&x!==void 0?x:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},H.prototype.setPanelButtons=function(h){var x,U,X=this;this.panels=h,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((x=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&x!==void 0?x:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((U=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&U!==void 0?U:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(G){var ge;G.uiStyleSettings=X.uiStyleSettings;var Ge=document.createElement("div");Ge.className=X.toolboxButtonStyleClass.name+" "+((ge=X.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ge!==void 0?ge:X.toolboxButtonStyleColorsClass.name),Ge.innerHTML=G.icon,Ge.title=G.title,Ge.addEventListener("click",function(){X.panelButtonClick(G)}),X.panelButtons.push(Ge),X.buttonRow.appendChild(Ge)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},H.prototype.panelButtonClick=function(h){var x=this,U=-1;if(h!==this.activePanel){U=this.panels.indexOf(h),this.panelRow.innerHTML="";var X=h.getUi();X.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(X),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=h}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){x.displayMode==="inline"?x.panelRow.style.display="none":x.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(G,ge){var Ge,rt;G.className=x.toolboxButtonStyleClass.name+" "+(ge===U?""+((Ge=x.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Ge!==void 0?Ge:x.toolboxActiveButtonStyleColorsClass.name):""+((rt=x.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&rt!==void 0?rt:x.toolboxButtonStyleColorsClass.name))})},H}(),Ne=function(H,h){this.title=H,this.icon=h},_e=function(H){function h(x,U,X,G){var ge=H.call(this,x,G||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return ge.colors=[],ge.addTransparent=!1,ge.colorBoxes=[],ge.colors=U,ge.currentColor=X,ge.setCurrentColor=ge.setCurrentColor.bind(ge),ge.getColorBox=ge.getColorBox.bind(ge),ge}return Me(h,H),h.prototype.getUi=function(){var x=this,U=document.createElement("div");return U.style.overflow="hidden",U.style.whiteSpace="nowrap",this.colors.forEach(function(X){var G=x.getColorBox(X);U.appendChild(G),x.colorBoxes.push(G)}),U},h.prototype.getColorBox=function(x){var U=this,X=this.uiStyleSettings.toolbarHeight/4,G=this.uiStyleSettings.toolbarHeight-X,ge=document.createElement("div");ge.style.display="inline-block",ge.style.boxSizing="content-box",ge.style.width=G-2+"px",ge.style.height=G-2+"px",ge.style.padding="1px",ge.style.marginRight="2px",ge.style.marginBottom="2px",ge.style.borderWidth="2px",ge.style.borderStyle="solid",ge.style.borderRadius=(G+2)/2+"px",ge.style.borderColor=x===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ge.addEventListener("click",function(){U.setCurrentColor(x,ge)});var Ge=document.createElement("div");return Ge.style.display="inline-block",Ge.style.width=G-2+"px",Ge.style.height=G-2+"px",Ge.style.backgroundColor=x,Ge.style.borderRadius=G/2+"px",x==="transparent"&&(Ge.style.fill=this.uiStyleSettings.toolboxAccentColor,Ge.innerHTML=`<svg viewBox="0 0 24 24">
|
|
<path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />
|
|
</svg>`),ge.appendChild(Ge),ge},h.prototype.setCurrentColor=function(x,U){var X=this;this.currentColor=x,this.colorBoxes.forEach(function(G){G.style.borderColor=G===U?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(x)},h}(Ne),We=function(){function H(h,x,U){this._state="new",this._isSelected=!1,this._container=h,this._overlayContainer=x,this.globalSettings=U,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(H.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),H.prototype.ownsTarget=function(h){return!1},Object.defineProperty(H.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),H.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},H.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},H.prototype.pointerDown=function(h,x){},H.prototype.dblClick=function(h,x){},H.prototype.manipulate=function(h){},H.prototype.pointerUp=function(h){this.stateChanged()},H.prototype.dispose=function(){},H.prototype.addMarkerVisualToContainer=function(h){this.container.childNodes.length>0?this.container.insertBefore(h,this.container.childNodes[0]):this.container.appendChild(h)},H.prototype.getState=function(){return{typeName:H.typeName,state:this.state,notes:this.notes}},H.prototype.restoreState=function(h){this._state=h.state,this.notes=h.notes},H.prototype.scale=function(h,x){},H.prototype.colorChanged=function(h){this.onColorChanged&&this.onColorChanged(h),this.stateChanged()},H.prototype.fillColorChanged=function(h){this.onFillColorChanged&&this.onFillColorChanged(h),this.stateChanged()},H.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var h=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),h.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(h)&&this.onStateChanged(this)}},H.typeName="MarkerBase",H}(),Fe=function(){function H(){this.findGripByVisual=this.findGripByVisual.bind(this)}return H.prototype.findGripByVisual=function(h){return this.topLeft.ownsTarget(h)?this.topLeft:this.topCenter.ownsTarget(h)?this.topCenter:this.topRight.ownsTarget(h)?this.topRight:this.centerLeft.ownsTarget(h)?this.centerLeft:this.centerRight.ownsTarget(h)?this.centerRight:this.bottomLeft.ownsTarget(h)?this.bottomLeft:this.bottomCenter.ownsTarget(h)?this.bottomCenter:this.bottomRight.ownsTarget(h)?this.bottomRight:void 0},H}(),et=function(){function H(){this.GRIP_SIZE=10,this.visual=ne.createGroup(),this.visual.appendChild(ne.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(ne.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return H.prototype.ownsTarget=function(h){return h===this.visual||h===this.visual.childNodes[0]||h===this.visual.childNodes[1]},H}(),Je=function(){function H(){}return H.toITransformMatrix=function(h){return{a:h.a,b:h.b,c:h.c,d:h.d,e:h.e,f:h.f}},H.toSVGMatrix=function(h,x){return h.a=x.a,h.b=x.b,h.c=x.c,h.d=x.d,h.e=x.e,h.f=x.f,h},H}(),Qe=function(H){function h(x,U,X){var G=H.call(this,x,U,X)||this;return G.left=0,G.top=0,G.width=0,G.height=0,G.defaultSize={x:50,y:20},G.offsetX=0,G.offsetY=0,G.rotationAngle=0,G.CB_DISTANCE=10,G._suppressMarkerCreateEvent=!1,G.container.transform.baseVal.appendItem(ne.createTransform()),G.setupControlBox(),G}return Me(h,H),Object.defineProperty(h.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"visual",{get:function(){return this._visual},set:function(x){this._visual=x;var U=ne.createTransform();this._visual.transform.baseVal.appendItem(U)},enumerable:!1,configurable:!0}),h.prototype.ownsTarget=function(x){return!!H.prototype.ownsTarget.call(this,x)||!!(this.controlGrips.findGripByVisual(x)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(x))},h.prototype.pointerDown=function(x,U){H.prototype.pointerDown.call(this,x,U),this.state==="new"&&(this.left=x.x,this.top=x.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var X=this.unrotatePoint(x);if(this.manipulationStartX=X.x,this.manipulationStartY=X.y,this.offsetX=X.x-this.left,this.offsetY=X.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(U),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(U)){this.activeGrip=this.rotatorGrip;var G=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=G.x-this.width/2,this.top=G.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ge=this.container.transform.baseVal.getItem(0);ge.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ge,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},h.prototype.pointerUp=function(x){var U=this.state;H.prototype.pointerUp.call(this,x),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(x),this._state="select",U==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},h.prototype.moveVisual=function(x){this.visual.style.transform="translate("+x.x+"px, "+x.y+"px)"},h.prototype.manipulate=function(x){var U=this.unrotatePoint(x);this.state==="creating"?this.resize(x):this.state==="move"?(this.left=this.manipulationStartLeft+(U.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(U.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(U):this.state==="rotate"&&this.rotate(x)},h.prototype.resize=function(x){var U=this.manipulationStartLeft,X=this.manipulationStartWidth,G=this.manipulationStartTop,ge=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:U=this.manipulationStartLeft+x.x-this.manipulationStartX,X=this.manipulationStartWidth+this.manipulationStartLeft-U;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:X=this.manipulationStartWidth+x.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:G=this.manipulationStartTop+x.y-this.manipulationStartY,ge=this.manipulationStartHeight+this.manipulationStartTop-G;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ge=this.manipulationStartHeight+x.y-this.manipulationStartY}X>=0?(this.left=U,this.width=X):(this.left=U+X,this.width=-X),ge>=0?(this.top=G,this.height=ge):(this.top=G+ge,this.height=-ge),this.setSize()},h.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},h.prototype.rotate=function(x){if(Math.abs(x.x-this.centerX)>.1){var U=Math.sign(x.x-this.centerX);this.rotationAngle=180*Math.atan((x.y-this.centerY)/(x.x-this.centerX))/Math.PI+90*U,this.applyRotation()}},h.prototype.applyRotation=function(){var x=this.container.transform.baseVal.getItem(0);x.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(x,0)},h.prototype.rotatePoint=function(x){if(this.rotationAngle===0)return x;var U=this.container.getCTM(),X=ne.createPoint(x.x,x.y);return{x:(X=X.matrixTransform(U)).x,y:X.y}},h.prototype.unrotatePoint=function(x){if(this.rotationAngle===0)return x;var U=this.container.getCTM();U=U.inverse();var X=ne.createPoint(x.x,x.y);return{x:(X=X.matrixTransform(U)).x,y:X.y}},h.prototype.select=function(){H.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},h.prototype.deselect=function(){H.prototype.deselect.call(this),this.controlBox.style.display="none"},h.prototype.setupControlBox=function(){this.controlBox=ne.createGroup();var x=ne.createTransform();x.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(x),this.container.appendChild(this.controlBox),this.controlRect=ne.createRect(this.width+this.CB_DISTANCE,this.height+this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"],["fill","transparent"],["pointer-events","none"]]),this.controlBox.appendChild(this.controlRect),this.globalSettings.disableRotation!==!0&&(this.rotatorGripLine=ne.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new Fe,this.addControlGrips(),this.controlBox.style.display="none"},h.prototype.adjustControlBox=function(){var x=this.controlBox.transform.baseVal.getItem(0);x.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(x,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),this.rotatorGripLine!==void 0&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},h.prototype.addControlGrips=function(){this.controlGrips.topLeft=this.createGrip(),this.controlGrips.topCenter=this.createGrip(),this.controlGrips.topRight=this.createGrip(),this.controlGrips.centerLeft=this.createGrip(),this.controlGrips.centerRight=this.createGrip(),this.controlGrips.bottomLeft=this.createGrip(),this.controlGrips.bottomCenter=this.createGrip(),this.controlGrips.bottomRight=this.createGrip(),this.globalSettings.disableRotation!==!0&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},h.prototype.createGrip=function(){var x=new et;return x.visual.transform.baseVal.appendItem(ne.createTransform()),this.controlBox.appendChild(x.visual),x},h.prototype.positionGrips=function(){var x=this.controlGrips.topLeft.GRIP_SIZE,U=-x/2,X=U,G=(this.width+this.CB_DISTANCE)/2-x/2,ge=(this.height+this.CB_DISTANCE)/2-x/2,Ge=this.height+this.CB_DISTANCE-x/2,rt=this.width+this.CB_DISTANCE-x/2;this.positionGrip(this.controlGrips.topLeft.visual,U,X),this.positionGrip(this.controlGrips.topCenter.visual,G,X),this.positionGrip(this.controlGrips.topRight.visual,rt,X),this.positionGrip(this.controlGrips.centerLeft.visual,U,ge),this.positionGrip(this.controlGrips.centerRight.visual,rt,ge),this.positionGrip(this.controlGrips.bottomLeft.visual,U,Ge),this.positionGrip(this.controlGrips.bottomCenter.visual,G,Ge),this.positionGrip(this.controlGrips.bottomRight.visual,rt,Ge),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,G,X-3*this.CB_DISTANCE)},h.prototype.positionGrip=function(x,U,X){var G=x.transform.baseVal.getItem(0);G.setTranslate(U,X),x.transform.baseVal.replaceItem(G,0)},h.prototype.hideControlBox=function(){this.controlBox.style.display="none"},h.prototype.showControlBox=function(){this.controlBox.style.display=""},h.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:Je.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:Je.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},H.prototype.getState.call(this))},h.prototype.restoreState=function(x){H.prototype.restoreState.call(this,x);var U=x;this.left=U.left,this.top=U.top,this.width=U.width,this.height=U.height,this.rotationAngle=U.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(Je.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,U.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(Je.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,U.containerTransformMatrix))},h.prototype.scale=function(x,U){H.prototype.scale.call(this,x,U);var X=this.rotatePoint({x:this.left,y:this.top}),G=this.unrotatePoint({x:X.x*x,y:X.y*U});this.left=G.x,this.top=G.y,this.width=this.width*x,this.height=this.height*U,this.adjustControlBox()},h}(We),Ye=function(H){function h(x,U,X){var G=H.call(this,x,U,X)||this;return G.fillColor="transparent",G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.opacity=1,G.setStrokeColor=G.setStrokeColor.bind(G),G.setFillColor=G.setFillColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.createVisual=G.createVisual.bind(G),G}return Me(h,H),h.prototype.ownsTarget=function(x){return!(!H.prototype.ownsTarget.call(this,x)&&x!==this.visual)},h.prototype.createVisual=function(){this.visual=ne.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},h.prototype.pointerDown=function(x,U){H.prototype.pointerDown.call(this,x,U),this.state==="new"&&(this.createVisual(),this.moveVisual(x),this._state="creating")},h.prototype.manipulate=function(x){H.prototype.manipulate.call(this,x)},h.prototype.resize=function(x){H.prototype.resize.call(this,x),this.setSize()},h.prototype.setSize=function(){H.prototype.setSize.call(this),ne.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},h.prototype.pointerUp=function(x){H.prototype.pointerUp.call(this,x),this.setSize()},h.prototype.setStrokeColor=function(x){this.strokeColor=x,this.visual&&ne.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(x),this.stateChanged()},h.prototype.setFillColor=function(x){this.fillColor=x,this.visual&&ne.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},h.prototype.setStrokeWidth=function(x){this.strokeWidth=x,this.visual&&ne.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},h.prototype.setStrokeDasharray=function(x){this.strokeDasharray=x,this.visual&&ne.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},h.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},H.prototype.getState.call(this))},h.prototype.restoreState=function(x){var U=x;this.fillColor=U.fillColor,this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.strokeDasharray,this.opacity=U.opacity,this.createVisual(),H.prototype.restoreState.call(this,x),this.setSize()},h.prototype.scale=function(x,U){H.prototype.scale.call(this,x,U),this.setSize()},h.title="Rectangle marker",h}(Qe),dt=function(H){function h(x,U,X,G){var ge=H.call(this,x,G||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return ge.widths=[],ge.widthBoxes=[],ge.widths=U,ge.currentWidth=X,ge.setCurrentWidth=ge.setCurrentWidth.bind(ge),ge}return Me(h,H),h.prototype.getUi=function(){var x=this,U=document.createElement("div");return U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2",this.widths.forEach(function(X){var G=document.createElement("div");G.style.display="flex",G.style.flexGrow="2",G.style.alignItems="center",G.style.justifyContent="space-between",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.borderColor=X===x.currentWidth?x.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){x.setCurrentWidth(X,G)}),U.appendChild(G);var ge=document.createElement("div");ge.innerText=X.toString(),ge.style.marginRight="5px",G.appendChild(ge);var Ge=document.createElement("div");Ge.style.minHeight="20px",Ge.style.flexGrow="2",Ge.style.display="flex",Ge.style.alignItems="center";var rt=document.createElement("hr");rt.style.minWidth="20px",rt.style.border="0px",rt.style.borderTop=X+"px solid "+x.uiStyleSettings.toolboxColor,rt.style.flexGrow="2",Ge.appendChild(rt),G.appendChild(Ge),x.widthBoxes.push(G)}),U},h.prototype.setCurrentWidth=function(x,U){var X=this;this.currentWidth=x,this.widthBoxes.forEach(function(G){G.style.borderColor=G===U?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},h}(Ne),$e=function(H){function h(x,U,X,G){var ge=H.call(this,x,G||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return ge.styles=[],ge.styleBoxes=[],ge.styles=U,ge.currentStyle=X,ge.setCurrentStyle=ge.setCurrentStyle.bind(ge),ge}return Me(h,H),h.prototype.getUi=function(){var x=this,U=document.createElement("div");return U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2",this.styles.forEach(function(X){var G=document.createElement("div");G.style.display="flex",G.style.alignItems="center",G.style.justifyContent="space-between",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.overflow="hidden",G.style.maxWidth=100/x.styles.length-5+"%",G.style.borderColor=X===x.currentStyle?x.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){x.setCurrentStyle(X,G)}),U.appendChild(G);var ge=document.createElement("div");ge.style.minHeight="20px",ge.style.flexGrow="2",ge.style.overflow="hidden";var Ge=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+x.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(X!==""?'stroke-dasharray="'+X+'"':"")+` />
|
|
</svg>`;ge.innerHTML=Ge,G.appendChild(ge),x.styleBoxes.push(G)}),U},h.prototype.setCurrentStyle=function(x,U){var X=this;this.currentStyle=x,this.styleBoxes.forEach(function(G){G.style.borderColor=G===U?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},h}(Ne),tt=function(H){function h(x,U,X){var G=H.call(this,x,U,X)||this;return G.strokeColor=X.defaultColor,G.strokeWidth=X.defaultStrokeWidth,G.strokeDasharray=X.defaultStrokeDasharray,G.strokePanel=new _e("Line color",X.defaultColorSet,X.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.strokeWidthPanel=new dt("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new $e("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G}return Me(h,H),Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var x=H.prototype.getState.call(this);return x.typeName=h.typeName,x},h.typeName="FrameMarker",h.title="Frame marker",h.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',h}(Ye),Oe=function(){this.defaultColorSet=["#EF4444","#10B981","#2563EB","#FFFF00","#7C3AED","#F472B6","#000000","#FFFFFF"],this.defaultColor=this.defaultColorSet[0],this.defaultFillColor=this.defaultColorSet[0],this.defaultStrokeColor=this.defaultColorSet[7],this.defaultHighlightColor=this.defaultColorSet[3],this.defaultStrokeWidth=3,this.defaultStrokeDasharray="",this.defaultHighlightOpacity=.5,this.defaultFontFamily="Helvetica, Arial, sans-serif",this.defaultStrokeWidths=[1,2,3,5,10],this.defaultStrokeDasharrays=["","3","12 3","9 6 3 6"],this.defaultOpacitySteps=[.1,.25,.5,.75,1],this.displayMode="inline",this.defaultFontFamilies=['Times, "Times New Roman", serif',"Helvetica, Arial, sans-serif",'Courier, "Courier New", monospace',"cursive","fantasy"],this.popupMargin=30,this.newFreehandMarkerOnPointerUp=!1,this.defaultColorsFollowCurrentColors=!1,this.freehandPixelRatio=1,this.disableRotation=!1},Ze=function(H){function h(x,U,X){var G=H.call(this,x,U,X)||this;return G.x1=0,G.y1=0,G.x2=0,G.y2=0,G.defaultLength=50,G.manipulationStartX=0,G.manipulationStartY=0,G.manipulationStartX1=0,G.manipulationStartY1=0,G.manipulationStartX2=0,G.manipulationStartY2=0,G.setupControlBox(),G}return Me(h,H),h.prototype.ownsTarget=function(x){return!!H.prototype.ownsTarget.call(this,x)||!(!this.grip1.ownsTarget(x)&&!this.grip2.ownsTarget(x))},h.prototype.pointerDown=function(x,U){H.prototype.pointerDown.call(this,x,U),this.manipulationStartX=x.x,this.manipulationStartY=x.y,this.state==="new"&&(this.x1=x.x,this.y1=x.y,this.x2=x.x,this.y2=x.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,this.state!=="new"&&(this.select(),this.grip1.ownsTarget(U)?this.activeGrip=this.grip1:this.grip2.ownsTarget(U)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},h.prototype.pointerUp=function(x){var U=this.state;H.prototype.pointerUp.call(this,x),this.state==="creating"&&Math.abs(this.x1-this.x2)<10&&Math.abs(this.y1-this.y2)<10?(this.x2=this.x1+this.defaultLength,this.adjustVisual(),this.adjustControlBox()):this.manipulate(x),this._state="select",U==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},h.prototype.adjustVisual=function(){},h.prototype.manipulate=function(x){this.state==="creating"?this.resize(x):this.state==="move"?(this.x1=this.manipulationStartX1+x.x-this.manipulationStartX,this.y1=this.manipulationStartY1+x.y-this.manipulationStartY,this.x2=this.manipulationStartX2+x.x-this.manipulationStartX,this.y2=this.manipulationStartY2+x.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(x)},h.prototype.resize=function(x){switch(this.activeGrip){case this.grip1:this.x1=x.x,this.y1=x.y;break;case this.grip2:case void 0:this.x2=x.x,this.y2=x.y}this.adjustVisual(),this.adjustControlBox()},h.prototype.select=function(){H.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},h.prototype.deselect=function(){H.prototype.deselect.call(this),this.controlBox.style.display="none"},h.prototype.setupControlBox=function(){this.controlBox=ne.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},h.prototype.adjustControlBox=function(){this.positionGrips()},h.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},h.prototype.createGrip=function(){var x=new et;return x.visual.transform.baseVal.appendItem(ne.createTransform()),this.controlBox.appendChild(x.visual),x},h.prototype.positionGrips=function(){var x=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-x/2,this.y1-x/2),this.positionGrip(this.grip2.visual,this.x2-x/2,this.y2-x/2)},h.prototype.positionGrip=function(x,U,X){var G=x.transform.baseVal.getItem(0);G.setTranslate(U,X),x.transform.baseVal.replaceItem(G,0)},h.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},H.prototype.getState.call(this))},h.prototype.restoreState=function(x){H.prototype.restoreState.call(this,x);var U=x;this.x1=U.x1,this.y1=U.y1,this.x2=U.x2,this.y2=U.y2},h.prototype.scale=function(x,U){H.prototype.scale.call(this,x,U),this.x1=this.x1*x,this.y1=this.y1*U,this.x2=this.x2*x,this.y2=this.y2*U,this.adjustVisual(),this.adjustControlBox()},h}(We),at=function(H){function h(x,U,X){var G=H.call(this,x,U,X)||this;return G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.setStrokeColor=G.setStrokeColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.strokeColor=X.defaultColor,G.strokeWidth=X.defaultStrokeWidth,G.strokeDasharray=X.defaultStrokeDasharray,G.strokePanel=new _e("Line color",X.defaultColorSet,X.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.strokeWidthPanel=new dt("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new $e("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G}return Me(h,H),h.prototype.ownsTarget=function(x){return!(!H.prototype.ownsTarget.call(this,x)&&x!==this.visual&&x!==this.selectorLine&&x!==this.visibleLine)},h.prototype.createVisual=function(){this.visual=ne.createGroup(),this.selectorLine=ne.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=ne.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},h.prototype.pointerDown=function(x,U){H.prototype.pointerDown.call(this,x,U),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},h.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),ne.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),ne.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),ne.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},h.prototype.setStrokeColor=function(x){this.strokeColor=x,this.adjustVisual(),this.colorChanged(x)},h.prototype.setStrokeWidth=function(x){this.strokeWidth=x,this.adjustVisual()},h.prototype.setStrokeDasharray=function(x){this.strokeDasharray=x,this.adjustVisual(),this.stateChanged()},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var x=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},H.prototype.getState.call(this));return x.typeName=h.typeName,x},h.prototype.restoreState=function(x){H.prototype.restoreState.call(this,x);var U=x;this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.strokeDasharray,this.createVisual(),this.adjustVisual()},h.typeName="LineMarker",h.title="Line marker",h.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',h}(Ze),Be=function(H){function h(x,U,X,G){var ge=H.call(this,x,G||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return ge.fonts=[],ge.fontBoxes=[],ge.fonts=U,ge.currentFont=X,ge.setCurrentFont=ge.setCurrentFont.bind(ge),ge}return Me(h,H),h.prototype.getUi=function(){var x=this,U=document.createElement("div");return U.style.overflow="hidden",U.style.flexGrow="2",this.fonts.forEach(function(X){var G=document.createElement("div");G.style.display="inline-block",G.style.alignItems="center",G.style.justifyContent="space-between",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.overflow="hidden",G.style.maxWidth=100/x.fonts.length-5+"%",G.style.borderColor=X===x.currentFont?x.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){x.setCurrentFont(X,G)}),U.appendChild(G);var ge=document.createElement("div");ge.style.display="flex",ge.style.minHeight="20px",ge.style.flexGrow="2",ge.style.fontFamily=X,ge.style.overflow="hidden";var Ge=document.createElement("div");Ge.style.whiteSpace="nowrap",Ge.style.overflow="hidden",Ge.style.textOverflow="ellipsis",Ge.innerHTML="The quick brown fox jumps over the lazy dog",ge.appendChild(Ge),G.appendChild(ge),x.fontBoxes.push(G)}),U},h.prototype.setCurrentFont=function(x,U){var X=this;this.currentFont=x,this.fontBoxes.forEach(function(G){G.style.borderColor=G===U?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},h}(Ne),Ke=function(H){function h(x,U,X){var G=H.call(this,x,U,X)||this;return G.color="transparent",G.padding=5,G.DEFAULT_TEXT="your text here",G.text=G.DEFAULT_TEXT,G.isMoved=!1,G.color=X.defaultColor,G.fontFamily=X.defaultFontFamily,G.defaultSize={x:100,y:30},G.setColor=G.setColor.bind(G),G.setFont=G.setFont.bind(G),G.renderText=G.renderText.bind(G),G.sizeText=G.sizeText.bind(G),G.textEditDivClicked=G.textEditDivClicked.bind(G),G.showTextEditor=G.showTextEditor.bind(G),G.setSize=G.setSize.bind(G),G.positionTextEditor=G.positionTextEditor.bind(G),G.colorPanel=new _e("Color",X.defaultColorSet,X.defaultColor),G.colorPanel.onColorChanged=G.setColor,G.fontFamilyPanel=new Be("Font",X.defaultFontFamilies,X.defaultFontFamily),G.fontFamilyPanel.onFontChanged=G.setFont,G}return Me(h,H),h.prototype.ownsTarget=function(x){if(H.prototype.ownsTarget.call(this,x)||x===this.visual||x===this.textElement||x===this.bgRectangle)return!0;var U=!1;return this.textElement.childNodes.forEach(function(X){X===x&&(U=!0)}),U},h.prototype.createVisual=function(){this.visual=ne.createGroup(),this.bgRectangle=ne.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=ne.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(ne.createTransform()),this.textElement.transform.baseVal.appendItem(ne.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},h.prototype.pointerDown=function(x,U){H.prototype.pointerDown.call(this,x,U),this.isMoved=!1,this.pointerDownPoint=x,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(x),this._state="creating")},h.prototype.renderText=function(){var x=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function(U){x.textElement.appendChild(ne.createTSpan(U.trim()===""?" ":U.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},h.prototype.getTextScale=function(){var x=this.textElement.getBBox(),U=1;if(x.width>0&&x.height>0){var X=(1*this.width-this.width*this.padding*2/100)/x.width,G=(1*this.height-this.height*this.padding*2/100)/x.height;U=Math.min(X,G)}return U},h.prototype.getTextPosition=function(x){var U=this.textElement.getBBox(),X=0,G=0;return U.width>0&&U.height>0&&(X=(this.width-U.width*x)/2,G=this.height/2-U.height*x/2),{x:X,y:G}},h.prototype.sizeText=function(){var x=this.textElement.getBBox(),U=this.getTextScale(),X=this.getTextPosition(U);X.y-=x.y*U,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+X.x+"px, "+X.y+"px) scale("+U+", "+U+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(X.x,X.y),this.textElement.transform.baseVal.getItem(1).setScale(U,U))},h.prototype.manipulate=function(x){H.prototype.manipulate.call(this,x),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(x.x-this.pointerDownPoint.x)>5||Math.abs(x.y-this.pointerDownPoint.y)>5)},h.prototype.resize=function(x){H.prototype.resize.call(this,x),this.isMoved=!0,this.setSize(),this.sizeText()},h.prototype.setSize=function(){H.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(ne.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),ne.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},h.prototype.pointerUp=function(x){var U=this.state;U==="creating"&&(this._suppressMarkerCreateEvent=!0),H.prototype.pointerUp.call(this,x),this.setSize(),(U==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},h.prototype.showTextEditor=function(){var x=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",function(U){U.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var U=Number.parseFloat(x.textEditor.style.fontSize);x.textEditor.clientWidth>=Number.parseInt(x.textEditor.style.maxWidth)&&U>.9;)U-=.1,x.textEditor.style.fontSize=Math.max(U,.9)+"em"}),this.textEditor.addEventListener("keyup",function(U){U.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(U){if(U.clipboardData){var X=U.clipboardData.getData("text"),G=window.getSelection();if(!G.rangeCount)return!1;G.deleteFromDocument(),G.getRangeAt(0).insertNode(document.createTextNode(X)),U.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){x.textEditDivClicked(x.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},h.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var x=this.getTextScale(),U=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),X=this.textElement.getBBox(),G={x:X.width*x,y:X.height*x};U.x-=G.x/2,U.y-=G.y/2,this.textEditor.style.top=U.y+"px",this.textEditor.style.left=U.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-U.x+"px",this.textEditor.style.fontSize=Math.max(16*x,12)+"px",this.textElement.style.display="none"}},h.prototype.textEditDivClicked=function(x){this.text=x.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},h.prototype.select=function(){H.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},h.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),H.prototype.deselect.call(this)},h.prototype.dblClick=function(x,U){H.prototype.dblClick.call(this,x,U),this.showTextEditor()},h.prototype.setColor=function(x){this.textElement&&ne.setAttributes(this.textElement,[["fill",x]]),this.color=x,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(x)},h.prototype.setFont=function(x){this.textElement&&ne.setAttributes(this.textElement,[["font-family",x]]),this.fontFamily=x,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},h.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},h.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var x=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},H.prototype.getState.call(this));return x.typeName=h.typeName,x},h.prototype.restoreState=function(x){var U=x;this.color=U.color,this.fontFamily=U.fontFamily,this.padding=U.padding,this.text=U.text,this.createVisual(),H.prototype.restoreState.call(this,x),this.setSize()},h.prototype.scale=function(x,U){H.prototype.scale.call(this,x,U),this.setSize(),this.sizeText(),this.positionTextEditor()},h.typeName="TextMarker",h.title="Text marker",h.icon='<svg viewBox="0 0 24 24"><path d="M9.6 14L12 7.7l2.4 6.3M11 5L5.5 19h2.2l1.1-3H15l1.1 3h2.2L13 5h-2z"/></svg>',h}(Qe),Ee=function(H){function h(x,U,X){var G=H.call(this,x,U,X)||this;return G.color="transparent",G.lineWidth=3,G.drawing=!1,G.pixelRatio=1,G.color=X.defaultColor,G.lineWidth=X.defaultStrokeWidth,G.pixelRatio=X.freehandPixelRatio,G.setColor=G.setColor.bind(G),G.addCanvas=G.addCanvas.bind(G),G.finishCreation=G.finishCreation.bind(G),G.setLineWidth=G.setLineWidth.bind(G),G.colorPanel=new _e("Color",X.defaultColorSet,X.defaultColor),G.colorPanel.onColorChanged=G.setColor,G.lineWidthPanel=new dt("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),G.lineWidthPanel.onWidthChanged=G.setLineWidth,G}return Me(h,H),h.prototype.ownsTarget=function(x){return!(!H.prototype.ownsTarget.call(this,x)&&x!==this.visual&&x!==this.drawingImage)},h.prototype.createVisual=function(){this.visual=ne.createGroup(),this.drawingImage=ne.createImage(),this.visual.appendChild(this.drawingImage);var x=ne.createTransform();this.visual.transform.baseVal.appendItem(x),this.addMarkerVisualToContainer(this.visual)},h.prototype.pointerDown=function(x,U){this.state==="new"&&(this.addCanvas(),this.createVisual(),this._state="creating"),this.state==="creating"?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(x.x,x.y),this.drawing=!0):H.prototype.pointerDown.call(this,x,U)},h.prototype.manipulate=function(x){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(x.x,x.y),this.canvasContext.stroke()):H.prototype.manipulate.call(this,x)},h.prototype.resize=function(x){H.prototype.resize.call(this,x),ne.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),ne.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},h.prototype.pointerUp=function(x){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):H.prototype.pointerUp.call(this,x)},h.prototype.addCanvas=function(){this.overlayContainer.innerHTML="",this.canvasElement=document.createElement("canvas"),this.canvasElement.width=this.overlayContainer.clientWidth*this.pixelRatio,this.canvasElement.height=this.overlayContainer.clientHeight*this.pixelRatio,this.canvasContext=this.canvasElement.getContext("2d"),this.canvasContext.scale(this.pixelRatio,this.pixelRatio),this.overlayContainer.appendChild(this.canvasElement)},h.prototype.select=function(){this.state==="creating"&&this.finishCreation(),H.prototype.select.call(this)},h.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),H.prototype.deselect.call(this)},h.prototype.finishCreation=function(){for(var x=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),U=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],X=U[0],G=U[1],ge=U[2],Ge=U[3],rt=!1,pt=0;pt<this.canvasElement.height;pt++)for(var Ve=0;Ve<this.canvasElement.width;Ve++)x.data[pt*this.canvasElement.width*4+4*Ve+3]>0&&(rt=!0,pt<G&&(G=pt),Ve<X&&(X=Ve),pt>Ge&&(Ge=pt),Ve>ge&&(ge=Ve));if(rt){this.left=X/this.pixelRatio,this.top=G/this.pixelRatio,this.width=(ge-X)/this.pixelRatio,this.height=(Ge-G)/this.pixelRatio;var Lt=document.createElement("canvas");Lt.width=ge-X,Lt.height=Ge-G,Lt.getContext("2d").putImageData(this.canvasContext.getImageData(X,G,ge-X,Ge-G),0,0),this.drawingImgUrl=Lt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},h.prototype.setDrawingImage=function(){ne.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),ne.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},h.prototype.setColor=function(x){this.color=x,this.colorChanged(x)},h.prototype.setLineWidth=function(x){this.lineWidth=x},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var x=Object.assign({drawingImgUrl:this.drawingImgUrl},H.prototype.getState.call(this));return x.typeName=h.typeName,x},h.prototype.restoreState=function(x){this.createVisual(),H.prototype.restoreState.call(this,x),this.drawingImgUrl=x.drawingImgUrl,this.setDrawingImage()},h.prototype.scale=function(x,U){H.prototype.scale.call(this,x,U),this.setDrawingImage()},h.typeName="FreehandMarker",h.title="Freehand marker",h.icon='<svg viewBox="0 0 24 24"><path d="M9.75 20.85c1.78-.7 1.39-2.63.49-3.85-.89-1.25-2.12-2.11-3.36-2.94A9.817 9.817 0 014.54 12c-.28-.33-.85-.94-.27-1.06.59-.12 1.61.46 2.13.68.91.38 1.81.82 2.65 1.34l1.01-1.7C8.5 10.23 6.5 9.32 4.64 9.05c-1.06-.16-2.18.06-2.54 1.21-.32.99.19 1.99.77 2.77 1.37 1.83 3.5 2.71 5.09 4.29.34.33.75.72.95 1.18.21.44.16.47-.31.47-1.24 0-2.79-.97-3.8-1.61l-1.01 1.7c1.53.94 4.09 2.41 5.96 1.79m11.09-15.6c.22-.22.22-.58 0-.79l-1.3-1.3a.562.562 0 00-.78 0l-1.02 1.02 2.08 2.08M11 10.92V13h2.08l6.15-6.15-2.08-2.08L11 10.92z"/></svg>',h}(Qe),me=function(H){function h(x,U,X){var G=H.call(this,x,X||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return G.typeBoxes=[],G.currentType=U,G.setCurrentType=G.setCurrentType.bind(G),G}return Me(h,H),h.prototype.getUi=function(){var x=this,U=document.createElement("div");U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2";for(var X=function(Ge){var rt="both";switch(Ge){case 0:rt="both";break;case 1:rt="start";break;case 2:rt="end";break;case 3:rt="none"}var pt=document.createElement("div");if(pt.style.display="flex",pt.style.flexGrow="2",pt.style.alignItems="center",pt.style.justifyContent="space-between",pt.style.padding="5px",pt.style.borderWidth="2px",pt.style.borderStyle="solid",pt.style.borderColor=rt===G.currentType?G.uiStyleSettings.toolboxAccentColor:"transparent",pt.addEventListener("click",function(){x.setCurrentType(rt,pt)}),U.appendChild(pt),rt==="both"||rt==="start"){var Ve=document.createElement("div");Ve.style.display="flex",Ve.style.alignItems="center",Ve.style.minHeight="20px",Ve.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
<polygon points="0,5 10,0 10,10" fill="`+(G.uiStyleSettings!==void 0?G.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Ve.style.marginLeft="5px",pt.appendChild(Ve)}var Lt=document.createElement("div");Lt.style.display="flex",Lt.style.alignItems="center",Lt.style.minHeight="20px",Lt.style.flexGrow="2";var It=document.createElement("hr");if(It.style.minWidth="20px",It.style.border="0px",It.style.borderTop="3px solid "+(G.uiStyleSettings!==void 0?G.uiStyleSettings.toolboxColor:"#eeeeee"),It.style.flexGrow="2",Lt.appendChild(It),pt.appendChild(Lt),rt==="both"||rt==="end"){var er=document.createElement("div");er.style.display="flex",er.style.alignItems="center",er.style.minHeight="20px",er.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
<polygon points="0,0 10,5 0,10" fill="`+(G.uiStyleSettings!==void 0?G.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,er.style.marginRight="5px",pt.appendChild(er)}G.typeBoxes.push(pt)},G=this,ge=0;ge<4;ge++)X(ge);return U},h.prototype.setCurrentType=function(x,U){var X=this;this.currentType=x,this.typeBoxes.forEach(function(G){G.style.borderColor=G===U?X.uiStyleSettings!==void 0?X.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},h}(Ne),ye=function(H){function h(x,U,X){var G=H.call(this,x,U,X)||this;return G.arrowType="end",G.arrowBaseHeight=10,G.arrowBaseWidth=10,G.getArrowPoints=G.getArrowPoints.bind(G),G.setArrowType=G.setArrowType.bind(G),G.arrowTypePanel=new me("Arrow type","end"),G.arrowTypePanel.onArrowTypeChanged=G.setArrowType,G}return Me(h,H),h.prototype.ownsTarget=function(x){return!(!H.prototype.ownsTarget.call(this,x)&&x!==this.arrow1&&x!==this.arrow2)},h.prototype.getArrowPoints=function(x,U){var X=this.arrowBaseWidth+2*this.strokeWidth,G=this.arrowBaseHeight+2*this.strokeWidth;return x-X/2+","+(U+G/2)+" "+x+","+(U-G/2)+" "+(x+X/2)+","+(U+G/2)},h.prototype.createTips=function(){this.arrow1=ne.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(ne.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=ne.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(ne.createTransform()),this.visual.appendChild(this.arrow2)},h.prototype.pointerDown=function(x,U){H.prototype.pointerDown.call(this,x,U),this.state==="creating"&&this.createTips()},h.prototype.adjustVisual=function(){if(H.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",ne.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),ne.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var x=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),U=this.arrow1.transform.baseVal.getItem(0);U.setRotate(x,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(U,0);var X=this.arrow2.transform.baseVal.getItem(0);X.setRotate(x+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(X,0)}},h.prototype.setArrowType=function(x){this.arrowType=x,this.adjustVisual(),this.stateChanged()},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var x=Object.assign({arrowType:this.arrowType},H.prototype.getState.call(this));return x.typeName=h.typeName,x},h.prototype.restoreState=function(x){H.prototype.restoreState.call(this,x);var U=x;this.arrowType=U.arrowType,this.createTips(),this.adjustVisual()},h.typeName="ArrowMarker",h.title="Arrow marker",h.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',h}(at),te=function(H){function h(x,U,X){var G=H.call(this,x,U,X)||this;return G.fillColor=X.defaultFillColor,G.strokeWidth=0,G.fillPanel=new _e("Color",X.defaultColorSet,X.defaultFillColor),G.fillPanel.onColorChanged=G.setFillColor,G}return Me(h,H),Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var x=H.prototype.getState.call(this);return x.typeName=h.typeName,x},h.typeName="CoverMarker",h.title="Cover marker",h.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',h}(Ye),re=function(H){function h(x,U,X,G){var ge=H.call(this,x,G||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return ge.opacities=[],ge.opacityBoxes=[],ge.opacities=U,ge.currentOpacity=X,ge.setCurrentOpacity=ge.setCurrentOpacity.bind(ge),ge}return Me(h,H),h.prototype.getUi=function(){var x=this,U=document.createElement("div");return U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2",U.style.justifyContent="space-between",this.opacities.forEach(function(X){var G=document.createElement("div");G.style.display="flex",G.style.alignItems="center",G.style.justifyContent="center",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.borderColor=X===x.currentOpacity?x.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){x.setCurrentOpacity(X,G)}),U.appendChild(G);var ge=document.createElement("div");ge.innerText=100*X+"%",G.appendChild(ge),x.opacityBoxes.push(G)}),U},h.prototype.setCurrentOpacity=function(x,U){var X=this;this.currentOpacity=x,this.opacityBoxes.forEach(function(G){G.style.borderColor=G===U?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},h}(Ne),ue=function(H){function h(x,U,X){var G=H.call(this,x,U,X)||this;return G.setOpacity=G.setOpacity.bind(G),G.fillColor=X.defaultHighlightColor,G.strokeWidth=0,G.opacity=X.defaultHighlightOpacity,G.fillPanel=new _e("Color",X.defaultColorSet,G.fillColor),G.fillPanel.onColorChanged=G.setFillColor,G.opacityPanel=new re("Opacity",X.defaultOpacitySteps,G.opacity),G.opacityPanel.onOpacityChanged=G.setOpacity,G}return Me(h,H),h.prototype.setOpacity=function(x){this.opacity=x,this.visual&&ne.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var x=H.prototype.getState.call(this);return x.typeName=h.typeName,x},h.typeName="HighlightMarker",h.title="Highlight marker",h.icon='<svg viewBox="0 0 24 24"><path d="M18.5 1.15c-.53 0-1.04.19-1.43.58l-5.81 5.82 5.65 5.65 5.82-5.81c.77-.78.77-2.04 0-2.83l-2.84-2.83c-.39-.39-.89-.58-1.39-.58M10.3 8.5l-5.96 5.96c-.78.78-.78 2.04.02 2.85C3.14 18.54 1.9 19.77.67 21h5.66l.86-.86c.78.76 2.03.75 2.81-.02l5.95-5.96"/></svg>',h}(te),fe='<svg viewBox="0 0 24 24"><path d="M19 11.5s-2 2.17-2 3.5a2 2 0 002 2 2 2 0 002-2c0-1.33-2-3.5-2-3.5M5.21 10L10 5.21 14.79 10m1.77-1.06L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.56-.59 1.53 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.59.59-1.56 0-2.12z"/></svg>',Pe=function(H){function h(x,U,X){var G=H.call(this,x,U,X)||this;return G.bgColor="transparent",G.tipPosition={x:0,y:0},G.tipBase1Position={x:0,y:0},G.tipBase2Position={x:0,y:0},G.tipMoving=!1,G.color=X.defaultStrokeColor,G.bgColor=X.defaultFillColor,G.fontFamily=X.defaultFontFamily,G.defaultSize={x:100,y:30},G.setBgColor=G.setBgColor.bind(G),G.getTipPoints=G.getTipPoints.bind(G),G.positionTip=G.positionTip.bind(G),G.setTipPoints=G.setTipPoints.bind(G),G.colorPanel=new _e("Text color",X.defaultColorSet,G.color,'<svg viewBox="0 0 24 24"><path d="M9.62 12L12 5.67 14.37 12M11 3L5.5 17h2.25l1.12-3h6.25l1.13 3h2.25L13 3h-2z"/></svg>'),G.colorPanel.onColorChanged=G.setColor,G.bgColorPanel=new _e("Fill color",X.defaultColorSet,G.bgColor,fe),G.bgColorPanel.onColorChanged=G.setBgColor,G.fontFamilyPanel=new Be("Font",X.defaultFontFamilies,X.defaultFontFamily),G.fontFamilyPanel.onFontChanged=G.setFont,G.tipGrip=new et,G.tipGrip.visual.transform.baseVal.appendItem(ne.createTransform()),G.controlBox.appendChild(G.tipGrip.visual),G}return Me(h,H),h.prototype.ownsTarget=function(x){return H.prototype.ownsTarget.call(this,x)||this.tipGrip.ownsTarget(x)||this.tip===x},h.prototype.createTip=function(){ne.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=ne.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},h.prototype.pointerDown=function(x,U){this.state==="new"&&H.prototype.pointerDown.call(this,x,U),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(U)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):H.prototype.pointerDown.call(this,x,U)},h.prototype.pointerUp=function(x){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,H.prototype.pointerUp.call(this,x);else{var U=this.state==="creating";H.prototype.pointerUp.call(this,x),this.setTipPoints(U),this.positionTip()}},h.prototype.manipulate=function(x){if(this.tipMoving){var U=this.unrotatePoint(x);this.tipPosition={x:U.x-this.manipulationStartLeft,y:U.y-this.manipulationStartTop},this.positionTip()}else H.prototype.manipulate.call(this,x)},h.prototype.setBgColor=function(x){this.bgRectangle&&this.tip&&(ne.setAttributes(this.bgRectangle,[["fill",x]]),ne.setAttributes(this.tip,[["fill",x]])),this.bgColor=x,this.fillColorChanged(x)},h.prototype.getTipPoints=function(){return this.setTipPoints(this.state==="creating"),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},h.prototype.setTipPoints=function(x){x===void 0&&(x=!1);var U=Math.min(this.height/2,15),X=this.height/5;x&&(this.tipPosition={x:U+X/2,y:this.height+20});var G=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?G<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(X=this.width/5,U=Math.min(this.width/2,15),this.tipBase1Position={x:U,y:0},this.tipBase2Position={x:U+X,y:0}):(this.tipBase1Position={x:0,y:U},this.tipBase2Position={x:0,y:U+X}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?G<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(X=this.width/5,U=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-U-X,y:0},this.tipBase2Position={x:this.width-U,y:0}):(this.tipBase1Position={x:this.width,y:U},this.tipBase2Position={x:this.width,y:U+X}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?G<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(X=this.width/5,U=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-U-X,y:this.height},this.tipBase2Position={x:this.width-U,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-U-X},this.tipBase2Position={x:this.width,y:this.height-U}):G<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(X=this.width/5,U=Math.min(this.width/2,15),this.tipBase1Position={x:U,y:this.height},this.tipBase2Position={x:U+X,y:this.height}):(this.tipBase1Position={x:0,y:this.height-U},this.tipBase2Position={x:0,y:this.height-U-X})},h.prototype.resize=function(x){H.prototype.resize.call(this,x),this.positionTip()},h.prototype.positionTip=function(){ne.setAttributes(this.tip,[["points",this.getTipPoints()]]);var x=this.tipGrip.visual.transform.baseVal.getItem(0);x.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(x,0)},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),h.prototype.select=function(){this.positionTip(),H.prototype.select.call(this)},h.prototype.getState=function(){var x=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},H.prototype.getState.call(this));return x.typeName=h.typeName,x},h.prototype.restoreState=function(x){var U=x;this.bgColor=U.bgColor,this.tipPosition=U.tipPosition,H.prototype.restoreState.call(this,x),this.createTip(),this.setTipPoints()},h.prototype.scale=function(x,U){H.prototype.scale.call(this,x,U),this.tipPosition={x:this.tipPosition.x*x,y:this.tipPosition.y*U},this.positionTip()},h.typeName="CalloutMarker",h.title="Callout marker",h.icon='<svg viewBox="0 0 24 24"><path d="M4 2h16a2 2 0 012 2v12a2 2 0 01-2 2h-4l-4 4-4-4H4a2 2 0 01-2-2V4a2 2 0 012-2m0 2v12h4.83L12 19.17 15.17 16H20V4H4m2 3h12v2H6V7m0 4h10v2H6v-2z"/></svg>',h}(Ke),Se=function(H){function h(x,U,X){var G=H.call(this,x,U,X)||this;return G.fillColor="transparent",G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.opacity=1,G.strokeColor=X.defaultColor,G.strokeWidth=X.defaultStrokeWidth,G.strokeDasharray=X.defaultStrokeDasharray,G.fillColor=X.defaultFillColor,G.setStrokeColor=G.setStrokeColor.bind(G),G.setFillColor=G.setFillColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.setOpacity=G.setOpacity.bind(G),G.createVisual=G.createVisual.bind(G),G.strokePanel=new _e("Line color",le(X.defaultColorSet,["transparent"]),X.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.fillPanel=new _e("Fill color",le(X.defaultColorSet,["transparent"]),G.fillColor,fe),G.fillPanel.onColorChanged=G.setFillColor,G.strokeWidthPanel=new dt("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new $e("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G.opacityPanel=new re("Opacity",X.defaultOpacitySteps,G.opacity),G.opacityPanel.onOpacityChanged=G.setOpacity,G}return Me(h,H),h.prototype.ownsTarget=function(x){return!(!H.prototype.ownsTarget.call(this,x)&&x!==this.visual)},h.prototype.createVisual=function(){this.visual=ne.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},h.prototype.pointerDown=function(x,U){H.prototype.pointerDown.call(this,x,U),this.state==="new"&&(this.createVisual(),this.moveVisual(x),this._state="creating")},h.prototype.manipulate=function(x){H.prototype.manipulate.call(this,x)},h.prototype.resize=function(x){H.prototype.resize.call(this,x),this.setSize()},h.prototype.setSize=function(){H.prototype.setSize.call(this),ne.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},h.prototype.pointerUp=function(x){H.prototype.pointerUp.call(this,x),this.setSize()},h.prototype.setStrokeColor=function(x){this.strokeColor=x,this.visual&&ne.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(x),this.stateChanged()},h.prototype.setFillColor=function(x){this.fillColor=x,this.visual&&ne.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(x),this.stateChanged()},h.prototype.setStrokeWidth=function(x){this.strokeWidth=x,this.visual&&ne.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},h.prototype.setStrokeDasharray=function(x){this.strokeDasharray=x,this.visual&&ne.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},h.prototype.setOpacity=function(x){this.opacity=x,this.visual&&ne.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var x=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},H.prototype.getState.call(this));return x.typeName=h.typeName,x},h.prototype.restoreState=function(x){var U=x;this.fillColor=U.fillColor,this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.strokeDasharray,this.opacity=U.opacity,this.createVisual(),H.prototype.restoreState.call(this,x),this.setSize()},h.prototype.scale=function(x,U){H.prototype.scale.call(this,x,U),this.setSize()},h.typeName="EllipseMarker",h.title="Ellipse marker",h.icon='<svg viewBox="0 0 24 24"><path d="M12 4C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',h}(Qe),ze=function(H){function h(x,U,X){return H.call(this,x,U,X)||this}return Me(h,H),Object.defineProperty(h.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),h.prototype.ownsTarget=function(x){return!(!H.prototype.ownsTarget.call(this,x)&&x!==this.tip1&&x!==this.tip2)},h.prototype.createTips=function(){this.tip1=ne.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(ne.createTransform()),this.visual.appendChild(this.tip1),this.tip2=ne.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(ne.createTransform()),this.visual.appendChild(this.tip2)},h.prototype.pointerDown=function(x,U){H.prototype.pointerDown.call(this,x,U),this.state==="creating"&&this.createTips()},h.prototype.adjustVisual=function(){if(H.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(ne.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),ne.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var x=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),U=this.tip1.transform.baseVal.getItem(0);U.setRotate(x,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(U,0);var X=this.tip2.transform.baseVal.getItem(0);X.setRotate(x+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(X,0)}},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var x=H.prototype.getState.call(this);return x.typeName=h.typeName,x},h.prototype.restoreState=function(x){H.prototype.restoreState.call(this,x),this.createTips(),this.adjustVisual()},h.typeName="MeasurementMarker",h.title="Measurement marker",h.icon='<svg viewBox="0 0 24 24"><path d="M1.39 18.36l1.77-1.76L4.58 18l1.06-1.05-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.42 1.41L10.59 12l-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.41 1.41 1.07-1.06-1.42-1.41 1.42-1.42L18 6.7l1.07-1.06-2.47-2.48 1.76-1.77 4.25 4.25L5.64 22.61l-4.25-4.25z"/></svg>',h}(at),ot=function(H){function h(x,U,X){var G=H.call(this,x,U,X)||this;return G.strokePanel.colors=X.defaultColorSet,G.fillColor="transparent",G}return Me(h,H),Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var x=H.prototype.getState.call(this);return x.typeName=h.typeName,x},h.typeName="EllipseFrameMarker",h.title="Ellipse frame marker",h.icon='<svg viewBox="0 0 24 24"><path d="M12 6c4.41 0 8 2.69 8 6s-3.59 6-8 6-8-2.69-8-6 3.59-6 8-6m0-2C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',h}(Se),ct=function(){function H(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(H.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),H.prototype.addUndoStep=function(h){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(h)||(this.undoStack.push(h),JSON.stringify(this.lastRedoStep)!==JSON.stringify(h)&&this.redoStack.splice(0,this.redoStack.length))},H.prototype.replaceLastUndoStep=function(h){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=h)},H.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},H.prototype.undo=function(){if(this.undoStack.length>1){var h=this.undoStack.pop();return h!==void 0&&this.redoStack.push(h),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},H.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},H}(),ht=function(H){function h(x,U,X){var G=H.call(this,x,U,X)||this;return G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.curveX=0,G.curveY=0,G.manipulationStartCurveX=0,G.manipulationStartCurveY=0,G.setStrokeColor=G.setStrokeColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.positionGrips=G.positionGrips.bind(G),G.addControlGrips=G.addControlGrips.bind(G),G.adjustVisual=G.adjustVisual.bind(G),G.setupControlBox=G.setupControlBox.bind(G),G.resize=G.resize.bind(G),G.strokeColor=X.defaultColor,G.strokeWidth=X.defaultStrokeWidth,G.strokeDasharray=X.defaultStrokeDasharray,G.strokePanel=new _e("Line color",X.defaultColorSet,X.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.strokeWidthPanel=new dt("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new $e("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G}return Me(h,H),h.prototype.ownsTarget=function(x){return!(!H.prototype.ownsTarget.call(this,x)&&x!==this.visual&&x!==this.selectorCurve&&x!==this.visibleCurve&&!this.curveGrip.ownsTarget(x))},h.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},h.prototype.createVisual=function(){this.visual=ne.createGroup(),this.selectorCurve=ne.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=ne.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},h.prototype.pointerDown=function(x,U){H.prototype.pointerDown.call(this,x,U),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=x.x,this.curveY=x.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(U)&&(this.activeGrip=this.curveGrip,this._state="resize")},h.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),ne.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),ne.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),ne.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},h.prototype.setupControlBox=function(){H.prototype.setupControlBox.call(this),this.curveControlLine1=ne.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=ne.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},h.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,H.prototype.addControlGrips.call(this)},h.prototype.positionGrips=function(){H.prototype.positionGrips.call(this);var x=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-x/2,this.curveY-x/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},h.prototype.manipulate=function(x){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+x.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+x.y-this.manipulationStartY),H.prototype.manipulate.call(this,x)},h.prototype.resize=function(x){this.activeGrip===this.curveGrip&&(this.curveX=x.x,this.curveY=x.y),H.prototype.resize.call(this,x),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},h.prototype.setStrokeColor=function(x){this.strokeColor=x,this.adjustVisual(),this.colorChanged(x)},h.prototype.setStrokeWidth=function(x){this.strokeWidth=x,this.adjustVisual()},h.prototype.setStrokeDasharray=function(x){this.strokeDasharray=x,this.adjustVisual()},h.prototype.scale=function(x,U){this.curveX=this.curveX*x,this.curveY=this.curveY*U,H.prototype.scale.call(this,x,U)},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var x=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},H.prototype.getState.call(this));return x.typeName=h.typeName,x},h.prototype.restoreState=function(x){H.prototype.restoreState.call(this,x);var U=x;this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.strokeDasharray,this.curveX=U.curveX,this.curveY=U.curveY,this.createVisual(),this.adjustVisual()},h.typeName="CurveMarker",h.title="Curve marker",h.icon='<svg viewBox="0 0 24 24"><path d="M18.5 2A1.5 1.5 0 0120 3.5 1.5 1.5 0 0118.5 5c-.23 0-.45-.05-.65-.15l-3.69 3.7.34.45c2.19-1.26 4.76-2 7.5-2l1 .03v2.01L22 9c-2.58 0-5 .75-7 2.04A3.96 3.96 0 0111.04 15C9.75 17 9 19.42 9 22l.04 1H7.03L7 22c0-2.74.74-5.31 2-7.5l-.45-.34-3.7 3.69c.1.2.15.42.15.65A1.5 1.5 0 013.5 20 1.5 1.5 0 012 18.5 1.5 1.5 0 013.5 17c.23 0 .45.05.65.15l3.69-3.7C7.31 12.78 7 11.92 7 11a4 4 0 014-4c.92 0 1.78.31 2.45.84l3.7-3.69c-.1-.2-.15-.42-.15-.65A1.5 1.5 0 0118.5 2M11 9a2 2 0 00-2 2 2 2 0 002 2 2 2 0 002-2 2 2 0 00-2-2z"/></svg>',h}(Ze),At=function(){function H(h,x){x===void 0&&(x=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=h,this.cancelable=x}return Object.defineProperty(H.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),H.prototype.preventDefault=function(){this._defaultPrevented=!0},H}(),wt=function(H){function h(x,U,X){var G=H.call(this,x,!1)||this;return G.dataUrl=U,G.state=X,G}return Me(h,H),h}(At),ft=function(H){function h(x,U,X){X===void 0&&(X=!1);var G=H.call(this,x,X)||this;return G.marker=U,G}return Me(h,H),h}(At),Kt=function(){function H(){this.render=[],this.beforeclose=[],this.close=[],this.show=[],this.restorestate=[],this.statechange=[],this.markerselect=[],this.markerdeselect=[],this.markercreating=[],this.markercreate=[],this.markerbeforedelete=[],this.markerdelete=[],this.markerchange=[],this.focus=[],this.blur=[]}return H.prototype.addEventListener=function(h,x){this[h].push(x)},H.prototype.removeEventListener=function(h,x){var U=this[h].indexOf(x);U>-1&&this[h].splice(U,1)},H}(),Ft=function(){function H(h){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Oe,this._isOpen=!1,this.undoRedoManager=new ct,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.renderMarkersOnly=!1,this.zoomSteps=[1,1.5,2,4],this._zoomLevel=1,this._isResizing=!1,this.prevPanPoint={x:0,y:0},this.eventListeners=new Kt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=H.instanceCounter++,this.styles=new Re(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=h,this.targetRoot=document.body,this.width=h.clientWidth,this.height=h.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(H.prototype,"ALL_MARKER_TYPES",{get:function(){return[tt,Ee,ye,Ke,ot,Se,ue,Pe,ze,te,at,ht]},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[tt,Ee,ye,Ke,Se,ue,Pe]},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"BASIC_MARKER_TYPES",{get:function(){return[tt,Ee,ye,Ke,ue]},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(h){var x=this;this._availableMarkerTypes.splice(0),h.forEach(function(U){if(typeof U=="string"){var X=x.ALL_MARKER_TYPES.find(function(G){return G.typeName===U});X!==void 0&&x._availableMarkerTypes.push(X)}else x._availableMarkerTypes.push(U)})},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(h){this._zoomLevel=h,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),H.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),Le.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},H.prototype.show=function(){var h=this;this.styles.styleSheetRoot===void 0&&Ie.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=Ie.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(x){return x(new At(h))})},H.prototype.render=function(){return ce(this,void 0,void 0,function(){var h;return ve(this,function(x){switch(x.label){case 0:return this.setCurrentMarker(),(h=new xe).naturalSize=this.renderAtNaturalSize,h.imageType=this.renderImageType,h.imageQuality=this.renderImageQuality,h.markersOnly=this.renderMarkersOnly,h.width=this.renderWidth,h.height=this.renderHeight,[4,h.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return x.sent(),[4,h.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,x.sent()]}})})},H.prototype.close=function(h){var x=this;if(h===void 0&&(h=!1),this.isOpen){var U=!1;h||this.eventListeners.beforeclose.forEach(function(X){var G=new At(x,!0);X(G),G.defaultPrevented&&(U=!0)}),U||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(X){return X(new At(x))}),this.detachEvents(),this._isOpen=!1)}},H.prototype.addMarkersToToolbar=function(){for(var h,x=[],U=0;U<arguments.length;U++)x[U]=arguments[U];(h=this._availableMarkerTypes).push.apply(h,x)},H.prototype.addRenderEventListener=function(h){this.addEventListener("render",function(x){h(x.dataUrl,x.state)})},H.prototype.removeRenderEventListener=function(h){},H.prototype.addCloseEventListener=function(h){this.addEventListener("close",function(){h()})},H.prototype.removeCloseEventListener=function(h){},H.prototype.setupResizeObserver=function(){var h=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){h.resize(h.target.clientWidth,h.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return h.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},H.prototype.onPopupTargetResize=function(){var h=1*this.target.clientWidth/this.target.clientHeight,x=this.editorCanvas.clientWidth/h>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*h:this.editorCanvas.clientWidth,U=x<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/h;this.resize(x,U)},H.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},H.prototype.resize=function(h,x){this._isResizing=!0;var U=h/this.imageWidth,X=x/this.imageHeight;this.imageWidth=Math.round(h),this.imageHeight=Math.round(x),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(U,X),this._isResizing=!1},H.prototype.scaleMarkers=function(h,x){var U,X=this;this._currentMarker&&this._currentMarker instanceof Ke?this._currentMarker.scale(h,x):(U=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(G){G!==X._currentMarker&&G.scale(h,x)}),U!==void 0&&this.setCurrentMarker(U)},H.prototype.setEditingTarget=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px"},H.prototype.setTopLeft=function(){var h=this.editingTarget.getBoundingClientRect(),x=this.editorCanvas.getBoundingClientRect();this.left=h.left-x.left,this.top=h.top-x.top},H.prototype.initMarkerCanvas=function(){this.markerImageHolder=document.createElement("div"),this.markerImageHolder.style.setProperty("touch-action","pinch-zoom"),this.markerImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.markerImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImage.style.pointerEvents="auto",this.markerImageHolder.style.position="absolute",this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.markerImageHolder.style.transformOrigin="top left",this.positionMarkerImage(),this.markerImageHolder.appendChild(this.markerImage),this.editorCanvas.appendChild(this.markerImageHolder)},H.prototype.addDefs=function(){for(var h,x=[],U=0;U<arguments.length;U++)x[U]=arguments[U];this.defs=ne.createDefs(),this.addDefsToImage(),(h=this.defs).append.apply(h,x)},H.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},H.prototype.initOverlay=function(){this.overlayContainer=document.createElement("div"),this.overlayContainer.style.position="absolute",this.overlayContainer.style.left="0px",this.overlayContainer.style.top="0px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.overlayContainer.style.display="flex",this.markerImageHolder.appendChild(this.overlayContainer)},H.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},H.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},H.prototype.attachWindowEvents=function(){window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("pointerout",this.onPointerOut),window.addEventListener("pointerleave",this.onPointerUp),window.addEventListener("resize",this.onWindowResize),window.addEventListener("keyup",this.onKeyUp)},H.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},H.prototype.detachWindowEvents=function(){window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("pointerout",this.onPointerOut),window.removeEventListener("pointerleave",this.onPointerUp),window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("keyup",this.onKeyUp)},H.prototype.addLogo=function(){this.logoUI=document.createElement("div"),this.logoUI.style.display="inline-block",this.logoUI.style.margin="0px",this.logoUI.style.padding="0px",this.logoUI.style.fill="#333333";var h=document.createElement("a");h.href="https://markerjs.com/",h.target="_blank",h.innerHTML='<svg viewBox="0 0 112 96" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path fill="#e5f20d" fill-opacity=".647" d="M0 40.386h111.96V95.62H0z"/><path d="M93.61 61.452c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.591 1.048-1.481 0-2.222-.74-2.222-2.22 0-16.617-.533-29.347-1.604-38.192-1.068-8.842-2.92-13.265-5.552-13.265-4.443 0-10.94 15.509-19.497 46.52v.124c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.592 1.048-1.48 0-2.22-.74-2.22-2.22 0-3.29.165-8.392.493-15.302.33-7.732.494-13.82.494-18.262 0-6.17-.186-10.55-.556-13.142-.37-2.591-1.172-3.887-2.406-3.887-2.796 0-6.333 5.12-10.612 15.363C38.494 34.367 34.01 46.44 29.32 60.34l-1.11 3.209a5.714 5.714 0 01-1.42 2.097c-.617.578-1.295.864-2.036.864-.987 0-1.644-.081-1.974-.247-.328-.162-.533-.656-.617-1.48-.41-4.03-.74-9.418-.987-16.165-.163-1.728-.329-4.566-.494-8.515-.822-13.901-1.562-23.3-2.221-28.196-.657-4.893-.987-7.628-.987-8.205 0-.657.33-1.44.987-2.345.659-.903 1.276-1.357 1.85-1.357 1.319 0 2.387.947 3.21 2.838.411.906.863 4.526 1.357 10.859.493 6.335.905 14.19 1.233 23.568l.617 18.88c4.527-13.983 9.216-26.673 14.068-38.068C45.65 6.686 50.093.988 54.123.988c2.715 0 4.566 1.974 5.553 5.923.987 3.949 1.481 9.667 1.481 17.152 0 3.949-.081 9.625-.247 17.029l-.123 5.676c3.373-11.762 6.725-21.634 10.057-29.615 3.331-7.979 6.685-11.97 10.056-11.97 8.475 0 12.71 18.757 12.71 56.269z" fill-rule="nonzero"/></svg>',h.title="Powered by marker.js",h.style.display="grid",h.style.alignItems="center",h.style.justifyItems="center",h.style.padding="3px",h.style.width="20px",h.style.height="20px",this.logoUI.appendChild(h),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},H.prototype.positionLogo=function(){this.logoUI&&(this.uiStyleSettings.logoPosition!=="right"?this.logoUI.style.left=this.markerImageHolder.offsetLeft+10+"px":this.logoUI.style.left=this.markerImageHolder.offsetLeft+this.markerImageHolder.offsetWidth-this.logoUI.clientWidth-10+"px",this.logoUI.style.top=this.markerImageHolder.offsetTop+this.markerImageHolder.offsetHeight-this.logoUI.clientHeight-10+"px")},H.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},H.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},H.prototype.showUI=function(){switch(this.settings.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.style.visibility=this._silentRenderMode?"hidden":"visible",this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.coverDiv.style.userSelect="none",this.settings.displayMode){case"inline":this.coverDiv.style.position="absolute";var h=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=h+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.settings.displayMode==="popup"?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new be(this.uiDiv,this.settings.displayMode,this._availableMarkerTypes,this.uiStyleSettings,this.styles),this.toolbar.addButtonClickListener(this.toolbarButtonClicked),this.toolbar.show(this._silentRenderMode||this.uiStyleSettings.hideToolbar?"hidden":"visible"),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.settings.displayMode==="popup"&&(this.contentDiv.style.backgroundColor=this.uiStyleSettings.canvasBackgroundColor,this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.uiStyleSettings.toolbarHeight+"px",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.settings.popupMargin+"px)"),this.contentDiv.style.overflow="auto",this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.settings.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.editorCanvas.style.transformOrigin="left top",this.editorCanvas.style.transform="scale("+this.zoomLevel+")",this.contentDiv.appendChild(this.editorCanvas),this.editingTarget=this.target instanceof HTMLImageElement?document.createElement("img"):document.createElement("canvas"),this.target.getClientRects().item(0).y<this.styles.settings.toolbarHeight&&(this.editingTarget.style.marginTop=this.target.offsetTop-this.styles.settings.toolbarHeight+"px"),this.editorCanvas.appendChild(this.editingTarget),this.toolbox=new Ae(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},H.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},H.prototype.removeMarker=function(h){this.markerImage.removeChild(h.container),this.markers.indexOf(h)>-1&&this.markers.splice(this.markers.indexOf(h),1),h.dispose()},H.prototype.switchToSelectMode=function(){this.mode="select",this.hideNotesEditor(),this._currentMarker!==void 0&&(this._currentMarker.state!=="new"?this._currentMarker.select():(this.removeMarker(this._currentMarker),this.setCurrentMarker(),this.markerImage.style.cursor="default"),this.addUndoStep())},H.prototype.toolbarButtonClicked=function(h,x){if(h==="marker"&&x!==void 0)this.createNewMarker(x);else if(h==="action")switch(x){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":this.notesArea===void 0?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},H.prototype.deleteSelectedMarker=function(){var h=this;if(this._currentMarker!==void 0){var x=!1;if(this.eventListeners.markerbeforedelete.forEach(function(X){var G=new ft(h,h._currentMarker,!0);X(G),G.defaultPrevented&&(x=!0)}),!x){var U=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(X){return X(new ft(h,U))})}}},H.prototype.clear=function(){var h=this,x=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ge){var Ge=new ft(h,void 0,!0);ge(Ge),Ge.defaultPrevented&&(x=!0)}),!x)){this.setCurrentMarker();for(var U=function(ge){var Ge=X.markers[ge];X.setCurrentMarker(X.markers[ge]),X._currentMarker.dispose(),X.markerImage.removeChild(X._currentMarker.container),X.markers.splice(X.markers.indexOf(X._currentMarker),1),X.eventListeners.markerdelete.forEach(function(rt){return rt(new ft(h,Ge))})},X=this,G=this.markers.length-1;G>=0;G--)U(G);this.addUndoStep()}},Object.defineProperty(H.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),H.prototype.showNotesEditor=function(){var h;this._currentMarker!==void 0&&(this.overlayContainer.innerHTML="",this.notesArea=document.createElement("textarea"),this.notesArea.className=this.uiStyleSettings.notesAreaStyleClassName,this.notesArea.style.pointerEvents="auto",this.notesArea.style.alignSelf="stretch",this.notesArea.style.width="100%",this.notesArea.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.notesArea.value=(h=this._currentMarker.notes)!==null&&h!==void 0?h:"",this.overlayContainer.appendChild(this.notesArea))},H.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(this._currentMarker!==void 0&&(this._currentMarker.notes=this.notesArea.value.trim()!==""?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},H.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},H.prototype.addUndoStep=function(){var h=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var x=this.getState(),U=this.undoRedoManager.getLastUndoStep();if(!U||U.width===x.width&&U.height===x.height){var X=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(x),X<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(G){return G(new At(h))})}else this.undoRedoManager.replaceLastUndoStep(x),this.eventListeners.statechange.forEach(function(G){return G(new At(h))})}},H.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},H.prototype.undoStep=function(){var h=this,x=this.undoRedoManager.undo();x!==void 0&&(this.restoreState(x),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(U){return U(new At(h))}))},H.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},H.prototype.redoStep=function(){var h=this,x=this.undoRedoManager.redo();x!==void 0&&(this.restoreState(x),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(U){return U(new At(h))}))},H.prototype.stepZoom=function(){var h=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=h<this.zoomSteps.length-1?this.zoomSteps[h+1]:this.zoomSteps[0]},H.prototype.panTo=function(h){this.contentDiv.scrollBy({left:this.prevPanPoint.x-h.x,top:this.prevPanPoint.y-h.y}),this.prevPanPoint=h},H.prototype.startRenderAndClose=function(){return ce(this,void 0,void 0,function(){var h,x,U=this;return ve(this,function(X){switch(X.label){case 0:return[4,this.render()];case 1:return h=X.sent(),x=this.getState(),this.eventListeners.render.forEach(function(G){return G(new wt(U,h,x))}),this.close(!0),[2]}})})},H.prototype.getState=function(h){h===!0&&this.setCurrentMarker();var x={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(U){return x.markers.push(U.getState())}),x},H.prototype.restoreState=function(h){var x=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);h.markers.forEach(function(U){var X=x._availableMarkerTypes.find(function(ge){return ge.typeName===U.typeName});if(X!==void 0){var G=x.addNewMarker(X);G.restoreState(U),x.markers.push(G)}}),h.width&&h.height&&(h.width!==this.imageWidth||h.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/h.width,this.imageHeight/h.height),this.eventListeners.restorestate.forEach(function(U){return U(new At(x))})},H.prototype.addNewMarker=function(h){var x=ne.createGroup();return this.markerImage.appendChild(x),new h(x,this.overlayContainer,this.settings)},H.prototype.createNewMarker=function(h){var x,U=this;(x=typeof h=="string"?this._availableMarkerTypes.find(function(X){return X.typeName===h}):h)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(x),this._currentMarker.onMarkerCreated=this.markerCreated,this._currentMarker.onColorChanged=this.colorChanged,this._currentMarker.onFillColorChanged=this.fillColorChanged,this._currentMarker.onStateChanged=this.markerStateChanged,this.markerImage.style.cursor="crosshair",this.toolbar.setActiveMarkerButton(x.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(X){return X(new ft(U,U._currentMarker))}))},H.prototype.markerCreated=function(h){var x=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(h),this.setCurrentMarker(h),h instanceof Ee&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(Ee):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(U){return U(new ft(x,x._currentMarker))})},H.prototype.colorChanged=function(h){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=h,this.settings.defaultStrokeColor=h)},H.prototype.fillColorChanged=function(h){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=h)},H.prototype.markerStateChanged=function(h){var x=this;this.eventListeners.markerchange.forEach(function(U){return U(new ft(x,h))})},H.prototype.setCurrentMarker=function(h){var x=this;this._currentMarker!==h&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(U){return U(new ft(x,x._currentMarker))})),this._currentMarker=h,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(U){return U(new ft(x,x._currentMarker))}))},H.prototype.onPointerDown=function(h){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||h.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var x=this.markers.find(function(U){return U.ownsTarget(h.target)});x!==void 0?(this.setCurrentMarker(x),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(h.clientX,h.clientY),h.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:h.clientX,y:h.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(h.clientX,h.clientY))},H.prototype.onDblClick=function(h){if(this._isFocused||this.focus(),this.mode==="select"){var x=this.markers.find(function(U){return U.ownsTarget(h.target)});x!==void 0&&x!==this._currentMarker&&this.setCurrentMarker(x),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(h.clientX,h.clientY),h.target):this.setCurrentMarker()}},H.prototype.onPointerMove=function(h){this.touchPoints!==1&&h.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||h.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(h.clientX,h.clientY)):this.zoomLevel>1&&this.panTo({x:h.clientX,y:h.clientY}))},H.prototype.onPointerUp=function(h){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(h.clientX,h.clientY)),this.isDragging=!1,this.addUndoStep()},H.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},H.prototype.onKeyUp=function(h){this._currentMarker===void 0||this.notesArea!==void 0||h.key!=="Delete"&&h.key!=="Backspace"||this.deleteSelectedMarker()},H.prototype.clientToLocalCoordinates=function(h,x){var U=this.markerImage.getBoundingClientRect();return{x:(h-U.left)/this.zoomLevel,y:(x-U.top)/this.zoomLevel}},H.prototype.onWindowResize=function(){this.positionUI()},H.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var h=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=h+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},H.prototype.addLicenseKey=function(h){Le.addKey(h)},H.prototype.addEventListener=function(h,x){this.eventListeners.addEventListener(h,x)},H.prototype.removeEventListener=function(h,x){this.eventListeners.removeEventListener(h,x)},H.prototype.renderState=function(h){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(h),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(H.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),H.prototype.focus=function(){var h=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(x){return x(new At(h))}))},H.prototype.blur=function(){var h=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(x){return x(new At(h))}))},H.instanceCounter=0,H}();/* **********************************
|
|
cropro version 1.2.0
|
|
@license SEE LICENSE IN LICENSE
|
|
|
|
copyright Alan Mendelevich
|
|
see README and LICENSE for details
|
|
********************************** *//*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */var Jt=function(H,h){return(Jt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(x,U){x.__proto__=U}||function(x,U){for(var X in U)Object.prototype.hasOwnProperty.call(U,X)&&(x[X]=U[X])})(H,h)};function Ht(H,h){if(typeof h!="function"&&h!==null)throw new TypeError("Class extends value "+String(h)+" is not a constructor or null");function x(){this.constructor=H}Jt(H,h),H.prototype=h===null?Object.create(h):(x.prototype=h.prototype,new x)}function kt(H,h,x,U){return new(x||(x=Promise))(function(X,G){function ge(pt){try{rt(U.next(pt))}catch(Ve){G(Ve)}}function Ge(pt){try{rt(U.throw(pt))}catch(Ve){G(Ve)}}function rt(pt){var Ve;pt.done?X(pt.value):(Ve=pt.value,Ve instanceof x?Ve:new x(function(Lt){Lt(Ve)})).then(ge,Ge)}rt((U=U.apply(H,h||[])).next())})}function Ur(H,h){var x,U,X,G,ge={label:0,sent:function(){if(1&X[0])throw X[1];return X[1]},trys:[],ops:[]};return G={next:Ge(0),throw:Ge(1),return:Ge(2)},typeof Symbol=="function"&&(G[Symbol.iterator]=function(){return this}),G;function Ge(rt){return function(pt){return function(Ve){if(x)throw new TypeError("Generator is already executing.");for(;ge;)try{if(x=1,U&&(X=2&Ve[0]?U.return:Ve[0]?U.throw||((X=U.return)&&X.call(U),0):U.next)&&!(X=X.call(U,Ve[1])).done)return X;switch(U=0,X&&(Ve=[2&Ve[0],X.value]),Ve[0]){case 0:case 1:X=Ve;break;case 4:return ge.label++,{value:Ve[1],done:!1};case 5:ge.label++,U=Ve[1],Ve=[0];continue;case 7:Ve=ge.ops.pop(),ge.trys.pop();continue;default:if(!(X=ge.trys,(X=X.length>0&&X[X.length-1])||Ve[0]!==6&&Ve[0]!==2)){ge=0;continue}if(Ve[0]===3&&(!X||Ve[1]>X[0]&&Ve[1]<X[3])){ge.label=Ve[1];break}if(Ve[0]===6&&ge.label<X[1]){ge.label=X[1],X=Ve;break}if(X&&ge.label<X[2]){ge.label=X[2],ge.ops.push(Ve);break}X[2]&&ge.ops.pop(),ge.trys.pop();continue}Ve=h.call(H,ge)}catch(Lt){Ve=[6,Lt],U=0}finally{x=X=0}if(5&Ve[0])throw Ve[1];return{value:Ve[0]?Ve[1]:void 0,done:!0}}([rt,pt])}}}var Zr=function(){function H(){}return H.addKey=function(h){H.key=h},Object.defineProperty(H,"isLicensed",{get:function(){return!!H.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(H.key)},enumerable:!1,configurable:!0}),H}(),bt=function(){function H(){}return H.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},H.setAttributes=function(h,x){for(var U=0,X=x;U<X.length;U++){var G=X[U],ge=G[0],Ge=G[1];h.setAttribute(ge,Ge)}},H.createRect=function(h,x,U){var X=document.createElementNS("http://www.w3.org/2000/svg","rect");return X.setAttribute("width",h.toString()),X.setAttribute("height",x.toString()),U&&H.setAttributes(X,U),X},H.createLine=function(h,x,U,X,G){var ge=document.createElementNS("http://www.w3.org/2000/svg","line");return ge.setAttribute("x1",h.toString()),ge.setAttribute("y1",x.toString()),ge.setAttribute("x2",U.toString()),ge.setAttribute("y2",X.toString()),G&&H.setAttributes(ge,G),ge},H.createPolygon=function(h,x){var U=document.createElementNS("http://www.w3.org/2000/svg","polygon");return U.setAttribute("points",h),x&&H.setAttributes(U,x),U},H.createCircle=function(h,x){var U=document.createElementNS("http://www.w3.org/2000/svg","circle");return U.setAttribute("cx",(h/2).toString()),U.setAttribute("cy",(h/2).toString()),U.setAttribute("r",h.toString()),x&&H.setAttributes(U,x),U},H.createEllipse=function(h,x,U){var X=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return X.setAttribute("cx",(h/2).toString()),X.setAttribute("cy",(x/2).toString()),X.setAttribute("rx",(h/2).toString()),X.setAttribute("ry",(x/2).toString()),U&&H.setAttributes(X,U),X},H.createGroup=function(h){var x=document.createElementNS("http://www.w3.org/2000/svg","g");return h&&H.setAttributes(x,h),x},H.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},H.createMarker=function(h,x,U,X,G,ge,Ge){var rt=document.createElementNS("http://www.w3.org/2000/svg","marker");return H.setAttributes(rt,[["id",h],["orient",x],["markerWidth",U.toString()],["markerHeight",X.toString()],["refX",G.toString()],["refY",ge.toString()]]),rt.appendChild(Ge),rt},H.createText=function(h){var x=document.createElementNS("http://www.w3.org/2000/svg","text");return x.setAttribute("x","0"),x.setAttribute("y","0"),h&&H.setAttributes(x,h),x},H.createTSpan=function(h,x){var U=document.createElementNS("http://www.w3.org/2000/svg","tspan");return U.textContent=h,x&&H.setAttributes(U,x),U},H.createImage=function(h){var x=document.createElementNS("http://www.w3.org/2000/svg","image");return h&&H.setAttributes(x,h),x},H.createPoint=function(h,x){var U=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return U.x=h,U.y=x,U},H.createPath=function(h,x){var U=document.createElementNS("http://www.w3.org/2000/svg","path");return U.setAttribute("d",h),x&&H.setAttributes(U,x),U},H.createElement=function(h,x){var U=document.createElementNS("http://www.w3.org/2000/svg",h);return x&&H.setAttributes(U,x),U},H.getHollowRectanglePath=function(h,x,U,X,G,ge,Ge,rt){return"M"+h+","+x+"V"+(x+X)+"H"+(h+U)+"V"+x+"H"+G+"V"+ge+"H"+(G+Ge)+"V"+(ge+rt)+"H"+G+"V"+x+"Z"},H}(),Ct=function(){function H(h){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+h+"_"}return Object.defineProperty(H.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#333333",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarBackgroundActiveColor:"#282828",toolbarColor:"#eeeeee",cropShadeColor:"#ffffff",cropFrameColor:"#ffffff",gripColor:"#333333",gripFillColor:"#cccccc",toolbarHeight:40}},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),H.prototype.addClass=function(h){return this.styleSheet===void 0&&this.addStyleSheet(),h.name=""+this.classNamePrefix+h.localName,this.classes.push(h),this.styleSheet.sheet.insertRule("."+h.name+" {"+h.style+"}",this.styleSheet.sheet.cssRules.length),h},H.prototype.addRule=function(h){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(h),this.styleSheet.sheet.insertRule(h.selector+" {"+h.style+"}",this.styleSheet.sheet.cssRules.length)},H.prototype.addStyleSheet=function(){var h;this.styleSheet=document.createElement("style"),((h=this.styleSheetRoot)!==null&&h!==void 0?h:document.head).appendChild(this.styleSheet),this.addRule(new st("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new st("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new st("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new xt("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new xt("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},H.prototype.removeStyleSheet=function(){var h;this.styleSheet&&(((h=this.styleSheetRoot)!==null&&h!==void 0?h:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},H}(),st=function(H,h){this.selector=H,this.style=h},xt=function(H,h){this.localName=H,this.style=h},Zt=function(){function H(){this.blocks=[],this.display=""}return H.prototype.addButtonBlock=function(h){h.className=this.blockClassName,h.buttonClassName=this.buttonClassName,h.buttonColorsClassName=this.buttonColorsClassName,h.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(h)},H.prototype.addElementBlock=function(h){h.className===void 0&&(h.className=this.blockClassName),this.blocks.push(h)},H.prototype.getUI=function(){var h=document.createElement("div");return h.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,h.style.display=this.display,this.blocks.forEach(function(x){return h.appendChild(x.getUI())}),h},H}(),nr=function(){function H(){}return H.prototype.getUI=function(){var h=document.createElement("div");if(h.className=this.className,this.minWidth!==void 0&&(h.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":h.style.justifyContent="flex-start";break;case"center":h.style.justifyContent="center";break;case"end":h.style.justifyContent="flex-end"}return h.style.whiteSpace="nowrap",h},H}(),rr=function(H){function h(){var x=H!==null&&H.apply(this,arguments)||this;return x.buttons=[],x}return Ht(h,H),h.prototype.addButton=function(x){x.className=this.buttonClassName,x.colorsClassName=this.buttonColorsClassName,x.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(x)},h.prototype.getUI=function(){var x=H.prototype.getUI.call(this);return this.buttons.forEach(function(U){return x.appendChild(U.getUI())}),x},h}(nr),Rt=function(){function H(h,x){this._isActive=!1,this._isHidden=!1,this._icon=h,this.title=x,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(H.prototype,"icon",{get:function(){return this._icon},set:function(h){this._icon=h,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isActive",{get:function(){return this._isActive},set:function(h){this._isActive=h,this.adjustClassName()},enumerable:!1,configurable:!0}),H.prototype.getUI=function(){var h=this;return this.buttonContainer=document.createElement("div"),this.buttonContainer.title=this.title,this.buttonContainer.className=this.className+" "+this.colorsClassName,this.adjustClassName(),this.buttonContainer.innerHTML=this._icon,this.onClick&&this.buttonContainer.addEventListener("click",function(){return h.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},H.prototype.adjustClassName=function(){this.activeColorsClassName&&(this._isActive&&this.buttonContainer.className.indexOf(this.activeColorsClassName)<0?this.buttonContainer.className+=" "+this.activeColorsClassName:this._isActive||(this.buttonContainer.className=this.buttonContainer.className.replace(this.activeColorsClassName,"")))},H.prototype.hide=function(){this._isHidden=!0},H}(),gt=function(H){function h(){var x=H!==null&&H.apply(this,arguments)||this;return x.elements=[],x}return Ht(h,H),h.prototype.addElement=function(x){this.elements.push(x)},h.prototype.getUI=function(){var x=H.prototype.getUI.call(this);return this.elements.forEach(function(U){return x.appendChild(U)}),x},h}(nr),kr=function(){function H(h,x){this.horizontal=h,this.vertical=x}return Object.defineProperty(H.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),H.prototype.getVerticalLength=function(h){return h/this.ratio},H.prototype.getHorizontalLength=function(h){return h*this.ratio},H}(),tn=function(){function H(){}return H.getIcon=function(h,x){if(h>0&&x>0){var U=new kr(h,x),X=U.ratio>=1?20:U.getHorizontalLength(20),G=U.ratio<1?20:U.getVerticalLength(20),ge=document.createElementNS("http://www.w3.org/2000/svg","svg");ge.setAttribute("xmlns","http://www.w3.org/2000/svg"),ge.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ge);var Ge=bt.createDefs();ge.appendChild(Ge);var rt=bt.createElement("clipPath",[["id","text-bg-clip"]]);Ge.appendChild(rt);var pt=bt.createPath(bt.getHollowRectanglePath((24-X)/2,(24-G)/2,X,G,(24-X)/2+2,(24-G)/2+2,X-4,G-4));ge.appendChild(pt);var Ve=bt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ve.appendChild(bt.createTSpan(h+":"+x)),ge.appendChild(Ve);var Lt=Ve.getBBox();bt.setAttributes(Ve,[["x",((24-Lt.width)/2).toString()],["y",((24-Lt.height)/2-Lt.y).toString()]]);var It=bt.createPath(bt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Lt.width))/2,(24-Math.ceil(Lt.height))/2,Math.ceil(Lt.width),Math.ceil(Lt.height)));return rt.appendChild(It),bt.setAttributes(pt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ge),ge.outerHTML}return'<svg viewBox="0 0 24 24"><path d="M19 12h-2v3h-3v2h5v-5M7 9h3V7H5v5h2V9m14-6H3a2 2 0 00-2 2v14a2 2 0 002 2h18a2 2 0 002-2V5a2 2 0 00-2-2m0 16H3V5h18v14z"/></svg>'},H}(),Tr=function(H){function h(x,U,X){var G=H.call(this,x,U)||this;return G.isDropdownOpen=!1,G.onClick=G.dropdownButtonClicked,G.dropdownButtons=X,G}return Ht(h,H),h.prototype.setupDropdown=function(){var x=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(U){U.className=x.className,U.colorsClassName=x.colorsClassName,x.dropdownBlock.appendChild(U.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},h.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},h.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},h.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},h.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},h.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},h}(Rt),Ot=function(){function H(h,x){this.GRIP_SIZE=10,this.color=h,this.fillColor=x,this.visual=bt.createGroup(),this.visual.appendChild(bt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(bt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return H.prototype.ownsTarget=function(h){return h===this.visual||h===this.visual.childNodes[0]||h===this.visual.childNodes[1]},H.prototype.setCenter=function(h,x){this.visual.childNodes.forEach(function(U){return bt.setAttributes(U,[["cx",h.toString()],["cy",x.toString()]])})},H}(),Ar=function(){function H(h,x,U,X){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=h,this.canvasHeight=x,this.margin=U,this.container=X,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(H.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(h){this._aspectRatio=h,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(h){this._isGridVisible=h,this.gridContainer&&bt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(h){this._zoomFactor=h,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),H.prototype.open=function(){var h=this;this.cropShadeElement=bt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=bt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var x=0;x<this.numberOfGridLines;x++)this.horizontalGridLines.push(bt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(bt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(U){return h.gridContainer.appendChild(U)}),this.verticalGridLines.forEach(function(U){return h.gridContainer.appendChild(U)}),this.cropRectElement=bt.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},H.prototype.setCropRectangle=function(h){this.cropRect=h;var x=Object.assign({},this.cropRect);this.zoomFactor!==1&&(x.width=this.cropRect.width*this.zoomFactor,x.height=this.cropRect.height*this.zoomFactor,x.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-x.width/2,x.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-x.height/2),bt.setAttributes(this.cropRectElement,[["x",x.x.toString()],["y",x.y.toString()],["width",x.width.toString()],["height",x.height.toString()]]);var U=x.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(G,ge){var Ge=x.y+U*(ge+1);bt.setAttributes(G,[["x1",""+x.x],["y1",""+Ge],["x2",""+(x.x+x.width)],["y2",""+Ge]])});var X=x.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(G,ge){var Ge=x.x+X*(ge+1);bt.setAttributes(G,[["x1",""+Ge],["y1",""+x.y],["x2",""+Ge],["y2",""+(x.y+x.height)]])}),bt.setAttributes(this.cropShadeElement,[["d",bt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,x.x,x.y,x.width,x.height)]]),this.topLeftGrip.setCenter(x.x,x.y),this.topRightGrip.setCenter(x.x+x.width,x.y),this.bottomLeftGrip.setCenter(x.x,x.y+x.height),this.bottomRightGrip.setCenter(x.x+x.width,x.y+x.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},H.prototype.attachEvents=function(){this.container.style.touchAction="none",this.container.addEventListener("pointerdown",this.onPointerDown),this.container.addEventListener("pointermove",this.onPointerMove),this.container.addEventListener("pointerup",this.onPointerUp)},H.prototype.clientToLocalCoordinates=function(h,x){var U=this.container.getBoundingClientRect();return{x:h-U.left+this.margin,y:x-U.top+this.margin}},H.prototype.onPointerDown=function(h){this.container.setPointerCapture(h.pointerId),this.previousPoint=this.clientToLocalCoordinates(h.clientX,h.clientY),this.cropRectElement===h.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(h.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(h.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(h.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(h.target)&&(this.activeGrip=this.bottomRightGrip)},H.prototype.onPointerMove=function(h){if(this.isMoving)this.move(this.clientToLocalCoordinates(h.clientX,h.clientY));else if(this.activeGrip){var x=this.clientToLocalCoordinates(h.clientX,h.clientY);this.resize(x)}h.preventDefault()},H.prototype.onPointerUp=function(h){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(h.pointerId)},H.prototype.move=function(h){var x=h.x-this.previousPoint.x,U=h.y-this.previousPoint.y;this.zoomFactor!==1&&(x=-x/this.zoomFactor,U=-U/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+x),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+U),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=h},H.prototype.resize=function(h){var x=Object.assign({},this.cropRect),U=h.x-this.previousPoint.x,X=h.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:x.x+U<this.margin&&(U=this.margin-x.x),x.x+=U,x.width=this.cropRect.x+this.cropRect.width-x.x;break;case this.bottomRightGrip:case this.topRightGrip:x.width+U>this.canvasWidth*this.zoomFactor&&(U=this.canvasWidth*this.zoomFactor-x.width),x.width+=U}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(x.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(U),x.height=this.aspectRatio.getVerticalLength(x.width)):(x.y+=X,x.height=this.cropRect.y+this.cropRect.height-x.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?x.height=this.aspectRatio.getVerticalLength(x.width):x.height+=X}x.width<10&&(x.x=this.cropRect.x,x.width=10),x.height<10&&(x.y=this.cropRect.y,x.height=10),this.previousPoint=h,x.x>=this.margin&&x.y>=this.margin&&x.x-this.margin+x.width<=this.canvasWidth&&x.y-this.margin+x.height<=this.canvasHeight&&(this.cropRect=x,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},H.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var h=this.cropRect.x+this.cropRect.width/2,x=this.cropRect.y+this.cropRect.height/2,U=this.aspectRatio.getHorizontalLength(this.cropRect.height),X=this.aspectRatio.getVerticalLength(this.cropRect.width);U/this.canvasWidth<X/this.canvasHeight?this.cropRect.width=U:this.cropRect.height=X,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=h-this.cropRect.width/2,this.cropRect.y=x-this.cropRect.height/2,this.cropRect.x+this.cropRect.width>this.margin+this.canvasWidth&&(this.cropRect.x=this.margin+this.canvasWidth-this.cropRect.width),this.cropRect.y+this.cropRect.height>this.margin+this.canvasHeight&&(this.cropRect.y=this.margin+this.canvasHeight-this.cropRect.height),this.cropRect.x=Math.max(this.cropRect.x,this.margin),this.cropRect.y=Math.max(this.cropRect.y,this.margin)}},H.prototype.getRescaledRect=function(h,x,U,X,G,ge){var Ge=U/h,rt=X/x;return{x:(G.x-ge)*Ge+ge,y:(G.y-ge)*rt+ge,width:G.width*Ge,height:G.height*rt}},H.prototype.scaleCanvas=function(h,x){var U=this.getRescaledRect(this.canvasWidth,this.canvasHeight,h,x,this.cropRect,this.margin);this.canvasWidth=h,this.canvasHeight=x,this.onCropChange&&this.onCropChange(U),this.setCropRectangle(U)},H}(),Kr=function(){function H(h){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=h,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(H.prototype,"angle",{get:function(){return this._angle},set:function(h){this._angle=h,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),H.prototype.getUI=function(){return this.controlContainer=document.createElement("div"),this.controlContainer.title=this.title,this.controlContainer.className=this.className+" "+this.colorsClassName,this.controlContainer.appendChild(this.getVisual()),this.controlContainer.addEventListener("pointerdown",this.onPointerDown),this.controlContainer.addEventListener("pointermove",this.onPointerMove),this.controlContainer.addEventListener("pointerup",this.onPointerUp),this.uiContainer.appendChild(this.controlContainer),this.uiContainer.style.display="inline-block",this.uiContainer.style.touchAction="none",this.setAngleLabel(),this.positionScaleShape(),this.uiContainer},H.prototype.onPointerDown=function(h){this.controlContainer.setPointerCapture(h.pointerId),this.isDragging=!0,this.previousPoint={x:h.clientX,y:h.clientY}},H.prototype.onPointerMove=function(h){this.isDragging&&(this.onAngleChange&&this.onAngleChange((h.clientX-this.previousPoint.x)/5),this.previousPoint.x=h.clientX)},H.prototype.onPointerUp=function(h){this.isDragging&&this.onAngleChange&&this.onAngleChange((h.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(h.pointerId)},H.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var h=this.angleLabelText.getBBox();bt.setAttributes(this.angleLabelElement,[["x",((this.width-h.width)/2).toString()],["y",(this.height/2).toString()]])}},H.prototype.positionScaleShape=function(){if(this.scaleShape){var h=this.scaleShape.transform.baseVal.getItem(0);h.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(h,0)}},H.prototype.getVisual=function(){var h=document.createElementNS("http://www.w3.org/2000/svg","svg");h.setAttribute("xmlns","http://www.w3.org/2000/svg"),h.setAttribute("width",this.width+"px"),h.setAttribute("height",this.height+"px"),h.setAttribute("viewBox","0 0 "+this.width+" "+this.height),h.style.flexShrink="0",document.body.appendChild(h);for(var x="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,U=1;U<=this.width/5+10;U++){var X=U%5==0?this.height/3:this.height/6;x+="h4v"+-X+"h1v"+X}x+="v1H0Z",this.scaleShape=bt.createPath(x);var G=bt.createTransform();this.scaleShape.transform.baseVal.appendItem(G),h.appendChild(this.scaleShape),this.angleLabelElement=bt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=bt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ge=bt.createTSpan("");return ge.innerHTML="°",this.angleLabelElement.appendChild(ge),h.appendChild(this.angleLabelElement),document.body.removeChild(h),h},H}(),rn=function(){function H(){this.naturalSize=!1,this.imageType="image/png"}return H.prototype.rasterize=function(h,x,U,X,G,ge,Ge){var rt=this;return new Promise(function(pt){var Ve=document.createElement("canvas");Ve.width=h.width.baseVal.value-2*X,Ve.height=h.height.baseVal.value-2*X;var Lt=1,It=1;rt.naturalSize===!0?(Lt=x.naturalWidth/(h.width.baseVal.value-2*X)/ge,It=x.naturalHeight/(h.height.baseVal.value-2*X)/Ge,Ve.width=x.naturalWidth/ge,Ve.height=x.naturalHeight/Ge):rt.width!==void 0&&rt.height!==void 0&&(Lt=rt.width/U.width,It=rt.height/U.height,Ve.width*=Lt,Ve.height*=It);var er=Ve.getContext("2d");er.translate(Ve.width/2,Ve.height/2),er.rotate(G*Math.PI/180),er.scale(ge,Ge),er.translate(-Ve.width/2,-Ve.height/2),er.drawImage(x,0,0,Ve.width,Ve.height);var zr=document.createElement("canvas");zr.width=U.width*Lt,zr.height=U.height*It,zr.getContext("2d").putImageData(er.getImageData((U.x-X)*Lt,(U.y-X)*It,U.width*Lt,U.height*It),0,0),pt(zr.toDataURL(rt.imageType,rt.imageQuality))})},H}(),He=function(){function H(h){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=H.instanceCounter++,this.styles=new Ct(this.instanceNo),this.target=h,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(H.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(h){this._zoomToCropEnabled=h,h?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(h){this._isGridVisible=h,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"gridLines",{get:function(){return this._gridLines},set:function(h){this._gridLines=h,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(h){this._rotationAngle=h,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"aspectRatio",{get:function(){var h;return(h=this._aspectRatio)!==null&&h!==void 0?h:this.aspectRatios[0]},set:function(h){this._aspectRatio=h},enumerable:!1,configurable:!0}),H.prototype.open=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.setupResizeObserver(),this.initCropCanvas(),this.setEditingTarget(),this.setTopLeft(),this.initCropLayer(),this.attachEvents(),this.applyAspectRatio(),this.displayMode==="popup"&&this.onPopupResize(),this._isOpen=!0},H.prototype.show=function(){this.showUI(),this.open()},H.prototype.close=function(h){h===void 0&&(h=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),h||this.closeEventListeners.forEach(function(x){return x()}),this._isOpen=!1)},H.prototype.addRenderEventListener=function(h){this.renderEventListeners.push(h)},H.prototype.removeRenderEventListener=function(h){this.renderEventListeners.indexOf(h)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(h),1)},H.prototype.addCloseEventListener=function(h){this.closeEventListeners.push(h)},H.prototype.removeCloseEventListener=function(h){this.closeEventListeners.indexOf(h)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(h),1)},H.prototype.setupResizeObserver=function(){var h=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){h.resize(h.target.clientWidth,h.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},H.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var h=1*this.target.clientWidth/this.target.clientHeight,x=this.contentDiv.clientWidth/h>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*h:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,U=x+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/h;this.resize(x,U)}},H.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},H.prototype.setEditingTargetSize=function(){this.editorCanvas.style.width=this.imageWidth+2*this.CANVAS_MARGIN+"px",this.editorCanvas.style.height=this.imageHeight+2*this.CANVAS_MARGIN+"px",bt.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},H.prototype.resize=function(h,x){this.imageWidth=Math.round(h),this.imageHeight=Math.round(x),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},H.prototype.setEditingTarget=function(){var h=document.createElement("canvas");h.width=this.target.naturalWidth,h.height=this.target.naturalHeight,h.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var x=h.toDataURL();bt.setAttributes(this.editingTarget,[["href",x]]),this.setEditingTargetSize()},H.prototype.setTopLeft=function(){var h=this.target.getBoundingClientRect(),x=this.editorCanvas.getBoundingClientRect();this.left=h.left-x.left-this.CANVAS_MARGIN,this.top=h.top-x.top-this.CANVAS_MARGIN},H.prototype.initCropCanvas=function(){this.cropImageHolder=document.createElement("div"),this.cropImageHolder.style.setProperty("touch-action","none"),this.cropImageHolder.style.setProperty("-ms-touch-action","none"),this.cropImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.cropImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImage.style.pointerEvents="auto",this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.cropImageHolder.style.transformOrigin="top left",this.positionCropImage(),this.defs=bt.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=bt.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=bt.createGroup(),this.editingTargetRotationScaleContainer=bt.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var h=bt.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(h);var x=bt.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(x),this.editingTargetContainer=bt.createGroup(),this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px)",this.editingTargetContainer.appendChild(this.editingTargetRotationContainer),this.cropImage.appendChild(this.editingTargetContainer),this.cropImageHolder.appendChild(this.cropImage),this.editorCanvas.appendChild(this.cropImageHolder)},H.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},H.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=bt.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Ar(this.imageWidth,this.imageHeight,this.CANVAS_MARGIN,this.cropLayerContainer),this.cropLayer.onCropChange=this.cropRectChanged,this.cropLayer.numberOfGridLines=this.gridLines,this.cropLayer.isGridVisible=this.isGridVisible,this.cropLayer.cropShadeColor=this.styles.settings.cropShadeColor,this.cropLayer.cropFrameColor=this.styles.settings.cropFrameColor,this.cropLayer.gripColor=this.styles.settings.gripColor,this.cropLayer.gripFillColor=this.styles.settings.gripFillColor,this.cropLayer.open(),this.cropLayer.setCropRectangle(this.cropRect),this.zoomToCropEnabled&&this.zoomToCrop()},H.prototype.zoomToCrop=function(){if(this.cropRect){var h=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,x=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=h+"px "+x+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-h+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-x+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},H.prototype.unzoomFromCrop=function(){this.zoomFactor=1,this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin="center",this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px) scale(1)",this.cropLayer.zoomFactor=this.zoomFactor)},H.prototype.cropRectChanged=function(h){this.cropRect=h,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},H.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},H.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},H.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},H.prototype.showUI=function(){switch(this.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var h=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,x=this.target.offsetTop>h+this.CANVAS_MARGIN?this.target.offsetTop-(h+this.CANVAS_MARGIN):0;this.coverDiv.style.top=x+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.displayMode==="popup"?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,this.displayMode==="popup"&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},H.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},H.prototype.addTopToolbar=function(){var h=this;this.topToolbar=new Zt,this.topToolbar.display=this.styles.settings.hideTopToolbar?"none":"",this.topToolbar.className=this.toolbarStyleClass.name,this.topToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.topToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.topToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.topToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.topToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.topToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var x=new rr;x.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(x);var U=[];this.aspectRatios.forEach(function(It){var er=new Rt(tn.getIcon(It.horizontal,It.vertical),It.horizontal===0&&It.vertical===0?"FREE":It.horizontal+":"+It.vertical);er.onClick=function(){return h.ratioButtonClicked(It)},U.push(er)}),this.aspectRatioButton=new Tr(tn.getIcon(0,0),"Aspect ratio",U),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,x.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var X=new Rt('<svg viewBox="0 0 24 24"><path d="M10 4v4h4V4h-4m6 0v4h4V4h-4m0 6v4h4v-4h-4m0 6v4h4v-4h-4m-2 4v-4h-4v4h4m-6 0v-4H4v4h4m0-6v-4H4v4h4m0-6V4H4v4h4m2 6h4v-4h-4v4M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4c-1.08 0-2-.9-2-2V4a2 2 0 012-2z"/></svg>',"Toggle grid");X.isActive=this.isGridVisible,X.onClick=function(){h.isGridVisible=!h.isGridVisible,X.isActive=h.isGridVisible},x.addButton(X);var G=new Rt('<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"Zoom to selection");if(G.isActive=this.zoomToCropEnabled,G.onClick=function(){h.zoomToCropEnabled=!h.zoomToCropEnabled,G.isActive=h.zoomToCropEnabled},x.addButton(G),!Zr.isLicensed){var ge=new gt;this.topToolbar.addElementBlock(ge);var Ge=document.createElement("div");Ge.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var rt=document.createElement("a");rt.style.color="currentColor",rt.href="https://markerjs.com/products/cropro",rt.target="_blank",rt.innerHTML='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M16.326 14.895c0 1.126-.558 1.688-1.673 1.688H9.931c-1.116 0-1.674-.562-1.674-1.688V3.733c0-1.126.558-1.688 1.674-1.688h4.722c1.115 0 1.673.562 1.673 1.688v2.899h-1.957V3.793h-4.124v11.042h4.124v-3.242h1.957v3.302z" fill="currentColor"/><path d="M15.94 7.364a.783.783 0 00-1.065-.304l-11.01 6.126a.783.783 0 00-.303 1.065l4.498 8.085a.783.783 0 001.065.304l11.01-6.126a.783.783 0 00.303-1.065L15.94 7.364zM5.311 14.173l3.737 6.718 9.641-5.364-3.737-6.718-9.641 5.364z" fill="#eef762"/></svg>',Ge.appendChild(rt),ge.addElement(Ge)}var pt=new rr;pt.minWidth=3*this.toolbarHeight+"px",pt.contentAlign="end",this.topToolbar.addButtonBlock(pt);var Ve=new Rt('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");Ve.onClick=this.startRenderAndClose,pt.addButton(Ve),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ve.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Lt=new Rt('<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"Close");Lt.onClick=this.close,pt.addButton(Lt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Lt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},H.prototype.addBottomToolbar=function(){var h=this;this.bottomToolbar=new Zt,this.bottomToolbar.display=this.styles.settings.hideBottomToolbar?"none":"",this.bottomToolbar.className=this.toolbarStyleClass.name,this.bottomToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.bottomToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.bottomToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.bottomToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.bottomToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.bottomToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var x=new rr;x.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(x);var U=new Rt('<svg viewBox="0 0 24 24"><path d="M13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93M7.1 18.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.02-4.47L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47z"/></svg>',"Rotate left");U.onClick=this.rotateLeftButtonClicked,x.addButton(U);var X=new Rt('<svg viewBox="0 0 24 24"><path d="M16.89 15.5l1.42 1.39c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.5M13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03m6.93-6.9a7.906 7.906 0 00-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47m-2.36-5.45L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45z"/></svg>',"Rotate right");X.onClick=this.rotateRightButtonClicked,x.addButton(X);var G=new gt;G.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(G),this.straightener=new Kr("Straighten"),this.straightener.className=this.toolbarStraightenerStyleClass.name,this.straightener.colorsClassName=this.styles.settings.toolbarStraightenerColorsClassName?this.styles.settings.toolbarStraightenerColorsClassName:this.toolbarStraightenerStyleColorsClass.name,this.straightener.onAngleChange=function(pt){h.rotateBy(pt),h.straightener.angle=h.rotationAngle},G.addElement(this.straightener.getUI());var ge=new rr;ge.minWidth=2*this.toolbarHeight+"px",ge.contentAlign="end",this.bottomToolbar.addButtonBlock(ge);var Ge=new Rt('<svg viewBox="0 0 24 24"><path d="M15 21h2v-2h-2m4-10h2V7h-2M3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2m16-2v2h2c0-1.1-.9-2-2-2m-8 20h2V1h-2m8 16h2v-2h-2M15 5h2V3h-2m4 10h2v-2h-2m0 10c1.1 0 2-.9 2-2h-2z"/></svg>',"Flip horizontal");Ge.onClick=this.flipHorizontallyButtonClicked,ge.addButton(Ge);var rt=new Rt('<svg viewBox="0 0 24 24"><path d="M3 15v2h2v-2m10 4v2h2v-2m2-16H5c-1.1 0-2 .9-2 2v4h2V5h14v4h2V5c0-1.1-.9-2-2-2m2 16h-2v2c1.1 0 2-.9 2-2M1 11v2h22v-2M7 19v2h2v-2m10-4v2h2v-2m-10 4v2h2v-2M3 19c0 1.1.9 2 2 2v-2z"/></svg>',"Flip vertical");rt.onClick=this.flipVerticallyButtonClicked,ge.addButton(rt)},H.prototype.ratioButtonClicked=function(h){this.aspectRatio=h,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},H.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=tn.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},H.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new kr(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},H.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},H.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},H.prototype.restoreState=function(h){if(h){var x=this.cropLayer.getRescaledRect(h.width,h.height,this.imageWidth,this.imageHeight,h.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(x),this.cropRectChanged(x),this.flippedHorizontally=h.flippedHorizontally,this.flippedVertically=h.flippedVertically,this.applyFlip(),this.rotationAngle=h.rotationAngle,this.applyRotation()}},H.prototype.clientToLocalCoordinates=function(h,x){var U=this.cropImage.getBoundingClientRect();return{x:h-U.left,y:x-U.top}},H.prototype.onWindowResize=function(){this.positionUI()},H.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var h=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=h+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},H.prototype.rotateLeftButtonClicked=function(){var h=this.rotationAngle-90;this.rotationAngle%90!=0&&(h+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(h)},H.prototype.rotateRightButtonClicked=function(){var h=this.rotationAngle+90;this.rotationAngle%90!=0&&(h-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(h)},H.prototype.rotateTo=function(h){h=(h=h>180?h-360:h)<=-180?h+360:h,this.rotationAngle=h,this.applyRotation()},H.prototype.rotateBy=function(h){this.rotateTo((this.rotationAngle+h)%360)},H.prototype.applyRotation=function(){var h=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var x=this.editingTargetRotationContainer.transform.baseVal.getItem(0);x.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(x,0);var U=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/U.width,this.imageHeight/U.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=h},H.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},H.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},H.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},H.prototype.startRenderAndClose=function(){return kt(this,void 0,void 0,function(){var h,x;return Ur(this,function(U){switch(U.label){case 0:return[4,this.render()];case 1:return h=U.sent(),x=this.getState(),this.renderEventListeners.forEach(function(X){return X(h,x)}),this.close(!0),[2]}})})},H.prototype.render=function(){return kt(this,void 0,void 0,function(){var h;return Ur(this,function(x){switch(x.label){case 0:return(h=new rn).naturalSize=this.renderAtNaturalSize,h.imageType=this.renderImageType,h.imageQuality=this.renderImageQuality,h.width=this.renderWidth,h.height=this.renderHeight,this.unzoomFromCrop(),bt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,h.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return x.sent(),[4,h.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,x.sent()]}})})},H.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new xt("toolbar",`
|
|
width: `+(this.displayMode==="inline"?"100%":"calc(100vw - "+2*this.popupMargin+"px)")+`;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-between;
|
|
height: `+this.toolbarHeight+`px;
|
|
box-sizing: content-box;
|
|
overflow: hidden;
|
|
line-height: 0px;
|
|
`)),this.toolbarStyleColorsClass=this.styles.addClass(new xt("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new xt("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var h=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new xt("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*h)+`px;
|
|
height: `+(this.toolbarHeight-2*h)+`px;
|
|
padding: `+h+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new xt("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new xt("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new st("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new st("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new xt("toolbar_dropdown",`
|
|
position: absolute;
|
|
max-width: `+4*this.toolbarHeight+`px;
|
|
z-index: 20;
|
|
white-space: normal;
|
|
box-sizing: content-box;
|
|
box-shadow: 3px 3px rgba(33, 33, 33, 0.1);
|
|
margin: `+(this.displayMode==="inline"?"0":this.popupMargin)+`px;
|
|
line-height: 0px;
|
|
`)),this.toolbarDropdownStyleColorsClass=this.styles.addClass(new xt("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new xt("toolbar_straightener_block",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
-webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 30%, rgba(0,0,0,1) 70%, rgba(0,0,0,0) 100%);
|
|
`)),this.toolbarStraightenerStyleClass=this.styles.addClass(new xt("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*h)+`px;
|
|
padding: `+h+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new xt("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},H.instanceCounter=0,H}(),lt=Q("8hTe"),Mt=Q.n(lt),zt=/<pre[^>]*>/g;function Yt(H){var h=document.createElement("div");return h.innerHTML=H,h.childNodes.length===0?"":h.childNodes[0].nodeValue}var qt=Te.a=function(H){var h=H.value,x=h===void 0?"":h,U=H.edit,X=U===void 0?!1:U,G=H.className,ge=H.showTextOnly,Ge=H.showLines,rt=H.replaces,pt=H.zoomImg,Ve=H.hasMask,Lt=H.style,It=Lt===void 0?{}:Lt,er=H.stylesPrev,zr=er===void 0?{}:er,Vr=String(x),pr=Object(R.useRef)(),Qr=Object(R.useRef)(),Gn=Object(R.useState)(""),Or=Object(W.a)(Gn,2),Xr=Or[0],jr=Or[1],bn=Object(R.useState)("office"),nn=Object(W.a)(bn,2),mn=nn[0],dn=nn[1],hi=function(){var jt=new He(Qr.current);jt.displayMode="popup",jt.addRenderEventListener(function(){var Er=Object(M.a)(P.a.mark(function Ut(dr){var Vt;return P.a.wrap(function(lr){for(;;)switch(lr.prev=lr.next){case 0:return pr.current.style.display="none",lr.next=3,Object(Ue.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:dr}});case 3:Vt=lr.sent,Vt!=null&&Vt.id&&rt(Qr.current.getAttribute("src").replace(se.a.API_SERVER,""),"/api/attachments/".concat(Vt==null?void 0:Vt.id,"?type=").concat(Vt.content_type));case 5:case"end":return lr.stop()}},Ut)}));return function(Ut){return Er.apply(this,arguments)}}()),jt.show()},Kn=function(){var jt=new Ft(Qr.current);jt.settings.displayMode="popup",jt.addEventListener("render",function(){var Er=Object(M.a)(P.a.mark(function Ut(dr){var Vt;return P.a.wrap(function(lr){for(;;)switch(lr.prev=lr.next){case 0:if(pr.current.style.display="none",!Qr.current){lr.next=6;break}return lr.next=4,Object(Ue.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:dr.dataUrl}});case 4:Vt=lr.sent,Vt!=null&&Vt.id&&rt(Qr.current.getAttribute("src").replace(se.a.API_SERVER,""),"/api/attachments/".concat(Vt==null?void 0:Vt.id,"?type=").concat(Vt.content_type));case 6:case"end":return lr.stop()}},Ut)}));return function(Ut){return Er.apply(this,arguments)}}()),jt.show(),window.markerArea=jt},an=Object(R.useMemo)(function(){try{var or=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,jt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Er=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Vr=Vr.replace(or,"("+se.a.API_SERVER+"/api/attachments/").replace(jt,'"'+se.a.API_SERVER+"/api/attachments/").replace(Er,'"'+se.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
`),Vr=Vr.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
|
|
`)}catch(hn){}var Ut=Z(Vr),dr=A();if(Vr.match(/\[TOC\]/)&&(Ut=Ut.replace("<p>[TOC]</p>",k()),C()),Ut=Ut.replace(/(__special_katext_id_\d+__)/g,function(hn,lr){var Pr=dr[lr],zn=Pr.type,Vn=Pr.expression;return Object(he.renderToString)(Yt(Vn)||"",{displayMode:zn==="block",throwOnError:!1,output:"html"})}),Ut=Ut.replace(/▁/g,"\u2581\u2581\u2581"),S(),ge){var Vt=document.createElement("div");return Vt.innerHTML=Ut,Vt.innerText}return setTimeout(function(){return On()},500),Ut},[Vr]),Yr=Object(R.useRef)();m.WebkitLineClamp=Ge,Ge&&(It=Object(I.a)(Object(I.a)({},It),m));function kn(or){var jt=or.target;if(jt.tagName.toUpperCase()==="IMG"){if(pt){var Er=jt.getAttribute("src");jr(Er),dn("image")}}else if(jt.tagName.toUpperCase()==="A"){var Ut=jt.getAttribute("href");if(Ut.indexOf("office")>-1)or.preventDefault(),jr(Ut),dn("office");else if(Ut.indexOf("application/pdf")>-1)or.preventDefault(),jr(Ut),dn("pdf");else if(Ut.indexOf("type=text")>-1)or.preventDefault(),jr(Ut),dn("html");else if(Ut.startsWith("#")){or.preventDefault();var dr=document.getElementById(Ut.replace("#",""));dr&&dr.scrollIntoView(!0)}}}var On=function(){var jt,Er=(jt=Yr.current)===null||jt===void 0?void 0:jt.querySelectorAll("video");Er==null||Er.forEach(function(Ut){if(Ut.oncontextmenu=function(){return!1},Ut.src.indexOf(".m3u8")>-1&&!Ut.canPlayType("application/vnd.apple.mpegurl")){if(ee.a.isSupported()){var dr=new ee.a;dr.loadSource(Ut.src),dr.attachMedia(Ut)}}})};Object(R.useEffect)(function(){if(Yr.current&&an&&(an.match(zt)&&window.PR.prettyPrint()),Yr.current)return Yr.current.addEventListener("click",kn),function(){Yr.current.removeEventListener("click",kn),S(),C()}},[an,Yr.current,kn]);var ci=function(jt){if(!X)return;jt.target.nodeName==="IMG"?(pr.current.style.display="flex",pr.current.style.width=jt.target.clientWidth+"px",pr.current.style.height=jt.target.clientHeight+"px",pr.current.style.top=jt.target.offsetTop+"px",pr.current.style.left=jt.target.offsetLeft+"px",Qr.current.src=jt.target.getAttribute("src")):pr.current.style.display="none"};return d.a.createElement("div",{style:{position:"relative"}},d.a.createElement("div",{ref:Yr,style:Object(I.a)({},It),className:"".concat(G||""," markdown-body ").concat(Mt.a.mdBody),onMouseOver:ci,dangerouslySetInnerHTML:{__html:an}}),d.a.createElement("div",{ref:pr,className:Mt.a.button},d.a.createElement($.a,null,d.a.createElement(V.a,{onClick:function(){return hi()}},"\u88C1\u526A"),d.a.createElement(V.a,{onClick:function(){return Kn()}},"\u7F16\u8F91"))),d.a.createElement("img",{ref:Qr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),d.a.createElement(Ce.a,{close:!0,data:Xr,hasMask:Ve,type:Xr!=null&&Xr.length?mn:"",style:Object(I.a)({},zr),onClose:function(){return jr("")}}))}},"9VGf":function(vt,Te,Q){"use strict";Q.d(Te,"a",function(){return O});var ie=Q("q1tI"),$=Q.n(ie);function O(V,I){var M=Object(ie.useRef)();Object(ie.useEffect)(function(){M.current=V}),Object(ie.useEffect)(function(){function W(){M.current()}if(I!==null){var N=setInterval(W,I);return function(){return clearInterval(N)}}},[I])}},BU3w:function(vt,Te,Q){"use strict";Q.d(Te,"a",function(){return M});var ie=Q("MNnm"),$="rc-util-key";function O(W){if(W.attachTo)return W.attachTo;var N=document.querySelector("head");return N||document.body}function V(W){var N,P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ie.a)())return null;var R=document.createElement("style");if((N=P.csp)===null||N===void 0?void 0:N.nonce){var d;R.nonce=(d=P.csp)===null||d===void 0?void 0:d.nonce}R.innerHTML=W;var f=O(P),w=f.firstChild;return P.prepend&&f.prepend?f.prepend(R):P.prepend&&w?f.insertBefore(R,w):f.appendChild(R),R}var I=new Map;function M(W,N){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},R=O(P);if(!I.has(R)){var d=V("",P),f=d.parentNode;I.set(R,f),f.removeChild(d)}var w=Array.from(I.get(R).children).find(function(i){return i.tagName==="STYLE"&&i[$]===N});if(w){var p,g;if(((p=P.csp)===null||p===void 0?void 0:p.nonce)&&w.nonce!==((g=P.csp)===null||g===void 0?void 0:g.nonce)){var b;w.nonce=(b=P.csp)===null||b===void 0?void 0:b.nonce}return w.innerHTML!==W&&(w.innerHTML=W),w}var o=V(W,P);return o[$]=N,o}},Bd2K:function(vt,Te,Q){(function(ie){ie(Q("VrN/"),Q("osHv"))})(function(ie){ie.defineOption("autoCloseTags",!1,function(P,R,d){if(d!=ie.Init&&d&&P.removeKeyMap("autoCloseTags"),!R)return;var f={name:"autoCloseTags"};(typeof R!="object"||R.whenClosing!==!1)&&(f["'/'"]=function(w){return M(w)}),(typeof R!="object"||R.whenOpening!==!1)&&(f["'>'"]=function(w){return V(w)}),P.addKeyMap(f)});var $=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],O=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function V(P){if(P.getOption("disableInput"))return ie.Pass;for(var R=P.listSelections(),d=[],f=P.getOption("autoCloseTags"),w=0;w<R.length;w++){if(!R[w].empty())return ie.Pass;var p=R[w].head,g=P.getTokenAt(p),b=ie.innerMode(P.getMode(),g.state),o=b.state,i=b.mode.xmlCurrentTag&&b.mode.xmlCurrentTag(o),s=i&&i.name;if(!s)return ie.Pass;var l=b.mode.configuration=="html",C=typeof f=="object"&&f.dontCloseTags||l&&$,m=typeof f=="object"&&f.indentTags||l&&O;g.end>p.ch&&(s=s.slice(0,s.length-g.end+p.ch));var v=s.toLowerCase();if(!s||g.type=="string"&&(g.end!=p.ch||!/[\"\']/.test(g.string.charAt(g.string.length-1))||g.string.length==1)||g.type=="tag"&&i.close||g.string.indexOf("/")==p.ch-g.start-1||C&&W(C,v)>-1||N(P,b.mode.xmlCurrentContext&&b.mode.xmlCurrentContext(o)||[],s,p,!0))return ie.Pass;var k=typeof f=="object"&&f.emptyTags;if(k&&W(k,s)>-1){d[w]={text:"/>",newPos:ie.Pos(p.line,p.ch+2)};continue}var L=m&&W(m,v)>-1;d[w]={indent:L,text:">"+(L?`
|
|
|
|
`:"")+"</"+s+">",newPos:L?ie.Pos(p.line+1,0):ie.Pos(p.line,p.ch+1)}}for(var E=typeof f=="object"&&f.dontIndentOnAutoClose,w=R.length-1;w>=0;w--){var y=d[w];P.replaceRange(y.text,R[w].head,R[w].anchor,"+insert");var c=P.listSelections().slice(0);c[w]={head:y.newPos,anchor:y.newPos},P.setSelections(c),!E&&y.indent&&(P.indentLine(y.newPos.line,null,!0),P.indentLine(y.newPos.line+1,null,!0))}}function I(P,R){for(var d=P.listSelections(),f=[],w=R?"/":"</",p=P.getOption("autoCloseTags"),g=typeof p=="object"&&p.dontIndentOnSlash,b=0;b<d.length;b++){if(!d[b].empty())return ie.Pass;var o=d[b].head,i=P.getTokenAt(o),s=ie.innerMode(P.getMode(),i.state),l=s.state;if(R&&(i.type=="string"||i.string.charAt(0)!="<"||i.start!=o.ch-1))return ie.Pass;var C,m=s.mode.name!="xml"&&P.getMode().name=="htmlmixed";if(m&&s.mode.name=="javascript")C=w+"script";else if(m&&s.mode.name=="css")C=w+"style";else{var v=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(l);if(!v||v.length&&N(P,v,v[v.length-1],o))return ie.Pass;C=w+v[v.length-1]}P.getLine(o.line).charAt(i.end)!=">"&&(C+=">"),f[b]=C}if(P.replaceSelections(f),d=P.listSelections(),!g)for(var b=0;b<d.length;b++)(b==d.length-1||d[b].head.line<d[b+1].head.line)&&P.indentLine(d[b].head.line)}function M(P){return P.getOption("disableInput")?ie.Pass:I(P,!0)}ie.commands.closeTag=function(P){return I(P)};function W(P,R){if(P.indexOf)return P.indexOf(R);for(var d=0,f=P.length;d<f;++d)if(P[d]==R)return d;return-1}function N(P,R,d,f,w){if(!ie.scanForClosingTag)return!1;var p=Math.min(P.lastLine()+1,f.line+500),g=ie.scanForClosingTag(P,f,null,p);if(!g||g.tag!=d)return!1;for(var b=w?1:0,o=R.length-1;o>=0&&R[o]==d;o--)++b;f=g.to;for(var o=1;o<b;o++){var i=ie.scanForClosingTag(P,f,null,p);if(!i||i.tag!=d)return!1;f=i.to}return!0}})},BjJ7:function(vt,Te,Q){"use strict";Q.d(Te,"d",function(){return $}),Q.d(Te,"c",function(){return O}),Q.d(Te,"e",function(){return V}),Q.d(Te,"b",function(){return I}),Q.d(Te,"a",function(){return W});var ie=Q("m3rI");function $(N){var P=!0;if(N.length>0){for(var R=0;R<N.length;R++)if(N[R].compile_success==0||!N[R].compile_success){P=!1;break}}else P=!1;return P}function O(N){for(var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",R=[],d=0;d<N.length;d++){var f=N[d],w=P?"".concat(P,"/").concat(f.name):"".concat(f.name);R.push({title:f.name,isLeaf:!(f.type==="tree"),key:w})}return R}function V(N,P,R){for(var d=0;d<N.length;d++){var f=N[d];if(f.key===P){f.children=R;break}f.children&&V(f.children,P,R)}return N}function I(N,P,R){var d;return function(){var f=this,w=arguments,p=function(){d=null,R||N.apply(f,w)},g=R&&!d;clearTimeout(d),d=setTimeout(p,P),g&&N.apply(f,w)}}var M=!0,W=ie.a.API_SERVER},"C+DQ":function(vt,Te,Q){},"C/vA":function(vt,Te,Q){"use strict";Q.d(Te,"a",function(){return ie});function ie($){var O=this,V=!1,I;return function(){return V||(V=!0,I=$.apply(O,arguments)),I}}},"Cg/j":function(vt,Te,Q){"use strict";Q.d(Te,"b",function(){return ie}),Q.d(Te,"a",function(){return $}),Q.d(Te,"c",function(){return V}),Q.d(Te,"d",function(){return I});var ie;(function(M){M.serviceIds=new Map,M.DI_TARGET="$di$target",M.DI_DEPENDENCIES="$di$dependencies";function W(N){return N[M.DI_DEPENDENCIES]||[]}M.getServiceDependencies=W})(ie||(ie={}));var $=V("instantiationService");function O(M,W,N,P){W[ie.DI_TARGET]===W?W[ie.DI_DEPENDENCIES].push({id:M,index:N,optional:P}):(W[ie.DI_DEPENDENCIES]=[{id:M,index:N,optional:P}],W[ie.DI_TARGET]=W)}function V(M){if(ie.serviceIds.has(M))return ie.serviceIds.get(M);var W=function(N,P,R){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");O(W,N,R,!1)};return W.toString=function(){return M},ie.serviceIds.set(M,W),W}function I(M){return function(W,N,P){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");O(M,W,P,!0)}}},DlQD:function(vt,Te,Q){(function(ie,$){vt.exports=$()})(this,function(){"use strict";function ie(Ee,me){for(var ye=0;ye<me.length;ye++){var te=me[ye];te.enumerable=te.enumerable||!1,te.configurable=!0,"value"in te&&(te.writable=!0),Object.defineProperty(Ee,te.key,te)}}function $(Ee,me,ye){return me&&ie(Ee.prototype,me),ye&&ie(Ee,ye),Ee}function O(Ee,me){if(!Ee)return;if(typeof Ee=="string")return V(Ee,me);var ye=Object.prototype.toString.call(Ee).slice(8,-1);if(ye==="Object"&&Ee.constructor&&(ye=Ee.constructor.name),ye==="Map"||ye==="Set")return Array.from(Ee);if(ye==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ye))return V(Ee,me)}function V(Ee,me){(me==null||me>Ee.length)&&(me=Ee.length);for(var ye=0,te=new Array(me);ye<me;ye++)te[ye]=Ee[ye];return te}function I(Ee,me){var ye;if(typeof Symbol=="undefined"||Ee[Symbol.iterator]==null){if(Array.isArray(Ee)||(ye=O(Ee))||me&&Ee&&typeof Ee.length=="number"){ye&&(Ee=ye);var te=0;return function(){return te>=Ee.length?{done:!0}:{done:!1,value:Ee[te++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return ye=Ee[Symbol.iterator](),ye.next.bind(ye)}function M(Ee,me){return me={exports:{}},Ee(me,me.exports),me.exports}var W=M(function(Ee){function me(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function ye(te){Ee.exports.defaults=te}Ee.exports={defaults:me(),getDefaults:me,changeDefaults:ye}}),N=W.defaults,P=W.getDefaults,R=W.changeDefaults,d=/[&<>"']/,f=/[&<>"']/g,w=/[<>"']|&(?!#?\w+;)/,p=/[<>"']|&(?!#?\w+;)/g,g={"&":"&","<":"<",">":">",'"':""","'":"'"},b=function(me){return g[me]};function o(Ee,me){if(me){if(d.test(Ee))return Ee.replace(f,b)}else if(w.test(Ee))return Ee.replace(p,b);return Ee}var i=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(Ee){return Ee.replace(i,function(me,ye){return ye=ye.toLowerCase(),ye==="colon"?":":ye.charAt(0)==="#"?ye.charAt(1)==="x"?String.fromCharCode(parseInt(ye.substring(2),16)):String.fromCharCode(+ye.substring(1)):""})}var l=/(^|[^\[])\^/g;function C(Ee,me){Ee=Ee.source||Ee,me=me||"";var ye={replace:function(re,ue){return ue=ue.source||ue,ue=ue.replace(l,"$1"),Ee=Ee.replace(re,ue),ye},getRegex:function(){return new RegExp(Ee,me)}};return ye}var m=/[^\w:]/g,v=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function k(Ee,me,ye){if(Ee){var te;try{te=decodeURIComponent(s(ye)).replace(m,"").toLowerCase()}catch(re){return null}if(te.indexOf("javascript:")===0||te.indexOf("vbscript:")===0||te.indexOf("data:")===0)return null}me&&!v.test(ye)&&(ye=u(me,ye));try{ye=encodeURI(ye).replace(/%25/g,"%")}catch(re){return null}return ye}var L={},E=/^[^:]+:\/*[^/]*$/,y=/^([^:]+:)[\s\S]*$/,c=/^([^:]+:\/*[^/]*)[\s\S]*$/;function u(Ee,me){L[" "+Ee]||(E.test(Ee)?L[" "+Ee]=Ee+"/":L[" "+Ee]=_(Ee,"/",!0)),Ee=L[" "+Ee];var ye=Ee.indexOf(":")===-1;return me.substring(0,2)==="//"?ye?me:Ee.replace(y,"$1")+me:me.charAt(0)==="/"?ye?me:Ee.replace(c,"$1")+me:Ee+me}var A={exec:function(){}};function S(Ee){for(var me=1,ye,te;me<arguments.length;me++){ye=arguments[me];for(te in ye)Object.prototype.hasOwnProperty.call(ye,te)&&(Ee[te]=ye[te])}return Ee}function T(Ee,me){var ye=Ee.replace(/\|/g,function(ue,fe,Pe){for(var Se=!1,ze=fe;--ze>=0&&Pe[ze]==="\\";)Se=!Se;return Se?"|":" |"}),te=ye.split(/ \|/),re=0;if(te.length>me)te.splice(me);else for(;te.length<me;)te.push("");for(;re<te.length;re++)te[re]=te[re].trim().replace(/\\\|/g,"|");return te}function _(Ee,me,ye){var te=Ee.length;if(te===0)return"";for(var re=0;re<te;){var ue=Ee.charAt(te-re-1);if(ue===me&&!ye)re++;else if(ue!==me&&ye)re++;else break}return Ee.substr(0,te-re)}function j(Ee,me){if(Ee.indexOf(me[1])===-1)return-1;for(var ye=Ee.length,te=0,re=0;re<ye;re++)if(Ee[re]==="\\")re++;else if(Ee[re]===me[0])te++;else if(Ee[re]===me[1]&&(te--,te<0))return re;return-1}function z(Ee){Ee&&Ee.sanitize&&!Ee.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var Z={escape:o,unescape:s,edit:C,cleanUrl:k,resolveUrl:u,noopTest:A,merge:S,splitCells:T,rtrim:_,findClosingBracket:j,checkSanitizeDeprecation:z},K=W.defaults,F=Z.rtrim,ee=Z.splitCells,se=Z.escape,he=Z.findClosingBracket;function Ce(Ee,me,ye){var te=me.href,re=me.title?se(me.title):null,ue=Ee[1].replace(/\\([\[\]])/g,"$1");return Ee[0].charAt(0)!=="!"?{type:"link",raw:ye,href:te,title:re,text:ue}:{type:"image",raw:ye,href:te,title:re,text:se(ue)}}function Ue(Ee,me){var ye=Ee.match(/^(\s+)(?:```)/);if(ye===null)return me;var te=ye[1];return me.split(`
|
|
`).map(function(re){var ue=re.match(/^\s+/);if(ue===null)return re;var fe=ue[0];return fe.length>=te.length?re.slice(te.length):re}).join(`
|
|
`)}var ke=function(){function Ee(ye){this.options=ye||K}var me=Ee.prototype;return me.space=function(te){var re=this.rules.block.newline.exec(te);if(re)return re[0].length>1?{type:"space",raw:re[0]}:{raw:`
|
|
`}},me.code=function(te,re){var ue=this.rules.block.code.exec(te);if(ue){var fe=re[re.length-1];if(fe&&fe.type==="paragraph")return{raw:ue[0],text:ue[0].trimRight()};var Pe=ue[0].replace(/^ {4}/gm,"");return{type:"code",raw:ue[0],codeBlockStyle:"indented",text:this.options.pedantic?Pe:F(Pe,`
|
|
`)}}},me.fences=function(te){var re=this.rules.block.fences.exec(te);if(re){var ue=re[0],fe=Ue(ue,re[3]||"");return{type:"code",raw:ue,lang:re[2]?re[2].trim():re[2],text:fe}}},me.heading=function(te){var re=this.rules.block.heading.exec(te);if(re)return{type:"heading",raw:re[0],depth:re[1].length,text:re[2]}},me.nptable=function(te){var re=this.rules.block.nptable.exec(te);if(re){var ue={type:"table",header:ee(re[1].replace(/^ *| *\| *$/g,"")),align:re[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:re[3]?re[3].replace(/\n$/,"").split(`
|
|
`):[],raw:re[0]};if(ue.header.length===ue.align.length){var fe=ue.align.length,Pe;for(Pe=0;Pe<fe;Pe++)/^ *-+: *$/.test(ue.align[Pe])?ue.align[Pe]="right":/^ *:-+: *$/.test(ue.align[Pe])?ue.align[Pe]="center":/^ *:-+ *$/.test(ue.align[Pe])?ue.align[Pe]="left":ue.align[Pe]=null;for(fe=ue.cells.length,Pe=0;Pe<fe;Pe++)ue.cells[Pe]=ee(ue.cells[Pe],ue.header.length);return ue}}},me.hr=function(te){var re=this.rules.block.hr.exec(te);if(re)return{type:"hr",raw:re[0]}},me.blockquote=function(te){var re=this.rules.block.blockquote.exec(te);if(re){var ue=re[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:re[0],text:ue}}},me.list=function(te){var re=this.rules.block.list.exec(te);if(re){for(var ue=re[0],fe=re[2],Pe=fe.length>1,Se=fe[fe.length-1]===")",ze={type:"list",raw:ue,ordered:Pe,start:Pe?+fe.slice(0,-1):"",loose:!1,items:[]},ot=re[0].match(this.rules.block.item),ct=!1,ht,At,wt,ft,Kt,Ft,Jt,Ht=ot.length,kt=0;kt<Ht;kt++)ht=ot[kt],ue=ht,At=ht.length,ht=ht.replace(/^ *([*+-]|\d+[.)]) */,""),~ht.indexOf(`
|
|
`)&&(At-=ht.length,ht=this.options.pedantic?ht.replace(/^ {1,4}/gm,""):ht.replace(new RegExp("^ {1,"+At+"}","gm"),"")),kt!==Ht-1&&(wt=this.rules.block.bullet.exec(ot[kt+1])[0],(Pe?wt.length===1||!Se&&wt[wt.length-1]===")":wt.length>1||this.options.smartLists&&wt!==fe)&&(ft=ot.slice(kt+1).join(`
|
|
`),ze.raw=ze.raw.substring(0,ze.raw.length-ft.length),kt=Ht-1)),Kt=ct||/\n\n(?!\s*$)/.test(ht),kt!==Ht-1&&(ct=ht.charAt(ht.length-1)===`
|
|
`,Kt||(Kt=ct)),Kt&&(ze.loose=!0),Ft=/^\[[ xX]\] /.test(ht),Jt=void 0,Ft&&(Jt=ht[1]!==" ",ht=ht.replace(/^\[[ xX]\] +/,"")),ze.items.push({type:"list_item",raw:ue,task:Ft,checked:Jt,loose:Kt,text:ht});return ze}},me.html=function(te){var re=this.rules.block.html.exec(te);if(re)return{type:this.options.sanitize?"paragraph":"html",raw:re[0],pre:!this.options.sanitizer&&(re[1]==="pre"||re[1]==="script"||re[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(re[0]):se(re[0]):re[0]}},me.def=function(te){var re=this.rules.block.def.exec(te);if(re){re[3]&&(re[3]=re[3].substring(1,re[3].length-1));var ue=re[1].toLowerCase().replace(/\s+/g," ");return{tag:ue,raw:re[0],href:re[2],title:re[3]}}},me.table=function(te){var re=this.rules.block.table.exec(te);if(re){var ue={type:"table",header:ee(re[1].replace(/^ *| *\| *$/g,"")),align:re[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:re[3]?re[3].replace(/\n$/,"").split(`
|
|
`):[]};if(ue.header.length===ue.align.length){ue.raw=re[0];var fe=ue.align.length,Pe;for(Pe=0;Pe<fe;Pe++)/^ *-+: *$/.test(ue.align[Pe])?ue.align[Pe]="right":/^ *:-+: *$/.test(ue.align[Pe])?ue.align[Pe]="center":/^ *:-+ *$/.test(ue.align[Pe])?ue.align[Pe]="left":ue.align[Pe]=null;for(fe=ue.cells.length,Pe=0;Pe<fe;Pe++)ue.cells[Pe]=ee(ue.cells[Pe].replace(/^ *\| *| *\| *$/g,""),ue.header.length);return ue}}},me.lheading=function(te){var re=this.rules.block.lheading.exec(te);if(re)return{type:"heading",raw:re[0],depth:re[2].charAt(0)==="="?1:2,text:re[1]}},me.paragraph=function(te){var re=this.rules.block.paragraph.exec(te);if(re)return{type:"paragraph",raw:re[0],text:re[1].charAt(re[1].length-1)===`
|
|
`?re[1].slice(0,-1):re[1]}},me.text=function(te,re){var ue=this.rules.block.text.exec(te);if(ue){var fe=re[re.length-1];return fe&&fe.type==="text"?{raw:ue[0],text:ue[0]}:{type:"text",raw:ue[0],text:ue[0]}}},me.escape=function(te){var re=this.rules.inline.escape.exec(te);if(re)return{type:"escape",raw:re[0],text:se(re[1])}},me.tag=function(te,re,ue){var fe=this.rules.inline.tag.exec(te);if(fe)return!re&&/^<a /i.test(fe[0])?re=!0:re&&/^<\/a>/i.test(fe[0])&&(re=!1),!ue&&/^<(pre|code|kbd|script)(\s|>)/i.test(fe[0])?ue=!0:ue&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(fe[0])&&(ue=!1),{type:this.options.sanitize?"text":"html",raw:fe[0],inLink:re,inRawBlock:ue,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(fe[0]):se(fe[0]):fe[0]}},me.link=function(te){var re=this.rules.inline.link.exec(te);if(re){var ue=he(re[2],"()");if(ue>-1){var fe=re[0].indexOf("!")===0?5:4,Pe=fe+re[1].length+ue;re[2]=re[2].substring(0,ue),re[0]=re[0].substring(0,Pe).trim(),re[3]=""}var Se=re[2],ze="";if(this.options.pedantic){var ot=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Se);ot?(Se=ot[1],ze=ot[3]):ze=""}else ze=re[3]?re[3].slice(1,-1):"";Se=Se.trim().replace(/^<([\s\S]*)>$/,"$1");var ct=Ce(re,{href:Se&&Se.replace(this.rules.inline._escapes,"$1"),title:ze&&ze.replace(this.rules.inline._escapes,"$1")},re[0]);return ct}},me.reflink=function(te,re){var ue;if((ue=this.rules.inline.reflink.exec(te))||(ue=this.rules.inline.nolink.exec(te))){var fe=(ue[2]||ue[1]).replace(/\s+/g," ");if(fe=re[fe.toLowerCase()],!fe||!fe.href){var Pe=ue[0].charAt(0);return{type:"text",raw:Pe,text:Pe}}var Se=Ce(ue,fe,ue[0]);return Se}},me.strong=function(te,re,ue){ue===void 0&&(ue="");var fe=this.rules.inline.strong.start.exec(te);if(fe&&(!fe[1]||fe[1]&&(ue===""||this.rules.inline.punctuation.exec(ue)))){re=re.slice(-1*te.length);var Pe=fe[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Pe.lastIndex=0;for(var Se;(fe=Pe.exec(re))!=null;)if(Se=this.rules.inline.strong.middle.exec(re.slice(0,fe.index+3)),Se)return{type:"strong",raw:te.slice(0,Se[0].length),text:te.slice(2,Se[0].length-2)}}},me.em=function(te,re,ue){ue===void 0&&(ue="");var fe=this.rules.inline.em.start.exec(te);if(fe&&(!fe[1]||fe[1]&&(ue===""||this.rules.inline.punctuation.exec(ue)))){re=re.slice(-1*te.length);var Pe=fe[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Pe.lastIndex=0;for(var Se;(fe=Pe.exec(re))!=null;)if(Se=this.rules.inline.em.middle.exec(re.slice(0,fe.index+2)),Se)return{type:"em",raw:te.slice(0,Se[0].length),text:te.slice(1,Se[0].length-1)}}},me.codespan=function(te){var re=this.rules.inline.code.exec(te);if(re){var ue=re[2].replace(/\n/g," "),fe=/[^ ]/.test(ue),Pe=ue.startsWith(" ")&&ue.endsWith(" ");return fe&&Pe&&(ue=ue.substring(1,ue.length-1)),ue=se(ue,!0),{type:"codespan",raw:re[0],text:ue}}},me.br=function(te){var re=this.rules.inline.br.exec(te);if(re)return{type:"br",raw:re[0]}},me.del=function(te){var re=this.rules.inline.del.exec(te);if(re)return{type:"del",raw:re[0],text:re[1]}},me.autolink=function(te,re){var ue=this.rules.inline.autolink.exec(te);if(ue){var fe,Pe;return ue[2]==="@"?(fe=se(this.options.mangle?re(ue[1]):ue[1]),Pe="mailto:"+fe):(fe=se(ue[1]),Pe=fe),{type:"link",raw:ue[0],text:fe,href:Pe,tokens:[{type:"text",raw:fe,text:fe}]}}},me.url=function(te,re){var ue;if(ue=this.rules.inline.url.exec(te)){var fe,Pe;if(ue[2]==="@")fe=se(this.options.mangle?re(ue[0]):ue[0]),Pe="mailto:"+fe;else{var Se;do Se=ue[0],ue[0]=this.rules.inline._backpedal.exec(ue[0])[0];while(Se!==ue[0]);fe=se(ue[0]),ue[1]==="www."?Pe="http://"+fe:Pe=fe}return{type:"link",raw:ue[0],text:fe,href:Pe,tokens:[{type:"text",raw:fe,text:fe}]}}},me.inlineText=function(te,re,ue){var fe=this.rules.inline.text.exec(te);if(fe){var Pe;return re?Pe=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(fe[0]):se(fe[0]):fe[0]:Pe=se(this.options.smartypants?ue(fe[0]):fe[0]),{type:"text",raw:fe[0],text:Pe}}},Ee}(),Me=Z.noopTest,ce=Z.edit,ve=Z.merge,le={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:Me,table:Me,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};le._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,le._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,le.def=ce(le.def).replace("label",le._label).replace("title",le._title).getRegex(),le.bullet=/(?:[*+-]|\d{1,9}[.)])/,le.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,le.item=ce(le.item,"gm").replace(/bull/g,le.bullet).getRegex(),le.list=ce(le.list).replace(/bull/g,le.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+le.def.source+")").getRegex(),le._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",le._comment=/<!--(?!-?>)[\s\S]*?-->/,le.html=ce(le.html,"i").replace("comment",le._comment).replace("tag",le._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),le.paragraph=ce(le._paragraph).replace("hr",le.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",le._tag).getRegex(),le.blockquote=ce(le.blockquote).replace("paragraph",le.paragraph).getRegex(),le.normal=ve({},le),le.gfm=ve({},le.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),le.gfm.nptable=ce(le.gfm.nptable).replace("hr",le.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",le._tag).getRegex(),le.gfm.table=ce(le.gfm.table).replace("hr",le.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",le._tag).getRegex(),le.pedantic=ve({},le.normal,{html:ce(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",le._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:Me,paragraph:ce(le.normal._paragraph).replace("hr",le.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",le.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var ne={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Me,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:Me,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};ne._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",ne.punctuation=ce(ne.punctuation).replace(/punctuation/g,ne._punctuation).getRegex(),ne._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",ne._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",ne.em.start=ce(ne.em.start).replace(/punctuation/g,ne._punctuation).getRegex(),ne.em.middle=ce(ne.em.middle).replace(/punctuation/g,ne._punctuation).replace(/overlapSkip/g,ne._overlapSkip).getRegex(),ne.em.endAst=ce(ne.em.endAst,"g").replace(/punctuation/g,ne._punctuation).getRegex(),ne.em.endUnd=ce(ne.em.endUnd,"g").replace(/punctuation/g,ne._punctuation).getRegex(),ne.strong.start=ce(ne.strong.start).replace(/punctuation/g,ne._punctuation).getRegex(),ne.strong.middle=ce(ne.strong.middle).replace(/punctuation/g,ne._punctuation).replace(/blockSkip/g,ne._blockSkip).getRegex(),ne.strong.endAst=ce(ne.strong.endAst,"g").replace(/punctuation/g,ne._punctuation).getRegex(),ne.strong.endUnd=ce(ne.strong.endUnd,"g").replace(/punctuation/g,ne._punctuation).getRegex(),ne.blockSkip=ce(ne._blockSkip,"g").getRegex(),ne.overlapSkip=ce(ne._overlapSkip,"g").getRegex(),ne._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,ne._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,ne._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,ne.autolink=ce(ne.autolink).replace("scheme",ne._scheme).replace("email",ne._email).getRegex(),ne._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,ne.tag=ce(ne.tag).replace("comment",le._comment).replace("attribute",ne._attribute).getRegex(),ne._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ne._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,ne._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,ne.link=ce(ne.link).replace("label",ne._label).replace("href",ne._href).replace("title",ne._title).getRegex(),ne.reflink=ce(ne.reflink).replace("label",ne._label).getRegex(),ne.reflinkSearch=ce(ne.reflinkSearch,"g").replace("reflink",ne.reflink).replace("nolink",ne.nolink).getRegex(),ne.normal=ve({},ne),ne.pedantic=ve({},ne.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:ce(/^!?\[(label)\]\((.*?)\)/).replace("label",ne._label).getRegex(),reflink:ce(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ne._label).getRegex()}),ne.gfm=ve({},ne.normal,{escape:ce(ne.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),ne.gfm.url=ce(ne.gfm.url,"i").replace("email",ne.gfm._extended_email).getRegex(),ne.breaks=ve({},ne.gfm,{br:ce(ne.br).replace("{2,}","*").getRegex(),text:ce(ne.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Le={block:le,inline:ne},xe=W.defaults,Ie=Le.block,Re=Le.inline;function ae(Ee){return Ee.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function oe(Ee){var me="",ye,te,re=Ee.length;for(ye=0;ye<re;ye++)te=Ee.charCodeAt(ye),Math.random()>.5&&(te="x"+te.toString(16)),me+="&#"+te+";";return me}var be=function(){function Ee(ye){this.tokens=[],this.tokens.links=Object.create(null),this.options=ye||xe,this.options.tokenizer=this.options.tokenizer||new ke,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var te={block:Ie.normal,inline:Re.normal};this.options.pedantic?(te.block=Ie.pedantic,te.inline=Re.pedantic):this.options.gfm&&(te.block=Ie.gfm,this.options.breaks?te.inline=Re.breaks:te.inline=Re.gfm),this.tokenizer.rules=te}Ee.lex=function(te,re){var ue=new Ee(re);return ue.lex(te)};var me=Ee.prototype;return me.lex=function(te){return te=te.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(te,this.tokens,!0),this.inline(this.tokens),this.tokens},me.blockTokens=function(te,re,ue){re===void 0&&(re=[]),ue===void 0&&(ue=!0),te=te.replace(/^ +$/gm,"");for(var fe,Pe,Se,ze;te;){if(fe=this.tokenizer.space(te)){te=te.substring(fe.raw.length),fe.type&&re.push(fe);continue}if(fe=this.tokenizer.code(te,re)){te=te.substring(fe.raw.length),fe.type?re.push(fe):(ze=re[re.length-1],ze.raw+=`
|
|
`+fe.raw,ze.text+=`
|
|
`+fe.text);continue}if(fe=this.tokenizer.fences(te)){te=te.substring(fe.raw.length),re.push(fe);continue}if(fe=this.tokenizer.heading(te)){te=te.substring(fe.raw.length),re.push(fe);continue}if(fe=this.tokenizer.nptable(te)){te=te.substring(fe.raw.length),re.push(fe);continue}if(fe=this.tokenizer.hr(te)){te=te.substring(fe.raw.length),re.push(fe);continue}if(fe=this.tokenizer.blockquote(te)){te=te.substring(fe.raw.length),fe.tokens=this.blockTokens(fe.text,[],ue),re.push(fe);continue}if(fe=this.tokenizer.list(te)){for(te=te.substring(fe.raw.length),Se=fe.items.length,Pe=0;Pe<Se;Pe++)fe.items[Pe].tokens=this.blockTokens(fe.items[Pe].text,[],!1);re.push(fe);continue}if(fe=this.tokenizer.html(te)){te=te.substring(fe.raw.length),re.push(fe);continue}if(ue&&(fe=this.tokenizer.def(te))){te=te.substring(fe.raw.length),this.tokens.links[fe.tag]||(this.tokens.links[fe.tag]={href:fe.href,title:fe.title});continue}if(fe=this.tokenizer.table(te)){te=te.substring(fe.raw.length),re.push(fe);continue}if(fe=this.tokenizer.lheading(te)){te=te.substring(fe.raw.length),re.push(fe);continue}if(ue&&(fe=this.tokenizer.paragraph(te))){te=te.substring(fe.raw.length),re.push(fe);continue}if(fe=this.tokenizer.text(te,re)){te=te.substring(fe.raw.length),fe.type?re.push(fe):(ze=re[re.length-1],ze.raw+=`
|
|
`+fe.raw,ze.text+=`
|
|
`+fe.text);continue}if(te){var ot="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(ot);break}else throw new Error(ot)}}return re},me.inline=function(te){var re,ue,fe,Pe,Se,ze,ot=te.length;for(re=0;re<ot;re++){ze=te[re];switch(ze.type){case"paragraph":case"text":case"heading":{ze.tokens=[],this.inlineTokens(ze.text,ze.tokens);break}case"table":{for(ze.tokens={header:[],cells:[]},Pe=ze.header.length,ue=0;ue<Pe;ue++)ze.tokens.header[ue]=[],this.inlineTokens(ze.header[ue],ze.tokens.header[ue]);for(Pe=ze.cells.length,ue=0;ue<Pe;ue++)for(Se=ze.cells[ue],ze.tokens.cells[ue]=[],fe=0;fe<Se.length;fe++)ze.tokens.cells[ue][fe]=[],this.inlineTokens(Se[fe],ze.tokens.cells[ue][fe]);break}case"blockquote":{this.inline(ze.tokens);break}case"list":{for(Pe=ze.items.length,ue=0;ue<Pe;ue++)this.inline(ze.items[ue].tokens);break}}}return te},me.inlineTokens=function(te,re,ue,fe,Pe){re===void 0&&(re=[]),ue===void 0&&(ue=!1),fe===void 0&&(fe=!1),Pe===void 0&&(Pe="");var Se,ze=te,ot;if(this.tokens.links){var ct=Object.keys(this.tokens.links);if(ct.length>0)for(;(ot=this.tokenizer.rules.inline.reflinkSearch.exec(ze))!=null;)ct.includes(ot[0].slice(ot[0].lastIndexOf("[")+1,-1))&&(ze=ze.slice(0,ot.index)+"["+"a".repeat(ot[0].length-2)+"]"+ze.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(ot=this.tokenizer.rules.inline.blockSkip.exec(ze))!=null;)ze=ze.slice(0,ot.index)+"["+"a".repeat(ot[0].length-2)+"]"+ze.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;te;){if(Se=this.tokenizer.escape(te)){te=te.substring(Se.raw.length),re.push(Se);continue}if(Se=this.tokenizer.tag(te,ue,fe)){te=te.substring(Se.raw.length),ue=Se.inLink,fe=Se.inRawBlock,re.push(Se);continue}if(Se=this.tokenizer.link(te)){te=te.substring(Se.raw.length),Se.type==="link"&&(Se.tokens=this.inlineTokens(Se.text,[],!0,fe)),re.push(Se);continue}if(Se=this.tokenizer.reflink(te,this.tokens.links)){te=te.substring(Se.raw.length),Se.type==="link"&&(Se.tokens=this.inlineTokens(Se.text,[],!0,fe)),re.push(Se);continue}if(Se=this.tokenizer.strong(te,ze,Pe)){te=te.substring(Se.raw.length),Se.tokens=this.inlineTokens(Se.text,[],ue,fe),re.push(Se);continue}if(Se=this.tokenizer.em(te,ze,Pe)){te=te.substring(Se.raw.length),Se.tokens=this.inlineTokens(Se.text,[],ue,fe),re.push(Se);continue}if(Se=this.tokenizer.codespan(te)){te=te.substring(Se.raw.length),re.push(Se);continue}if(Se=this.tokenizer.br(te)){te=te.substring(Se.raw.length),re.push(Se);continue}if(Se=this.tokenizer.del(te)){te=te.substring(Se.raw.length),Se.tokens=this.inlineTokens(Se.text,[],ue,fe),re.push(Se);continue}if(Se=this.tokenizer.autolink(te,oe)){te=te.substring(Se.raw.length),re.push(Se);continue}if(!ue&&(Se=this.tokenizer.url(te,oe))){te=te.substring(Se.raw.length),re.push(Se);continue}if(Se=this.tokenizer.inlineText(te,fe,ae)){te=te.substring(Se.raw.length),Pe=Se.raw.slice(-1),re.push(Se);continue}if(te){var ht="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(ht);break}else throw new Error(ht)}}return re},$(Ee,null,[{key:"rules",get:function(){return{block:Ie,inline:Re}}}]),Ee}(),Ae=W.defaults,Ne=Z.cleanUrl,_e=Z.escape,We=function(){function Ee(ye){this.options=ye||Ae}var me=Ee.prototype;return me.code=function(te,re,ue){var fe=(re||"").match(/\S*/)[0];if(this.options.highlight){var Pe=this.options.highlight(te,fe);Pe!=null&&Pe!==te&&(ue=!0,te=Pe)}return fe?'<pre><code class="'+this.options.langPrefix+_e(fe,!0)+'">'+(ue?te:_e(te,!0))+`</code></pre>
|
|
`:"<pre><code>"+(ue?te:_e(te,!0))+`</code></pre>
|
|
`},me.blockquote=function(te){return`<blockquote>
|
|
`+te+`</blockquote>
|
|
`},me.html=function(te){return te},me.heading=function(te,re,ue,fe){return this.options.headerIds?"<h"+re+' id="'+this.options.headerPrefix+fe.slug(ue)+'">'+te+"</h"+re+`>
|
|
`:"<h"+re+">"+te+"</h"+re+`>
|
|
`},me.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},me.list=function(te,re,ue){var fe=re?"ol":"ul",Pe=re&&ue!==1?' start="'+ue+'"':"";return"<"+fe+Pe+`>
|
|
`+te+"</"+fe+`>
|
|
`},me.listitem=function(te){return"<li>"+te+`</li>
|
|
`},me.checkbox=function(te){return"<input "+(te?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},me.paragraph=function(te){return"<p>"+te+`</p>
|
|
`},me.table=function(te,re){return re&&(re="<tbody>"+re+"</tbody>"),`<table>
|
|
<thead>
|
|
`+te+`</thead>
|
|
`+re+`</table>
|
|
`},me.tablerow=function(te){return`<tr>
|
|
`+te+`</tr>
|
|
`},me.tablecell=function(te,re){var ue=re.header?"th":"td",fe=re.align?"<"+ue+' align="'+re.align+'">':"<"+ue+">";return fe+te+"</"+ue+`>
|
|
`},me.strong=function(te){return"<strong>"+te+"</strong>"},me.em=function(te){return"<em>"+te+"</em>"},me.codespan=function(te){return"<code>"+te+"</code>"},me.br=function(){return this.options.xhtml?"<br/>":"<br>"},me.del=function(te){return"<del>"+te+"</del>"},me.link=function(te,re,ue){if(te=Ne(this.options.sanitize,this.options.baseUrl,te),te===null)return ue;var fe='<a href="'+_e(te)+'"';return re&&(fe+=' title="'+re+'"'),fe+=">"+ue+"</a>",fe},me.image=function(te,re,ue){if(te=Ne(this.options.sanitize,this.options.baseUrl,te),te===null)return ue;var fe='<img src="'+te+'" alt="'+ue+'"';return re&&(fe+=' title="'+re+'"'),fe+=this.options.xhtml?"/>":">",fe},me.text=function(te){return te},Ee}(),Fe=function(){function Ee(){}var me=Ee.prototype;return me.strong=function(te){return te},me.em=function(te){return te},me.codespan=function(te){return te},me.del=function(te){return te},me.html=function(te){return te},me.text=function(te){return te},me.link=function(te,re,ue){return""+ue},me.image=function(te,re,ue){return""+ue},me.br=function(){return""},Ee}(),et=function(){function Ee(){this.seen={}}var me=Ee.prototype;return me.slug=function(te){var re=te.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(re)){var ue=re;do this.seen[ue]++,re=ue+"-"+this.seen[ue];while(this.seen.hasOwnProperty(re))}return this.seen[re]=0,re},Ee}(),Je=W.defaults,Qe=Z.unescape,Ye=function(){function Ee(ye){this.options=ye||Je,this.options.renderer=this.options.renderer||new We,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Fe,this.slugger=new et}Ee.parse=function(te,re){var ue=new Ee(re);return ue.parse(te)};var me=Ee.prototype;return me.parse=function(te,re){re===void 0&&(re=!0);var ue="",fe,Pe,Se,ze,ot,ct,ht,At,wt,ft,Kt,Ft,Jt,Ht,kt,Ur,Zr,bt,Ct=te.length;for(fe=0;fe<Ct;fe++){ft=te[fe];switch(ft.type){case"space":continue;case"hr":{ue+=this.renderer.hr();continue}case"heading":{ue+=this.renderer.heading(this.parseInline(ft.tokens),ft.depth,Qe(this.parseInline(ft.tokens,this.textRenderer)),this.slugger);continue}case"code":{ue+=this.renderer.code(ft.text,ft.lang,ft.escaped);continue}case"table":{for(At="",ht="",ze=ft.header.length,Pe=0;Pe<ze;Pe++)ht+=this.renderer.tablecell(this.parseInline(ft.tokens.header[Pe]),{header:!0,align:ft.align[Pe]});for(At+=this.renderer.tablerow(ht),wt="",ze=ft.cells.length,Pe=0;Pe<ze;Pe++){for(ct=ft.tokens.cells[Pe],ht="",ot=ct.length,Se=0;Se<ot;Se++)ht+=this.renderer.tablecell(this.parseInline(ct[Se]),{header:!1,align:ft.align[Se]});wt+=this.renderer.tablerow(ht)}ue+=this.renderer.table(At,wt);continue}case"blockquote":{wt=this.parse(ft.tokens),ue+=this.renderer.blockquote(wt);continue}case"list":{for(Kt=ft.ordered,Ft=ft.start,Jt=ft.loose,ze=ft.items.length,wt="",Pe=0;Pe<ze;Pe++)kt=ft.items[Pe],Ur=kt.checked,Zr=kt.task,Ht="",kt.task&&(bt=this.renderer.checkbox(Ur),Jt?kt.tokens.length>0&&kt.tokens[0].type==="text"?(kt.tokens[0].text=bt+" "+kt.tokens[0].text,kt.tokens[0].tokens&&kt.tokens[0].tokens.length>0&&kt.tokens[0].tokens[0].type==="text"&&(kt.tokens[0].tokens[0].text=bt+" "+kt.tokens[0].tokens[0].text)):kt.tokens.unshift({type:"text",text:bt}):Ht+=bt),Ht+=this.parse(kt.tokens,Jt),wt+=this.renderer.listitem(Ht,Zr,Ur);ue+=this.renderer.list(wt,Kt,Ft);continue}case"html":{ue+=this.renderer.html(ft.text);continue}case"paragraph":{ue+=this.renderer.paragraph(this.parseInline(ft.tokens));continue}case"text":{for(wt=ft.tokens?this.parseInline(ft.tokens):ft.text;fe+1<Ct&&te[fe+1].type==="text";)ft=te[++fe],wt+=`
|
|
`+(ft.tokens?this.parseInline(ft.tokens):ft.text);ue+=re?this.renderer.paragraph(wt):wt;continue}default:{var st='Token with "'+ft.type+'" type was not found.';if(this.options.silent){console.error(st);return}else throw new Error(st)}}}return ue},me.parseInline=function(te,re){re=re||this.renderer;var ue="",fe,Pe,Se=te.length;for(fe=0;fe<Se;fe++){Pe=te[fe];switch(Pe.type){case"escape":{ue+=re.text(Pe.text);break}case"html":{ue+=re.html(Pe.text);break}case"link":{ue+=re.link(Pe.href,Pe.title,this.parseInline(Pe.tokens,re));break}case"image":{ue+=re.image(Pe.href,Pe.title,Pe.text);break}case"strong":{ue+=re.strong(this.parseInline(Pe.tokens,re));break}case"em":{ue+=re.em(this.parseInline(Pe.tokens,re));break}case"codespan":{ue+=re.codespan(Pe.text);break}case"br":{ue+=re.br();break}case"del":{ue+=re.del(this.parseInline(Pe.tokens,re));break}case"text":{ue+=re.text(Pe.text);break}default:{var ze='Token with "'+Pe.type+'" type was not found.';if(this.options.silent){console.error(ze);return}else throw new Error(ze)}}}return ue},Ee}(),dt=Z.merge,$e=Z.checkSanitizeDeprecation,tt=Z.escape,Oe=W.getDefaults,Ze=W.changeDefaults,at=W.defaults;function Be(Ee,me,ye){if(typeof Ee=="undefined"||Ee===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Ee!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Ee)+", string expected");if(typeof me=="function"&&(ye=me,me=null),me=dt({},Be.defaults,me||{}),$e(me),ye){var te=me.highlight,re;try{re=be.lex(Ee,me)}catch(Se){return ye(Se)}var ue=function(ze){var ot;if(!ze)try{ot=Ye.parse(re,me)}catch(ct){ze=ct}return me.highlight=te,ze?ye(ze):ye(null,ot)};if(!te||te.length<3)return ue();if(delete me.highlight,!re.length)return ue();var fe=0;Be.walkTokens(re,function(Se){Se.type==="code"&&(fe++,setTimeout(function(){te(Se.text,Se.lang,function(ze,ot){if(ze)return ue(ze);ot!=null&&ot!==Se.text&&(Se.text=ot,Se.escaped=!0),fe--,fe===0&&ue()})},0))}),fe===0&&ue();return}try{var Pe=be.lex(Ee,me);return me.walkTokens&&Be.walkTokens(Pe,me.walkTokens),Ye.parse(Pe,me)}catch(Se){if(Se.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,me.silent)return"<p>An error occurred:</p><pre>"+tt(Se.message+"",!0)+"</pre>";throw Se}}Be.options=Be.setOptions=function(Ee){return dt(Be.defaults,Ee),Ze(Be.defaults),Be},Be.getDefaults=Oe,Be.defaults=at,Be.use=function(Ee){var me=dt({},Ee);if(Ee.renderer&&function(){var te=Be.defaults.renderer||new We,re=function(Pe){var Se=te[Pe];te[Pe]=function(){for(var ze=arguments.length,ot=new Array(ze),ct=0;ct<ze;ct++)ot[ct]=arguments[ct];var ht=Ee.renderer[Pe].apply(te,ot);return ht===!1&&(ht=Se.apply(te,ot)),ht}};for(var ue in Ee.renderer)re(ue);me.renderer=te}(),Ee.tokenizer&&function(){var te=Be.defaults.tokenizer||new ke,re=function(Pe){var Se=te[Pe];te[Pe]=function(){for(var ze=arguments.length,ot=new Array(ze),ct=0;ct<ze;ct++)ot[ct]=arguments[ct];var ht=Ee.tokenizer[Pe].apply(te,ot);return ht===!1&&(ht=Se.apply(te,ot)),ht}};for(var ue in Ee.tokenizer)re(ue);me.tokenizer=te}(),Ee.walkTokens){var ye=Be.defaults.walkTokens;me.walkTokens=function(te){Ee.walkTokens(te),ye&&ye(te)}}Be.setOptions(me)},Be.walkTokens=function(Ee,me){for(var ye=I(Ee),te;!(te=ye()).done;){var re=te.value;me(re);switch(re.type){case"table":{for(var ue=I(re.tokens.header),fe;!(fe=ue()).done;){var Pe=fe.value;Be.walkTokens(Pe,me)}for(var Se=I(re.tokens.cells),ze;!(ze=Se()).done;)for(var ot=ze.value,ct=I(ot),ht;!(ht=ct()).done;){var At=ht.value;Be.walkTokens(At,me)}break}case"list":{Be.walkTokens(re.items,me);break}default:re.tokens&&Be.walkTokens(re.tokens,me)}}},Be.Parser=Ye,Be.parser=Ye.parse,Be.Renderer=We,Be.TextRenderer=Fe,Be.Lexer=be,Be.lexer=be.lex,Be.Tokenizer=ke,Be.Slugger=et,Be.parse=Be;var Ke=Be;return Ke})},ELLl:function(vt,Te,Q){(function(ie){ie(Q("VrN/"))})(function(ie){var $={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},O=ie.Pos;ie.defineOption("autoCloseBrackets",!1,function(g,b,o){o&&o!=ie.Init&&(g.removeKeyMap(I),g.state.closeBrackets=null),b&&(M(V(b,"pairs")),g.state.closeBrackets=b,g.addKeyMap(I))});function V(g,b){return b=="pairs"&&typeof g=="string"?g:typeof g=="object"&&g[b]!=null?g[b]:$[b]}var I={Backspace:P,Enter:R};function M(g){for(var b=0;b<g.length;b++){var o=g.charAt(b),i="'"+o+"'";I[i]||(I[i]=W(o))}}M($.pairs+"`");function W(g){return function(b){return f(b,g)}}function N(g){var b=g.state.closeBrackets;if(!b||b.override)return b;var o=g.getModeAt(g.getCursor());return o.closeBrackets||b}function P(g){var b=N(g);if(!b||g.getOption("disableInput"))return ie.Pass;for(var o=V(b,"pairs"),i=g.listSelections(),s=0;s<i.length;s++){if(!i[s].empty())return ie.Pass;var l=w(g,i[s].head);if(!l||o.indexOf(l)%2!=0)return ie.Pass}for(var s=i.length-1;s>=0;s--){var C=i[s].head;g.replaceRange("",O(C.line,C.ch-1),O(C.line,C.ch+1),"+delete")}}function R(g){var b=N(g),o=b&&V(b,"explode");if(!o||g.getOption("disableInput"))return ie.Pass;for(var i=g.listSelections(),s=0;s<i.length;s++){if(!i[s].empty())return ie.Pass;var l=w(g,i[s].head);if(!l||o.indexOf(l)%2!=0)return ie.Pass}g.operation(function(){var C=g.lineSeparator()||`
|
|
`;g.replaceSelection(C+C,null),g.execCommand("goCharLeft"),i=g.listSelections();for(var m=0;m<i.length;m++){var v=i[m].head.line;g.indentLine(v,null,!0),g.indentLine(v+1,null,!0)}})}function d(g){var b=ie.cmpPos(g.anchor,g.head)>0;return{anchor:new O(g.anchor.line,g.anchor.ch+(b?-1:1)),head:new O(g.head.line,g.head.ch+(b?1:-1))}}function f(g,b){var o=N(g);if(!o||g.getOption("disableInput"))return ie.Pass;var i=V(o,"pairs"),s=i.indexOf(b);if(s==-1)return ie.Pass;for(var l=V(o,"closeBefore"),C=V(o,"triples"),m=i.charAt(s+1)==b,v=g.listSelections(),k=s%2==0,L,E=0;E<v.length;E++){var y=v[E],c=y.head,u,A=g.getRange(c,O(c.line,c.ch+1));if(k&&!y.empty())u="surround";else if((m||!k)&&A==b)m&&p(g,c)?u="both":C.indexOf(b)>=0&&g.getRange(c,O(c.line,c.ch+3))==b+b+b?u="skipThree":u="skip";else if(m&&c.ch>1&&C.indexOf(b)>=0&&g.getRange(O(c.line,c.ch-2),c)==b+b){if(c.ch>2&&/\bstring/.test(g.getTokenTypeAt(O(c.line,c.ch-2))))return ie.Pass;u="addFour"}else if(m){var S=c.ch==0?" ":g.getRange(O(c.line,c.ch-1),c);if(!ie.isWordChar(A)&&S!=b&&!ie.isWordChar(S))u="both";else return ie.Pass}else if(k&&(A.length===0||/\s/.test(A)||l.indexOf(A)>-1))u="both";else return ie.Pass;if(!L)L=u;else if(L!=u)return ie.Pass}var T=s%2?i.charAt(s-1):b,_=s%2?b:i.charAt(s+1);g.operation(function(){if(L=="skip")g.execCommand("goCharRight");else if(L=="skipThree")for(var j=0;j<3;j++)g.execCommand("goCharRight");else if(L=="surround"){for(var z=g.getSelections(),j=0;j<z.length;j++)z[j]=T+z[j]+_;g.replaceSelections(z,"around"),z=g.listSelections().slice();for(var j=0;j<z.length;j++)z[j]=d(z[j]);g.setSelections(z)}else L=="both"?(g.replaceSelection(T+_,null),g.triggerElectric(T+_),g.execCommand("goCharLeft")):L=="addFour"&&(g.replaceSelection(T+T+T+T,"before"),g.execCommand("goCharRight"))})}function w(g,b){var o=g.getRange(O(b.line,b.ch-1),O(b.line,b.ch+1));return o.length==2?o:null}function p(g,b){var o=g.getTokenAt(O(b.line,b.ch+1));return/\bstring/.test(o.type)&&o.start==b.ch&&(b.ch==0||!/\bstring/.test(g.getTokenTypeAt(b)))}})},HmJG:function(vt,Te,Q){},JYp7:function(vt,Te,Q){"use strict";Q.d(Te,"c",function(){return $}),Q.d(Te,"d",function(){return O}),Q.d(Te,"f",function(){return I}),Q.d(Te,"a",function(){return M}),Q.d(Te,"b",function(){return W}),Q.d(Te,"e",function(){return N});var ie=function(){var P=function(R,d){return P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,w){f.__proto__=w}||function(f,w){for(var p in w)w.hasOwnProperty(p)&&(f[p]=w[p])},P(R,d)};return function(R,d){P(R,d);function f(){this.constructor=R}R.prototype=d===null?Object.create(d):(f.prototype=d.prototype,new f)}}(),$={done:!0,value:void 0},O;(function(P){var R={next:function(){return $}};function d(){return R}P.empty=d;function f(m){var v=!1;return{next:function(){return v?$:(v=!0,{done:!1,value:m})}}}P.single=f;function w(m,v,k){return v===void 0&&(v=0),k===void 0&&(k=m.length),{next:function(){return v>=k?$:{done:!1,value:m[v++]}}}}P.fromArray=w;function p(m){return{next:function(){var v=m.next();return v.done?$:{done:!1,value:v.value}}}}P.fromNativeIterator=p;function g(m){return m?Array.isArray(m)?P.fromArray(m):m:P.empty()}P.from=g;function b(m,v){return{next:function(){var k=m.next();return k.done?$:{done:!1,value:v(k.value)}}}}P.map=b;function o(m,v){return{next:function(){for(;;){var k=m.next();if(k.done)return $;if(v(k.value))return{done:!1,value:k.value}}}}}P.filter=o;function i(m,v){for(var k=m.next();!k.done;k=m.next())v(k.value)}P.forEach=i;function s(m,v){v===void 0&&(v=Number.POSITIVE_INFINITY);var k=[];if(v===0)return k;for(var L=0,E=m.next();!E.done&&!(k.push(E.value),++L>=v);E=m.next());return k}P.collect=s;function l(){for(var m=[],v=0;v<arguments.length;v++)m[v]=arguments[v];var k=0;return{next:function(){if(k>=m.length)return $;var L=m[k],E=L.next();return E.done?(k++,this.next()):E}}}P.concat=l;function C(m){return new V(m)}P.chain=C})(O||(O={}));var V=function(){function P(R){this.it=R}return P.prototype.next=function(){return this.it.next()},P}();function I(P){return Array.isArray(P)?O.fromArray(P):P||O.empty()}var M=function(){function P(R,d,f,w){d===void 0&&(d=0),f===void 0&&(f=R.length),w===void 0&&(w=d-1),this.items=R,this.start=d,this.end=f,this.index=w}return P.prototype.first=function(){return this.index=this.start,this.current()},P.prototype.next=function(){return this.index=Math.min(this.index+1,this.end),this.current()},P.prototype.current=function(){return this.index===this.start-1||this.index===this.end?null:this.items[this.index]},P}(),W=function(P){ie(R,P);function R(d,f,w,p){return f===void 0&&(f=0),w===void 0&&(w=d.length),p===void 0&&(p=f-1),P.call(this,d,f,w,p)||this}return R.prototype.current=function(){return P.prototype.current.call(this)},R.prototype.previous=function(){return this.index=Math.max(this.index-1,this.start-1),this.current()},R.prototype.first=function(){return this.index=this.start,this.current()},R.prototype.last=function(){return this.index=this.end-1,this.current()},R.prototype.parent=function(){return null},R}(M),N=function(){function P(R,d){this.iterator=R,this.fn=d}return P.prototype.next=function(){return this.fn(this.iterator.next())},P}()},LdHM:function(vt,Te,Q){"use strict";Q.d(Te,"b",function(){return l}),Q.d(Te,"a",function(){return m});var ie=Q("1OyB"),$=Q("vuIU"),O=Q("Ji7U"),V=Q("LK+K"),I=Q("q1tI"),M=Q("rePB"),W=Q("Ff2n"),N=Q("ODXe"),P=Q("4IlW"),R=Q("bX4T"),d=Q("YrtM"),f=Q("TSYQ"),w=Q.n(f),p=Q("+nKL"),g=Q("8OUc"),b=function(ee,se){var he=ee.prefixCls,Ce=ee.id,Ue=ee.flattenOptions,ke=ee.childrenAsData,Me=ee.values,ce=ee.searchValue,ve=ee.multiple,le=ee.defaultActiveFirstOption,ne=ee.height,Le=ee.itemHeight,xe=ee.notFoundContent,Ie=ee.open,Re=ee.menuItemSelectedIcon,ae=ee.virtual,oe=ee.onSelect,be=ee.onToggleOpen,Ae=ee.onActiveValue,Ne=ee.onScroll,_e=ee.onMouseEnter,We="".concat(he,"-item"),Fe=Object(d.a)(function(){return Ue},[Ie,Ue],function(Ke,Ee){return Ee[0]&&Ke[1]!==Ee[1]}),et=I.useRef(null),Je=function(Ee){Ee.preventDefault()},Qe=function(Ee){et.current&&et.current.scrollTo({index:Ee})},Ye=function(Ee){for(var me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ye=Fe.length,te=0;te<ye;te+=1){var re=(Ee+te*me+ye)%ye,ue=Fe[re],fe=ue.group,Pe=ue.data;if(!fe&&!Pe.disabled)return re}return-1},dt=I.useState(function(){return Ye(0)}),$e=Object(N.a)(dt,2),tt=$e[0],Oe=$e[1],Ze=function(Ee){Oe(Ee);var me=Fe[Ee];if(!me){Ae(null,-1);return}Ae(me.data.value,Ee)};I.useEffect(function(){Ze(le!==!1?Ye(0):-1)},[Fe.length,ce]),I.useEffect(function(){var Ke=setTimeout(function(){if(!ve&&Ie&&Me.size===1){var Ee=Array.from(Me)[0],me=Fe.findIndex(function(ye){var te=ye.data;return te.value===Ee});Ze(me),Qe(me)}});return function(){return clearTimeout(Ke)}},[Ie]);var at=function(Ee){Ee!==void 0&&oe(Ee,{selected:!Me.has(Ee)}),ve||be(!1)};if(I.useImperativeHandle(se,function(){return{onKeyDown:function(Ee){var me=Ee.which;switch(me){case P.a.UP:case P.a.DOWN:{var ye=0;if(me===P.a.UP?ye=-1:me===P.a.DOWN&&(ye=1),ye!==0){var te=Ye(tt+ye,ye);Qe(te),Ze(te)}break}case P.a.ENTER:{var re=Fe[tt];re&&!re.data.disabled?at(re.data.value):at(void 0),Ie&&Ee.preventDefault();break}case P.a.ESC:be(!1)}},onKeyUp:function(){},scrollTo:function(Ee){Qe(Ee)}}}),Fe.length===0)return I.createElement("div",{role:"listbox",id:"".concat(Ce,"_list"),className:"".concat(We,"-empty"),onMouseDown:Je},xe);function Be(Ke){var Ee=Fe[Ke];if(!Ee)return null;var me=Ee.data||{},ye=me.value,te=me.label,re=me.children,ue=Object(R.a)(me,!0),fe=ke?re:te;return Ee?I.createElement("div",Object.assign({"aria-label":typeof fe=="string"?fe:null},ue,{key:Ke,role:"option",id:"".concat(Ce,"_list_").concat(Ke),"aria-selected":Me.has(ye)}),ye):null}return I.createElement(I.Fragment,null,I.createElement("div",{role:"listbox",id:"".concat(Ce,"_list"),style:{height:0,width:0,overflow:"hidden"}},Be(tt-1),Be(tt),Be(tt+1)),I.createElement(p.a,{itemKey:"key",ref:et,data:Fe,height:ne,itemHeight:Le,fullHeight:!1,onMouseDown:Je,onScroll:Ne,virtual:ae,onMouseEnter:_e},function(Ke,Ee){var me,ye=Ke.group,te=Ke.groupOption,re=Ke.data,ue=re.label,fe=re.key;if(ye)return I.createElement("div",{className:w()(We,"".concat(We,"-group"))},ue!==void 0?ue:fe);var Pe=re.disabled,Se=re.value,ze=re.title,ot=re.children,ct=re.style,ht=re.className,At=Object(W.a)(re,["disabled","value","title","children","style","className"]),wt=Me.has(Se),ft="".concat(We,"-option"),Kt=w()(We,ft,ht,(me={},Object(M.a)(me,"".concat(ft,"-grouped"),te),Object(M.a)(me,"".concat(ft,"-active"),tt===Ee&&!Pe),Object(M.a)(me,"".concat(ft,"-disabled"),Pe),Object(M.a)(me,"".concat(ft,"-selected"),wt),me)),Ft=ke?ot:ue,Jt=!Re||typeof Re=="function"||wt;return I.createElement("div",Object.assign({},At,{"aria-selected":wt,className:Kt,title:ze,onMouseMove:function(){if(tt===Ee||Pe)return;Ze(Ee)},onClick:function(){Pe||at(Se)},style:ct}),I.createElement("div",{className:"".concat(ft,"-content")},Ft||Se),I.isValidElement(Re)||wt,Jt&&I.createElement(g.a,{className:"".concat(We,"-option-state"),customizeIcon:Re,customizeIconProps:{isSelected:wt}},wt?"\u2713":null))}))},o=I.forwardRef(b);o.displayName="OptionList";var i=o,s=function(){return null};s.isSelectOption=!0;var l=s,C=function(){return null};C.isSelectOptGroup=!0;var m=C,v=Q("VTBJ"),k=Q("Zm9Q");function L(F){var ee=F.key,se=F.props,he=se.children,Ce=se.value,Ue=Object(W.a)(se,["children","value"]);return Object(v.a)({key:ee,value:Ce!==void 0?Ce:ee,children:he},Ue)}function E(F){var ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(k.a)(F).map(function(se,he){if(!I.isValidElement(se)||!se.type)return null;var Ce=se.type.isSelectOptGroup,Ue=se.key,ke=se.props,Me=ke.children,ce=Object(W.a)(ke,["children"]);return ee||!Ce?L(se):Object(v.a)(Object(v.a)({key:"__RC_SELECT_GRP__".concat(Ue===null?he:Ue,"__"),label:Ue},ce),{},{options:E(Me)})}).filter(function(se){return se})}var y=Q("2Qr1"),c=Q("qNPg"),u=Q("U8pU"),A=Q("Kwbf"),S=Q("WKfj");function T(F){var ee=F.mode,se=F.options,he=F.children,Ce=F.backfill,Ue=F.allowClear,ke=F.placeholder,Me=F.getInputElement,ce=F.showSearch,ve=F.onSearch,le=F.defaultOpen,ne=F.autoFocus,Le=F.labelInValue,xe=F.value,Ie=F.inputValue,Re=F.optionLabelProp,ae=ee==="multiple"||ee==="tags",oe=ce!==void 0?ce:ae||ee==="combobox",be=se||E(he);if(Object(A.a)(ee!=="tags"||be.every(function(We){return!We.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),ee==="tags"||ee==="combobox"){var Ae=be.some(function(We){return We.options?We.options.some(function(Fe){return typeof("value"in Fe?Fe.value:Fe.key)=="number"}):typeof("value"in We?We.value:We.key)=="number"});Object(A.a)(!Ae,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(A.a)(ee!=="combobox"||!Re,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(A.a)(ee==="combobox"||!Ce,"`backfill` only works with `combobox` mode."),Object(A.a)(ee==="combobox"||!Me,"`getInputElement` only work with `combobox` mode."),Object(A.b)(ee!=="combobox"||!Me||!Ue||!ke,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),ve&&!oe&&ee!=="combobox"&&ee!=="tags"&&Object(A.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(A.b)(!le||ne,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),xe!=null){var Ne=Object(S.d)(xe);Object(A.a)(!Le||Ne.every(function(We){return Object(u.a)(We)==="object"&&("key"in We||"value"in We)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(A.a)(!ae||Array.isArray(xe),"`value` should be array when `mode` is `multiple` or `tags`")}if(he){var _e=null;Object(k.a)(he).some(function(We){if(!I.isValidElement(We)||!We.type)return!1;var Fe=We.type;if(Fe.isSelectOption)return!1;if(Fe.isSelectOptGroup){var et=Object(k.a)(We.props.children).every(function(Je){return!I.isValidElement(Je)||!We.type||Je.type.isSelectOption?!0:(_e=Je.type,!1)});return!et}return _e=Fe,!0}),_e&&Object(A.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(_e.displayName||_e.name||_e,"`.")),Object(A.a)(Ie===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var _=T,j=Object(c.a)({prefixCls:"rc-select",components:{optionList:i},convertChildrenToData:E,flattenOptions:y.d,getLabeledValue:y.e,filterOptions:y.b,isValueDisabled:y.g,findValueOption:y.c,warningProps:_,fillOptionsWithMissingValue:y.a}),z=function(F){Object(O.a)(se,F);var ee=Object(V.a)(se);function se(){var he;return Object(ie.a)(this,se),he=ee.apply(this,arguments),he.selectRef=I.createRef(),he.focus=function(){he.selectRef.current.focus()},he.blur=function(){he.selectRef.current.blur()},he}return Object($.a)(se,[{key:"render",value:function(){return I.createElement(j,Object.assign({ref:this.selectRef},this.props))}}]),se}(I.Component);z.Option=l,z.OptGroup=m;var Z=z,K=Te.c=Z},M8RZ:function(vt,Te,Q){"use strict";Q.d(Te,"a",function(){return P});var ie=Q("fWQN"),$=Q("mtLc"),O=Q("yKVA"),V=Q("879j"),I=Q("q1tI"),M=Q.n(I),W=Q("i8i4"),N=Q.n(W),P=function(R){Object(O.a)(f,R);var d=Object(V.a)(f);function f(w){var p;Object(ie.a)(this,f),p=d.call(this,w);var g=window.document;return p.node=g.createElement("div"),g.body.appendChild(p.node),p}return Object($.a)(f,[{key:"render",value:function(){var p=this.props.children;return Object(W.createPortal)(p,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),f}(M.a.Component)},MI8n:function(vt,Te,Q){"use strict";Q.d(Te,"b",function(){return M}),Q.d(Te,"a",function(){return P}),Q.d(Te,"e",function(){return R}),Q.d(Te,"d",function(){return d}),Q.d(Te,"c",function(){return f}),Q.d(Te,"f",function(){return w});var ie=Q("/cxE"),$=Q("C/vA"),O=Q("pmY6"),V=Q("24hK"),I=function(){var p=function(g,b){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,i){o.__proto__=i}||function(o,i){for(var s in i)i.hasOwnProperty(s)&&(o[s]=i[s])},p(g,b)};return function(g,b){p(g,b);function o(){this.constructor=g}g.prototype=b===null?Object.create(b):(o.prototype=b.prototype,new o)}}(),M;(function(p){p.None=function(){return O.a.None};function g(_){return function(j,z,Z){z===void 0&&(z=null);var K=!1,F;return F=_(function(ee){return K?void 0:(F?F.dispose():K=!0,j.call(z,ee))},null,Z),K&&F.dispose(),F}}p.once=g;function b(_,j){return m(function(z,Z,K){return Z===void 0&&(Z=null),_(function(F){return z.call(Z,j(F))},null,K)})}p.map=b;function o(_,j){return m(function(z,Z,K){return Z===void 0&&(Z=null),_(function(F){j(F),z.call(Z,F)},null,K)})}p.forEach=o;function i(_,j){return m(function(z,Z,K){return Z===void 0&&(Z=null),_(function(F){return j(F)&&z.call(Z,F)},null,K)})}p.filter=i;function s(_){return _}p.signal=s;function l(){for(var _=[],j=0;j<arguments.length;j++)_[j]=arguments[j];return function(z,Z,K){return Z===void 0&&(Z=null),O.e.apply(void 0,_.map(function(F){return F(function(ee){return z.call(Z,ee)},null,K)}))}}p.any=l;function C(_,j,z){var Z=z;return b(_,function(K){return Z=j(Z,K),Z})}p.reduce=C;function m(_){var j,z=new P({onFirstListenerAdd:function(){j=_(z.fire,z)},onLastListenerRemove:function(){j.dispose()}});return z.event}p.snapshot=m;function v(_,j,z,Z,K){z===void 0&&(z=100),Z===void 0&&(Z=!1);var F,ee=void 0,se=void 0,he=0,Ce=new P({leakWarningThreshold:K,onFirstListenerAdd:function(){F=_(function(Ue){he++,ee=j(ee,Ue),Z&&!se&&(Ce.fire(ee),ee=void 0),clearTimeout(se),se=setTimeout(function(){var ke=ee;ee=void 0,se=void 0,(!Z||he>1)&&Ce.fire(ke),he=0},z)})},onLastListenerRemove:function(){F.dispose()}});return Ce.event}p.debounce=v;function k(_){var j=new Date().getTime();return b(g(_),function(z){return new Date().getTime()-j})}p.stopwatch=k;function L(_){var j=!0,z;return i(_,function(Z){var K=j||Z!==z;return j=!1,z=Z,K})}p.latch=L;function E(_,j,z){j===void 0&&(j=!1),z===void 0&&(z=[]);var Z=z.slice(),K=_(function(se){Z?Z.push(se):ee.fire(se)}),F=function(){Z&&Z.forEach(function(se){return ee.fire(se)}),Z=null},ee=new P({onFirstListenerAdd:function(){K||(K=_(function(se){return ee.fire(se)}))},onFirstListenerDidAdd:function(){Z&&(j?setTimeout(F):F())},onLastListenerRemove:function(){K&&K.dispose(),K=null}});return ee.event}p.buffer=E;var y=function(){function _(j){this.event=j}return _.prototype.map=function(j){return new _(b(this.event,j))},_.prototype.forEach=function(j){return new _(o(this.event,j))},_.prototype.filter=function(j){return new _(i(this.event,j))},_.prototype.reduce=function(j,z){return new _(C(this.event,j,z))},_.prototype.latch=function(){return new _(L(this.event))},_.prototype.debounce=function(j,z,Z,K){return z===void 0&&(z=100),Z===void 0&&(Z=!1),new _(v(this.event,j,z,Z,K))},_.prototype.on=function(j,z,Z){return this.event(j,z,Z)},_.prototype.once=function(j,z,Z){return g(this.event)(j,z,Z)},_}();function c(_){return new y(_)}p.chain=c;function u(_,j,z){z===void 0&&(z=function(se){return se});var Z=function(){for(var se=[],he=0;he<arguments.length;he++)se[he]=arguments[he];return ee.fire(z.apply(void 0,se))},K=function(){return _.on(j,Z)},F=function(){return _.removeListener(j,Z)},ee=new P({onFirstListenerAdd:K,onLastListenerRemove:F});return ee.event}p.fromNodeEventEmitter=u;function A(_,j,z){z===void 0&&(z=function(se){return se});var Z=function(){for(var se=[],he=0;he<arguments.length;he++)se[he]=arguments[he];return ee.fire(z.apply(void 0,se))},K=function(){return _.addEventListener(j,Z)},F=function(){return _.removeEventListener(j,Z)},ee=new P({onFirstListenerAdd:K,onLastListenerRemove:F});return ee.event}p.fromDOMEventEmitter=A;function S(_){var j=new P,z=!1;return _.then(void 0,function(){return null}).then(function(){z?j.fire(void 0):setTimeout(function(){return j.fire(void 0)},0)}),z=!0,j.event}p.fromPromise=S;function T(_){return new Promise(function(j){return g(_)(j)})}p.toPromise=T})(M||(M={}));var W=-1,N=function(){function p(g,b){b===void 0&&(b=Math.random().toString(18).slice(2,5)),this.customThreshold=g,this.name=b,this._warnCountdown=0}return p.prototype.dispose=function(){this._stacks&&this._stacks.clear()},p.prototype.check=function(g){var b=this,o=W;if(typeof this.customThreshold=="number"&&(o=this.customThreshold),o<=0||g<o)return;this._stacks||(this._stacks=new Map);var i=new Error().stack.split(`
|
|
`).slice(3).join(`
|
|
`),s=this._stacks.get(i)||0;if(this._stacks.set(i,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=o*.5;var l,C=0;this._stacks.forEach(function(m,v){(!l||C<m)&&(l=v,C=m)}),console.warn("["+this.name+"] potential listener LEAK detected, having "+g+" listeners already. MOST frequent listener ("+C+"):"),console.warn(l)}return function(){var m=b._stacks.get(i)||0;b._stacks.set(i,m-1)}},p}(),P=function(){function p(g){this._disposed=!1,this._options=g,this._leakageMon=W>0?new N(this._options&&this._options.leakWarningThreshold):void 0}return Object.defineProperty(p.prototype,"event",{get:function(){var g=this;return this._event||(this._event=function(b,o,i){g._listeners||(g._listeners=new V.a);var s=g._listeners.isEmpty();s&&g._options&&g._options.onFirstListenerAdd&&g._options.onFirstListenerAdd(g);var l=g._listeners.push(o?[b,o]:b);s&&g._options&&g._options.onFirstListenerDidAdd&&g._options.onFirstListenerDidAdd(g),g._options&&g._options.onListenerDidAdd&&g._options.onListenerDidAdd(g,b,o);var C;g._leakageMon&&(C=g._leakageMon.check(g._listeners.size));var m;return m={dispose:function(){if(C&&C(),m.dispose=p._noop,!g._disposed&&(l(),g._options&&g._options.onLastListenerRemove)){var v=g._listeners&&!g._listeners.isEmpty();v||g._options.onLastListenerRemove(g)}}},i instanceof O.b?i.add(m):Array.isArray(i)&&i.push(m),m}),this._event},enumerable:!0,configurable:!0}),p.prototype.fire=function(g){if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new V.a);for(var b=this._listeners.iterator(),o=b.next();!o.done;o=b.next())this._deliveryQueue.push([o.value,g]);for(;this._deliveryQueue.size>0;){var i=this._deliveryQueue.shift(),s=i[0],l=i[1];try{typeof s=="function"?s.call(void 0,l):s[0].call(s[1],l)}catch(C){Object(ie.e)(C)}}}},p.prototype.dispose=function(){this._listeners&&this._listeners.clear(),this._deliveryQueue&&this._deliveryQueue.clear(),this._leakageMon&&this._leakageMon.dispose(),this._disposed=!0},p._noop=function(){},p}(),R=function(p){I(g,p);function g(b){var o=p.call(this,b)||this;return o._isPaused=0,o._eventQueue=new V.a,o._mergeFn=b&&b.merge,o}return g.prototype.pause=function(){this._isPaused++},g.prototype.resume=function(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){var b=this._eventQueue.toArray();this._eventQueue.clear(),p.prototype.fire.call(this,this._mergeFn(b))}else for(;!this._isPaused&&this._eventQueue.size!==0;)p.prototype.fire.call(this,this._eventQueue.shift())},g.prototype.fire=function(b){this._listeners&&(this._isPaused!==0?this._eventQueue.push(b):p.prototype.fire.call(this,b))},g}(P),d=function(){function p(){var g=this;this.hasListeners=!1,this.events=[],this.emitter=new P({onFirstListenerAdd:function(){return g.onFirstListenerAdd()},onLastListenerRemove:function(){return g.onLastListenerRemove()}})}return Object.defineProperty(p.prototype,"event",{get:function(){return this.emitter.event},enumerable:!0,configurable:!0}),p.prototype.add=function(g){var b=this,o={event:g,listener:null};this.events.push(o),this.hasListeners&&this.hook(o);var i=function(){b.hasListeners&&b.unhook(o);var s=b.events.indexOf(o);b.events.splice(s,1)};return Object(O.h)(Object($.a)(i))},p.prototype.onFirstListenerAdd=function(){var g=this;this.hasListeners=!0,this.events.forEach(function(b){return g.hook(b)})},p.prototype.onLastListenerRemove=function(){var g=this;this.hasListeners=!1,this.events.forEach(function(b){return g.unhook(b)})},p.prototype.hook=function(g){var b=this;g.listener=g.event(function(o){return b.emitter.fire(o)})},p.prototype.unhook=function(g){g.listener&&g.listener.dispose(),g.listener=null},p.prototype.dispose=function(){this.emitter.dispose()},p}(),f=function(){function p(){this.buffers=[]}return p.prototype.wrapEvent=function(g){var b=this;return function(o,i,s){return g(function(l){var C=b.buffers[b.buffers.length-1];C?C.push(function(){return o.call(i,l)}):o.call(i,l)},void 0,s)}},p.prototype.bufferEvents=function(g){var b=[];this.buffers.push(b);var o=g();return this.buffers.pop(),b.forEach(function(i){return i()}),o},p}(),w=function(){function p(){var g=this;this.listening=!1,this.inputEvent=M.None,this.inputEventListener=O.a.None,this.emitter=new P({onFirstListenerDidAdd:function(){g.listening=!0,g.inputEventListener=g.inputEvent(g.emitter.fire,g.emitter)},onLastListenerRemove:function(){g.listening=!1,g.inputEventListener.dispose()}}),this.event=this.emitter.event}return Object.defineProperty(p.prototype,"input",{set:function(g){this.inputEvent=g,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=g(this.emitter.fire,this.emitter))},enumerable:!0,configurable:!0}),p.prototype.dispose=function(){this.inputEventListener.dispose(),this.emitter.dispose()},p}()},N0LK:function(vt,Te,Q){"use strict";Q.d(Te,"x",function(){return ie}),Q.d(Te,"F",function(){return $}),Q.d(Te,"r",function(){return V}),Q.d(Te,"o",function(){return I}),Q.d(Te,"p",function(){return M}),Q.d(Te,"Q",function(){return W}),Q.d(Te,"K",function(){return P}),Q.d(Te,"k",function(){return R}),Q.d(Te,"N",function(){return d}),Q.d(Te,"m",function(){return f}),Q.d(Te,"l",function(){return w}),Q.d(Te,"I",function(){return p}),Q.d(Te,"H",function(){return g}),Q.d(Te,"q",function(){return b}),Q.d(Te,"t",function(){return o}),Q.d(Te,"D",function(){return i}),Q.d(Te,"e",function(){return s}),Q.d(Te,"f",function(){return l}),Q.d(Te,"B",function(){return C}),Q.d(Te,"C",function(){return m}),Q.d(Te,"n",function(){return k}),Q.d(Te,"O",function(){return E}),Q.d(Te,"c",function(){return y}),Q.d(Te,"d",function(){return c}),Q.d(Te,"z",function(){return u}),Q.d(Te,"A",function(){return A}),Q.d(Te,"u",function(){return S}),Q.d(Te,"E",function(){return _}),Q.d(Te,"G",function(){return j}),Q.d(Te,"i",function(){return Z}),Q.d(Te,"g",function(){return F}),Q.d(Te,"v",function(){return se}),Q.d(Te,"h",function(){return he}),Q.d(Te,"y",function(){return Ce}),Q.d(Te,"w",function(){return Ue}),Q.d(Te,"a",function(){return ke}),Q.d(Te,"P",function(){return Me}),Q.d(Te,"L",function(){return ce}),Q.d(Te,"J",function(){return ve}),Q.d(Te,"j",function(){return le}),Q.d(Te,"M",function(){return ne}),Q.d(Te,"s",function(){return Le}),Q.d(Te,"b",function(){return xe});function ie(ae){return!ae||typeof ae!="string"?!0:ae.trim().length===0}function $(ae,oe,be){be===void 0&&(be="0");for(var Ae=""+ae,Ne=[Ae],_e=Ae.length;_e<oe;_e++)Ne.push(be);return Ne.reverse().join("")}var O=/{(\d+)}/g;function V(ae){for(var oe=[],be=1;be<arguments.length;be++)oe[be-1]=arguments[be];return oe.length===0?ae:ae.replace(O,function(Ae,Ne){var _e=parseInt(Ne,10);return isNaN(_e)||_e<0||_e>=oe.length?Ae:oe[_e]})}function I(ae){return ae.replace(/[<>&]/g,function(oe){switch(oe){case"<":return"<";case">":return">";case"&":return"&";default:return oe}})}function M(ae){return ae.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function W(ae,oe){oe===void 0&&(oe=" ");var be=N(ae,oe);return P(be,oe)}function N(ae,oe){if(!ae||!oe)return ae;var be=oe.length;if(be===0||ae.length===0)return ae;for(var Ae=0;ae.indexOf(oe,Ae)===Ae;)Ae=Ae+be;return ae.substring(Ae)}function P(ae,oe){if(!ae||!oe)return ae;var be=oe.length,Ae=ae.length;if(be===0||Ae===0)return ae;for(var Ne=Ae,_e=-1;!(_e=ae.lastIndexOf(oe,Ne-1),_e===-1||_e+be!==Ne);){if(_e===0)return"";Ne=_e}return ae.substring(0,Ne)}function R(ae){return ae.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function d(ae,oe){if(ae.length<oe.length)return!1;if(ae===oe)return!0;for(var be=0;be<oe.length;be++)if(ae[be]!==oe[be])return!1;return!0}function f(ae,oe){var be=ae.length-oe.length;return be>0?ae.indexOf(oe,be)===be:be===0?ae===oe:!1}function w(ae,oe,be){if(be===void 0&&(be={}),!ae)throw new Error("Cannot create regex from empty string");oe||(ae=M(ae)),be.wholeWord&&(/\B/.test(ae.charAt(0))||(ae="\\b"+ae),/\B/.test(ae.charAt(ae.length-1))||(ae=ae+"\\b"));var Ae="";return be.global&&(Ae+="g"),be.matchCase||(Ae+="i"),be.multiline&&(Ae+="m"),be.unicode&&(Ae+="u"),new RegExp(ae,Ae)}function p(ae){if(ae.source==="^"||ae.source==="^$"||ae.source==="$"||ae.source==="^\\s*$")return!1;var oe=ae.exec("");return!!(oe&&ae.lastIndex===0)}function g(ae){return(ae.global?"g":"")+(ae.ignoreCase?"i":"")+(ae.multiline?"m":"")+(ae.unicode?"u":"")}function b(ae){for(var oe=0,be=ae.length;oe<be;oe++){var Ae=ae.charCodeAt(oe);if(Ae!==32&&Ae!==9)return oe}return-1}function o(ae,oe,be){oe===void 0&&(oe=0),be===void 0&&(be=ae.length);for(var Ae=oe;Ae<be;Ae++){var Ne=ae.charCodeAt(Ae);if(Ne!==32&&Ne!==9)return ae.substring(oe,Ae)}return ae.substring(oe,be)}function i(ae,oe){oe===void 0&&(oe=ae.length-1);for(var be=oe;be>=0;be--){var Ae=ae.charCodeAt(be);if(Ae!==32&&Ae!==9)return be}return-1}function s(ae,oe){return ae<oe?-1:ae>oe?1:0}function l(ae,oe){for(var be=Math.min(ae.length,oe.length),Ae=0;Ae<be;Ae++){var Ne=ae.charCodeAt(Ae),_e=oe.charCodeAt(Ae);if(Ne===_e)continue;m(Ne)&&(Ne+=32),m(_e)&&(_e+=32);var We=Ne-_e;if(We===0)continue;return C(Ne)&&C(_e)?We:s(ae.toLowerCase(),oe.toLowerCase())}return ae.length<oe.length?-1:ae.length>oe.length?1:0}function C(ae){return ae>=97&&ae<=122}function m(ae){return ae>=65&&ae<=90}function v(ae){return C(ae)||m(ae)}function k(ae,oe){return ae.length===oe.length&&L(ae,oe)}function L(ae,oe,be){be===void 0&&(be=ae.length);for(var Ae=0;Ae<be;Ae++){var Ne=ae.charCodeAt(Ae),_e=oe.charCodeAt(Ae);if(Ne===_e)continue;if(v(Ne)&&v(_e)){var We=Math.abs(Ne-_e);if(We!==0&&We!==32)return!1}else if(String.fromCharCode(Ne).toLowerCase()!==String.fromCharCode(_e).toLowerCase())return!1}return!0}function E(ae,oe){var be=oe.length;return oe.length>ae.length?!1:L(ae,oe,be)}function y(ae,oe){var be,Ae=Math.min(ae.length,oe.length);for(be=0;be<Ae;be++)if(ae.charCodeAt(be)!==oe.charCodeAt(be))return be;return Ae}function c(ae,oe){var be,Ae=Math.min(ae.length,oe.length),Ne=ae.length-1,_e=oe.length-1;for(be=0;be<Ae;be++)if(ae.charCodeAt(Ne-be)!==oe.charCodeAt(_e-be))return be;return Ae}function u(ae){return 55296<=ae&&ae<=56319}function A(ae){return 56320<=ae&&ae<=57343}function S(ae,oe,be){var Ae=ae.charCodeAt(be);if(u(Ae)&&be+1<oe){var Ne=ae.charCodeAt(be+1);if(A(Ne))return(Ae-55296<<10)+(Ne-56320)+65536}return Ae}function T(ae,oe){var be=ae.charCodeAt(oe-1);if(A(be)&&oe>1){var Ae=ae.charCodeAt(oe-2);if(u(Ae))return(Ae-55296<<10)+(be-56320)+65536}return be}function _(ae,oe){var be=Ie.getInstance(),Ae=oe,Ne=ae.length,_e=S(ae,Ne,oe);oe+=_e>=65536?2:1;for(var We=be.getGraphemeBreakType(_e);oe<Ne;){var Fe=S(ae,Ne,oe),et=be.getGraphemeBreakType(Fe);if(xe(We,et))break;oe+=Fe>=65536?2:1,We=et}return oe-Ae}function j(ae,oe){var be=Ie.getInstance(),Ae=oe,Ne=T(ae,oe);oe-=Ne>=65536?2:1;for(var _e=be.getGraphemeBreakType(Ne);oe>0;){var We=T(ae,oe),Fe=be.getGraphemeBreakType(We);if(xe(Fe,_e))break;oe-=We>=65536?2:1,_e=Fe}return Ae-oe}var z=/(?:[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05F4\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u0710\u0712-\u072F\u074D-\u07A5\u07B1-\u07EA\u07F4\u07F5\u07FA-\u0815\u081A\u0824\u0828\u0830-\u0858\u085E-\u08BD\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFD3D\uFD50-\uFDFC\uFE70-\uFEFC]|\uD802[\uDC00-\uDD1B\uDD20-\uDE00\uDE10-\uDE33\uDE40-\uDEE4\uDEEB-\uDF35\uDF40-\uDFFF]|\uD803[\uDC00-\uDCFF]|\uD83A[\uDC00-\uDCCF\uDD00-\uDD43\uDD50-\uDFFF]|\uD83B[\uDC00-\uDEBB])/;function Z(ae){return z.test(ae)}var K=/(?:[\u231A\u231B\u23F0\u23F3\u2600-\u27BF\u2B50\u2B55]|\uD83C[\uDDE6-\uDDFF\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F\uDE80-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD00-\uDDFF\uDE70-\uDE73\uDE78-\uDE82\uDE90-\uDE95])/;function F(ae){return K.test(ae)}var ee=/^[\t\n\r\x20-\x7E]*$/;function se(ae){return ee.test(ae)}function he(ae){for(var oe=0,be=ae.length;oe<be;oe++)if(Ce(ae.charCodeAt(oe)))return!0;return!1}function Ce(ae){return ae=+ae,ae>=11904&&ae<=55215||ae>=63744&&ae<=64255||ae>=65281&&ae<=65374}function Ue(ae){return ae>=127462&&ae<=127487||ae>=9728&&ae<=10175||ae>=127744&&ae<=128591||ae>=128640&&ae<=128764||ae>=128992&&ae<=129003||ae>=129280&&ae<=129535||ae>=129648&&ae<=129651||ae>=129656&&ae<=129666||ae>=129680&&ae<=129685}var ke=String.fromCharCode(65279);function Me(ae){return!!(ae&&ae.length>0&&ae.charCodeAt(0)===65279)}function ce(ae){return btoa(encodeURIComponent(ae))}function ve(ae,oe){for(var be="",Ae=0;Ae<oe;Ae++)be+=ae;return be}function le(ae,oe){return oe===void 0&&(oe=!1),ae?(oe&&(ae=ae.replace(/\\./g,"")),ae.toLowerCase()!==ae):!1}function ne(ae){var oe=90-65+1;return ae=ae%(2*oe),ae<oe?String.fromCharCode(97+ae):String.fromCharCode(65+ae-oe)}function Le(ae){var oe=Ie.getInstance();return oe.getGraphemeBreakType(ae)}function xe(ae,oe){return ae===0?oe!==5&&oe!==7:ae===2&&oe===3?!1:ae===4||ae===2||ae===3||(oe===4||oe===2||oe===3)?!0:ae===8&&(oe===8||oe===9||oe===11||oe===12)||((ae===11||ae===9)&&(oe===9||oe===10)||((ae===12||ae===10)&&oe===10||(oe===5||oe===13||(oe===7||(ae===1||ae===13&&oe===14)))))?!1:!(ae===6&&oe===6)}var Ie=function(){function ae(){this._data=Re()}return ae.getInstance=function(){return ae._INSTANCE||(ae._INSTANCE=new ae),ae._INSTANCE},ae.prototype.getGraphemeBreakType=function(oe){if(oe<32)return oe===10?3:oe===13?2:4;if(oe<127)return 0;for(var be=this._data,Ae=be.length/3,Ne=1;Ne<=Ae;)if(oe<be[3*Ne])Ne=2*Ne;else if(oe>be[3*Ne+1])Ne=2*Ne+1;else return be[3*Ne+2];return 0},ae._INSTANCE=null,ae}();function Re(){return JSON.parse("[0,0,0,51592,51592,11,44424,44424,11,72251,72254,5,7150,7150,7,48008,48008,11,55176,55176,11,128420,128420,14,3276,3277,5,9979,9980,14,46216,46216,11,49800,49800,11,53384,53384,11,70726,70726,5,122915,122916,5,129320,129327,14,2558,2558,5,5906,5908,5,9762,9763,14,43360,43388,8,45320,45320,11,47112,47112,11,48904,48904,11,50696,50696,11,52488,52488,11,54280,54280,11,70082,70083,1,71350,71350,7,73111,73111,5,127892,127893,14,128726,128727,14,129473,129474,14,2027,2035,5,2901,2902,5,3784,3789,5,6754,6754,5,8418,8420,5,9877,9877,14,11088,11088,14,44008,44008,5,44872,44872,11,45768,45768,11,46664,46664,11,47560,47560,11,48456,48456,11,49352,49352,11,50248,50248,11,51144,51144,11,52040,52040,11,52936,52936,11,53832,53832,11,54728,54728,11,69811,69814,5,70459,70460,5,71096,71099,7,71998,71998,5,72874,72880,5,119149,119149,7,127374,127374,14,128335,128335,14,128482,128482,14,128765,128767,14,129399,129400,14,129680,129685,14,1476,1477,5,2377,2380,7,2759,2760,5,3137,3140,7,3458,3459,7,4153,4154,5,6432,6434,5,6978,6978,5,7675,7679,5,9723,9726,14,9823,9823,14,9919,9923,14,10035,10036,14,42736,42737,5,43596,43596,5,44200,44200,11,44648,44648,11,45096,45096,11,45544,45544,11,45992,45992,11,46440,46440,11,46888,46888,11,47336,47336,11,47784,47784,11,48232,48232,11,48680,48680,11,49128,49128,11,49576,49576,11,50024,50024,11,50472,50472,11,50920,50920,11,51368,51368,11,51816,51816,11,52264,52264,11,52712,52712,11,53160,53160,11,53608,53608,11,54056,54056,11,54504,54504,11,54952,54952,11,68108,68111,5,69933,69940,5,70197,70197,7,70498,70499,7,70845,70845,5,71229,71229,5,71727,71735,5,72154,72155,5,72344,72345,5,73023,73029,5,94095,94098,5,121403,121452,5,126981,127182,14,127538,127546,14,127990,127990,14,128391,128391,14,128445,128449,14,128500,128505,14,128752,128752,14,129160,129167,14,129356,129356,14,129432,129442,14,129648,129651,14,129751,131069,14,173,173,4,1757,1757,1,2274,2274,1,2494,2494,5,2641,2641,5,2876,2876,5,3014,3016,7,3262,3262,7,3393,3396,5,3570,3571,7,3968,3972,5,4228,4228,7,6086,6086,5,6679,6680,5,6912,6915,5,7080,7081,5,7380,7392,5,8252,8252,14,9096,9096,14,9748,9749,14,9784,9786,14,9833,9850,14,9890,9894,14,9938,9938,14,9999,9999,14,10085,10087,14,12349,12349,14,43136,43137,7,43454,43456,7,43755,43755,7,44088,44088,11,44312,44312,11,44536,44536,11,44760,44760,11,44984,44984,11,45208,45208,11,45432,45432,11,45656,45656,11,45880,45880,11,46104,46104,11,46328,46328,11,46552,46552,11,46776,46776,11,47000,47000,11,47224,47224,11,47448,47448,11,47672,47672,11,47896,47896,11,48120,48120,11,48344,48344,11,48568,48568,11,48792,48792,11,49016,49016,11,49240,49240,11,49464,49464,11,49688,49688,11,49912,49912,11,50136,50136,11,50360,50360,11,50584,50584,11,50808,50808,11,51032,51032,11,51256,51256,11,51480,51480,11,51704,51704,11,51928,51928,11,52152,52152,11,52376,52376,11,52600,52600,11,52824,52824,11,53048,53048,11,53272,53272,11,53496,53496,11,53720,53720,11,53944,53944,11,54168,54168,11,54392,54392,11,54616,54616,11,54840,54840,11,55064,55064,11,65438,65439,5,69633,69633,5,69837,69837,1,70018,70018,7,70188,70190,7,70368,70370,7,70465,70468,7,70712,70719,5,70835,70840,5,70850,70851,5,71132,71133,5,71340,71340,7,71458,71461,5,71985,71989,7,72002,72002,7,72193,72202,5,72281,72283,5,72766,72766,7,72885,72886,5,73104,73105,5,92912,92916,5,113824,113827,4,119173,119179,5,121505,121519,5,125136,125142,5,127279,127279,14,127489,127490,14,127570,127743,14,127900,127901,14,128254,128254,14,128369,128370,14,128400,128400,14,128425,128432,14,128468,128475,14,128489,128494,14,128715,128720,14,128745,128745,14,128759,128760,14,129004,129023,14,129296,129304,14,129340,129342,14,129388,129392,14,129404,129407,14,129454,129455,14,129485,129487,14,129659,129663,14,129719,129727,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2363,2363,7,2402,2403,5,2507,2508,7,2622,2624,7,2691,2691,7,2786,2787,5,2881,2884,5,3006,3006,5,3072,3072,5,3170,3171,5,3267,3268,7,3330,3331,7,3406,3406,1,3538,3540,5,3655,3662,5,3897,3897,5,4038,4038,5,4184,4185,5,4352,4447,8,6068,6069,5,6155,6157,5,6448,6449,7,6742,6742,5,6783,6783,5,6966,6970,5,7042,7042,7,7143,7143,7,7212,7219,5,7412,7412,5,8206,8207,4,8294,8303,4,8596,8601,14,9410,9410,14,9742,9742,14,9757,9757,14,9770,9770,14,9794,9794,14,9828,9828,14,9855,9855,14,9882,9882,14,9900,9903,14,9929,9933,14,9963,9967,14,9987,9988,14,10006,10006,14,10062,10062,14,10175,10175,14,11744,11775,5,42607,42607,5,43043,43044,7,43263,43263,5,43444,43445,7,43569,43570,5,43698,43700,5,43766,43766,5,44032,44032,11,44144,44144,11,44256,44256,11,44368,44368,11,44480,44480,11,44592,44592,11,44704,44704,11,44816,44816,11,44928,44928,11,45040,45040,11,45152,45152,11,45264,45264,11,45376,45376,11,45488,45488,11,45600,45600,11,45712,45712,11,45824,45824,11,45936,45936,11,46048,46048,11,46160,46160,11,46272,46272,11,46384,46384,11,46496,46496,11,46608,46608,11,46720,46720,11,46832,46832,11,46944,46944,11,47056,47056,11,47168,47168,11,47280,47280,11,47392,47392,11,47504,47504,11,47616,47616,11,47728,47728,11,47840,47840,11,47952,47952,11,48064,48064,11,48176,48176,11,48288,48288,11,48400,48400,11,48512,48512,11,48624,48624,11,48736,48736,11,48848,48848,11,48960,48960,11,49072,49072,11,49184,49184,11,49296,49296,11,49408,49408,11,49520,49520,11,49632,49632,11,49744,49744,11,49856,49856,11,49968,49968,11,50080,50080,11,50192,50192,11,50304,50304,11,50416,50416,11,50528,50528,11,50640,50640,11,50752,50752,11,50864,50864,11,50976,50976,11,51088,51088,11,51200,51200,11,51312,51312,11,51424,51424,11,51536,51536,11,51648,51648,11,51760,51760,11,51872,51872,11,51984,51984,11,52096,52096,11,52208,52208,11,52320,52320,11,52432,52432,11,52544,52544,11,52656,52656,11,52768,52768,11,52880,52880,11,52992,52992,11,53104,53104,11,53216,53216,11,53328,53328,11,53440,53440,11,53552,53552,11,53664,53664,11,53776,53776,11,53888,53888,11,54000,54000,11,54112,54112,11,54224,54224,11,54336,54336,11,54448,54448,11,54560,54560,11,54672,54672,11,54784,54784,11,54896,54896,11,55008,55008,11,55120,55120,11,64286,64286,5,66272,66272,5,68900,68903,5,69762,69762,7,69817,69818,5,69927,69931,5,70003,70003,5,70070,70078,5,70094,70094,7,70194,70195,7,70206,70206,5,70400,70401,5,70463,70463,7,70475,70477,7,70512,70516,5,70722,70724,5,70832,70832,5,70842,70842,5,70847,70848,5,71088,71089,7,71102,71102,7,71219,71226,5,71231,71232,5,71342,71343,7,71453,71455,5,71463,71467,5,71737,71738,5,71995,71996,5,72000,72000,7,72145,72147,7,72160,72160,5,72249,72249,7,72273,72278,5,72330,72342,5,72752,72758,5,72850,72871,5,72882,72883,5,73018,73018,5,73031,73031,5,73109,73109,5,73461,73462,7,94031,94031,5,94192,94193,7,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,126976,126979,14,127184,127231,14,127344,127345,14,127405,127461,14,127514,127514,14,127561,127567,14,127778,127779,14,127896,127896,14,127985,127986,14,127995,127999,5,128326,128328,14,128360,128366,14,128378,128378,14,128394,128397,14,128405,128406,14,128422,128423,14,128435,128443,14,128453,128464,14,128479,128480,14,128484,128487,14,128496,128498,14,128640,128709,14,128723,128724,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129096,129103,14,129292,129292,14,129311,129311,14,129329,129330,14,129344,129349,14,129360,129374,14,129394,129394,14,129402,129402,14,129413,129425,14,129445,129450,14,129466,129471,14,129483,129483,14,129511,129535,14,129653,129655,14,129667,129670,14,129705,129711,14,129731,129743,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2307,2307,7,2366,2368,7,2382,2383,7,2434,2435,7,2497,2500,5,2519,2519,5,2563,2563,7,2631,2632,5,2677,2677,5,2750,2752,7,2763,2764,7,2817,2817,5,2879,2879,5,2891,2892,7,2914,2915,5,3008,3008,5,3021,3021,5,3076,3076,5,3146,3149,5,3202,3203,7,3264,3265,7,3271,3272,7,3298,3299,5,3390,3390,5,3402,3404,7,3426,3427,5,3535,3535,5,3544,3550,7,3635,3635,7,3763,3763,7,3893,3893,5,3953,3966,5,3981,3991,5,4145,4145,7,4157,4158,5,4209,4212,5,4237,4237,5,4520,4607,10,5970,5971,5,6071,6077,5,6089,6099,5,6277,6278,5,6439,6440,5,6451,6456,7,6683,6683,5,6744,6750,5,6765,6770,7,6846,6846,5,6964,6964,5,6972,6972,5,7019,7027,5,7074,7077,5,7083,7085,5,7146,7148,7,7154,7155,7,7222,7223,5,7394,7400,5,7416,7417,5,8204,8204,5,8233,8233,4,8288,8292,4,8413,8416,5,8482,8482,14,8986,8987,14,9193,9203,14,9654,9654,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9775,14,9792,9792,14,9800,9811,14,9825,9826,14,9831,9831,14,9852,9853,14,9872,9873,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9936,9936,14,9941,9960,14,9974,9974,14,9982,9985,14,9992,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10145,10145,14,11013,11015,14,11503,11505,5,12334,12335,5,12951,12951,14,42612,42621,5,43014,43014,5,43047,43047,7,43204,43205,5,43335,43345,5,43395,43395,7,43450,43451,7,43561,43566,5,43573,43574,5,43644,43644,5,43710,43711,5,43758,43759,7,44005,44005,5,44012,44012,7,44060,44060,11,44116,44116,11,44172,44172,11,44228,44228,11,44284,44284,11,44340,44340,11,44396,44396,11,44452,44452,11,44508,44508,11,44564,44564,11,44620,44620,11,44676,44676,11,44732,44732,11,44788,44788,11,44844,44844,11,44900,44900,11,44956,44956,11,45012,45012,11,45068,45068,11,45124,45124,11,45180,45180,11,45236,45236,11,45292,45292,11,45348,45348,11,45404,45404,11,45460,45460,11,45516,45516,11,45572,45572,11,45628,45628,11,45684,45684,11,45740,45740,11,45796,45796,11,45852,45852,11,45908,45908,11,45964,45964,11,46020,46020,11,46076,46076,11,46132,46132,11,46188,46188,11,46244,46244,11,46300,46300,11,46356,46356,11,46412,46412,11,46468,46468,11,46524,46524,11,46580,46580,11,46636,46636,11,46692,46692,11,46748,46748,11,46804,46804,11,46860,46860,11,46916,46916,11,46972,46972,11,47028,47028,11,47084,47084,11,47140,47140,11,47196,47196,11,47252,47252,11,47308,47308,11,47364,47364,11,47420,47420,11,47476,47476,11,47532,47532,11,47588,47588,11,47644,47644,11,47700,47700,11,47756,47756,11,47812,47812,11,47868,47868,11,47924,47924,11,47980,47980,11,48036,48036,11,48092,48092,11,48148,48148,11,48204,48204,11,48260,48260,11,48316,48316,11,48372,48372,11,48428,48428,11,48484,48484,11,48540,48540,11,48596,48596,11,48652,48652,11,48708,48708,11,48764,48764,11,48820,48820,11,48876,48876,11,48932,48932,11,48988,48988,11,49044,49044,11,49100,49100,11,49156,49156,11,49212,49212,11,49268,49268,11,49324,49324,11,49380,49380,11,49436,49436,11,49492,49492,11,49548,49548,11,49604,49604,11,49660,49660,11,49716,49716,11,49772,49772,11,49828,49828,11,49884,49884,11,49940,49940,11,49996,49996,11,50052,50052,11,50108,50108,11,50164,50164,11,50220,50220,11,50276,50276,11,50332,50332,11,50388,50388,11,50444,50444,11,50500,50500,11,50556,50556,11,50612,50612,11,50668,50668,11,50724,50724,11,50780,50780,11,50836,50836,11,50892,50892,11,50948,50948,11,51004,51004,11,51060,51060,11,51116,51116,11,51172,51172,11,51228,51228,11,51284,51284,11,51340,51340,11,51396,51396,11,51452,51452,11,51508,51508,11,51564,51564,11,51620,51620,11,51676,51676,11,51732,51732,11,51788,51788,11,51844,51844,11,51900,51900,11,51956,51956,11,52012,52012,11,52068,52068,11,52124,52124,11,52180,52180,11,52236,52236,11,52292,52292,11,52348,52348,11,52404,52404,11,52460,52460,11,52516,52516,11,52572,52572,11,52628,52628,11,52684,52684,11,52740,52740,11,52796,52796,11,52852,52852,11,52908,52908,11,52964,52964,11,53020,53020,11,53076,53076,11,53132,53132,11,53188,53188,11,53244,53244,11,53300,53300,11,53356,53356,11,53412,53412,11,53468,53468,11,53524,53524,11,53580,53580,11,53636,53636,11,53692,53692,11,53748,53748,11,53804,53804,11,53860,53860,11,53916,53916,11,53972,53972,11,54028,54028,11,54084,54084,11,54140,54140,11,54196,54196,11,54252,54252,11,54308,54308,11,54364,54364,11,54420,54420,11,54476,54476,11,54532,54532,11,54588,54588,11,54644,54644,11,54700,54700,11,54756,54756,11,54812,54812,11,54868,54868,11,54924,54924,11,54980,54980,11,55036,55036,11,55092,55092,11,55148,55148,11,55216,55238,9,65056,65071,5,65529,65531,4,68097,68099,5,68159,68159,5,69446,69456,5,69688,69702,5,69808,69810,7,69815,69816,7,69821,69821,1,69888,69890,5,69932,69932,7,69957,69958,7,70016,70017,5,70067,70069,7,70079,70080,7,70089,70092,5,70095,70095,5,70191,70193,5,70196,70196,5,70198,70199,5,70367,70367,5,70371,70378,5,70402,70403,7,70462,70462,5,70464,70464,5,70471,70472,7,70487,70487,5,70502,70508,5,70709,70711,7,70720,70721,7,70725,70725,7,70750,70750,5,70833,70834,7,70841,70841,7,70843,70844,7,70846,70846,7,70849,70849,7,71087,71087,5,71090,71093,5,71100,71101,5,71103,71104,5,71216,71218,7,71227,71228,7,71230,71230,7,71339,71339,5,71341,71341,5,71344,71349,5,71351,71351,5,71456,71457,7,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123628,123631,5,125252,125258,5,126980,126980,14,127183,127183,14,127245,127247,14,127340,127343,14,127358,127359,14,127377,127386,14,127462,127487,6,127491,127503,14,127535,127535,14,127548,127551,14,127568,127569,14,127744,127777,14,127780,127891,14,127894,127895,14,127897,127899,14,127902,127984,14,127987,127989,14,127991,127994,14,128000,128253,14,128255,128317,14,128329,128334,14,128336,128359,14,128367,128368,14,128371,128377,14,128379,128390,14,128392,128393,14,128398,128399,14,128401,128404,14,128407,128419,14,128421,128421,14,128424,128424,14,128433,128434,14,128444,128444,14,128450,128452,14,128465,128467,14,128476,128478,14,128481,128481,14,128483,128483,14,128488,128488,14,128495,128495,14,128499,128499,14,128506,128591,14,128710,128714,14,128721,128722,14,128725,128725,14,128728,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129664,129666,14,129671,129679,14,129686,129704,14,129712,129718,14,129728,129730,14,129744,129750,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2259,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3134,3136,5,3142,3144,5,3157,3158,5,3201,3201,5,3260,3260,5,3263,3263,5,3266,3266,5,3270,3270,5,3274,3275,7,3285,3286,5,3328,3329,5,3387,3388,5,3391,3392,7,3398,3400,7,3405,3405,5,3415,3415,5,3457,3457,5,3530,3530,5,3536,3537,7,3542,3542,5,3551,3551,5,3633,3633,5,3636,3642,5,3761,3761,5,3764,3772,5,3864,3865,5,3895,3895,5,3902,3903,7,3967,3967,7,3974,3975,5,3993,4028,5,4141,4144,5,4146,4151,5,4155,4156,7,4182,4183,7,4190,4192,5,4226,4226,5,4229,4230,5,4253,4253,5,4448,4519,9,4957,4959,5,5938,5940,5,6002,6003,5,6070,6070,7,6078,6085,7,6087,6088,7,6109,6109,5,6158,6158,4,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6848,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7673,5,8203,8203,4,8205,8205,13,8232,8232,4,8234,8238,4,8265,8265,14,8293,8293,4,8400,8412,5,8417,8417,5,8421,8432,5,8505,8505,14,8617,8618,14,9000,9000,14,9167,9167,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9776,9783,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9935,14,9937,9937,14,9939,9940,14,9961,9962,14,9968,9973,14,9975,9978,14,9981,9981,14,9986,9986,14,9989,9989,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10084,14,10133,10135,14,10160,10160,14,10548,10549,14,11035,11036,14,11093,11093,14,11647,11647,5,12330,12333,5,12336,12336,14,12441,12442,5,12953,12953,14,42608,42610,5,42654,42655,5,43010,43010,5,43019,43019,5,43045,43046,5,43052,43052,5,43188,43203,7,43232,43249,5,43302,43309,5,43346,43347,7,43392,43394,5,43443,43443,5,43446,43449,5,43452,43453,5,43493,43493,5,43567,43568,7,43571,43572,7,43587,43587,5,43597,43597,7,43696,43696,5,43703,43704,5,43713,43713,5,43756,43757,5,43765,43765,7,44003,44004,7,44006,44007,7,44009,44010,7,44013,44013,5,44033,44059,12,44061,44087,12,44089,44115,12,44117,44143,12,44145,44171,12,44173,44199,12,44201,44227,12,44229,44255,12,44257,44283,12,44285,44311,12,44313,44339,12,44341,44367,12,44369,44395,12,44397,44423,12,44425,44451,12,44453,44479,12,44481,44507,12,44509,44535,12,44537,44563,12,44565,44591,12,44593,44619,12,44621,44647,12,44649,44675,12,44677,44703,12,44705,44731,12,44733,44759,12,44761,44787,12,44789,44815,12,44817,44843,12,44845,44871,12,44873,44899,12,44901,44927,12,44929,44955,12,44957,44983,12,44985,45011,12,45013,45039,12,45041,45067,12,45069,45095,12,45097,45123,12,45125,45151,12,45153,45179,12,45181,45207,12,45209,45235,12,45237,45263,12,45265,45291,12,45293,45319,12,45321,45347,12,45349,45375,12,45377,45403,12,45405,45431,12,45433,45459,12,45461,45487,12,45489,45515,12,45517,45543,12,45545,45571,12,45573,45599,12,45601,45627,12,45629,45655,12,45657,45683,12,45685,45711,12,45713,45739,12,45741,45767,12,45769,45795,12,45797,45823,12,45825,45851,12,45853,45879,12,45881,45907,12,45909,45935,12,45937,45963,12,45965,45991,12,45993,46019,12,46021,46047,12,46049,46075,12,46077,46103,12,46105,46131,12,46133,46159,12,46161,46187,12,46189,46215,12,46217,46243,12,46245,46271,12,46273,46299,12,46301,46327,12,46329,46355,12,46357,46383,12,46385,46411,12,46413,46439,12,46441,46467,12,46469,46495,12,46497,46523,12,46525,46551,12,46553,46579,12,46581,46607,12,46609,46635,12,46637,46663,12,46665,46691,12,46693,46719,12,46721,46747,12,46749,46775,12,46777,46803,12,46805,46831,12,46833,46859,12,46861,46887,12,46889,46915,12,46917,46943,12,46945,46971,12,46973,46999,12,47001,47027,12,47029,47055,12,47057,47083,12,47085,47111,12,47113,47139,12,47141,47167,12,47169,47195,12,47197,47223,12,47225,47251,12,47253,47279,12,47281,47307,12,47309,47335,12,47337,47363,12,47365,47391,12,47393,47419,12,47421,47447,12,47449,47475,12,47477,47503,12,47505,47531,12,47533,47559,12,47561,47587,12,47589,47615,12,47617,47643,12,47645,47671,12,47673,47699,12,47701,47727,12,47729,47755,12,47757,47783,12,47785,47811,12,47813,47839,12,47841,47867,12,47869,47895,12,47897,47923,12,47925,47951,12,47953,47979,12,47981,48007,12,48009,48035,12,48037,48063,12,48065,48091,12,48093,48119,12,48121,48147,12,48149,48175,12,48177,48203,12,48205,48231,12,48233,48259,12,48261,48287,12,48289,48315,12,48317,48343,12,48345,48371,12,48373,48399,12,48401,48427,12,48429,48455,12,48457,48483,12,48485,48511,12,48513,48539,12,48541,48567,12,48569,48595,12,48597,48623,12,48625,48651,12,48653,48679,12,48681,48707,12,48709,48735,12,48737,48763,12,48765,48791,12,48793,48819,12,48821,48847,12,48849,48875,12,48877,48903,12,48905,48931,12,48933,48959,12,48961,48987,12,48989,49015,12,49017,49043,12,49045,49071,12,49073,49099,12,49101,49127,12,49129,49155,12,49157,49183,12,49185,49211,12,49213,49239,12,49241,49267,12,49269,49295,12,49297,49323,12,49325,49351,12,49353,49379,12,49381,49407,12,49409,49435,12,49437,49463,12,49465,49491,12,49493,49519,12,49521,49547,12,49549,49575,12,49577,49603,12,49605,49631,12,49633,49659,12,49661,49687,12,49689,49715,12,49717,49743,12,49745,49771,12,49773,49799,12,49801,49827,12,49829,49855,12,49857,49883,12,49885,49911,12,49913,49939,12,49941,49967,12,49969,49995,12,49997,50023,12,50025,50051,12,50053,50079,12,50081,50107,12,50109,50135,12,50137,50163,12,50165,50191,12,50193,50219,12,50221,50247,12,50249,50275,12,50277,50303,12,50305,50331,12,50333,50359,12,50361,50387,12,50389,50415,12,50417,50443,12,50445,50471,12,50473,50499,12,50501,50527,12,50529,50555,12,50557,50583,12,50585,50611,12,50613,50639,12,50641,50667,12,50669,50695,12,50697,50723,12,50725,50751,12,50753,50779,12,50781,50807,12,50809,50835,12,50837,50863,12,50865,50891,12,50893,50919,12,50921,50947,12,50949,50975,12,50977,51003,12,51005,51031,12,51033,51059,12,51061,51087,12,51089,51115,12,51117,51143,12,51145,51171,12,51173,51199,12,51201,51227,12,51229,51255,12,51257,51283,12,51285,51311,12,51313,51339,12,51341,51367,12,51369,51395,12,51397,51423,12,51425,51451,12,51453,51479,12,51481,51507,12,51509,51535,12,51537,51563,12,51565,51591,12,51593,51619,12,51621,51647,12,51649,51675,12,51677,51703,12,51705,51731,12,51733,51759,12,51761,51787,12,51789,51815,12,51817,51843,12,51845,51871,12,51873,51899,12,51901,51927,12,51929,51955,12,51957,51983,12,51985,52011,12,52013,52039,12,52041,52067,12,52069,52095,12,52097,52123,12,52125,52151,12,52153,52179,12,52181,52207,12,52209,52235,12,52237,52263,12,52265,52291,12,52293,52319,12,52321,52347,12,52349,52375,12,52377,52403,12,52405,52431,12,52433,52459,12,52461,52487,12,52489,52515,12,52517,52543,12,52545,52571,12,52573,52599,12,52601,52627,12,52629,52655,12,52657,52683,12,52685,52711,12,52713,52739,12,52741,52767,12,52769,52795,12,52797,52823,12,52825,52851,12,52853,52879,12,52881,52907,12,52909,52935,12,52937,52963,12,52965,52991,12,52993,53019,12,53021,53047,12,53049,53075,12,53077,53103,12,53105,53131,12,53133,53159,12,53161,53187,12,53189,53215,12,53217,53243,12,53245,53271,12,53273,53299,12,53301,53327,12,53329,53355,12,53357,53383,12,53385,53411,12,53413,53439,12,53441,53467,12,53469,53495,12,53497,53523,12,53525,53551,12,53553,53579,12,53581,53607,12,53609,53635,12,53637,53663,12,53665,53691,12,53693,53719,12,53721,53747,12,53749,53775,12,53777,53803,12,53805,53831,12,53833,53859,12,53861,53887,12,53889,53915,12,53917,53943,12,53945,53971,12,53973,53999,12,54001,54027,12,54029,54055,12,54057,54083,12,54085,54111,12,54113,54139,12,54141,54167,12,54169,54195,12,54197,54223,12,54225,54251,12,54253,54279,12,54281,54307,12,54309,54335,12,54337,54363,12,54365,54391,12,54393,54419,12,54421,54447,12,54449,54475,12,54477,54503,12,54505,54531,12,54533,54559,12,54561,54587,12,54589,54615,12,54617,54643,12,54645,54671,12,54673,54699,12,54701,54727,12,54729,54755,12,54757,54783,12,54785,54811,12,54813,54839,12,54841,54867,12,54869,54895,12,54897,54923,12,54925,54951,12,54953,54979,12,54981,55007,12,55009,55035,12,55037,55063,12,55065,55091,12,55093,55119,12,55121,55147,12,55149,55175,12,55177,55203,12,55243,55291,10,65024,65039,5,65279,65279,4,65520,65528,4,66045,66045,5,66422,66426,5,68101,68102,5,68152,68154,5,68325,68326,5,69291,69292,5,69632,69632,7,69634,69634,7,69759,69761,5]")}},Ot1p:function(vt,Te,Q){"use strict";var ie=Q("2qtc"),$=Q("kLXV"),O=Q("rAM+"),V=Q("miYZ"),I=Q("tsqr"),M=Q("9og8"),W=Q("tJVT"),N=Q("jrin"),P=Q("WmNS"),R=Q.n(P),d=Q("q1tI"),f=Q.n(d),w=Q("VrN/"),p=Q.n(w),g=Q("bdgK"),b=Q("p77/"),o=Q("Bd2K"),i=Q("ELLl"),s=Q("19Vz"),l=Q("lZu9"),C=Q("+NIl"),m=Q("kSUc"),v=Q("9Bee"),k=function(Se){var ze=Se.value,ot=ze===void 0?"":ze,ct=Se.className,ht=Se.showTextOnly,At=Se.showLines,wt=Se.style,ft=wt===void 0?{}:wt,Kt=Object(d.useMemo)(function(){return""},[ot]);return f.a.createElement(f.a.Fragment,null,f.a.createElement("div",{dangerouslySetInnerHTML:{__html:Kt}}))},L=Q("0Owb"),E=Q("dejd"),y=Q("C+DQ"),c=Q("1vsH"),u=Q("m3rI"),A=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function S(Se){var ze=Se.onActionCallback,ot=Se.title,ct=Se.icon,ht=Se.actionName,At=Se.className,wt=At===void 0?"":At,ft=Se.children;function Kt(){ze(ht)}return f.a.createElement("a",{title:ot,className:wt,onClick:Kt},f.a.createElement("i",{className:"md-iconfont ".concat(ct)}),ft)}var T=function(Se){var ze=Se.watch,ot=Se.showNullButton,ct=Se.onActionCallback,ht=Se.fullScreen,At=Se.insertTemp,wt=Se.hidetoolBar,ft=Se.uuid,Kt=Se.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(c.D)("_educoder_session_login"),"&_educoder_session=").concat(Object(c.D)("_educoder_session"),"&key=").concat(ft,"&api=").concat(encodeURIComponent(u.a.PROXY_SERVER)));var Ft=[].concat(A,[{title:"".concat(ze?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(ze?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return f.a.createElement("ul",{className:"markdown-toolbar-container"},!wt&&Ft.map(function(Jt,Ht){return f.a.createElement("li",{key:Ht},Jt.actionName?f.a.createElement(S,Object(L.a)({},Jt,{onActionCallback:ct})):f.a.createElement("span",{className:"v-line"}))}),ot?f.a.createElement("li",null,f.a.createElement(S,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:ct},f.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,At&&f.a.createElement("li",null,f.a.createElement(S,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(At),onActionCallback:ct},f.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),f.a.createElement("li",{className:"btn-full-screen"},f.a.createElement(S,{icon:"".concat(ht?"icon-shrink":"icon-enlarge"),title:ht?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:ct})))},_=Q("M8RZ"),j=Q("+L6B"),z=Q("2/Rp"),Z=Q("y8nQ"),K=Q("Vl3Y"),F=Q("5NDa"),ee=Q("5rEg"),se={labelCol:{span:4},wrapperCol:{span:20}},he=function(Se){var ze=Se.callback,ot=Se.onCancel;function ct(ht){ze(ht)}return f.a.createElement(K.a,Object(L.a)({},se,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:ct}),f.a.createElement(K.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},f.a.createElement(ee.a,null)),f.a.createElement(K.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},f.a.createElement(ee.a,null)),f.a.createElement("div",{className:"flex-container flex-end"},f.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),f.a.createElement(z.a,{type:"ghost",onClick:ot},"\u53D6\u6D88")))},Ce=Q("7ahc"),Ue=Q("k1fw"),ke=Q("HmJG"),Me=Q("BjJ7"),ce=K.a.useForm,ve={width:280,marginRight:10},le={labelCol:{span:5},wrapperCol:{span:19}},ne=function(Se){var ze=Se.callback,ot=Se.onCancel,ct=ce(),ht=Object(W.a)(ct,1),At=ht[0],wt=Object(d.useRef)();function ft(Jt){ze(Object(Ue.a)(Object(Ue.a)({},Jt),{},{name:wt.current}))}function Kt(Jt,Ht){At.setFieldsValue({src:"/api/attachments/".concat(Jt.id,"?type=").concat(Jt.content_type),type:Ht.type})}function Ft(Jt){var Ht=Jt.target.files[0];wt.current=Ht.name,xe(Ht,Kt)}return f.a.createElement(K.a,Object(L.a)({form:At},le,{className:"upload-image-panel",onFinish:ft}),f.a.createElement(K.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},f.a.createElement("div",{className:"flex-container"},f.a.createElement(K.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},f.a.createElement(ee.a,{style:ve})),f.a.createElement(Le,{onFileChange:Ft}))),f.a.createElement(K.a.Item,{label:"\u6587\u4EF6\u63CF\u8FF0",name:"alt"},f.a.createElement(ee.a,{style:{width:264}})),f.a.createElement(K.a.Item,{style:{textAlign:"right"}},f.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),f.a.createElement(z.a,{type:"ghost",onClick:ot},"\u53D6\u6D88")))};function Le(Se){var ze=Se.onFileChange;return f.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",f.a.createElement("input",{type:"file",onChange:ze}))}function xe(Se,ze){if(!Se)throw new String("\u6CA1\u6709\u6587\u4EF6");var ot=new FormData;ot.append("editormd-image-file",Se),ot.append("file_param_name","editormd-image-file"),ot.append("byxhr","true");var ct=new window.XMLHttpRequest;ct.withCredentials=!0,ct.addEventListener("load",function(ht){ze(JSON.parse(ht.target.responseText),Se)},!1),ct.addEventListener("error",function(ht){console.error(ht)},!1),ct.open("POST","".concat(Me.a,"/api/attachments.json")),ct.send(ot)}var Ie=Q("giR+"),Re=Q("fyUT"),ae=Q("7Kak"),oe=Q("9yH6"),be=oe.a.Group,Ae={margin:"0 8px"},Ne=function(Se){var ze=Se.callback,ot=Se.onCancel;function ct(ht){ze(ht)}return f.a.createElement(K.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:ct},f.a.createElement("div",{className:"flex-container"},f.a.createElement("span",{style:Ae},"\u5355\u5143\u683C\u6570\uFF1A"),f.a.createElement("span",{style:Ae},"\u884C\u6570"),f.a.createElement(K.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},f.a.createElement(Re.a,null)),f.a.createElement("span",{style:Ae},"\u5217\u6570"),f.a.createElement(K.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},f.a.createElement(Re.a,null))),f.a.createElement("div",{className:"flex-container",style:{marginTop:12}},f.a.createElement("span",{style:Ae},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),f.a.createElement(K.a.Item,{name:"align"},f.a.createElement(be,null,f.a.createElement(oe.a,{value:"default"},f.a.createElement("i",{className:"fa fa-align-justify"})),f.a.createElement(oe.a,{value:"left"},f.a.createElement("i",{className:"fa fa-align-left"})),f.a.createElement(oe.a,{value:"center"},f.a.createElement("i",{className:"fa fa-align-center"})),f.a.createElement(oe.a,{value:"right"},f.a.createElement("i",{className:"fa fa-align-right"}))))),f.a.createElement("div",{className:"flex-container flex-end"},f.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),f.a.createElement(z.a,{type:"ghost",onClick:ot},"\u53D6\u6D88")))},_e=Q("ErOA"),We=Q("7Cbv"),Fe="link",et="upload-image",Je="code-block",Qe="add-table",Ye="------------",dt={default:Ye,left:":".concat(Ye),center:":".concat(Ye,":"),right:"".concat(Ye,":")},$e=Q("9VGf"),tt,Oe;function Ze(){}var at=0,Be=1e4,Ke="\u2581",Ee=`
|
|
**\u6A21\u677F\u6807\u9898**
|
|
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function me(Se){return/^\d+$/.test(Se)?"".concat(Se,"px"):Se}var ye=navigator.platform.toUpperCase().indexOf("MAC")>=0,te=ye?"Cmd":"Ctrl",re=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"],ue=(tt={},Object(N.a)(tt,te+"-B","bold"),Object(N.a)(tt,te+"-I","italic"),tt),fe=(Oe={},Object(N.a)(Oe,Fe,"\u6DFB\u52A0\u94FE\u63A5"),Object(N.a)(Oe,Je,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(N.a)(Oe,et,"\u6DFB\u52A0\u6587\u4EF6"),Object(N.a)(Oe,Qe,"\u6DFB\u52A0\u8868\u683C"),Oe),Pe=Te.a=function(Se){var ze=Se.defaultValue,ot=ze===void 0?"":ze,ct=Se.onChange,ht=Se.width,At=ht===void 0?"100%":ht,wt=Se.height,ft=wt===void 0?400:wt,Kt=Se.miniToolbar,Ft=Kt===void 0?!1:Kt,Jt=Se.isFocus,Ht=Jt===void 0?!1:Jt,kt=Se.watch,Ur=Se.insertTemp,Zr=Se.mode,bt=Zr===void 0?"markdown":Zr,Ct=Se.id,st=Ct===void 0?"markdown-editor-id":Ct,xt=Se.showResizeBar,Zt=xt===void 0?!1:xt,nr=Se.noStorage,rr=nr===void 0?!1:nr,Rt=Se.showNullButton,gt=Rt===void 0?!1:Rt,kr=Se.hidetoolBar,tn=kr===void 0?!1:kr,Tr=Se.fullScreen,Ot=Tr===void 0?!1:Tr,Ar=Se.onBlur,Kr=Se.onCMBeforeChange,rn=Se.onFullScreen,He=Se.className,lt=He===void 0?"":He,Mt=Se.disablePaste,zt=Mt===void 0?!1:Mt,Yt=Se.placeholder,qt=Yt===void 0?"":Yt,H=Se.values,h=H===void 0?"":H,x=Object(d.useState)(null),U=Object(W.a)(x,2),X=U[0],G=U[1],ge=Object(d.useState)(ot),Ge=Object(W.a)(ge,2),rt=Ge[0],pt=Ge[1],Ve=Object(d.useState)(kt),Lt=Object(W.a)(Ve,2),It=Lt[0],er=Lt[1],zr=Object(d.useState)(Ot),Vr=Object(W.a)(zr,2),pr=Vr[0],Qr=Vr[1],Gn=Object(d.useState)(""),Or=Object(W.a)(Gn,2),Xr=Or[0],jr=Or[1],bn=Object(d.useState)(0),nn=Object(W.a)(bn,2),mn=nn[0],dn=nn[1],hi=Object(d.useState)(ft),Kn=Object(W.a)(hi,2),an=Kn[0],Yr=Kn[1],kn=Object(d.useState)(!1),On=Object(W.a)(kn,2),ci=On[0],or=On[1],jt=Object(d.useRef)(Object(We.a)()),Er=Object(d.useRef)(!1),Ut=Object(d.useRef)(),dr=Object(d.useRef)(),Vt=Object(d.useRef)(),hn=Object(d.useRef)(),lr=Object(d.useRef)(),Pr=function(){var yt=Object(M.a)(R.a.mark(function Dt(){var St,_t;return R.a.wrap(function($t){for(;;)switch($t.prev=$t.next){case 0:return $t.next=2,Object(_e.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:jt.current}});case 2:_t=$t.sent,_t!=null&&(St=_t.attachments)!==null&&St!==void 0&&St.length&&(console.log("cm:",X,dr),_t.attachments.map(function(Bt){Bt.content_type.indexOf("image")>-1?X.replaceSelection(".concat(Bt.content_type,")")):Bt.content_type.indexOf("video")>-1?X.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Bt.content_type.indexOf("pdf")>-1?X.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Bt.id,"?type=").concat(Bt.content_type,'&disposition=inline" target="_blank">').concat(Bt.name,"</a>")):X.replaceSelection("[".concat(Bt.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(Bt.id,"?type=").concat(Bt.content_type,")"))}));case 4:case"end":return $t.stop()}},Dt)}));return function(){return yt.apply(this,arguments)}}();Object(d.useEffect)(function(){pt(h),X==null||X.setValue(h)},[h]),Object(d.useEffect)(function(){rn==null||rn(pr)},[pr]),Object(d.useEffect)(function(){if(dr.current){var yt=p.a.fromTextArea(dr.current,{mode:bt,lineNumbers:!Ft,lineWrapping:!0,value:ot,autoCloseTags:!0,autoCloseBrackets:!0});Ht&&yt.focus();function Dt(St,_t){if(zt){_t.preventDefault();return}var Wt=_t.clipboardData;if(Wt){var $t=Wt.types.toString(),Bt=Wt.items;if($t==="Files"||Wt.types.indexOf("Files")>-1){if(_t.preventDefault(),bt=="stex")return;try{var hr,Mr=Bt[1];((hr=Bt[0])===null||hr===void 0?void 0:hr.kind)==="file"&&(Mr=Bt[0]);var Nt=Mr.getAsFile(),En=Nt.name.split(".").pop();xe(Nt,function(Gt){if(Gt.id){var gr,qr,en;(Nt==null||((gr=Nt.type)===null||gr===void 0)?void 0:gr.indexOf("image"))>-1?yt.replaceSelection(".concat(Gt.content_type,")")):(Nt==null||((qr=Nt.type)===null||qr===void 0)?void 0:qr.indexOf("video"))>-1?yt.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Gt.id,'"></video>')):(Nt==null||((en=Nt.type)===null||en===void 0)?void 0:en.indexOf("pdf"))>-1?yt.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Nt.type,'&disposition=inline" target="_blank">').concat(Nt.name,"</a>")):re.includes(En)?yt.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Gt.id,'?type=office&disposition=inline" target="_blank">').concat(Nt.name,"</a>")):yt.replaceSelection("[".concat(Nt.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Gt.content_type,")"))}else(Gt==null?void 0:Gt.status)===401&&(document.location.href="/user/login")})}catch(Gt){I.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return yt.on("paste",Dt),yt.on("dragleave",function(St,_t){Vt.current.classList.remove("mouse-hover-md")}),yt.on("dragover",function(St,_t){Vt.current.classList.add("mouse-hover-md")}),yt.on("drop",function(St,_t){Vt.current.classList.add("mouse-hover-md");var Wt;if(Wt=_t.dataTransfer.files,Wt.length>0){_t.preventDefault(),_t.stopPropagation();for(var $t=function(Mr){var Nt=Wt[Mr],En=Nt.name.split(".").pop();xe(Nt,function(Gt){if(Gt.id){var gr,qr,en;(Nt==null||((gr=Nt.type)===null||gr===void 0)?void 0:gr.indexOf("image"))>-1?yt.replaceSelection(".concat(Gt.content_type,")")):(Nt==null||((qr=Nt.type)===null||qr===void 0)?void 0:qr.indexOf("video"))>-1?yt.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Gt.id,'"></video>')):(Nt==null||((en=Nt.type)===null||en===void 0)?void 0:en.indexOf("pdf"))>-1?yt.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Nt.type,'&disposition=inline" target="_blank">').concat(Nt.name,"</a>")):re.includes(En)?yt.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Gt.id,'?type=office&disposition=inline" target="_blank">').concat(Nt.name,"</a>")):yt.replaceSelection("[".concat(Nt.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Gt.content_type,")"))}else(Gt==null?void 0:Gt.status)===401&&(document.location.href="/user/login")})},Bt=0;Bt<Wt.length;Bt++)$t(Bt)}}),G(yt),function(){yt.off("paste",Dt)}}},[]);var zn=Object(d.useCallback)(function(){if(Vt.current)try{}catch(yt){console.log(yt,"---- to set md editor body height")}},[an,Vt,pr]);Object(d.useEffect)(function(){function yt(){var St=new g.default(function(_t){var Wt=Object(O.a)(_t),$t;try{for(Wt.s();!($t=Wt.n()).done;){var Bt=$t.value;(Bt.target.offsetHeight>0||Bt.target.offsetWidth>0)&&(zn(),X.setSize("100%","100%"),X.refresh())}}catch(hr){Wt.e(hr)}finally{Wt.f()}});return St.observe(dr.current.parentElement),St}if(X){var Dt=yt();return function(){Dt.unobserve(dr.current.parentElement)}}},[X,zn]),Object(d.useEffect)(function(){if(X){for(var yt=[],Dt=function(){var Bt=_t[St];Wt=Object(W.a)(Bt,2);var hr=Wt[0],Mr=Wt[1],Nt=Object(N.a)({},hr,function(){Vn(Mr)});yt.push(Nt),X.addKeyMap(Nt)},St=0,_t=Object.entries(ue);St<_t.length;St++){var Wt;Dt()}return Ut.current=setInterval(function(){Er.current&&Pr()},4e3),function(){clearInterval(Ut.current);var $t=Object(O.a)(yt),Bt;try{for($t.s();!(Bt=$t.n()).done;){var hr=Bt.value;X.removeKeyMap(hr)}}catch(Mr){$t.e(Mr)}finally{$t.f()}}}},[X]),Object(d.useEffect)(function(){Ot!==pr&&Qr(Ot)},[Ot]),Object($e.a)(function(){if(!rr&&mn>0){var yt=new Date().getTime(),Dt=window.sessionStorage.getItem(st);yt>=mn+Be&&(!Dt||Dt!==rt)&&(window.sessionStorage.setItem(st,rt),or(!0))}},Be),Object(d.useEffect)(function(){er(kt)},[X,kt]),Object(d.useEffect)(function(){X&&(Ht&&X.focus())},[X,Ht]),Object(d.useEffect)(function(){if(It&&X){var yt=X.getScrollerElement();function Dt(St){var _t=St.target;if(lr.current){var Wt=_t.scrollTop/_t.scrollHeight;lr.current.scrollTop=lr.current.scrollHeight*Wt}}return yt.addEventListener("scroll",Dt),function(){yt.removeEventListener("scroll",Dt)}}},[X,It]),Object(d.useEffect)(function(){if(X&&Kr){function yt(Dt,St){Kr(Dt,St)}return X.on("beforeChange",yt),function(){X.off("beforeChange",yt)}}},[X,Kr]),Object(d.useEffect)(function(){if(X&&Ar){function yt(){Ar(X.getValue())}return X.on("blur",yt),function(){X.off("blur",yt)}}},[X,Ar]),Object(d.useEffect)(function(){if(X){function yt(Dt){var St=Dt.getValue();pt(St),dn(new Date().getTime()),Dt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),ct&&ct(St)}return X.on("change",yt),function(){X.off("change",yt)}}},[X,ct]),Object(d.useEffect)(function(){X&&(ot==null?(X.setValue(""),pt("")):ot!==X.getValue()&&(X.setValue(ot),pt(ot),X.setCursor(X.lineCount(),0)))},[X,ot]);var Vn=Object(d.useCallback)(function(yt){var Dt=X.getCursor(),St=X.getSelection(),_t=St.split(`
|
|
`);switch(yt){case"bold":return X.replaceSelection("**"+St+"**"),St===""&&X.setCursor(Dt.line,Dt.ch+2),X.focus();case"italic":return X.replaceSelection("*"+St+"*"),St===""&&X.setCursor(Dt.line,Dt.ch+1),X.focus();case"code":return X.replaceSelection("`"+St+"`"),St===""&&X.setCursor(Dt.line,Dt.ch+1),X.focus();case"inline-latex":return X.replaceSelection("`$$"+St+"$$`"),St===""&&X.setCursor(Dt.line,Dt.ch+3),X.focus();case"latex":return X.replaceSelection("```latex\n"+St+"\n```"),X.setCursor(Dt.line+1,St.length+1),X.focus();case"line-break":return X.replaceSelection(`<br/>
|
|
`),X.focus();case"list-ul":return St===""?X.replaceSelection("- "+St):X.replaceSelection(_t.map(function(Wt){return Wt===""?"":"- ".concat(Wt)}).join(`
|
|
`)),X.focus();case"list-ol":return St===""?X.replaceSelection("1. "+St):X.replaceSelection(_t.map(function(Wt,$t){return Wt===""?"":"".concat($t+1,". ").concat(Wt)}).join(`
|
|
`)),X.focus();case"add-null-ch":return St===""&&X.setCursor(Dt.line,Dt.ch+1),X.replaceSelection(Ke),X.focus();case"inster-template-1":return St===""&&X.setCursor(Dt.line,Dt.ch),X.replaceSelection(Ee),X.focus();case"eraser":return X.setValue(""),X.focus();case"trigger-watch":return er(!It),X.focus();case"trigger-full-screen":return Qr(!pr),X.focus();case Fe:jr(Fe);return;case Je:jr(Je);return;case et:jr(et);return;case Qe:jr(Qe);return;default:throw new Error}},[X,It,pr]),xn=Object(d.useCallback)(function(yt){jr("");switch(Xr){case Fe:var Dt=yt.title,St=yt.link;return X.replaceSelection("[".concat(Dt,"](").concat(St,")")),X.focus();case Je:var _t=yt.language,Wt=yt.content;return X.replaceSelection(["```"+_t,Wt,"```"].join(`
|
|
`)),X.focus();case et:var $t=yt.src,Bt=yt.alt,hr=yt.name;return $t.indexOf("type=image")>-1?X.replaceSelection(".concat($t,' "').concat(Bt||"",'" )')):$t.indexOf("type=application/pdf")>-1?X.replaceSelection('<a href="'.concat($t,'&disposition=inline" target="_blank">').concat(hr,"</a>")):X.replaceSelection('<a href="'.concat($t,'" target="_blank">').concat(hr,"</a>")),X.focus();case Qe:for(var Mr=yt.row,Nt=yt.col,En=yt.align,Gt=`
|
|
`,gr=0;gr<Mr;gr++){for(var qr=[],en=[],Wi=0;Wi<Nt;Wi++)gr===1&&en.push(dt[En]),qr.push(" ");gr===1&&(Gt+="| ".concat(en.join(" | "),` |
|
|
`)),Gt+="| ".concat(qr.join(Nt===1?"":" | "),` |
|
|
`)}return X.replaceSelection(Gt+`
|
|
`),X.focus();default:throw new Error}},[X,Xr]),Ui=Object(d.useMemo)(function(){switch(Xr){case Fe:return f.a.createElement(he,{callback:xn,onCancel:Wr});case Je:return f.a.createElement(Ce.b,{callback:xn,onCancel:Wr});case et:return f.a.createElement(ne,{callback:xn,onCancel:Wr});case Qe:return f.a.createElement(Ne,{callback:xn,onCancel:Wr});default:return null}},[Xr]);function Wr(){jr("")}Object(d.useEffect)(function(){if(hn.current){var yt=hn.current,Dt=!1,St=0;function _t(Bt){Dt=!0,St=Bt.pageY}function Wt(){Dt=!1}function $t(Bt){if(Dt){var hr=Bt.pageY-St;hr<0&&(hr=0),hr>300&&(hr=300);var Mr=ft+hr+"px";Yr(Mr)}}return yt.addEventListener("mousedown",_t),document.addEventListener("mousemove",$t),document.addEventListener("mouseup",Wt),function(){yt.removeEventListener("mousedown",_t),document.removeEventListener("mousemove",$t),document.removeEventListener("mouseup",Wt)}}},[X,hn]),Object(d.useEffect)(function(){Yr(ft)},[ft]);var fi=me(At),on=me(an),Xn={width:fi,height:on},ji=Object(d.useMemo)(function(){if(mn){var yt=new Date(mn),Dt=yt.getHours(),St=yt.getMinutes(),_t=yt.getSeconds();return Dt=Dt<10?"0"+Dt:Dt,St=St<10?"0"+St:St,_t=_t<10?"0"+_t:_t,"".concat(Dt,":").concat(St,":").concat(_t)}return 0},[mn]);function Pn(){window.sessionStorage.removeItem(st),or(!1),dn(0)}function $a(){or(!1),dn(0),X.setValue(window.sessionStorage.getItem(st))}function da(yt,Dt){var St=X.getValue();St=St.replace(yt,Dt),pt(St),X==null||X.setValue(St)}return f.a.createElement(d.Fragment,null,f.a.createElement("div",{className:"markdown-editor-wrapper",ref:Vt},f.a.createElement("div",{className:"markdown-editor-container ".concat(lt," ").concat(It?"on-preview":""," ").concat(Ft?"mini":""," ").concat(pr?"full-screen":""),style:Xn},f.a.createElement(T,{insertTemp:Ur,watch:It,fullScreen:pr,showNullButton:gt,onActionCallback:Vn,hidetoolBar:tn,uuid:jt.current,setOpenPhones:function(){Er.current=!0}}),f.a.createElement("div",{className:"markdown-editor-body"},f.a.createElement("div",{className:"codemirror-container"},f.a.createElement("textarea",{ref:dr,placeholder:qt})),It?f.a.createElement("div",{ref:lr,className:"preview-container"},bt==="stex"&&f.a.createElement(k,{value:rt}),bt!=="stex"&&f.a.createElement(v.a,{edit:!0,value:rt,replaces:da})):null))),Zt?f.a.createElement("a",{ref:hn,className:"editor-resize"}):null,f.a.createElement(_.a,null,fe[Xr]?f.a.createElement($.a,{centered:!0,title:fe[Xr],visible:!0,onCancel:Wr,footer:null},Ui):null))}},QDVR:function(vt,Te,Q){"use strict";Q.d(Te,"e",function(){return $}),Q.d(Te,"d",function(){return O}),Q.d(Te,"c",function(){return W}),Q.d(Te,"b",function(){return N}),Q.d(Te,"a",function(){return R});var ie=function(){var d=function(f,w){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,g){p.__proto__=g}||function(p,g){for(var b in g)g.hasOwnProperty(b)&&(p[b]=g[b])},d(f,w)};return function(f,w){d(f,w);function p(){this.constructor=f}f.prototype=w===null?Object.create(w):(p.prototype=w.prototype,new p)}}();function $(d){var f=[];return d.forEach(function(w){return f.push(w)}),f}function O(d){var f=[];return d.forEach(function(w,p){return f.push(p)}),f}var V=function(){function d(){this._value="",this._pos=0}return d.prototype.reset=function(f){return this._value=f,this._pos=0,this},d.prototype.next=function(){return this._pos+=1,this},d.prototype.hasNext=function(){return this._pos<this._value.length-1},d.prototype.cmp=function(f){var w=f.charCodeAt(0),p=this._value.charCodeAt(this._pos);return w-p},d.prototype.value=function(){return this._value[this._pos]},d}(),I=function(){function d(f){f===void 0&&(f=!0),this._splitOnBackslash=f}return d.prototype.reset=function(f){return this._value=f.replace(/\\$|\/$/,""),this._from=0,this._to=0,this.next()},d.prototype.hasNext=function(){return this._to<this._value.length},d.prototype.next=function(){this._from=this._to;for(var f=!0;this._to<this._value.length;this._to++){var w=this._value.charCodeAt(this._to);if(w===47||this._splitOnBackslash&&w===92)if(f)this._from++;else break;else f=!1}return this},d.prototype.cmp=function(f){for(var w=0,p=f.length,g=this._from;w<p&&g<this._to;){var b=f.charCodeAt(w)-this._value.charCodeAt(g);if(b!==0)return b;w+=1,g+=1}return p===this._to-this._from?0:w<p?-1:1},d.prototype.value=function(){return this._value.substring(this._from,this._to)},d}(),M=function(){function d(){}return d}(),W=function(){function d(f){this._iter=f}return d.forPaths=function(){return new d(new I)},d.forStrings=function(){return new d(new V)},d.prototype.clear=function(){this._root=void 0},d.prototype.set=function(f,w){var p=this._iter.reset(f),g;for(this._root||(this._root=new M,this._root.segment=p.value()),g=this._root;;){var b=p.cmp(g.segment);if(b>0)g.left||(g.left=new M,g.left.segment=p.value()),g=g.left;else if(b<0)g.right||(g.right=new M,g.right.segment=p.value()),g=g.right;else if(p.hasNext())p.next(),g.mid||(g.mid=new M,g.mid.segment=p.value()),g=g.mid;else break}var o=g.value;return g.value=w,g.key=f,o},d.prototype.get=function(f){for(var w=this._iter.reset(f),p=this._root;p;){var g=w.cmp(p.segment);if(g>0)p=p.left;else if(g<0)p=p.right;else if(w.hasNext())w.next(),p=p.mid;else break}return p?p.value:void 0},d.prototype.findSubstr=function(f){for(var w=this._iter.reset(f),p=this._root,g=void 0;p;){var b=w.cmp(p.segment);if(b>0)p=p.left;else if(b<0)p=p.right;else if(w.hasNext())w.next(),g=p.value||g,p=p.mid;else break}return p&&p.value||g},d.prototype.forEach=function(f){this._forEach(this._root,f)},d.prototype._forEach=function(f,w){f&&(this._forEach(f.left,w),f.value&&w(f.value,f.key),this._forEach(f.mid,w),this._forEach(f.right,w))},d}(),N=function(){function d(){this.map=new Map,this.ignoreCase=!1}return d.prototype.set=function(f,w){this.map.set(this.toKey(f),w)},d.prototype.get=function(f){return this.map.get(this.toKey(f))},d.prototype.toKey=function(f){var w=f.toString();return this.ignoreCase&&(w=w.toLowerCase()),w},d}(),P=function(){function d(){this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0}return d.prototype.clear=function(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0},Object.defineProperty(d.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),d.prototype.get=function(f,w){w===void 0&&(w=0);var p=this._map.get(f);return p?(w!==0&&this.touch(p,w),p.value):void 0},d.prototype.set=function(f,w,p){p===void 0&&(p=0);var g=this._map.get(f);if(g)g.value=w,p!==0&&this.touch(g,p);else{g={key:f,value:w,next:void 0,previous:void 0};switch(p){case 0:this.addItemLast(g);break;case 1:this.addItemFirst(g);break;case 2:this.addItemLast(g);break;default:this.addItemLast(g);break}this._map.set(f,g),this._size++}},d.prototype.delete=function(f){return!!this.remove(f)},d.prototype.remove=function(f){var w=this._map.get(f);return w?(this._map.delete(f),this.removeItem(w),this._size--,w.value):void 0},d.prototype.forEach=function(f,w){for(var p=this._head;p;)w?f.bind(w)(p.value,p.key,this):f(p.value,p.key,this),p=p.next},d.prototype.trimOld=function(f){if(f>=this.size)return;if(f===0){this.clear();return}for(var w=this._head,p=this.size;w&&p>f;)this._map.delete(w.key),w=w.next,p--;this._head=w,this._size=p,w&&(w.previous=void 0)},d.prototype.addItemFirst=function(f){if(!this._head&&!this._tail)this._tail=f;else if(this._head)f.next=this._head,this._head.previous=f;else throw new Error("Invalid list");this._head=f},d.prototype.addItemLast=function(f){if(!this._head&&!this._tail)this._head=f;else if(this._tail)f.previous=this._tail,this._tail.next=f;else throw new Error("Invalid list");this._tail=f},d.prototype.removeItem=function(f){if(f===this._head&&f===this._tail)this._head=void 0,this._tail=void 0;else if(f===this._head){if(!f.next)throw new Error("Invalid list");f.next.previous=void 0,this._head=f.next}else if(f===this._tail){if(!f.previous)throw new Error("Invalid list");f.previous.next=void 0,this._tail=f.previous}else{var w=f.next,p=f.previous;if(!w||!p)throw new Error("Invalid list");w.previous=p,p.next=w}f.next=void 0,f.previous=void 0},d.prototype.touch=function(f,w){if(!this._head||!this._tail)throw new Error("Invalid list");if(w!==1&&w!==2)return;if(w===1){if(f===this._head)return;var p=f.next,g=f.previous;f===this._tail?(g.next=void 0,this._tail=g):(p.previous=g,g.next=p),f.previous=void 0,f.next=this._head,this._head.previous=f,this._head=f}else if(w===2){if(f===this._tail)return;var p=f.next,g=f.previous;f===this._head?(p.previous=void 0,this._head=p):(p.previous=g,g.next=p),f.next=void 0,f.previous=this._tail,this._tail.next=f,this._tail=f}},d.prototype.toJSON=function(){var f=[];return this.forEach(function(w,p){f.push([p,w])}),f},d}(),R=function(d){ie(f,d);function f(w,p){p===void 0&&(p=1);var g=d.call(this)||this;return g._limit=w,g._ratio=Math.min(Math.max(0,p),1),g}return f.prototype.get=function(w){return d.prototype.get.call(this,w,2)},f.prototype.peek=function(w){return d.prototype.get.call(this,w,0)},f.prototype.set=function(w,p){d.prototype.set.call(this,w,p,2),this.checkTrim()},f.prototype.checkTrim=function(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))},f}(P)},RxwV:function(vt,Te,Q){"use strict";var ie=Q("q1tI"),$=Q("uciX"),O=Q("2W6z"),V=Q.n(O),I=Q("4IlW"),M=Q("uK0f"),W=Q.n(M);function N(ce,ve){if(ce===ve)return!0;if(!ce||!ve)return!1;var le=ce.length;if(ve.length!==le)return!1;for(var ne=0;ne<le;ne++)if(ce[ne]!==ve[ne])return!1;return!0}function P(ce){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?P=function(le){return typeof le}:P=function(le){return le&&typeof Symbol=="function"&&le.constructor===Symbol&&le!==Symbol.prototype?"symbol":typeof le},P(ce)}function R(ce,ve){if(!(ce instanceof ve))throw new TypeError("Cannot call a class as a function")}function d(ce,ve){for(var le=0;le<ve.length;le++){var ne=ve[le];ne.enumerable=ne.enumerable||!1,ne.configurable=!0,"value"in ne&&(ne.writable=!0),Object.defineProperty(ce,ne.key,ne)}}function f(ce,ve,le){return ve&&d(ce.prototype,ve),le&&d(ce,le),ce}function w(ce,ve){if(typeof ve!="function"&&ve!==null)throw new TypeError("Super expression must either be null or a function");ce.prototype=Object.create(ve&&ve.prototype,{constructor:{value:ce,writable:!0,configurable:!0}}),ve&&p(ce,ve)}function p(ce,ve){return p=Object.setPrototypeOf||function(ne,Le){return ne.__proto__=Le,ne},p(ce,ve)}function g(ce){var ve=i();return function(){var le=s(ce),ne;if(ve){var Le=s(this).constructor;ne=Reflect.construct(le,arguments,Le)}else ne=le.apply(this,arguments);return b(this,ne)}}function b(ce,ve){return ve&&(P(ve)==="object"||typeof ve=="function")?ve:o(ce)}function o(ce){if(ce===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return ce}function i(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(ce){return!1}}function s(ce){return s=Object.setPrototypeOf?Object.getPrototypeOf:function(le){return le.__proto__||Object.getPrototypeOf(le)},s(ce)}var l=function(){var ce=function(ve){w(ne,ve);var le=g(ne);function ne(){var Le;return R(this,ne),Le=le.apply(this,arguments),Le.menuItems={},Le.saveMenuItem=function(xe){return function(Ie){Le.menuItems[xe]=Ie}},Le}return f(ne,[{key:"componentDidMount",value:function(){this.scrollActiveItemToView()}},{key:"componentDidUpdate",value:function(xe){!xe.visible&&this.props.visible&&this.scrollActiveItemToView()}},{key:"getFieldName",value:function(xe){var Ie=this.props,Re=Ie.fieldNames,ae=Ie.defaultFieldNames;return Re[xe]||ae[xe]}},{key:"getOption",value:function(xe,Ie){var Re=this.props,ae=Re.prefixCls,oe=Re.expandTrigger,be=Re.expandIcon,Ae=Re.loadingIcon,Ne=this.props.onSelect.bind(this,xe,Ie),_e=this.props.onItemDoubleClick.bind(this,xe,Ie),We={onClick:Ne,onDoubleClick:_e},Fe="".concat(ae,"-menu-item"),et=null,Je=xe[this.getFieldName("children")]&&xe[this.getFieldName("children")].length>0;(Je||xe.isLeaf===!1)&&(Fe+=" ".concat(ae,"-menu-item-expand"),xe.loading||(et=ie.createElement("span",{className:"".concat(ae,"-menu-item-expand-icon")},be))),oe==="hover"&&(Je||xe.isLeaf===!1)&&(We={onMouseEnter:this.delayOnSelect.bind(this,Ne),onMouseLeave:this.delayOnSelect.bind(this),onClick:Ne}),this.isActiveOption(xe,Ie)&&(Fe+=" ".concat(ae,"-menu-item-active"),We.ref=this.saveMenuItem(Ie)),xe.disabled&&(Fe+=" ".concat(ae,"-menu-item-disabled"));var Qe=null;xe.loading&&(Fe+=" ".concat(ae,"-menu-item-loading"),Qe=Ae||null);var Ye="";return"title"in xe?Ye=xe.title:typeof xe[this.getFieldName("label")]=="string"&&(Ye=xe[this.getFieldName("label")]),ie.createElement("li",Object.assign({key:xe[this.getFieldName("value")],className:Fe,title:Ye},We,{role:"menuitem",onMouseDown:function($e){return $e.preventDefault()}}),xe[this.getFieldName("label")],et,Qe)}},{key:"getActiveOptions",value:function(xe){var Ie=this,Re=this.props.options,ae=xe||this.props.activeValue;return W()(Re,function(oe,be){return oe[Ie.getFieldName("value")]===ae[be]},{childrenKeyName:this.getFieldName("children")})}},{key:"getShowOptions",value:function(){var xe=this,Ie=this.props.options,Re=this.getActiveOptions().map(function(ae){return ae[xe.getFieldName("children")]}).filter(function(ae){return!!ae});return Re.unshift(Ie),Re}},{key:"delayOnSelect",value:function(xe){for(var Ie=this,Re=arguments.length,ae=new Array(Re>1?Re-1:0),oe=1;oe<Re;oe++)ae[oe-1]=arguments[oe];this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null),typeof xe=="function"&&(this.delayTimer=window.setTimeout(function(){xe(ae),Ie.delayTimer=null},150))}},{key:"scrollActiveItemToView",value:function(){for(var xe=this.getShowOptions().length,Ie=0;Ie<xe;Ie++){var Re=this.menuItems[Ie];Re&&Re.parentElement&&(Re.parentElement.scrollTop=Re.offsetTop)}}},{key:"isActiveOption",value:function(xe,Ie){var Re=this.props.activeValue,ae=Re===void 0?[]:Re;return ae[Ie]===xe[this.getFieldName("value")]}},{key:"render",value:function(){var xe=this,Ie=this.props,Re=Ie.prefixCls,ae=Ie.dropdownMenuColumnStyle;return ie.createElement("div",null,this.getShowOptions().map(function(oe,be){return ie.createElement("ul",{className:"".concat(Re,"-menu"),key:be,style:ae},oe.map(function(Ae){return xe.getOption(Ae,be)}))}))}}]),ne}(ie.Component);return ce.defaultProps={options:[],value:[],activeValue:[],onSelect:function(){},prefixCls:"rc-cascader-menus",visible:!1,expandTrigger:"click"},ce}(),C=l,m={bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},topLeft:{points:["bl","tl"],offset:[0,-4],overflow:{adjustX:1,adjustY:1}},bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},topRight:{points:["br","tr"],offset:[0,-4],overflow:{adjustX:1,adjustY:1}}},v=m;function k(ce){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?k=function(le){return typeof le}:k=function(le){return le&&typeof Symbol=="function"&&le.constructor===Symbol&&le!==Symbol.prototype?"symbol":typeof le},k(ce)}function L(ce,ve){if(ce==null)return{};var le=E(ce,ve),ne,Le;if(Object.getOwnPropertySymbols){var xe=Object.getOwnPropertySymbols(ce);for(Le=0;Le<xe.length;Le++){if(ne=xe[Le],ve.indexOf(ne)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(ce,ne))continue;le[ne]=ce[ne]}}return le}function E(ce,ve){if(ce==null)return{};var le={},ne=Object.keys(ce),Le,xe;for(xe=0;xe<ne.length;xe++){if(Le=ne[xe],ve.indexOf(Le)>=0)continue;le[Le]=ce[Le]}return le}function y(ce){return S(ce)||A(ce)||u(ce)||c()}function c(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function u(ce,ve){if(!ce)return;if(typeof ce=="string")return T(ce,ve);var le=Object.prototype.toString.call(ce).slice(8,-1);if(le==="Object"&&ce.constructor&&(le=ce.constructor.name),le==="Map"||le==="Set")return Array.from(ce);if(le==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(le))return T(ce,ve)}function A(ce){if(typeof Symbol!="undefined"&&Symbol.iterator in Object(ce))return Array.from(ce)}function S(ce){if(Array.isArray(ce))return T(ce)}function T(ce,ve){(ve==null||ve>ce.length)&&(ve=ce.length);for(var le=0,ne=new Array(ve);le<ve;le++)ne[le]=ce[le];return ne}function _(ce,ve){if(!(ce instanceof ve))throw new TypeError("Cannot call a class as a function")}function j(ce,ve){for(var le=0;le<ve.length;le++){var ne=ve[le];ne.enumerable=ne.enumerable||!1,ne.configurable=!0,"value"in ne&&(ne.writable=!0),Object.defineProperty(ce,ne.key,ne)}}function z(ce,ve,le){return ve&&j(ce.prototype,ve),le&&j(ce,le),ce}function Z(ce,ve){if(typeof ve!="function"&&ve!==null)throw new TypeError("Super expression must either be null or a function");ce.prototype=Object.create(ve&&ve.prototype,{constructor:{value:ce,writable:!0,configurable:!0}}),ve&&K(ce,ve)}function K(ce,ve){return K=Object.setPrototypeOf||function(ne,Le){return ne.__proto__=Le,ne},K(ce,ve)}function F(ce){var ve=he();return function(){var le=Ce(ce),ne;if(ve){var Le=Ce(this).constructor;ne=Reflect.construct(le,arguments,Le)}else ne=le.apply(this,arguments);return ee(this,ne)}}function ee(ce,ve){return ve&&(k(ve)==="object"||typeof ve=="function")?ve:se(ce)}function se(ce){if(ce===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return ce}function he(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(ce){return!1}}function Ce(ce){return Ce=Object.setPrototypeOf?Object.getPrototypeOf:function(le){return le.__proto__||Object.getPrototypeOf(le)},Ce(ce)}var Ue=function(){var ce=function(ve){Z(ne,ve);var le=F(ne);function ne(Le){var xe;_(this,ne),xe=le.call(this,Le),xe.setPopupVisible=function(Re){var ae=xe.state.value;"popupVisible"in xe.props||xe.setState({popupVisible:Re}),Re&&!xe.state.popupVisible&&xe.setState({activeValue:ae}),xe.props.onPopupVisibleChange(Re)},xe.handleChange=function(Re,ae,oe){var be=ae.visible;(oe.type!=="keydown"||oe.keyCode===I.a.ENTER)&&(xe.props.onChange(Re.map(function(Ae){return Ae[xe.getFieldName("value")]}),Re),xe.setPopupVisible(be))},xe.handlePopupVisibleChange=function(Re){xe.setPopupVisible(Re)},xe.handleMenuSelect=function(Re,ae,oe){var be=xe.trigger.getRootDomNode();be&&be.focus&&be.focus();var Ae=xe.props,Ne=Ae.changeOnSelect,_e=Ae.loadData,We=Ae.expandTrigger;if(!Re||Re.disabled)return;var Fe=xe.state.activeValue;Fe=Fe.slice(0,ae+1),Fe[ae]=Re[xe.getFieldName("value")];var et=xe.getActiveOptions(Fe);if(Re.isLeaf===!1&&!Re[xe.getFieldName("children")]&&_e){Ne&&xe.handleChange(et,{visible:!0},oe),xe.setState({activeValue:Fe}),_e(et);return}var Je={};!Re[xe.getFieldName("children")]||!Re[xe.getFieldName("children")].length?(xe.handleChange(et,{visible:!1},oe),Je.value=Fe):Ne&&(oe.type==="click"||oe.type==="keydown")&&(We==="hover"?xe.handleChange(et,{visible:!1},oe):xe.handleChange(et,{visible:!0},oe),Je.value=Fe),Je.activeValue=Fe,("value"in xe.props||oe.type==="keydown"&&oe.keyCode!==I.a.ENTER)&&delete Je.value,xe.setState(Je)},xe.handleItemDoubleClick=function(){var Re=xe.props.changeOnSelect;Re&&xe.setPopupVisible(!1)},xe.handleKeyDown=function(Re){var ae=xe.props.children;if(ae&&ae.props.onKeyDown){ae.props.onKeyDown(Re);return}var oe=y(xe.state.activeValue),be=oe.length-1<0?0:oe.length-1,Ae=xe.getCurrentLevelOptions(),Ne=Ae.map(function(et){return et[xe.getFieldName("value")]}).indexOf(oe[be]);if(Re.keyCode!==I.a.DOWN&&Re.keyCode!==I.a.UP&&Re.keyCode!==I.a.LEFT&&Re.keyCode!==I.a.RIGHT&&Re.keyCode!==I.a.ENTER&&Re.keyCode!==I.a.SPACE&&Re.keyCode!==I.a.BACKSPACE&&Re.keyCode!==I.a.ESC&&Re.keyCode!==I.a.TAB)return;if(!xe.state.popupVisible&&Re.keyCode!==I.a.BACKSPACE&&Re.keyCode!==I.a.LEFT&&Re.keyCode!==I.a.RIGHT&&Re.keyCode!==I.a.ESC&&Re.keyCode!==I.a.TAB){xe.setPopupVisible(!0);return}if(Re.keyCode===I.a.DOWN||Re.keyCode===I.a.UP){Re.preventDefault();var _e=Ne;_e!==-1?Re.keyCode===I.a.DOWN?(_e+=1,_e=_e>=Ae.length?0:_e):(_e-=1,_e=_e<0?Ae.length-1:_e):_e=0,oe[be]=Ae[_e][xe.getFieldName("value")]}else if(Re.keyCode===I.a.LEFT||Re.keyCode===I.a.BACKSPACE)Re.preventDefault(),oe.splice(oe.length-1,1);else if(Re.keyCode===I.a.RIGHT)Re.preventDefault(),Ae[Ne]&&Ae[Ne][xe.getFieldName("children")]&&oe.push(Ae[Ne][xe.getFieldName("children")][0][xe.getFieldName("value")]);else if(Re.keyCode===I.a.ESC||Re.keyCode===I.a.TAB){xe.setPopupVisible(!1);return}(!oe||oe.length===0)&&xe.setPopupVisible(!1);var We=xe.getActiveOptions(oe),Fe=We[We.length-1];xe.handleMenuSelect(Fe,We.length-1,Re),xe.props.onKeyDown&&xe.props.onKeyDown(Re)},xe.saveTrigger=function(Re){xe.trigger=Re};var Ie=[];return"value"in Le?Ie=Le.value||[]:"defaultValue"in Le&&(Ie=Le.defaultValue||[]),V()(!("filedNames"in Le),"`filedNames` of Cascader is a typo usage and deprecated, please use `fieldNames` instead."),xe.state={popupVisible:Le.popupVisible,activeValue:Ie,value:Ie,prevProps:Le},xe.defaultFieldNames={label:"label",value:"value",children:"children"},xe}return z(ne,[{key:"getPopupDOMNode",value:function(){return this.trigger.getPopupDomNode()}},{key:"getFieldName",value:function(xe){var Ie=this.defaultFieldNames,Re=this.props,ae=Re.fieldNames,oe=Re.filedNames;return"filedNames"in this.props?oe[xe]||Ie[xe]:ae[xe]||Ie[xe]}},{key:"getFieldNames",value:function(){var xe=this.props,Ie=xe.fieldNames,Re=xe.filedNames;return"filedNames"in this.props?Re:Ie}},{key:"getCurrentLevelOptions",value:function(){var xe=this,Ie=this.props.options,Re=Ie===void 0?[]:Ie,ae=this.state.activeValue,oe=ae===void 0?[]:ae,be=W()(Re,function(Ae,Ne){return Ae[xe.getFieldName("value")]===oe[Ne]},{childrenKeyName:this.getFieldName("children")});return be[be.length-2]?be[be.length-2][this.getFieldName("children")]:y(Re).filter(function(Ae){return!Ae.disabled})}},{key:"getActiveOptions",value:function(xe){var Ie=this;return W()(this.props.options||[],function(Re,ae){return Re[Ie.getFieldName("value")]===xe[ae]},{childrenKeyName:this.getFieldName("children")})}},{key:"render",value:function(){var xe=this.props,Ie=xe.prefixCls,Re=xe.transitionName,ae=xe.popupClassName,oe=xe.options,be=oe===void 0?[]:oe,Ae=xe.disabled,Ne=xe.builtinPlacements,_e=xe.popupPlacement,We=xe.children,Fe=xe.dropdownRender,et=L(xe,["prefixCls","transitionName","popupClassName","options","disabled","builtinPlacements","popupPlacement","children","dropdownRender"]),Je=ie.createElement("div",null),Qe="";be&&be.length>0?Je=ie.createElement(C,Object.assign({},this.props,{fieldNames:this.getFieldNames(),defaultFieldNames:this.defaultFieldNames,activeValue:this.state.activeValue,onSelect:this.handleMenuSelect,onItemDoubleClick:this.handleItemDoubleClick,visible:this.state.popupVisible})):Qe=" ".concat(Ie,"-menus-empty");var Ye=Je;return Fe&&(Ye=Fe(Je)),ie.createElement($.a,Object.assign({ref:this.saveTrigger},et,{popupPlacement:_e,builtinPlacements:Ne,popupTransitionName:Re,action:Ae?[]:["click"],popupVisible:Ae?!1:this.state.popupVisible,onPopupVisibleChange:this.handlePopupVisibleChange,prefixCls:"".concat(Ie,"-menus"),popupClassName:ae+Qe,popup:Ye}),ie.cloneElement(We,{onKeyDown:this.handleKeyDown,tabIndex:Ae?void 0:0}))}}],[{key:"getDerivedStateFromProps",value:function(xe,Ie){var Re=Ie.prevProps,ae=Re===void 0?{}:Re,oe={prevProps:xe};return"value"in xe&&!N(ae.value,xe.value)&&(oe.value=xe.value||[],"loadData"in xe||(oe.activeValue=xe.value||[])),"popupVisible"in xe&&(oe.popupVisible=xe.popupVisible),oe}}]),ne}(ie.Component);return ce.defaultProps={onChange:function(){},onPopupVisibleChange:function(){},disabled:!1,transitionName:"",prefixCls:"rc-cascader",popupClassName:"",popupPlacement:"bottomLeft",builtinPlacements:v,expandTrigger:"click",fieldNames:{label:"label",value:"value",children:"children"},expandIcon:">"},ce}(),ke=Ue,Me=Te.a=ke},SJMd:function(vt,Te){/**
|
|
* @license
|
|
* Copyright (C) 2006 Google Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var Q,ie,$,O=!1,V,I;window.PR_SHOULD_USE_CONTINUATION=!0;var M,W;(function(){var N=window,P=["break,continue,do,else,for,if,return,while"],R=[P,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],d=[R,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],f=[d,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],w=[d,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],p=[d,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],g="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",b=[d,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],o="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",i=[P,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],s=[P,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],l=[P,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],C=[f,p,w,b,o,i,s,l],m=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,v="str",k="kwd",L="com",E="typ",y="lit",c="pun",u="pln",A="tag",S="dec",T="src",_="atn",j="atv",z="nocode",Z="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function K(oe){for(var be=0,Ae=!1,Ne=!1,_e=0,We=oe.length;_e<We;++_e){var Fe=oe[_e];if(Fe.ignoreCase)Ne=!0;else if(/[a-z]/i.test(Fe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Ae=!0,Ne=!1;break}}var et={b:8,t:9,n:10,v:11,f:12,r:13};function Je(tt){var Oe=tt.charCodeAt(0);if(Oe!==92)return Oe;var Ze=tt.charAt(1);return Oe=et[Ze],Oe||("0"<=Ze&&Ze<="7"?parseInt(tt.substring(1),8):Ze==="u"||Ze==="x"?parseInt(tt.substring(2),16):tt.charCodeAt(1))}function Qe(tt){if(tt<32)return(tt<16?"\\x0":"\\x")+tt.toString(16);var Oe=String.fromCharCode(tt);return Oe==="\\"||Oe==="-"||Oe==="]"||Oe==="^"?"\\"+Oe:Oe}function Ye(tt){var Oe=tt.substring(1,tt.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),Ze=[],at=Oe[0]==="^",Be=["["];at&&Be.push("^");for(var Ke=at?1:0,Ee=Oe.length;Ke<Ee;++Ke){var me=Oe[Ke];if(/\\[bdsw]/i.test(me))Be.push(me);else{var ye=Je(me),te;Ke+2<Ee&&Oe[Ke+1]==="-"?(te=Je(Oe[Ke+2]),Ke+=2):te=ye,Ze.push([ye,te]),te<65||ye>122||(te<65||ye>90||Ze.push([Math.max(65,ye)|32,Math.min(te,90)|32]),te<97||ye>122||Ze.push([Math.max(97,ye)&~32,Math.min(te,122)&~32]))}}Ze.sort(function(Pe,Se){return Pe[0]-Se[0]||Se[1]-Pe[1]});for(var re=[],ue=[],Ke=0;Ke<Ze.length;++Ke){var fe=Ze[Ke];fe[0]<=ue[1]+1?ue[1]=Math.max(ue[1],fe[1]):re.push(ue=fe)}for(var Ke=0;Ke<re.length;++Ke){var fe=re[Ke];Be.push(Qe(fe[0])),fe[1]>fe[0]&&(fe[1]+1>fe[0]&&Be.push("-"),Be.push(Qe(fe[1])))}return Be.push("]"),Be.join("")}function dt(tt){for(var Oe=tt.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),Ze=Oe.length,at=[],Be=0,Ke=0;Be<Ze;++Be){var Ee=Oe[Be];if(Ee==="(")++Ke;else if(Ee.charAt(0)==="\\"){var me=+Ee.substring(1);me&&(me<=Ke?at[me]=-1:Oe[Be]=Qe(me))}}for(var Be=1;Be<at.length;++Be)at[Be]===-1&&(at[Be]=++be);for(var Be=0,Ke=0;Be<Ze;++Be){var Ee=Oe[Be];if(Ee==="(")++Ke,at[Ke]||(Oe[Be]="(?:");else if(Ee.charAt(0)==="\\"){var me=+Ee.substring(1);me&&me<=Ke&&(Oe[Be]="\\"+at[me])}}for(var Be=0;Be<Ze;++Be)Oe[Be]==="^"&&Oe[Be+1]!=="^"&&(Oe[Be]="");if(tt.ignoreCase&&Ae)for(var Be=0;Be<Ze;++Be){var Ee=Oe[Be],ye=Ee.charAt(0);Ee.length>=2&&ye==="["?Oe[Be]=Ye(Ee):ye!=="\\"&&(Oe[Be]=Ee.replace(/[a-zA-Z]/g,function(ue){var fe=ue.charCodeAt(0);return"["+String.fromCharCode(fe&~32,fe|32)+"]"}))}return Oe.join("")}for(var $e=[],_e=0,We=oe.length;_e<We;++_e){var Fe=oe[_e];if(Fe.global||Fe.multiline)throw new Error(""+Fe);$e.push("(?:"+dt(Fe)+")")}return new RegExp($e.join("|"),Ne?"gi":"g")}function F(oe,be){var Ae=/(?:^|\s)nocode(?:\s|$)/,Ne=[],_e=0,We=[],Fe=0;function et(Je){var Qe=Je.nodeType;if(Qe==1){if(Ae.test(Je.className))return;for(var Ye=Je.firstChild;Ye;Ye=Ye.nextSibling)et(Ye);var dt=Je.nodeName.toLowerCase();(dt==="br"||dt==="li")&&(Ne[Fe]=`
|
|
`,We[Fe<<1]=_e++,We[Fe++<<1|1]=Je)}else if(Qe==3||Qe==4){var $e=Je.nodeValue;$e.length&&(be?$e=$e.replace(/\r\n?/g,`
|
|
`):$e=$e.replace(/[ \t\r\n]+/g," "),Ne[Fe]=$e,We[Fe<<1]=_e,_e+=$e.length,We[Fe++<<1|1]=Je)}}return et(oe),{sourceCode:Ne.join("").replace(/\n$/,""),spans:We}}function ee(oe,be,Ae,Ne,_e){if(!Ae)return;var We={sourceNode:oe,pre:1,langExtension:null,numberLines:null,sourceCode:Ae,spans:null,basePos:be,decorations:null};Ne(We),_e.push.apply(_e,We.decorations)}var se=/\S/;function he(oe){for(var be=void 0,Ae=oe.firstChild;Ae;Ae=Ae.nextSibling){var Ne=Ae.nodeType;be=Ne===1?be?oe:Ae:Ne===3&&se.test(Ae.nodeValue)?oe:be}return be===oe?void 0:be}function Ce(oe,be){var Ae={},Ne;(function(){for(var Fe=oe.concat(be),et=[],Je={},Qe=0,Ye=Fe.length;Qe<Ye;++Qe){var dt=Fe[Qe],$e=dt[3];if($e)for(var tt=$e.length;--tt>=0;)Ae[$e.charAt(tt)]=dt;var Oe=dt[1],Ze=""+Oe;Je.hasOwnProperty(Ze)||(et.push(Oe),Je[Ze]=null)}et.push(/[\0-\uffff]/),Ne=K(et)})();var _e=be.length,We=function(Fe){for(var et=Fe.sourceCode,Je=Fe.basePos,Qe=Fe.sourceNode,Ye=[Je,u],dt=0,$e=et.match(Ne)||[],tt={},Oe=0,Ze=$e.length;Oe<Ze;++Oe){var at=$e[Oe],Be=tt[at],Ke=void 0,Ee;if(typeof Be=="string")Ee=!1;else{var me=Ae[at.charAt(0)];if(me)Ke=at.match(me[1]),Be=me[0];else{for(var ye=0;ye<_e;++ye)if(me=be[ye],Ke=at.match(me[1]),Ke){Be=me[0];break}Ke||(Be=u)}Ee=Be.length>=5&&Be.substring(0,5)==="lang-",Ee&&!(Ke&&typeof Ke[1]=="string")&&(Ee=!1,Be=T),Ee||(tt[at]=Be)}var te=dt;if(dt+=at.length,!Ee)Ye.push(Je+te,Be);else{var re=Ke[1],ue=at.indexOf(re),fe=ue+re.length;Ke[2]&&(fe=at.length-Ke[2].length,ue=fe-re.length);var Pe=Be.substring(5);ee(Qe,Je+te,at.substring(0,ue),We,Ye),ee(Qe,Je+te+ue,re,ne(Pe,re),Ye),ee(Qe,Je+te+fe,at.substring(fe),We,Ye)}}Fe.decorations=Ye};return We}function Ue(oe){var be=[],Ae=[];oe.tripleQuotedStrings?be.push([v,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):oe.multiLineStrings?be.push([v,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):be.push([v,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),oe.verbatimStrings&&Ae.push([v,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ne=oe.hashComments;Ne&&(oe.cStyleComments?(Ne>1?be.push([L,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):be.push([L,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Ae.push([v,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):be.push([L,/^#[^\r\n]*/,null,"#"])),oe.cStyleComments&&(Ae.push([L,/^\/\/[^\r\n]*/,null]),Ae.push([L,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var _e=oe.regexLiterals;if(_e){var We=_e>1?"":`
|
|
\r`,Fe=We?".":"[\\S\\s]",et="/(?=[^/*"+We+"])(?:[^/\\x5B\\x5C"+We+"]|\\x5C"+Fe+"|\\x5B(?:[^\\x5C\\x5D"+We+"]|\\x5C"+Fe+")*(?:\\x5D|$))+/";Ae.push(["lang-regex",RegExp("^"+Z+"("+et+")")])}var Je=oe.types;Je&&Ae.push([E,Je]);var Qe=(""+oe.keywords).replace(/^ | $/g,"");Qe.length&&Ae.push([k,new RegExp("^(?:"+Qe.replace(/[\s,]+/g,"|")+")\\b"),null]),be.push([u,/^\s+/,null,` \r
|
|
\xA0`]);var Ye="^.[^\\s\\w.$@'\"`/\\\\]*";return oe.regexLiterals&&(Ye+="(?!s*/)"),Ae.push([y,/^@[a-z_$][a-z_$@0-9]*/i,null],[E,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[u,/^[a-z_$][a-z_$@0-9]*/i,null],[y,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[u,/^\\[\s\S]?/,null],[c,new RegExp(Ye),null]),Ce(be,Ae)}var ke=Ue({keywords:C,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Me(oe,be,Ae){for(var Ne=/(?:^|\s)nocode(?:\s|$)/,_e=/\r\n?|\n/,We=oe.ownerDocument,Fe=We.createElement("li");oe.firstChild;)Fe.appendChild(oe.firstChild);var et=[Fe];function Je(Oe){var Ze=Oe.nodeType;if(Ze==1&&!Ne.test(Oe.className))if(Oe.nodeName==="br")Qe(Oe),Oe.parentNode&&Oe.parentNode.removeChild(Oe);else for(var at=Oe.firstChild;at;at=at.nextSibling)Je(at);else if((Ze==3||Ze==4)&&Ae){var Be=Oe.nodeValue,Ke=Be.match(_e);if(Ke){var Ee=Be.substring(0,Ke.index);Oe.nodeValue=Ee;var me=Be.substring(Ke.index+Ke[0].length);if(me){var ye=Oe.parentNode;ye.insertBefore(We.createTextNode(me),Oe.nextSibling)}Qe(Oe),Ee||Oe.parentNode.removeChild(Oe)}}}function Qe(Oe){for(;!Oe.nextSibling;)if(Oe=Oe.parentNode,!Oe)return;function Ze(Ke,Ee){var me=Ee?Ke.cloneNode(!1):Ke,ye=Ke.parentNode;if(ye){var te=Ze(ye,1),re=Ke.nextSibling;te.appendChild(me);for(var ue=re;ue;ue=re)re=ue.nextSibling,te.appendChild(ue)}return me}for(var at=Ze(Oe.nextSibling,0),Be;(Be=at.parentNode)&&Be.nodeType===1;)at=Be;et.push(at)}for(var Ye=0;Ye<et.length;++Ye)Je(et[Ye]);be===(be|0)&&et[0].setAttribute("value",be);var dt=We.createElement("ol");dt.className="linenums";for(var $e=Math.max(0,be-1|0)||0,Ye=0,tt=et.length;Ye<tt;++Ye)Fe=et[Ye],Fe.className="L"+(Ye+$e)%10,Fe.firstChild||Fe.appendChild(We.createTextNode("\xA0")),dt.appendChild(Fe);oe.appendChild(dt)}function ce(oe){var be=/\bMSIE\s(\d+)/.exec(navigator.userAgent);be=be&&+be[1]<=8;var Ae=/\n/g,Ne=oe.sourceCode,_e=Ne.length,We=0,Fe=oe.spans,et=Fe.length,Je=0,Qe=oe.decorations,Ye=Qe.length,dt=0;Qe[Ye]=_e;var $e,tt;for(tt=$e=0;tt<Ye;)Qe[tt]!==Qe[tt+2]?(Qe[$e++]=Qe[tt++],Qe[$e++]=Qe[tt++]):tt+=2;for(Ye=$e,tt=$e=0;tt<Ye;){for(var Oe=Qe[tt],Ze=Qe[tt+1],at=tt+2;at+2<=Ye&&Qe[at+1]===Ze;)at+=2;Qe[$e++]=Oe,Qe[$e++]=Ze,tt=at}Ye=Qe.length=$e;var Be=oe.sourceNode,Ke="";Be&&(Ke=Be.style.display,Be.style.display="none");try{for(var Ee=null;Je<et;){var me=Fe[Je],ye=Fe[Je+2]||_e,te=Qe[dt+2]||_e,at=Math.min(ye,te),re=Fe[Je+1],ue;if(re.nodeType!==1&&(ue=Ne.substring(We,at))){be&&(ue=ue.replace(Ae,"\r")),re.nodeValue=ue;var fe=re.ownerDocument,Pe=fe.createElement("span");Pe.className=Qe[dt+1];var Se=re.parentNode;Se.replaceChild(Pe,re),Pe.appendChild(re),We<ye&&(Fe[Je+1]=re=fe.createTextNode(Ne.substring(at,ye)),Se.insertBefore(re,Pe.nextSibling))}We=at,We>=ye&&(Je+=2),We>=te&&(dt+=2)}}finally{Be&&(Be.style.display=Ke)}}var ve={};function le(oe,be){for(var Ae=be.length;--Ae>=0;){var Ne=be[Ae];ve.hasOwnProperty(Ne)?N.console&&console.warn("cannot override language handler %s",Ne):ve[Ne]=oe}}function ne(oe,be){return oe&&ve.hasOwnProperty(oe)||(oe=/^\s*</.test(be)?"default-markup":"default-code"),ve[oe]}le(ke,["default-code"]),le(Ce([],[[u,/^[^<?]+/],[S,/^<!\w[^>]*(?:>|$)/],[L,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[c,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),le(Ce([[u,/^[\s]+/,null,` \r
|
|
`],[j,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[A,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[_,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[c,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),le(Ce([],[[j,/^[\s\S]+/]]),["uq.val"]),le(Ue({keywords:f,hashComments:!0,cStyleComments:!0,types:m}),["c","cc","cpp","cxx","cyc","m"]),le(Ue({keywords:"null,true,false"}),["json"]),le(Ue({keywords:p,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:m}),["cs"]),le(Ue({keywords:w,cStyleComments:!0}),["java"]),le(Ue({keywords:l,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),le(Ue({keywords:i,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),le(Ue({keywords:o,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),le(Ue({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),le(Ue({keywords:b,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),le(Ue({keywords:g,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),le(Ce([],[[v,/^[\s\S]+/]]),["regex"]);function Le(oe){var be=oe.langExtension;try{var Ae=F(oe.sourceNode,oe.pre),Ne=Ae.sourceCode;oe.sourceCode=Ne,oe.spans=Ae.spans,oe.basePos=0,ne(be,Ne)(oe),ce(oe)}catch(_e){N.console&&console.log(_e&&_e.stack||_e)}}function xe(oe,be,Ae){var Ne=Ae||!1,_e=be||null,We=document.createElement("div");We.innerHTML="<pre>"+oe+"</pre>",We=We.firstChild,Ne&&Me(We,Ne,!0);var Fe={langExtension:_e,numberLines:Ne,sourceNode:We,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Le(Fe),We.innerHTML}function Ie(oe,be){var Ae=be||document.body,Ne=Ae.ownerDocument||document;function _e(me){return Ae.getElementsByTagName(me)}for(var We=[_e("pre"),_e("code"),_e("xmp")],Fe=[],et=0;et<We.length;++et)for(var Je=0,Qe=We[et].length;Je<Qe;++Je)Fe.push(We[et][Je]);We=null;var Ye=Date;Ye.now||(Ye={now:function(){return+new Date}});var dt=0,$e=/\blang(?:uage)?-([\w.]+)(?!\S)/,tt=/\bprettyprint\b/,Oe=/\bprettyprinted\b/,Ze=/pre|xmp/i,at=/^code$/i,Be=/^(?:pre|code|xmp)$/i,Ke={};function Ee(){for(var me=N.PR_SHOULD_USE_CONTINUATION?Ye.now()+250:Infinity;dt<Fe.length&&Ye.now()<me;dt++){for(var ye=Fe[dt],te=Ke,re=ye;re=re.previousSibling;){var ue=re.nodeType,fe=(ue===7||ue===8)&&re.nodeValue;if(fe?!/^\??prettify\b/.test(fe):ue!==3||/\S/.test(re.nodeValue))break;if(fe){te={},fe.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Ht,kt,Ur){te[kt]=Ur});break}}var Pe=ye.className;if((te!==Ke||tt.test(Pe))&&!Oe.test(Pe)){for(var Se=!1,ze=ye.parentNode;ze;ze=ze.parentNode){var ot=ze.tagName;if(Be.test(ot)&&ze.className&&tt.test(ze.className)){Se=!0;break}}if(!Se){ye.className+=" prettyprinted";var ct=te.lang;if(!ct){ct=Pe.match($e);var ht;!ct&&(ht=he(ye))&&at.test(ht.tagName)&&(ct=ht.className.match($e)),ct&&(ct=ct[1])}var At;if(Ze.test(ye.tagName))At=1;else{var wt=ye.currentStyle,ft=Ne.defaultView,Kt=wt?wt.whiteSpace:ft&&ft.getComputedStyle?ft.getComputedStyle(ye,null).getPropertyValue("white-space"):0;At=Kt&&Kt.substring(0,3)==="pre"}var Ft=te.linenums;(Ft=Ft==="true"||+Ft)||(Ft=Pe.match(/\blinenums\b(?::(\d+))?/),Ft=Ft?Ft[1]&&Ft[1].length?+Ft[1]:!0:!1),Ft&&Me(ye,Ft,At);var Jt={langExtension:ct,sourceNode:ye,numberLines:Ft,pre:At,sourceCode:null,basePos:null,spans:null,decorations:null};Le(Jt)}}}dt<Fe.length?N.setTimeout(Ee,250):typeof oe=="function"&&oe()}Ee()}var Re=N.PR={createSimpleLexer:Ce,registerLangHandler:le,sourceDecorator:Ue,PR_ATTRIB_NAME:_,PR_ATTRIB_VALUE:j,PR_COMMENT:L,PR_DECLARATION:S,PR_KEYWORD:k,PR_LITERAL:y,PR_NOCODE:z,PR_PLAIN:u,PR_PUNCTUATION:c,PR_SOURCE:T,PR_STRING:v,PR_TAG:A,PR_TYPE:E,prettyPrintOne:O?N.prettyPrintOne=xe:M=xe,prettyPrint:W=O?N.prettyPrint=Ie:W=Ie},ae=N.define;typeof ae=="function"&&ae.amd&&ae("google-code-prettify",[],function(){return Re})})()},T8No:function(vt,Te,Q){"use strict";Q.d(Te,"a",function(){return V}),Q.d(Te,"b",function(){return w}),Q.d(Te,"d",function(){return p}),Q.d(Te,"c",function(){return g}),Q.d(Te,"e",function(){return b});var ie=Q("N0LK"),$=Q("Cg/j"),O=function(){var o=function(i,s){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,C){l.__proto__=C}||function(l,C){for(var m in C)C.hasOwnProperty(m)&&(l[m]=C[m])},o(i,s)};return function(i,s){o(i,s);function l(){this.constructor=i}i.prototype=s===null?Object.create(s):(l.prototype=s.prototype,new l)}}(),V=function(){function o(){}return o.has=function(i){return M.create(i)},o.equals=function(i,s){return W.create(i,s)},o.regex=function(i,s){return R.create(i,s)},o.not=function(i){return P.create(i)},o.and=function(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];return f.create(i)},o.or=function(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];return w.create(i)},o.deserialize=function(i,s){return s===void 0&&(s=!1),i?this._deserializeOrExpression(i,s):void 0},o._deserializeOrExpression=function(i,s){var l=this,C=i.split("||");return w.create(C.map(function(m){return l._deserializeAndExpression(m,s)}))},o._deserializeAndExpression=function(i,s){var l=this,C=i.split("&&");return f.create(C.map(function(m){return l._deserializeOne(m,s)}))},o._deserializeOne=function(i,s){if(i=i.trim(),i.indexOf("!=")>=0){var l=i.split("!=");return N.create(l[0].trim(),this._deserializeValue(l[1],s))}if(i.indexOf("==")>=0){var l=i.split("==");return W.create(l[0].trim(),this._deserializeValue(l[1],s))}if(i.indexOf("=~")>=0){var l=i.split("=~");return R.create(l[0].trim(),this._deserializeRegexValue(l[1],s))}return/^\!\s*/.test(i)?P.create(i.substr(1).trim()):M.create(i)},o._deserializeValue=function(i,s){if(i=i.trim(),i==="true")return!0;if(i==="false")return!1;var l=/^'([^']*)'$/.exec(i);return l?l[1].trim():i},o._deserializeRegexValue=function(i,s){if(Object(ie.x)(i)){if(s)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}var l=i.indexOf("/"),C=i.lastIndexOf("/");if(l===C||l<0){if(s)throw new Error("bad regexp-value '"+i+"', missing /-enclosure");return console.warn("bad regexp-value '"+i+"', missing /-enclosure"),null}var m=i.slice(l+1,C),v=i[C+1]==="i"?"i":"";try{return new RegExp(m,v)}catch(k){if(s)throw new Error("bad regexp-value '"+i+"', parse error: "+k);return console.warn("bad regexp-value '"+i+"', parse error: "+k),null}},o}();function I(o,i){var s=o.getType(),l=i.getType();if(s!==l)return s-l;switch(s){case 1:return o.cmp(i);case 2:return o.cmp(i);case 3:return o.cmp(i);case 4:return o.cmp(i);case 6:return o.cmp(i);case 7:return o.cmp(i);case 5:return o.cmp(i);default:throw new Error("Unknown ContextKeyExpr!")}}var M=function(){function o(i){this.key=i}return o.create=function(i){return new o(i)},o.prototype.getType=function(){return 1},o.prototype.cmp=function(i){return this.key<i.key?-1:this.key>i.key?1:0},o.prototype.equals=function(i){return i instanceof o?this.key===i.key:!1},o.prototype.evaluate=function(i){return!!i.getValue(this.key)},o.prototype.keys=function(){return[this.key]},o.prototype.negate=function(){return P.create(this.key)},o}(),W=function(){function o(i,s){this.key=i,this.value=s}return o.create=function(i,s){return typeof s=="boolean"?s?M.create(i):P.create(i):new o(i,s)},o.prototype.getType=function(){return 3},o.prototype.cmp=function(i){return this.key<i.key?-1:this.key>i.key?1:this.value<i.value?-1:this.value>i.value?1:0},o.prototype.equals=function(i){return i instanceof o?this.key===i.key&&this.value===i.value:!1},o.prototype.evaluate=function(i){return i.getValue(this.key)==this.value},o.prototype.keys=function(){return[this.key]},o.prototype.negate=function(){return N.create(this.key,this.value)},o}(),N=function(){function o(i,s){this.key=i,this.value=s}return o.create=function(i,s){return typeof s=="boolean"?s?P.create(i):M.create(i):new o(i,s)},o.prototype.getType=function(){return 4},o.prototype.cmp=function(i){return this.key<i.key?-1:this.key>i.key?1:this.value<i.value?-1:this.value>i.value?1:0},o.prototype.equals=function(i){return i instanceof o?this.key===i.key&&this.value===i.value:!1},o.prototype.evaluate=function(i){return i.getValue(this.key)!=this.value},o.prototype.keys=function(){return[this.key]},o.prototype.negate=function(){return W.create(this.key,this.value)},o}(),P=function(){function o(i){this.key=i}return o.create=function(i){return new o(i)},o.prototype.getType=function(){return 2},o.prototype.cmp=function(i){return this.key<i.key?-1:this.key>i.key?1:0},o.prototype.equals=function(i){return i instanceof o?this.key===i.key:!1},o.prototype.evaluate=function(i){return!i.getValue(this.key)},o.prototype.keys=function(){return[this.key]},o.prototype.negate=function(){return M.create(this.key)},o}(),R=function(){function o(i,s){this.key=i,this.regexp=s}return o.create=function(i,s){return new o(i,s)},o.prototype.getType=function(){return 6},o.prototype.cmp=function(i){if(this.key<i.key)return-1;if(this.key>i.key)return 1;var s=this.regexp?this.regexp.source:"",l=i.regexp?i.regexp.source:"";return s<l?-1:s>l?1:0},o.prototype.equals=function(i){if(i instanceof o){var s=this.regexp?this.regexp.source:"",l=i.regexp?i.regexp.source:"";return this.key===i.key&&s===l}return!1},o.prototype.evaluate=function(i){var s=i.getValue(this.key);return this.regexp?this.regexp.test(s):!1},o.prototype.keys=function(){return[this.key]},o.prototype.negate=function(){return d.create(this)},o}(),d=function(){function o(i){this._actual=i}return o.create=function(i){return new o(i)},o.prototype.getType=function(){return 7},o.prototype.cmp=function(i){return this._actual.cmp(i._actual)},o.prototype.equals=function(i){return i instanceof o?this._actual.equals(i._actual):!1},o.prototype.evaluate=function(i){return!this._actual.evaluate(i)},o.prototype.keys=function(){return this._actual.keys()},o.prototype.negate=function(){return this._actual},o}(),f=function(){function o(i){this.expr=i}return o.create=function(i){var s=o._normalizeArr(i);return s.length===0?void 0:s.length===1?s[0]:new o(s)},o.prototype.getType=function(){return 5},o.prototype.cmp=function(i){if(this.expr.length<i.expr.length)return-1;if(this.expr.length>i.expr.length)return 1;for(var s=0,l=this.expr.length;s<l;s++){var C=I(this.expr[s],i.expr[s]);if(C!==0)return C}return 0},o.prototype.equals=function(i){if(i instanceof o){if(this.expr.length!==i.expr.length)return!1;for(var s=0,l=this.expr.length;s<l;s++)if(!this.expr[s].equals(i.expr[s]))return!1;return!0}return!1},o.prototype.evaluate=function(i){for(var s=0,l=this.expr.length;s<l;s++)if(!this.expr[s].evaluate(i))return!1;return!0},o._normalizeArr=function(i){var s=[];if(i){for(var l=0,C=i.length;l<C;l++){var m=i[l];if(!m)continue;if(m instanceof o){s=s.concat(m.expr);continue}if(m instanceof w)throw new Error('It is not allowed to have an or expression here due to lack of parens! For example "a && (b||c)" is not supported, use "(a&&b) || (a&&c)" instead.');s.push(m)}s.sort(I)}return s},o.prototype.keys=function(){for(var i=[],s=0,l=this.expr;s<l.length;s++){var C=l[s];i.push.apply(i,C.keys())}return i},o.prototype.negate=function(){for(var i=[],s=0,l=this.expr;s<l.length;s++){var C=l[s];i.push(C.negate())}return w.create(i)},o}(),w=function(){function o(i){this.expr=i}return o.create=function(i){var s=o._normalizeArr(i);return s.length===0?void 0:s.length===1?s[0]:new o(s)},o.prototype.getType=function(){return 8},o.prototype.equals=function(i){if(i instanceof o){if(this.expr.length!==i.expr.length)return!1;for(var s=0,l=this.expr.length;s<l;s++)if(!this.expr[s].equals(i.expr[s]))return!1;return!0}return!1},o.prototype.evaluate=function(i){for(var s=0,l=this.expr.length;s<l;s++)if(this.expr[s].evaluate(i))return!0;return!1},o._normalizeArr=function(i){var s=[];if(i){for(var l=0,C=i.length;l<C;l++){var m=i[l];if(!m)continue;if(m instanceof o){s=s.concat(m.expr);continue}s.push(m)}s.sort(I)}return s},o.prototype.keys=function(){for(var i=[],s=0,l=this.expr;s<l.length;s++){var C=l[s];i.push.apply(i,C.keys())}return i},o.prototype.negate=function(){for(var i=[],s=0,l=this.expr;s<l.length;s++){var C=l[s];i.push(C.negate())}for(var m=function(T){return T instanceof o?T.expr:[T]};i.length>1;){for(var v=i.shift(),k=i.shift(),L=[],E=0,y=m(v);E<y.length;E++)for(var c=y[E],u=0,A=m(k);u<A.length;u++){var S=A[u];L.push(V.and(c,S))}i.unshift(V.or.apply(V,L))}return i[0]},o}(),p=function(o){O(i,o);function i(s,l){var C=o.call(this,s)||this;return C._defaultValue=l,C}return i.prototype.bindTo=function(s){return s.createKey(this.key,this._defaultValue)},i.prototype.getValue=function(s){return s.getContextKeyValue(this.key)},i.prototype.toNegated=function(){return V.not(this.key)},i}(M),g=Object($.c)("contextKeyService"),b="setContext"},"VrN/":function(vt,Te,Q){(function(ie,$){vt.exports=$()})(this,function(){"use strict";var ie=navigator.userAgent,$=navigator.platform,O=/gecko\/\d/i.test(ie),V=/MSIE \d/.test(ie),I=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ie),M=/Edge\/(\d+)/.exec(ie),W=V||I||M,N=W&&(V?document.documentMode||6:+(M||I)[1]),P=!M&&/WebKit\//.test(ie),R=P&&/Qt\/\d+\.\d+/.test(ie),d=!M&&/Chrome\//.test(ie),f=/Opera\//.test(ie),w=/Apple Computer/.test(navigator.vendor),p=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ie),g=/PhantomJS/.test(ie),b=!M&&/AppleWebKit/.test(ie)&&/Mobile\/\w+/.test(ie),o=/Android/.test(ie),i=b||o||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ie),s=b||/Mac/.test($),l=/\bCrOS\b/.test(ie),C=/win/i.test($),m=f&&ie.match(/Version\/(\d*\.\d*)/);m&&(m=Number(m[1])),m&&m>=15&&(f=!1,P=!0);var v=s&&(R||f&&(m==null||m<12.11)),k=O||W&&N>=9;function L(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var E=function(e,t){var n=e.className,r=L(t).exec(n);if(r){var a=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(a?r[1]+a:"")}};function y(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function c(e,t){return y(e).appendChild(t)}function u(e,t,n,r){var a=document.createElement(e);if(n&&(a.className=n),r&&(a.style.cssText=r),typeof t=="string")a.appendChild(document.createTextNode(t));else if(t)for(var D=0;D<t.length;++D)a.appendChild(t[D]);return a}function A(e,t,n,r){var a=u(e,t,n,r);return a.setAttribute("role","presentation"),a}var S;document.createRange?S=function(e,t,n,r){var a=document.createRange();return a.setEnd(r||e,n),a.setStart(e,t),a}:S=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(a){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function T(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function _(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function j(e,t){var n=e.className;L(t).test(n)||(e.className+=(n?" ":"")+t)}function z(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!L(n[r]).test(t)&&(t+=" "+n[r]);return t}var Z=function(e){e.select()};b?Z=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:W&&(Z=function(e){try{e.select()}catch(t){}});function K(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function F(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function ee(e,t,n,r,a){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var D=r||0,B=a||0;;){var Y=e.indexOf(" ",D);if(Y<0||Y>=t)return B+(t-D);B+=Y-D,B+=n-B%n,D=Y+1}}var se=function(){this.id=null,this.f=null,this.time=0,this.handler=K(this.onTimeout,this)};se.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},se.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function he(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var Ce=50,Ue={toString:function(){return"CodeMirror.Pass"}},ke={scroll:!1},Me={origin:"*mouse"},ce={origin:"+move"};function ve(e,t,n){for(var r=0,a=0;;){var D=e.indexOf(" ",r);D==-1&&(D=e.length);var B=D-r;if(D==e.length||a+B>=t)return r+Math.min(B,t-a);if(a+=D-r,a+=n-a%n,r=D+1,a>=t)return r}}var le=[""];function ne(e){for(;le.length<=e;)le.push(Le(le)+" ");return le[e]}function Le(e){return e[e.length-1]}function xe(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Ie(e,t,n){for(var r=0,a=n(t);r<e.length&&n(e[r])<=a;)r++;e.splice(r,0,t)}function Re(){}function ae(e,t){var n;return Object.create?n=Object.create(e):(Re.prototype=e,n=new Re),t&&F(t,n),n}var oe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function be(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||oe.test(e))}function Ae(e,t){return t?t.source.indexOf("\\w")>-1&&be(e)?!0:t.test(e):be(e)}function Ne(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var _e=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function We(e){return e.charCodeAt(0)>=768&&_e.test(e)}function Fe(e,t,n){for(;(n<0?t>0:t<e.length)&&We(e.charAt(t));)t+=n;return t}function et(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var a=(t+n)/2,D=r<0?Math.ceil(a):Math.floor(a);if(D==t)return e(D)?t:n;e(D)?n=D:t=D+r}}function Je(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var a=!1,D=0;D<e.length;++D){var B=e[D];(B.from<n&&B.to>t||t==n&&B.to==t)&&(r(Math.max(B.from,t),Math.min(B.to,n),B.level==1?"rtl":"ltr",D),a=!0)}a||r(t,n,"ltr")}var Qe=null;function Ye(e,t,n){var r;Qe=null;for(var a=0;a<e.length;++a){var D=e[a];if(D.from<t&&D.to>t)return a;D.to==t&&(D.from!=D.to&&n=="before"?r=a:Qe=a),D.from==t&&(D.from!=D.to&&n!="before"?r=a:Qe=a)}return r!=null?r:Qe}var dt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(q){return q<=247?e.charAt(q):1424<=q&&q<=1524?"R":1536<=q&&q<=1785?t.charAt(q-1536):1774<=q&&q<=2220?"r":8192<=q&&q<=8203?"w":q==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,a=/[stwN]/,D=/[LRr]/,B=/[Lb1n]/,Y=/[1n]/;function J(q,de,pe){this.level=q,this.from=de,this.to=pe}return function(q,de){var pe=de=="ltr"?"L":"R";if(q.length==0||de=="ltr"&&!r.test(q))return!1;for(var De=q.length,we=[],je=0;je<De;++je)we.push(n(q.charCodeAt(je)));for(var Xe=0,qe=pe;Xe<De;++Xe){var nt=we[Xe];nt=="m"?we[Xe]=qe:qe=nt}for(var ut=0,it=pe;ut<De;++ut){var mt=we[ut];mt=="1"&&it=="r"?we[ut]="n":D.test(mt)&&(it=mt,mt=="r"&&(we[ut]="R"))}for(var Tt=1,Et=we[0];Tt<De-1;++Tt){var Pt=we[Tt];Pt=="+"&&Et=="1"&&we[Tt+1]=="1"?we[Tt]="1":Pt==","&&Et==we[Tt+1]&&(Et=="1"||Et=="n")&&(we[Tt]=Et),Et=Pt}for(var tr=0;tr<De;++tr){var br=we[tr];if(br==",")we[tr]="N";else if(br=="%"){var ar=void 0;for(ar=tr+1;ar<De&&we[ar]=="%";++ar);for(var Gr=tr&&we[tr-1]=="!"||ar<De&&we[ar]=="1"?"1":"N",Nr=tr;Nr<ar;++Nr)we[Nr]=Gr;tr=ar-1}}for(var cr=0,Fr=pe;cr<De;++cr){var Sr=we[cr];Fr=="L"&&Sr=="1"?we[cr]="L":D.test(Sr)&&(Fr=Sr)}for(var mr=0;mr<De;++mr)if(a.test(we[mr])){var fr=void 0;for(fr=mr+1;fr<De&&a.test(we[fr]);++fr);for(var sr=(mr?we[mr-1]:pe)=="L",Br=(fr<De?we[fr]:pe)=="L",ui=sr==Br?sr?"L":"R":pe,Rn=mr;Rn<fr;++Rn)we[Rn]=ui;mr=fr-1}for(var Lr=[],pn,xr=0;xr<De;)if(B.test(we[xr])){var Xa=xr;for(++xr;xr<De&&B.test(we[xr]);++xr);Lr.push(new J(0,Xa,xr))}else{var yn=xr,Wn=Lr.length,Hn=de=="rtl"?1:0;for(++xr;xr<De&&we[xr]!="L";++xr);for(var Rr=yn;Rr<xr;)if(Y.test(we[Rr])){yn<Rr&&(Lr.splice(Wn,0,new J(1,yn,Rr)),Wn+=Hn);var di=Rr;for(++Rr;Rr<xr&&Y.test(we[Rr]);++Rr);Lr.splice(Wn,0,new J(2,di,Rr)),Wn+=Hn,yn=Rr}else++Rr;yn<xr&&Lr.splice(Wn,0,new J(1,yn,xr))}return de=="ltr"&&(Lr[0].level==1&&(pn=q.match(/^\s+/))&&(Lr[0].from=pn[0].length,Lr.unshift(new J(0,0,pn[0].length))),Le(Lr).level==1&&(pn=q.match(/\s+$/))&&(Le(Lr).to-=pn[0].length,Lr.push(new J(0,De-pn[0].length,De)))),de=="rtl"?Lr.reverse():Lr}}();function $e(e,t){var n=e.order;return n==null&&(n=e.order=dt(e.text,t)),n}var tt=[],Oe=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||tt).concat(n)}};function Ze(e,t){return e._handlers&&e._handlers[t]||tt}function at(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,a=r&&r[t];if(a){var D=he(a,n);D>-1&&(r[t]=a.slice(0,D).concat(a.slice(D+1)))}}}function Be(e,t){var n=Ze(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),a=0;a<n.length;++a)n[a].apply(null,r)}function Ke(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Be(e,n||t.type,e,t),ue(t)||t.codemirrorIgnore}function Ee(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)he(n,t[r])==-1&&n.push(t[r])}function me(e,t){return Ze(e,t).length>0}function ye(e){e.prototype.on=function(t,n){Oe(this,t,n)},e.prototype.off=function(t,n){at(this,t,n)}}function te(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function re(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ue(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function fe(e){te(e),re(e)}function Pe(e){return e.target||e.srcElement}function Se(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),s&&e.ctrlKey&&t==1&&(t=3),t}var ze=function(){if(W&&N<9)return!1;var e=u("div");return"draggable"in e||"dragDrop"in e}(),ot;function ct(e){if(ot==null){var t=u("span","\u200B");c(e,u("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(ot=t.offsetWidth<=1&&t.offsetHeight>2&&!(W&&N<8))}var n=ot?u("span","\u200B"):u("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var ht;function At(e){if(ht!=null)return ht;var t=c(e,document.createTextNode("A\u062EA")),n=S(t,0,1).getBoundingClientRect(),r=S(t,1,2).getBoundingClientRect();return y(e),!n||n.left==n.right?!1:ht=r.right-n.right<3}var wt=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var a=e.indexOf(`
|
|
`,t);a==-1&&(a=e.length);var D=e.slice(t,e.charAt(a-1)=="\r"?a-1:a),B=D.indexOf("\r");B!=-1?(n.push(D.slice(0,B)),t+=B+1):(n.push(D),t=a+1)}return n}:function(e){return e.split(/\r\n?|\n/)},ft=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Kt=function(){var e=u("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Ft=null;function Jt(e){if(Ft!=null)return Ft;var t=c(e,u("span","x")),n=t.getBoundingClientRect(),r=S(t,0,1).getBoundingClientRect();return Ft=Math.abs(n.left-r.left)>1}var Ht={},kt={};function Ur(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ht[e]=t}function Zr(e,t){kt[e]=t}function bt(e){if(typeof e=="string"&&kt.hasOwnProperty(e))e=kt[e];else if(e&&typeof e.name=="string"&&kt.hasOwnProperty(e.name)){var t=kt[e.name];typeof t=="string"&&(t={name:t}),e=ae(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return bt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return bt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Ct(e,t){t=bt(t);var n=Ht[t.name];if(!n)return Ct(e,"text/plain");var r=n(e,t);if(st.hasOwnProperty(t.name)){var a=st[t.name];for(var D in a){if(!a.hasOwnProperty(D))continue;r.hasOwnProperty(D)&&(r["_"+D]=r[D]),r[D]=a[D]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var B in t.modeProps)r[B]=t.modeProps[B];return r}var st={};function xt(e,t){var n=st.hasOwnProperty(e)?st[e]:st[e]={};F(t,n)}function Zt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var a=t[r];a instanceof Array&&(a=a.concat([])),n[r]=a}return n}function nr(e,t){for(var n;e.innerMode&&!(n=e.innerMode(t),!n||n.mode==e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function rr(e,t,n){return e.startState?e.startState(t,n):!0}var Rt=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Rt.prototype.eol=function(){return this.pos>=this.string.length},Rt.prototype.sol=function(){return this.pos==this.lineStart},Rt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Rt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Rt.prototype.eat=function(e){var t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)return++this.pos,t},Rt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Rt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Rt.prototype.skipToEnd=function(){this.pos=this.string.length},Rt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Rt.prototype.backUp=function(e){this.pos-=e},Rt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=ee(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?ee(this.string,this.lineStart,this.tabSize):0)},Rt.prototype.indentation=function(){return ee(this.string,null,this.tabSize)-(this.lineStart?ee(this.string,this.lineStart,this.tabSize):0)},Rt.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(B){return n?B.toLowerCase():B},a=this.string.substr(this.pos,e.length);if(r(a)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var D=this.string.slice(this.pos).match(e);return D&&D.index>0?null:(D&&t!==!1&&(this.pos+=D[0].length),D)}},Rt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Rt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Rt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Rt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function gt(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var a=n.children[r],D=a.chunkSize();if(t<D){n=a;break}t-=D}return n.lines[t]}function kr(e,t,n){var r=[],a=t.line;return e.iter(t.line,n.line+1,function(D){var B=D.text;a==n.line&&(B=B.slice(0,n.ch)),a==t.line&&(B=B.slice(t.ch)),r.push(B),++a}),r}function tn(e,t,n){var r=[];return e.iter(t,n,function(a){r.push(a.text)}),r}function Tr(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Ot(e){if(e.parent==null)return null;for(var t=e.parent,n=he(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var a=0;!(r.children[a]==t);++a)n+=r.children[a].chunkSize();return n+t.first}function Ar(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var a=e.children[r],D=a.height;if(t<D){e=a;continue e}t-=D,n+=a.chunkSize()}return n}while(!e.lines);for(var B=0;B<e.lines.length;++B){var Y=e.lines[B],J=Y.height;if(t<J)break;t-=J}return n+B}function Kr(e,t){return t>=e.first&&t<e.first+e.size}function rn(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function He(e,t,n){if(n===void 0&&(n=null),!(this instanceof He))return new He(e,t,n);this.line=e,this.ch=t,this.sticky=n}function lt(e,t){return e.line-t.line||e.ch-t.ch}function Mt(e,t){return e.sticky==t.sticky&<(e,t)==0}function zt(e){return He(e.line,e.ch)}function Yt(e,t){return lt(e,t)<0?t:e}function qt(e,t){return lt(e,t)<0?e:t}function H(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function h(e,t){if(t.line<e.first)return He(e.first,0);var n=e.first+e.size-1;return t.line>n?He(n,gt(e,n).text.length):x(t,gt(e,t.line).text.length)}function x(e,t){var n=e.ch;return n==null||n>t?He(e.line,t):n<0?He(e.line,0):e}function U(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=h(e,t[r]);return n}var X=function(e,t){this.state=e,this.lookAhead=t},G=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};G.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},G.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},G.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},G.fromSaved=function(e,t,n){return t instanceof X?new G(e,Zt(e.mode,t.state),n,t.lookAhead):new G(e,Zt(e.mode,t),n)},G.prototype.save=function(e){var t=e!==!1?Zt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new X(t,this.maxLookAhead):t};function ge(e,t,n,r){var a=[e.state.modeGen],D={};Vr(e,t.text,e.doc.mode,n,function(q,de){return a.push(q,de)},D,r);for(var B=n.state,Y=function(q){n.baseTokens=a;var de=e.state.overlays[q],pe=1,De=0;n.state=!0,Vr(e,t.text,de.mode,n,function(we,je){for(var Xe=pe;De<we;){var qe=a[pe];qe>we&&a.splice(pe,1,we,a[pe+1],qe),pe+=2,De=Math.min(we,qe)}if(!je)return;if(de.opaque)a.splice(Xe,pe-Xe,we,"overlay "+je),pe=Xe+2;else for(;Xe<pe;Xe+=2){var nt=a[Xe+1];a[Xe+1]=(nt?nt+" ":"")+"overlay "+je}},D),n.state=B,n.baseTokens=null,n.baseTokenPos=1},J=0;J<e.state.overlays.length;++J)Y(J);return{styles:a,classes:D.bgClass||D.textClass?D:null}}function Ge(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=rt(e,Ot(t)),a=t.text.length>e.options.maxHighlightLength&&Zt(e.doc.mode,r.state),D=ge(e,t,r);a&&(r.state=a),t.stateAfter=r.save(!a),t.styles=D.styles,D.classes?t.styleClasses=D.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function rt(e,t,n){var r=e.doc,a=e.display;if(!r.mode.startState)return new G(r,!0,t);var D=pr(e,t,n),B=D>r.first&>(r,D-1).stateAfter,Y=B?G.fromSaved(r,B,D):new G(r,rr(r.mode),D);return r.iter(D,t,function(J){pt(e,J.text,Y);var q=Y.line;J.stateAfter=q==t-1||q%5==0||q>=a.viewFrom&&q<a.viewTo?Y.save():null,Y.nextLine()}),n&&(r.modeFrontier=Y.line),Y}function pt(e,t,n,r){var a=e.doc.mode,D=new Rt(t,e.options.tabSize,n);for(D.start=D.pos=r||0,t==""&&Ve(a,n.state);!D.eol();)Lt(a,D,n.state),D.start=D.pos}function Ve(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=nr(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function Lt(e,t,n,r){for(var a=0;a<10;a++){r&&(r[0]=nr(e,n).mode);var D=e.token(t,n);if(t.pos>t.start)return D}throw new Error("Mode "+e.name+" failed to advance stream.")}var It=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function er(e,t,n,r){var a=e.doc,D=a.mode,B;t=h(a,t);var Y=gt(a,t.line),J=rt(e,t.line,n),q=new Rt(Y.text,e.options.tabSize,J),de;for(r&&(de=[]);(r||q.pos<t.ch)&&!q.eol();)q.start=q.pos,B=Lt(D,q,J.state),r&&de.push(new It(q,B,Zt(a.mode,J.state)));return r?de:new It(q,B,J.state)}function zr(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function Vr(e,t,n,r,a,D,B){var Y=n.flattenSpans;Y==null&&(Y=e.options.flattenSpans);var J=0,q=null,de=new Rt(t,e.options.tabSize,r),pe,De=e.options.addModeClass&&[null];for(t==""&&zr(Ve(n,r.state),D);!de.eol();){if(de.pos>e.options.maxHighlightLength?(Y=!1,B&&pt(e,t,r,de.pos),de.pos=t.length,pe=null):pe=zr(Lt(n,de,r.state,De),D),De){var we=De[0].name;we&&(pe="m-"+(pe?we+" "+pe:we))}if(!Y||q!=pe){for(;J<de.start;)J=Math.min(de.start,J+5e3),a(J,q);q=pe}de.start=de.pos}for(;J<de.pos;){var je=Math.min(de.pos,J+5e3);a(je,q),J=je}}function pr(e,t,n){for(var r,a,D=e.doc,B=n?-1:t-(e.doc.mode.innerMode?1e3:100),Y=t;Y>B;--Y){if(Y<=D.first)return D.first;var J=gt(D,Y-1),q=J.stateAfter;if(q&&(!n||Y+(q instanceof X?q.lookAhead:0)<=D.modeFrontier))return Y;var de=ee(J.text,null,e.options.tabSize);(a==null||r>de)&&(a=Y-1,r=de)}return a}function Qr(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var n=e.first,r=t-1;r>n;r--){var a=gt(e,r).stateAfter;if(a&&(!(a instanceof X)||r+a.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Gn=!1,Or=!1;function Xr(){Gn=!0}function jr(){Or=!0}function bn(e,t,n){this.marker=e,this.from=t,this.to=n}function nn(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function mn(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function dn(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function hi(e,t,n){var r;if(e)for(var a=0;a<e.length;++a){var D=e[a],B=D.marker,Y=D.from==null||(B.inclusiveLeft?D.from<=t:D.from<t);if(Y||D.from==t&&B.type=="bookmark"&&(!n||!D.marker.insertLeft)){var J=D.to==null||(B.inclusiveRight?D.to>=t:D.to>t);(r||(r=[])).push(new bn(B,D.from,J?null:D.to))}}return r}function Kn(e,t,n){var r;if(e)for(var a=0;a<e.length;++a){var D=e[a],B=D.marker,Y=D.to==null||(B.inclusiveRight?D.to>=t:D.to>t);if(Y||D.from==t&&B.type=="bookmark"&&(!n||D.marker.insertLeft)){var J=D.from==null||(B.inclusiveLeft?D.from<=t:D.from<t);(r||(r=[])).push(new bn(B,J?null:D.from-t,D.to==null?null:D.to-t))}}return r}function an(e,t){if(t.full)return null;var n=Kr(e,t.from.line)&>(e,t.from.line).markedSpans,r=Kr(e,t.to.line)&>(e,t.to.line).markedSpans;if(!n&&!r)return null;var a=t.from.ch,D=t.to.ch,B=lt(t.from,t.to)==0,Y=hi(n,a,B),J=Kn(r,D,B),q=t.text.length==1,de=Le(t.text).length+(q?a:0);if(Y)for(var pe=0;pe<Y.length;++pe){var De=Y[pe];if(De.to==null){var we=nn(J,De.marker);we?q&&(De.to=we.to==null?null:we.to+de):De.to=a}}if(J)for(var je=0;je<J.length;++je){var Xe=J[je];if(Xe.to!=null&&(Xe.to+=de),Xe.from==null){var qe=nn(Y,Xe.marker);qe||(Xe.from=de,q&&(Y||(Y=[])).push(Xe))}else Xe.from+=de,q&&(Y||(Y=[])).push(Xe)}Y&&(Y=Yr(Y)),J&&J!=Y&&(J=Yr(J));var nt=[Y];if(!q){var ut=t.text.length-2,it;if(ut>0&&Y)for(var mt=0;mt<Y.length;++mt)Y[mt].to==null&&(it||(it=[])).push(new bn(Y[mt].marker,null,null));for(var Tt=0;Tt<ut;++Tt)nt.push(it);nt.push(J)}return nt}function Yr(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function kn(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(we){if(we.markedSpans)for(var je=0;je<we.markedSpans.length;++je){var Xe=we.markedSpans[je].marker;Xe.readOnly&&(!r||he(r,Xe)==-1)&&(r||(r=[])).push(Xe)}}),!r)return null;for(var a=[{from:t,to:n}],D=0;D<r.length;++D)for(var B=r[D],Y=B.find(0),J=0;J<a.length;++J){var q=a[J];if(lt(q.to,Y.from)<0||lt(q.from,Y.to)>0)continue;var de=[J,1],pe=lt(q.from,Y.from),De=lt(q.to,Y.to);(pe<0||!B.inclusiveLeft&&!pe)&&de.push({from:q.from,to:Y.from}),(De>0||!B.inclusiveRight&&!De)&&de.push({from:Y.to,to:q.to}),a.splice.apply(a,de),J+=de.length-3}return a}function On(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function ci(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function or(e){return e.inclusiveLeft?-1:0}function jt(e){return e.inclusiveRight?1:0}function Er(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),a=t.find(),D=lt(r.from,a.from)||or(e)-or(t);if(D)return-D;var B=lt(r.to,a.to)||jt(e)-jt(t);return B||t.id-e.id}function Ut(e,t){var n=Or&&e.markedSpans,r;if(n)for(var a=void 0,D=0;D<n.length;++D)a=n[D],a.marker.collapsed&&(t?a.from:a.to)==null&&(!r||Er(r,a.marker)<0)&&(r=a.marker);return r}function dr(e){return Ut(e,!0)}function Vt(e){return Ut(e,!1)}function hn(e,t){var n=Or&&e.markedSpans,r;if(n)for(var a=0;a<n.length;++a){var D=n[a];D.marker.collapsed&&(D.from==null||D.from<t)&&(D.to==null||D.to>t)&&(!r||Er(r,D.marker)<0)&&(r=D.marker)}return r}function lr(e,t,n,r,a){var D=gt(e,t),B=Or&&D.markedSpans;if(B)for(var Y=0;Y<B.length;++Y){var J=B[Y];if(!J.marker.collapsed)continue;var q=J.marker.find(0),de=lt(q.from,n)||or(J.marker)-or(a),pe=lt(q.to,r)||jt(J.marker)-jt(a);if(de>=0&&pe<=0||de<=0&&pe>=0)continue;if(de<=0&&(J.marker.inclusiveRight&&a.inclusiveLeft?lt(q.to,n)>=0:lt(q.to,n)>0)||de>=0&&(J.marker.inclusiveRight&&a.inclusiveLeft?lt(q.from,r)<=0:lt(q.from,r)<0))return!0}}function Pr(e){for(var t;t=dr(e);)e=t.find(-1,!0).line;return e}function zn(e){for(var t;t=Vt(e);)e=t.find(1,!0).line;return e}function Vn(e){for(var t,n;t=Vt(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function xn(e,t){var n=gt(e,t),r=Pr(n);return n==r?t:Ot(r)}function Ui(e,t){if(t>e.lastLine())return t;var n=gt(e,t),r;if(!Wr(e,n))return t;for(;r=Vt(n);)n=r.find(1,!0).line;return Ot(n)+1}function Wr(e,t){var n=Or&&t.markedSpans;if(n)for(var r=void 0,a=0;a<n.length;++a){if(r=n[a],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&fi(e,t,r))return!0}}function fi(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return fi(e,r.line,nn(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var a=void 0,D=0;D<t.markedSpans.length;++D)if(a=t.markedSpans[D],a.marker.collapsed&&!a.marker.widgetNode&&a.from==n.to&&(a.to==null||a.to!=n.from)&&(a.marker.inclusiveLeft||n.marker.inclusiveRight)&&fi(e,t,a))return!0}function on(e){e=Pr(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var a=n.lines[r];if(a==e)break;t+=a.height}for(var D=n.parent;D;n=D,D=n.parent)for(var B=0;B<D.children.length;++B){var Y=D.children[B];if(Y==n)break;t+=Y.height}return t}function Xn(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=dr(r);){var a=n.find(0,!0);r=a.from.line,t+=a.from.ch-a.to.ch}for(r=e;n=Vt(r);){var D=n.find(0,!0);t-=r.text.length-D.from.ch,r=D.to.line,t+=r.text.length-D.to.ch}return t}function ji(e){var t=e.display,n=e.doc;t.maxLine=gt(n,n.first),t.maxLineLength=Xn(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var a=Xn(r);a>t.maxLineLength&&(t.maxLineLength=a,t.maxLine=r)})}var Pn=function(e,t,n){this.text=e,ci(this,t),this.height=n?n(this):1};Pn.prototype.lineNo=function(){return Ot(this)},ye(Pn);function $a(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),On(e),ci(e,n);var a=r?r(e):1;a!=e.height&&Tr(e,a)}function da(e){e.parent=null,On(e)}var yt={},Dt={};function St(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Dt:yt;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function _t(e,t){var n=A("span",null,null,P?"padding-right: .1px":null),r={pre:A("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var a=0;a<=(t.rest?t.rest.length:0);a++){var D=a?t.rest[a-1]:t.line,B=void 0;r.pos=0,r.addToken=$t,At(e.display.measure)&&(B=$e(D,e.doc.direction))&&(r.addToken=hr(r.addToken,B)),r.map=[];var Y=t!=e.display.externalMeasured&&Ot(D);Nt(D,r,Ge(e,D,Y)),D.styleClasses&&(D.styleClasses.bgClass&&(r.bgClass=z(D.styleClasses.bgClass,r.bgClass||"")),D.styleClasses.textClass&&(r.textClass=z(D.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(ct(e.display.measure))),a==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(P){var J=r.content.lastChild;(/\bcm-tab\b/.test(J.className)||J.querySelector&&J.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Be(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=z(r.pre.className,r.textClass||"")),r}function Wt(e){var t=u("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function $t(e,t,n,r,a,D,B){if(!t)return;var Y=e.splitSpaces?Bt(t,e.trailingSpace):t,J=e.cm.state.specialChars,q=!1,de;if(!J.test(t))e.col+=t.length,de=document.createTextNode(Y),e.map.push(e.pos,e.pos+t.length,de),W&&N<9&&(q=!0),e.pos+=t.length;else{de=document.createDocumentFragment();for(var pe=0;;){J.lastIndex=pe;var De=J.exec(t),we=De?De.index-pe:t.length-pe;if(we){var je=document.createTextNode(Y.slice(pe,pe+we));W&&N<9?de.appendChild(u("span",[je])):de.appendChild(je),e.map.push(e.pos,e.pos+we,je),e.col+=we,e.pos+=we}if(!De)break;pe+=we+1;var Xe=void 0;if(De[0]==" "){var qe=e.cm.options.tabSize,nt=qe-e.col%qe;Xe=de.appendChild(u("span",ne(nt),"cm-tab")),Xe.setAttribute("role","presentation"),Xe.setAttribute("cm-text"," "),e.col+=nt}else De[0]=="\r"||De[0]==`
|
|
`?(Xe=de.appendChild(u("span",De[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Xe.setAttribute("cm-text",De[0]),e.col+=1):(Xe=e.cm.options.specialCharPlaceholder(De[0]),Xe.setAttribute("cm-text",De[0]),W&&N<9?de.appendChild(u("span",[Xe])):de.appendChild(Xe),e.col+=1);e.map.push(e.pos,e.pos+1,Xe),e.pos++}}if(e.trailingSpace=Y.charCodeAt(t.length-1)==32,n||r||a||q||D||B){var ut=n||"";r&&(ut+=r),a&&(ut+=a);var it=u("span",[de],ut,D);if(B)for(var mt in B)B.hasOwnProperty(mt)&&mt!="style"&&mt!="class"&&it.setAttribute(mt,B[mt]);return e.content.appendChild(it)}e.content.appendChild(de)}function Bt(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",a=0;a<e.length;a++){var D=e.charAt(a);D==" "&&n&&(a==e.length-1||e.charCodeAt(a+1)==32)&&(D="\xA0"),r+=D,n=D==" "}return r}function hr(e,t){return function(n,r,a,D,B,Y,J){a=a?a+" cm-force-border":"cm-force-border";for(var q=n.pos,de=q+r.length;;){for(var pe=void 0,De=0;De<t.length&&!(pe=t[De],pe.to>q&&pe.from<=q);De++);if(pe.to>=de)return e(n,r,a,D,B,Y,J);e(n,r.slice(0,pe.to-q),a,D,null,Y,J),D=null,r=r.slice(pe.to-q),q=pe.to}}}function Mr(e,t,n,r){var a=!r&&n.widgetNode;a&&e.map.push(e.pos,e.pos+t,a),!r&&e.cm.display.input.needsContentAttribute&&(a||(a=e.content.appendChild(document.createElement("span"))),a.setAttribute("cm-marker",n.id)),a&&(e.cm.display.input.setUneditable(a),e.content.appendChild(a)),e.pos+=t,e.trailingSpace=!1}function Nt(e,t,n){var r=e.markedSpans,a=e.text,D=0;if(!r){for(var B=1;B<n.length;B+=2)t.addToken(t,a.slice(D,D=n[B]),St(n[B+1],t.cm.options));return}for(var Y=a.length,J=0,q=1,de="",pe,De,we=0,je,Xe,qe,nt,ut;;){if(we==J){je=Xe=qe=De="",ut=null,nt=null,we=Infinity;for(var it=[],mt=void 0,Tt=0;Tt<r.length;++Tt){var Et=r[Tt],Pt=Et.marker;if(Pt.type=="bookmark"&&Et.from==J&&Pt.widgetNode)it.push(Pt);else if(Et.from<=J&&(Et.to==null||Et.to>J||Pt.collapsed&&Et.to==J&&Et.from==J)){if(Et.to!=null&&Et.to!=J&&we>Et.to&&(we=Et.to,Xe=""),Pt.className&&(je+=" "+Pt.className),Pt.css&&(De=(De?De+";":"")+Pt.css),Pt.startStyle&&Et.from==J&&(qe+=" "+Pt.startStyle),Pt.endStyle&&Et.to==we&&(mt||(mt=[])).push(Pt.endStyle,Et.to),Pt.title&&((ut||(ut={})).title=Pt.title),Pt.attributes)for(var tr in Pt.attributes)(ut||(ut={}))[tr]=Pt.attributes[tr];Pt.collapsed&&(!nt||Er(nt.marker,Pt)<0)&&(nt=Et)}else Et.from>J&&we>Et.from&&(we=Et.from)}if(mt)for(var br=0;br<mt.length;br+=2)mt[br+1]==we&&(Xe+=" "+mt[br]);if(!nt||nt.from==J)for(var ar=0;ar<it.length;++ar)Mr(t,0,it[ar]);if(nt&&(nt.from||0)==J){if(Mr(t,(nt.to==null?Y+1:nt.to)-J,nt.marker,nt.from==null),nt.to==null)return;nt.to==J&&(nt=!1)}}if(J>=Y)break;for(var Gr=Math.min(Y,we);;){if(de){var Nr=J+de.length;if(!nt){var cr=Nr>Gr?de.slice(0,Gr-J):de;t.addToken(t,cr,pe?pe+je:je,qe,J+cr.length==we?Xe:"",De,ut)}if(Nr>=Gr){de=de.slice(Gr-J),J=Gr;break}J=Nr,qe=""}de=a.slice(D,D=n[q++]),pe=St(n[q++],t.cm.options)}}}function En(e,t,n){this.line=t,this.rest=Vn(t),this.size=this.rest?Ot(Le(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Wr(e,t)}function Gt(e,t,n){for(var r=[],a,D=t;D<n;D=a){var B=new En(e.doc,gt(e.doc,D),D);a=D+B.size,r.push(B)}return r}var gr=null;function qr(e){gr?gr.ops.push(e):e.ownsGroup=gr={ops:[e],delayedCallbacks:[]}}function en(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var a=e.ops[r];if(a.cursorActivityHandlers)for(;a.cursorActivityCalled<a.cursorActivityHandlers.length;)a.cursorActivityHandlers[a.cursorActivityCalled++].call(null,a.cm)}}while(n<t.length)}function Wi(e,t){var n=e.ownsGroup;if(!n)return;try{en(n)}finally{gr=null,t(n)}}var pi=null;function Cr(e,t){var n=Ze(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),a;gr?a=gr.delayedCallbacks:pi?a=pi:(a=pi=[],setTimeout(Ps,0));for(var D=function(Y){a.push(function(){return n[Y].apply(null,r)})},B=0;B<n.length;++B)D(B)}function Ps(){var e=pi;pi=null;for(var t=0;t<e.length;++t)e[t]()}function Ja(e,t,n,r){for(var a=0;a<t.changes.length;a++){var D=t.changes[a];D=="text"?_s(e,t):D=="gutter"?Qa(e,t,n,r):D=="class"?ha(e,t):D=="widget"&&Is(e,t,r)}t.changes=null}function mi(e){return e.node==e.text&&(e.node=u("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),W&&N<8&&(e.node.style.zIndex=2)),e.node}function Ms(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=mi(t);t.background=r.insertBefore(u("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function Za(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):_t(e,t)}function _s(e,t){var n=t.text.className,r=Za(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,ha(e,t)):n&&(t.text.className=n)}function ha(e,t){Ms(e,t),t.line.wrapClass?mi(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Qa(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var a=mi(t);t.gutterBackground=u("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),a.insertBefore(t.gutterBackground,t.text)}var D=t.line.gutterMarkers;if(e.options.lineNumbers||D){var B=mi(t),Y=t.gutter=u("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(Y),B.insertBefore(Y,t.text),t.line.gutterClass&&(Y.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!D||!D["CodeMirror-linenumbers"])&&(t.lineNumber=Y.appendChild(u("div",rn(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),D)for(var J=0;J<e.display.gutterSpecs.length;++J){var q=e.display.gutterSpecs[J].className,de=D.hasOwnProperty(q)&&D[q];de&&Y.appendChild(u("div",[de],"CodeMirror-gutter-elt","left: "+r.gutterLeft[q]+"px; width: "+r.gutterWidth[q]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=L("CodeMirror-linewidget"),a=t.node.firstChild,D=void 0;a;a=D)D=a.nextSibling,r.test(a.className)&&t.node.removeChild(a);qa(e,t,n)}function Ns(e,t,n,r){var a=Za(e,t);return t.text=t.node=a.pre,a.bgClass&&(t.bgClass=a.bgClass),a.textClass&&(t.textClass=a.textClass),ha(e,t),Qa(e,t,n,r),qa(e,t,r),t.node}function qa(e,t,n){if(eo(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)eo(e,t.rest[r],t,n,!1)}function eo(e,t,n,r,a){if(!t.widgets)return;for(var D=mi(n),B=0,Y=t.widgets;B<Y.length;++B){var J=Y[B],q=u("div",[J.node],"CodeMirror-linewidget"+(J.className?" "+J.className:""));J.handleMouseEvents||q.setAttribute("cm-ignore-events","true"),Fs(J,q,n,r),e.display.input.setUneditable(q),a&&J.above?D.insertBefore(q,n.gutter||n.text):D.appendChild(q),Cr(J,"redraw")}}function Fs(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var a=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(a-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=a+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function gi(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!T(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),c(t.display.measure,u("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function gn(e,t){for(var n=Pe(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function Hi(e){return e.lineSpace.offsetTop}function ca(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function to(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=c(e.measure,u("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function cn(e){return Ce-e.display.nativeBarWidth}function Mn(e){return e.display.scroller.clientWidth-cn(e)-e.display.barWidth}function fa(e){return e.display.scroller.clientHeight-cn(e)-e.display.barHeight}function Bs(e,t,n){var r=e.options.lineWrapping,a=r&&Mn(e);if(!t.measure.heights||r&&t.measure.width!=a){var D=t.measure.heights=[];if(r){t.measure.width=a;for(var B=t.text.firstChild.getClientRects(),Y=0;Y<B.length-1;Y++){var J=B[Y],q=B[Y+1];Math.abs(J.bottom-q.bottom)>2&&D.push((J.bottom+q.top)/2-n.top)}}D.push(n.bottom-n.top)}}function ro(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var a=0;a<e.rest.length;a++)if(Ot(e.rest[a])>n)return{map:e.measure.maps[a],cache:e.measure.caches[a],before:!0}}function Us(e,t){t=Pr(t);var n=Ot(t),r=e.display.externalMeasured=new En(e.doc,t,n);r.lineN=n;var a=r.built=_t(e,r);return r.text=a.pre,c(e.display.lineMeasure,a.pre),r}function no(e,t,n,r){return fn(e,Yn(e,t),n,r)}function pa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Nn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Yn(e,t){var n=Ot(t),r=pa(e,n);r&&!r.text?r=null:r&&r.changes&&(Ja(e,r,n,xa(e)),e.curOp.forceUpdate=!0),r||(r=Us(e,t));var a=ro(r,t,n);return{line:t,view:r,rect:null,map:a.map,cache:a.cache,before:a.before,hasHeights:!1}}function fn(e,t,n,r,a){t.before&&(n=-1);var D=n+(r||""),B;return t.cache.hasOwnProperty(D)?B=t.cache[D]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Bs(e,t.view,t.rect),t.hasHeights=!0),B=Ws(e,t,n,r),B.bogus||(t.cache[D]=B)),{left:B.left,right:B.right,top:a?B.rtop:B.top,bottom:a?B.rbottom:B.bottom}}var io={left:0,right:0,top:0,bottom:0};function ao(e,t,n){for(var r,a,D,B,Y,J,q=0;q<e.length;q+=3)if(Y=e[q],J=e[q+1],t<Y?(a=0,D=1,B="left"):t<J?(a=t-Y,D=a+1):(q==e.length-3||t==J&&e[q+3]>t)&&(D=J-Y,a=D-1,t>=J&&(B="right")),a!=null){if(r=e[q+2],Y==J&&n==(r.insertLeft?"left":"right")&&(B=n),n=="left"&&a==0)for(;q&&e[q-2]==e[q-3]&&e[q-1].insertLeft;)r=e[(q-=3)+2],B="left";if(n=="right"&&a==J-Y)for(;q<e.length-3&&e[q+3]==e[q+4]&&!e[q+5].insertLeft;)r=e[(q+=3)+2],B="right";break}return{node:r,start:a,end:D,collapse:B,coverStart:Y,coverEnd:J}}function js(e,t){var n=io;if(t=="left")for(var r=0;r<e.length&&!((n=e[r]).left!=n.right);r++);else for(var a=e.length-1;a>=0&&!((n=e[a]).left!=n.right);a--);return n}function Ws(e,t,n,r){var a=ao(t.map,n,r),D=a.node,B=a.start,Y=a.end,J=a.collapse,q;if(D.nodeType==3){for(var de=0;de<4;de++){for(;B&&We(t.line.text.charAt(a.coverStart+B));)--B;for(;a.coverStart+Y<a.coverEnd&&We(t.line.text.charAt(a.coverStart+Y));)++Y;if(W&&N<9&&B==0&&Y==a.coverEnd-a.coverStart?q=D.parentNode.getBoundingClientRect():q=js(S(D,B,Y).getClientRects(),r),q.left||q.right||B==0)break;Y=B,B=B-1,J="right"}W&&N<11&&(q=Hs(e.display.measure,q))}else{B>0&&(J=r="right");var pe;e.options.lineWrapping&&(pe=D.getClientRects()).length>1?q=pe[r=="right"?pe.length-1:0]:q=D.getBoundingClientRect()}if(W&&N<9&&!B&&(!q||!q.left&&!q.right)){var De=D.parentNode.getClientRects()[0];De?q={left:De.left,right:De.left+Jn(e.display),top:De.top,bottom:De.bottom}:q=io}for(var we=q.top-t.rect.top,je=q.bottom-t.rect.top,Xe=(we+je)/2,qe=t.view.measure.heights,nt=0;nt<qe.length-1&&!(Xe<qe[nt]);nt++);var ut=nt?qe[nt-1]:0,it=qe[nt],mt={left:(J=="right"?q.right:q.left)-t.rect.left,right:(J=="left"?q.left:q.right)-t.rect.left,top:ut,bottom:it};return!q.left&&!q.right&&(mt.bogus=!0),e.options.singleCursorHeightPerLine||(mt.rtop=we,mt.rbottom=je),mt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Jt(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function oo(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function so(e){e.display.externalMeasure=null,y(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)oo(e.display.view[t])}function vi(e){so(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function lo(){return d&&o?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function uo(){return d&&o?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function ma(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=gi(e.widgets[n]));return t}function Gi(e,t,n,r,a){if(!a){var D=ma(t);n.top+=D,n.bottom+=D}if(r=="line")return n;r||(r="local");var B=on(t);if(r=="local"?B+=Hi(e.display):B-=e.display.viewOffset,r=="page"||r=="window"){var Y=e.display.lineSpace.getBoundingClientRect();B+=Y.top+(r=="window"?0:uo());var J=Y.left+(r=="window"?0:lo());n.left+=J,n.right+=J}return n.top+=B,n.bottom+=B,n}function ho(e,t,n){if(n=="div")return t;var r=t.left,a=t.top;if(n=="page")r-=lo(),a-=uo();else if(n=="local"||!n){var D=e.display.sizer.getBoundingClientRect();r+=D.left,a+=D.top}var B=e.display.lineSpace.getBoundingClientRect();return{left:r-B.left,top:a-B.top}}function ga(e,t,n,r,a){return r||(r=gt(e.doc,t.line)),Gi(e,r,no(e,r,t.ch,a),n)}function sn(e,t,n,r,a,D){r=r||gt(e.doc,t.line),a||(a=Yn(e,r));function B(je,Xe){var qe=fn(e,a,je,Xe?"right":"left",D);return Xe?qe.left=qe.right:qe.right=qe.left,Gi(e,r,qe,n)}var Y=$e(r,e.doc.direction),J=t.ch,q=t.sticky;if(J>=r.text.length?(J=r.text.length,q="before"):J<=0&&(J=0,q="after"),!Y)return B(q=="before"?J-1:J,q=="before");function de(je,Xe,qe){var nt=Y[Xe],ut=nt.level==1;return B(qe?je-1:je,ut!=qe)}var pe=Ye(Y,J,q),De=Qe,we=de(J,pe,q=="before");return De!=null&&(we.other=de(J,De,q!="before")),we}function co(e,t){var n=0;t=h(e.doc,t),e.options.lineWrapping||(n=Jn(e.display)*t.ch);var r=gt(e.doc,t.line),a=on(r)+Hi(e.display);return{left:n,right:n,top:a,bottom:a+r.height}}function va(e,t,n,r,a){var D=He(e,t,n);return D.xRel=a,r&&(D.outside=r),D}function ya(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return va(r.first,0,null,-1,-1);var a=Ar(r,n),D=r.first+r.size-1;if(a>D)return va(r.first+r.size-1,gt(r,D).text.length,null,1,1);t<0&&(t=0);for(var B=gt(r,a);;){var Y=Gs(e,B,a,t,n),J=hn(B,Y.ch+(Y.xRel>0||Y.outside>0?1:0));if(!J)return Y;var q=J.find(1);if(q.line==a)return q;B=gt(r,a=q.line)}}function fo(e,t,n,r){r-=ma(t);var a=t.text.length,D=et(function(B){return fn(e,n,B-1).bottom<=r},a,0);return a=et(function(B){return fn(e,n,B).top>r},D,a),{begin:D,end:a}}function po(e,t,n,r){n||(n=Yn(e,t));var a=Gi(e,t,fn(e,n,r),"line").top;return fo(e,t,n,a)}function ba(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Gs(e,t,n,r,a){a-=on(t);var D=Yn(e,t),B=ma(t),Y=0,J=t.text.length,q=!0,de=$e(t,e.doc.direction);if(de){var pe=(e.options.lineWrapping?zs:Ks)(e,t,n,D,de,r,a);q=pe.level!=1,Y=q?pe.from:pe.to-1,J=q?pe.to:pe.from-1}var De=null,we=null,je=et(function(Tt){var Et=fn(e,D,Tt);return Et.top+=B,Et.bottom+=B,ba(Et,r,a,!1)?(Et.top<=a&&Et.left<=r&&(De=Tt,we=Et),!0):!1},Y,J),Xe,qe,nt=!1;if(we){var ut=r-we.left<we.right-r,it=ut==q;je=De+(it?0:1),qe=it?"after":"before",Xe=ut?we.left:we.right}else{!q&&(je==J||je==Y)&&je++,qe=je==0?"after":je==t.text.length?"before":fn(e,D,je-(q?1:0)).bottom+B<=a==q?"after":"before";var mt=sn(e,He(n,je,qe),"line",t,D);Xe=mt.left,nt=a<mt.top?-1:a>=mt.bottom?1:0}return je=Fe(t.text,je,1),va(n,je,qe,nt,r-Xe)}function Ks(e,t,n,r,a,D,B){var Y=et(function(pe){var De=a[pe],we=De.level!=1;return ba(sn(e,He(n,we?De.to:De.from,we?"before":"after"),"line",t,r),D,B,!0)},0,a.length-1),J=a[Y];if(Y>0){var q=J.level!=1,de=sn(e,He(n,q?J.from:J.to,q?"after":"before"),"line",t,r);ba(de,D,B,!0)&&de.top>B&&(J=a[Y-1])}return J}function zs(e,t,n,r,a,D,B){var Y=fo(e,t,r,B),J=Y.begin,q=Y.end;/\s/.test(t.text.charAt(q-1))&&q--;for(var de=null,pe=null,De=0;De<a.length;De++){var we=a[De];if(we.from>=q||we.to<=J)continue;var je=we.level!=1,Xe=fn(e,r,je?Math.min(q,we.to)-1:Math.max(J,we.from)).right,qe=Xe<D?D-Xe+1e9:Xe-D;(!de||pe>qe)&&(de=we,pe=qe)}return de||(de=a[a.length-1]),de.from<J&&(de={from:J,to:de.to,level:de.level}),de.to>q&&(de={from:de.from,to:q,level:de.level}),de}var _n;function $n(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(_n==null){_n=u("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)_n.appendChild(document.createTextNode("x")),_n.appendChild(u("br"));_n.appendChild(document.createTextNode("x"))}c(e.measure,_n);var n=_n.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),y(e.measure),n||1}function Jn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=u("span","xxxxxxxxxx"),n=u("pre",[t],"CodeMirror-line-like");c(e.measure,n);var r=t.getBoundingClientRect(),a=(r.right-r.left)/10;return a>2&&(e.cachedCharWidth=a),a||10}function xa(e){for(var t=e.display,n={},r={},a=t.gutters.clientLeft,D=t.gutters.firstChild,B=0;D;D=D.nextSibling,++B){var Y=e.display.gutterSpecs[B].className;n[Y]=D.offsetLeft+D.clientLeft+a,r[Y]=D.clientWidth}return{fixedPos:Ea(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ea(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function mo(e){var t=$n(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Jn(e.display)-3);return function(a){if(Wr(e.doc,a))return 0;var D=0;if(a.widgets)for(var B=0;B<a.widgets.length;B++)a.widgets[B].height&&(D+=a.widgets[B].height);return n?D+(Math.ceil(a.text.length/r)||1)*t:D+t}}function Ca(e){var t=e.doc,n=mo(e);t.iter(function(r){var a=n(r);a!=r.height&&Tr(r,a)})}function In(e,t,n,r){var a=e.display;if(!n&&Pe(t).getAttribute("cm-not-content")=="true")return null;var D,B,Y=a.lineSpace.getBoundingClientRect();try{D=t.clientX-Y.left,B=t.clientY-Y.top}catch(pe){return null}var J=ya(e,D,B),q;if(r&&J.xRel>0&&(q=gt(e.doc,J.line).text).length==J.ch){var de=ee(q,q.length,e.options.tabSize)-q.length;J=He(J.line,Math.max(0,Math.round((D-to(e.display).left)/Jn(e.display))-de))}return J}function Nn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function _r(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var a=e.display;if(r&&n<a.viewTo&&(a.updateLineNumbers==null||a.updateLineNumbers>t)&&(a.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=a.viewTo)Or&&xn(e.doc,t)<a.viewTo&&Sn(e);else if(n<=a.viewFrom)Or&&Ui(e.doc,n+r)>a.viewFrom?Sn(e):(a.viewFrom+=r,a.viewTo+=r);else if(t<=a.viewFrom&&n>=a.viewTo)Sn(e);else if(t<=a.viewFrom){var D=Ki(e,n,n+r,1);D?(a.view=a.view.slice(D.index),a.viewFrom=D.lineN,a.viewTo+=r):Sn(e)}else if(n>=a.viewTo){var B=Ki(e,t,t,-1);B?(a.view=a.view.slice(0,B.index),a.viewTo=B.lineN):Sn(e)}else{var Y=Ki(e,t,t,-1),J=Ki(e,n,n+r,1);Y&&J?(a.view=a.view.slice(0,Y.index).concat(Gt(e,Y.lineN,J.lineN)).concat(a.view.slice(J.index)),a.viewTo+=r):Sn(e)}var q=a.externalMeasured;q&&(n<q.lineN?q.lineN+=r:t<q.lineN+q.size&&(a.externalMeasured=null))}function Cn(e,t,n){e.curOp.viewChanged=!0;var r=e.display,a=e.display.externalMeasured;if(a&&t>=a.lineN&&t<a.lineN+a.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var D=r.view[Nn(e,t)];if(D.node==null)return;var B=D.changes||(D.changes=[]);he(B,n)==-1&&B.push(n)}function Sn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ki(e,t,n,r){var a=Nn(e,t),D,B=e.display.view;if(!Or||n==e.doc.first+e.doc.size)return{index:a,lineN:n};for(var Y=e.display.viewFrom,J=0;J<a;J++)Y+=B[J].size;if(Y!=t){if(r>0){if(a==B.length-1)return null;D=Y+B[a].size-t,a++}else D=Y-t;t+=D,n+=D}for(;xn(e.doc,n)!=n;){if(a==(r<0?0:B.length-1))return null;n+=r*B[a-(r<0?1:0)].size,a+=r}return{index:a,lineN:n}}function Vs(e,t,n){var r=e.display,a=r.view;a.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=Gt(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Gt(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Nn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(Gt(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,Nn(e,n)))),r.viewTo=n}function go(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var a=t[r];!a.hidden&&(!a.node||a.changes)&&++n}return n}function yi(e){e.display.input.showSelection(e.display.input.prepareSelection())}function vo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},a=r.cursors=document.createDocumentFragment(),D=r.selection=document.createDocumentFragment(),B=0;B<n.sel.ranges.length;B++){if(!t&&B==n.sel.primIndex)continue;var Y=n.sel.ranges[B];if(Y.from().line>=e.display.viewTo||Y.to().line<e.display.viewFrom)continue;var J=Y.empty();(J||e.options.showCursorWhenSelecting)&&yo(e,Y.head,a),J||Xs(e,Y,D)}return r}function yo(e,t,n){var r=sn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),a=n.appendChild(u("div","\xA0","CodeMirror-cursor"));if(a.style.left=r.left+"px",a.style.top=r.top+"px",a.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var D=n.appendChild(u("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));D.style.display="",D.style.left=r.other.left+"px",D.style.top=r.other.top+"px",D.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function zi(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,a=e.doc,D=document.createDocumentFragment(),B=to(e.display),Y=B.left,J=Math.max(r.sizerWidth,Mn(e)-r.sizer.offsetLeft)-B.right,q=a.direction=="ltr";function de(it,mt,Tt,Et){mt<0&&(mt=0),mt=Math.round(mt),Et=Math.round(Et),D.appendChild(u("div",null,"CodeMirror-selected","position: absolute; left: "+it+`px;
|
|
top: `+mt+"px; width: "+(Tt==null?J-it:Tt)+`px;
|
|
height: `+(Et-mt)+"px"))}function pe(it,mt,Tt){var Et=gt(a,it),Pt=Et.text.length,tr,br;function ar(cr,Fr){return ga(e,He(it,cr),"div",Et,Fr)}function Gr(cr,Fr,Sr){var mr=po(e,Et,null,cr),fr=Fr=="ltr"==(Sr=="after")?"left":"right",sr=Sr=="after"?mr.begin:mr.end-(/\s/.test(Et.text.charAt(mr.end-1))?2:1);return ar(sr,fr)[fr]}var Nr=$e(Et,a.direction);return Je(Nr,mt||0,Tt==null?Pt:Tt,function(cr,Fr,Sr,mr){var fr=Sr=="ltr",sr=ar(cr,fr?"left":"right"),Br=ar(Fr-1,fr?"right":"left"),ui=mt==null&&cr==0,Rn=Tt==null&&Fr==Pt,Lr=mr==0,pn=!Nr||mr==Nr.length-1;if(Br.top-sr.top<=3){var xr=(q?ui:Rn)&&Lr,Xa=(q?Rn:ui)&&pn,yn=xr?Y:(fr?sr:Br).left,Wn=Xa?J:(fr?Br:sr).right;de(yn,sr.top,Wn-yn,sr.bottom)}else{var Hn,Rr,di,Ya;fr?(Hn=q&&ui&&Lr?Y:sr.left,Rr=q?J:Gr(cr,Sr,"before"),di=q?Y:Gr(Fr,Sr,"after"),Ya=q&&Rn&&pn?J:Br.right):(Hn=q?Gr(cr,Sr,"before"):Y,Rr=!q&&ui&&Lr?J:sr.right,di=!q&&Rn&&pn?Y:Br.left,Ya=q?Gr(Fr,Sr,"after"):J),de(Hn,sr.top,Rr-Hn,sr.bottom),sr.bottom<Br.top&&de(Y,sr.bottom,null,Br.top),de(di,Br.top,Ya-di,Br.bottom)}(!tr||zi(sr,tr)<0)&&(tr=sr),zi(Br,tr)<0&&(tr=Br),(!br||zi(sr,br)<0)&&(br=sr),zi(Br,br)<0&&(br=Br)}),{start:tr,end:br}}var De=t.from(),we=t.to();if(De.line==we.line)pe(De.line,De.ch,we.ch);else{var je=gt(a,De.line),Xe=gt(a,we.line),qe=Pr(je)==Pr(Xe),nt=pe(De.line,De.ch,qe?je.text.length+1:null).end,ut=pe(we.line,qe?0:null,we.ch).start;qe&&(nt.top<ut.top-2?(de(nt.right,nt.top,null,nt.bottom),de(Y,ut.top,ut.left,ut.bottom)):de(nt.right,nt.top,ut.left-nt.right,nt.bottom)),nt.bottom<ut.top&&de(Y,nt.bottom,null,ut.top)}n.appendChild(D)}function Sa(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Zn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function bo(e){e.state.focused||(e.display.input.focus(),Ta(e))}function xo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Zn(e))},100)}function Ta(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Be(e,"focus",e,t),e.state.focused=!0,j(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),P&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Sa(e)}function Zn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Be(e,"blur",e,t),e.state.focused=!1,E(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Vi(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var a=t.view[r],D=e.options.lineWrapping,B=void 0,Y=0;if(a.hidden)continue;if(W&&N<8){var J=a.node.offsetTop+a.node.offsetHeight;B=J-n,n=J}else{var q=a.node.getBoundingClientRect();B=q.bottom-q.top,!D&&a.text.firstChild&&(Y=a.text.firstChild.getBoundingClientRect().right-q.left-1)}var de=a.line.height-B;if((de>.005||de<-.005)&&(Tr(a.line,B),Eo(a.line),a.rest))for(var pe=0;pe<a.rest.length;pe++)Eo(a.rest[pe]);if(Y>e.display.sizerWidth){var De=Math.ceil(Y/Jn(e.display));De>e.display.maxLineLength&&(e.display.maxLineLength=De,e.display.maxLine=a.line,e.display.maxLineChanged=!0)}}}function Eo(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function Xi(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Hi(e));var a=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,D=Ar(t,r),B=Ar(t,a);if(n&&n.ensure){var Y=n.ensure.from.line,J=n.ensure.to.line;Y<D?(D=Y,B=Ar(t,on(gt(t,Y))+e.wrapper.clientHeight)):Math.min(J,t.lastLine())>=B&&(D=Ar(t,on(gt(t,J))-e.wrapper.clientHeight),B=J)}return{from:D,to:Math.max(B,D+1)}}function Ys(e,t){if(Ke(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),a=null;if(t.top+r.top<0?a=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(a=!1),a!=null&&!g){var D=u("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-Hi(e.display))+`px;
|
|
height: `+(t.bottom-t.top+cn(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(D),D.scrollIntoView(a),e.display.lineSpace.removeChild(D)}}function $s(e,t,n,r){r==null&&(r=0);var a;!e.options.lineWrapping&&t==n&&(t=t.ch?He(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?He(t.line,t.ch+1,"before"):t);for(var D=0;D<5;D++){var B=!1,Y=sn(e,t),J=!n||n==t?Y:sn(e,n);a={left:Math.min(Y.left,J.left),top:Math.min(Y.top,J.top)-r,right:Math.max(Y.left,J.left),bottom:Math.max(Y.bottom,J.bottom)+r};var q=wa(e,a),de=e.doc.scrollTop,pe=e.doc.scrollLeft;if(q.scrollTop!=null&&(xi(e,q.scrollTop),Math.abs(e.doc.scrollTop-de)>1&&(B=!0)),q.scrollLeft!=null&&(Fn(e,q.scrollLeft),Math.abs(e.doc.scrollLeft-pe)>1&&(B=!0)),!B)break}return a}function Js(e,t){var n=wa(e,t);n.scrollTop!=null&&xi(e,n.scrollTop),n.scrollLeft!=null&&Fn(e,n.scrollLeft)}function wa(e,t){var n=e.display,r=$n(e.display);t.top<0&&(t.top=0);var a=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,D=fa(e),B={};t.bottom-t.top>D&&(t.bottom=t.top+D);var Y=e.doc.height+ca(n),J=t.top<r,q=t.bottom>Y-r;if(t.top<a)B.scrollTop=J?0:t.top;else if(t.bottom>a+D){var de=Math.min(t.top,(q?Y:t.bottom)-D);de!=a&&(B.scrollTop=de)}var pe=e.options.fixedGutter?0:n.gutters.offsetWidth,De=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-pe,we=Mn(e)-n.gutters.offsetWidth,je=t.right-t.left>we;return je&&(t.right=t.left+we),t.left<10?B.scrollLeft=0:t.left<De?B.scrollLeft=Math.max(0,t.left+pe-(je?0:10)):t.right>we+De-3&&(B.scrollLeft=t.right+(je?0:10)-we),B}function La(e,t){if(t==null)return;Yi(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Qn(e){Yi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function bi(e,t,n){(t!=null||n!=null)&&Yi(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Zs(e,t){Yi(e),e.curOp.scrollToPos=t}function Yi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=co(e,t.from),r=co(e,t.to);Co(e,n,r,t.margin)}}function Co(e,t,n,r){var a=wa(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});bi(e,a.scrollLeft,a.scrollTop)}function xi(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;O||Da(e,{top:t}),So(e,t,!0),O&&Da(e),Si(e,100)}function So(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function Fn(e,t,n,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,Do(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function Ei(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+ca(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+cn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Bn=function(e,t,n){this.cm=n;var r=this.vert=u("div",[u("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),a=this.horiz=u("div",[u("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=a.tabIndex=-1,e(r),e(a),Oe(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Oe(a,"scroll",function(){a.clientWidth&&t(a.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,W&&N<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Bn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var a=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+a)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var D=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+D)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},Bn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Bn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Bn.prototype.zeroWidthHack=function(){var e=s&&!p?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new se,this.disableVert=new se},Bn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var a=e.getBoundingClientRect(),D=n=="vert"?document.elementFromPoint(a.right-1,(a.top+a.bottom)/2):document.elementFromPoint((a.right+a.left)/2,a.bottom-1);D!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},Bn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Ci=function(){};Ci.prototype.update=function(){return{bottom:0,right:0}},Ci.prototype.setScrollLeft=function(){},Ci.prototype.setScrollTop=function(){},Ci.prototype.clear=function(){};function qn(e,t){t||(t=Ei(e));var n=e.display.barWidth,r=e.display.barHeight;To(e,t);for(var a=0;a<4&&n!=e.display.barWidth||r!=e.display.barHeight;a++)n!=e.display.barWidth&&e.options.lineWrapping&&Vi(e),To(e,Ei(e)),n=e.display.barWidth,r=e.display.barHeight}function To(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var wo={native:Bn,null:Ci};function Lo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&E(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new wo[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Oe(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?Fn(e,t):xi(e,t)},e),e.display.scrollbars.addClass&&j(e.display.wrapper,e.display.scrollbars.addClass)}var Qs=0;function Un(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Qs},qr(e.curOp)}function jn(e){var t=e.curOp;t&&Wi(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;qs(n)})}function qs(e){for(var t=e.ops,n=0;n<t.length;n++)el(t[n]);for(var r=0;r<t.length;r++)tl(t[r]);for(var a=0;a<t.length;a++)rl(t[a]);for(var D=0;D<t.length;D++)nl(t[D]);for(var B=0;B<t.length;B++)il(t[B])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&ji(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new $i(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Aa(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&Vi(t),e.barMeasure=Ei(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=no(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+cn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Mn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function nl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Fn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==_();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&qn(t,e.barMeasure),e.updatedDisplay&&ka(t,e.barMeasure),e.selectionChanged&&Sa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&bo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Ao(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&So(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Fn(t,e.scrollLeft,!0,!0),e.scrollToPos){var a=$s(t,h(r,e.scrollToPos.from),h(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,a)}var D=e.maybeHiddenMarkers,B=e.maybeUnhiddenMarkers;if(D)for(var Y=0;Y<D.length;++Y)D[Y].lines.length||Be(D[Y],"hide");if(B)for(var J=0;J<B.length;++J)B[J].lines.length&&Be(B[J],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Be(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Hr(e,t){if(e.curOp)return t();Un(e);try{return t()}finally{jn(e)}}function vr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Un(e);try{return t.apply(e,arguments)}finally{jn(e)}}}function Dr(e){return function(){if(this.curOp)return e.apply(this,arguments);Un(this);try{return e.apply(this,arguments)}finally{jn(this)}}}function yr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Un(t);try{return e.apply(this,arguments)}finally{jn(t)}}}function Si(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,K(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=rt(e,t.highlightFrontier),a=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(D){if(r.line>=e.display.viewFrom){var B=D.styles,Y=D.text.length>e.options.maxHighlightLength?Zt(t.mode,r.state):null,J=ge(e,D,r,!0);Y&&(r.state=Y),D.styles=J.styles;var q=D.styleClasses,de=J.classes;de?D.styleClasses=de:q&&(D.styleClasses=null);for(var pe=!B||B.length!=D.styles.length||q!=de&&(!q||!de||q.bgClass!=de.bgClass||q.textClass!=de.textClass),De=0;!pe&&De<B.length;++De)pe=B[De]!=D.styles[De];pe&&a.push(r.line),D.stateAfter=r.save(),r.nextLine()}else D.text.length<=e.options.maxHighlightLength&&pt(e,D.text,r),D.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return Si(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),a.length&&Hr(e,function(){for(var D=0;D<a.length;D++)Cn(e,a[D],"text")})}var $i=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Xi(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Mn(e),this.force=n,this.dims=xa(e),this.events=[]};$i.prototype.signal=function(e,t){me(e,t)&&this.events.push(arguments)},$i.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Be.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=cn(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=cn(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=_();if(!t||!T(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&T(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function ll(e){if(!e||!e.activeElt||e.activeElt==_())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&T(document.body,e.anchorNode)&&T(document.body,e.focusNode)){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function Aa(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return Sn(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&go(e)==0)return!1;Ro(e)&&(Sn(e),t.dims=xa(e));var a=r.first+r.size,D=Math.max(t.visible.from-e.options.viewportMargin,r.first),B=Math.min(a,t.visible.to+e.options.viewportMargin);n.viewFrom<D&&D-n.viewFrom<20&&(D=Math.max(r.first,n.viewFrom)),n.viewTo>B&&n.viewTo-B<20&&(B=Math.min(a,n.viewTo)),Or&&(D=xn(e.doc,D),B=Ui(e.doc,B));var Y=D!=n.viewFrom||B!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,D,B),n.viewOffset=on(gt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var J=go(e);if(!Y&&J==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var q=sl(e);return J>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),J>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(q),y(n.cursorDiv),y(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,Y&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,Si(e,400)),n.updateLineNumbers=null,!0}function Ao(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Mn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ca(e.display)-fa(e),n.top)}),t.visible=Xi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Xi(e.display,e.doc,n));if(!Aa(e,t))break;Vi(e);var a=Ei(e);yi(e),qn(e,a),ka(e,a),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Da(e,t){var n=new $i(e,t);if(Aa(e,n)){Vi(e),Ao(e,n);var r=Ei(e);yi(e),qn(e,r),ka(e,r),n.finish()}}function ul(e,t,n){var r=e.display,a=e.options.lineNumbers,D=r.lineDiv,B=D.firstChild;function Y(je){var Xe=je.nextSibling;return P&&s&&e.display.currentWheelTarget==je?je.style.display="none":je.parentNode.removeChild(je),Xe}for(var J=r.view,q=r.viewFrom,de=0;de<J.length;de++){var pe=J[de];if(!pe.hidden)if(!pe.node||pe.node.parentNode!=D){var De=Ns(e,pe,q,n);D.insertBefore(De,B)}else{for(;B!=pe.node;)B=Y(B);var we=a&&t!=null&&t<=q&&pe.lineNumber;pe.changes&&(he(pe.changes,"gutter")>-1&&(we=!1),Ja(e,pe,q,n)),we&&(y(pe.lineNumber),pe.lineNumber.appendChild(document.createTextNode(rn(e.options,q)))),B=pe.node.nextSibling}q+=pe.size}for(;B;)B=Y(B)}function Ra(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function ka(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+cn(e)+"px"}function Do(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Ea(t)-t.scroller.scrollLeft+e.doc.scrollLeft,a=t.gutters.offsetWidth,D=r+"px",B=0;B<n.length;B++)if(!n[B].hidden){e.options.fixedGutter&&(n[B].gutter&&(n[B].gutter.style.left=D),n[B].gutterBackground&&(n[B].gutterBackground.style.left=D));var Y=n[B].alignable;if(Y)for(var J=0;J<Y.length;J++)Y[J].style.left=D}e.options.fixedGutter&&(t.gutters.style.left=r+a+"px")}function Ro(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=rn(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var a=r.measure.appendChild(u("div",[u("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),D=a.firstChild.offsetWidth,B=a.offsetWidth-D;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(D,r.lineGutter.offsetWidth-B)+1,r.lineNumWidth=r.lineNumInnerWidth+B,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Ra(e.display),!0}return!1}function Oa(e,t){for(var n=[],r=!1,a=0;a<e.length;a++){var D=e[a],B=null;if(typeof D!="string"&&(B=D.style,D=D.className),D=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:D,style:B})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function ko(e){var t=e.gutters,n=e.gutterSpecs;y(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var a=n[r],D=a.className,B=a.style,Y=t.appendChild(u("div",null,"CodeMirror-gutter "+D));B&&(Y.style.cssText=B),D=="CodeMirror-linenumbers"&&(e.lineGutter=Y,Y.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Ra(e)}function Ti(e){ko(e.display),_r(e),Do(e)}function dl(e,t,n,r){var a=this;this.input=n,a.scrollbarFiller=u("div",null,"CodeMirror-scrollbar-filler"),a.scrollbarFiller.setAttribute("cm-not-content","true"),a.gutterFiller=u("div",null,"CodeMirror-gutter-filler"),a.gutterFiller.setAttribute("cm-not-content","true"),a.lineDiv=A("div",null,"CodeMirror-code"),a.selectionDiv=u("div",null,null,"position: relative; z-index: 1"),a.cursorDiv=u("div",null,"CodeMirror-cursors"),a.measure=u("div",null,"CodeMirror-measure"),a.lineMeasure=u("div",null,"CodeMirror-measure"),a.lineSpace=A("div",[a.measure,a.lineMeasure,a.selectionDiv,a.cursorDiv,a.lineDiv],null,"position: relative; outline: none");var D=A("div",[a.lineSpace],"CodeMirror-lines");a.mover=u("div",[D],null,"position: relative"),a.sizer=u("div",[a.mover],"CodeMirror-sizer"),a.sizerWidth=null,a.heightForcer=u("div",null,null,"position: absolute; height: "+Ce+"px; width: 1px;"),a.gutters=u("div",null,"CodeMirror-gutters"),a.lineGutter=null,a.scroller=u("div",[a.sizer,a.heightForcer,a.gutters],"CodeMirror-scroll"),a.scroller.setAttribute("tabIndex","-1"),a.wrapper=u("div",[a.scrollbarFiller,a.gutterFiller,a.scroller],"CodeMirror"),W&&N<8&&(a.gutters.style.zIndex=-1,a.scroller.style.paddingRight=0),!P&&!(O&&i)&&(a.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(a.wrapper):e(a.wrapper)),a.viewFrom=a.viewTo=t.first,a.reportedViewFrom=a.reportedViewTo=t.first,a.view=[],a.renderedView=null,a.externalMeasured=null,a.viewOffset=0,a.lastWrapHeight=a.lastWrapWidth=0,a.updateLineNumbers=null,a.nativeBarWidth=a.barHeight=a.barWidth=0,a.scrollbarsClipped=!1,a.lineNumWidth=a.lineNumInnerWidth=a.lineNumChars=null,a.alignWidgets=!1,a.cachedCharWidth=a.cachedTextHeight=a.cachedPaddingH=null,a.maxLine=null,a.maxLineLength=0,a.maxLineChanged=!1,a.wheelDX=a.wheelDY=a.wheelStartX=a.wheelStartY=null,a.shift=!1,a.selForContextMenu=null,a.activeTouch=null,a.gutterSpecs=Oa(r.gutters,r.lineNumbers),ko(a),n.init(a)}var Ji=0,$r=null;W?$r=-.53:O?$r=15:d?$r=-.7:w&&($r=-1/3);function Oo(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function hl(e){var t=Oo(e);return t.x*=$r,t.y*=$r,t}function Po(e,t){var n=Oo(t),r=n.x,a=n.y,D=e.display,B=D.scroller,Y=B.scrollWidth>B.clientWidth,J=B.scrollHeight>B.clientHeight;if(!(r&&Y||a&&J))return;if(a&&s&&P){e:for(var q=t.target,de=D.view;q!=B;q=q.parentNode)for(var pe=0;pe<de.length;pe++)if(de[pe].node==q){e.display.currentWheelTarget=q;break e}}if(r&&!O&&!f&&$r!=null){a&&J&&xi(e,Math.max(0,B.scrollTop+a*$r)),Fn(e,Math.max(0,B.scrollLeft+r*$r)),(!a||a&&J)&&te(t),D.wheelStartX=null;return}if(a&&$r!=null){var De=a*$r,we=e.doc.scrollTop,je=we+D.wrapper.clientHeight;De<0?we=Math.max(0,we+De-50):je=Math.min(e.doc.height,je+De+50),Da(e,{top:we,bottom:je})}Ji<20&&(D.wheelStartX==null?(D.wheelStartX=B.scrollLeft,D.wheelStartY=B.scrollTop,D.wheelDX=r,D.wheelDY=a,setTimeout(function(){if(D.wheelStartX==null)return;var Xe=B.scrollLeft-D.wheelStartX,qe=B.scrollTop-D.wheelStartY,nt=qe&&D.wheelDY&&qe/D.wheelDY||Xe&&D.wheelDX&&Xe/D.wheelDX;if(D.wheelStartX=D.wheelStartY=null,!nt)return;$r=($r*Ji+nt)/(Ji+1),++Ji},200)):(D.wheelDX+=r,D.wheelDY+=a))}var Jr=function(e,t){this.ranges=e,this.primIndex=t};Jr.prototype.primary=function(){return this.ranges[this.primIndex]},Jr.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!Mt(n.anchor,r.anchor)||!Mt(n.head,r.head))return!1}return!0},Jr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Xt(zt(this.ranges[t].anchor),zt(this.ranges[t].head));return new Jr(e,this.primIndex)},Jr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Jr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(lt(t,r.from())>=0&<(e,r.to())<=0)return n}return-1};var Xt=function(e,t){this.anchor=e,this.head=t};Xt.prototype.from=function(){return qt(this.anchor,this.head)},Xt.prototype.to=function(){return Yt(this.anchor,this.head)},Xt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function ln(e,t,n){var r=e&&e.options.selectionsMayTouch,a=t[n];t.sort(function(De,we){return lt(De.from(),we.from())}),n=he(t,a);for(var D=1;D<t.length;D++){var B=t[D],Y=t[D-1],J=lt(Y.to(),B.from());if(r&&!B.empty()?J>0:J>=0){var q=qt(Y.from(),B.from()),de=Yt(Y.to(),B.to()),pe=Y.empty()?B.from()==B.head:Y.from()==Y.head;D<=n&&--n,t.splice(--D,2,new Xt(pe?de:q,pe?q:de))}}return new Jr(t,n)}function Tn(e,t){return new Jr([new Xt(e,t||e)],0)}function wn(e){return e.text?He(e.from.line+e.text.length-1,Le(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Mo(e,t){if(lt(e,t.from)<0)return e;if(lt(e,t.to)<=0)return wn(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=wn(t).ch-t.to.ch),He(n,r)}function Pa(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var a=e.sel.ranges[r];n.push(new Xt(Mo(a.anchor,t),Mo(a.head,t)))}return ln(e.cm,n,e.sel.primIndex)}function _o(e,t,n){return e.line==t.line?He(n.line,e.ch-t.ch+n.ch):He(n.line+(e.line-t.line),e.ch)}function cl(e,t,n){for(var r=[],a=He(e.first,0),D=a,B=0;B<t.length;B++){var Y=t[B],J=_o(Y.from,a,D),q=_o(wn(Y),a,D);if(a=Y.to,D=q,n=="around"){var de=e.sel.ranges[B],pe=lt(de.head,de.anchor)<0;r[B]=new Xt(pe?q:J,pe?J:q)}else r[B]=new Xt(J,J)}return new Jr(r,e.sel.primIndex)}function Ma(e){e.doc.mode=Ct(e.options,e.doc.modeOption),wi(e)}function wi(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,Si(e,100),e.state.modeGen++,e.curOp&&_r(e)}function Io(e,t){return t.from.ch==0&&t.to.ch==0&&Le(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function _a(e,t,n,r){function a(ut){return n?n[ut]:null}function D(ut,it,mt){$a(ut,it,mt,r),Cr(ut,"change",ut,t)}function B(ut,it){for(var mt=[],Tt=ut;Tt<it;++Tt)mt.push(new Pn(q[Tt],a(Tt),r));return mt}var Y=t.from,J=t.to,q=t.text,de=gt(e,Y.line),pe=gt(e,J.line),De=Le(q),we=a(q.length-1),je=J.line-Y.line;if(t.full)e.insert(0,B(0,q.length)),e.remove(q.length,e.size-q.length);else if(Io(e,t)){var Xe=B(0,q.length-1);D(pe,pe.text,we),je&&e.remove(Y.line,je),Xe.length&&e.insert(Y.line,Xe)}else if(de==pe)if(q.length==1)D(de,de.text.slice(0,Y.ch)+De+de.text.slice(J.ch),we);else{var qe=B(1,q.length-1);qe.push(new Pn(De+de.text.slice(J.ch),we,r)),D(de,de.text.slice(0,Y.ch)+q[0],a(0)),e.insert(Y.line+1,qe)}else if(q.length==1)D(de,de.text.slice(0,Y.ch)+q[0]+pe.text.slice(J.ch),a(0)),e.remove(Y.line+1,je);else{D(de,de.text.slice(0,Y.ch)+q[0],a(0)),D(pe,De+pe.text.slice(J.ch),we);var nt=B(1,q.length-1);je>1&&e.remove(Y.line+1,je-1),e.insert(Y.line+1,nt)}Cr(e,"change",e,t)}function Ln(e,t,n){function r(a,D,B){if(a.linked)for(var Y=0;Y<a.linked.length;++Y){var J=a.linked[Y];if(J.doc==D)continue;var q=B&&J.sharedHist;if(n&&!q)continue;t(J.doc,q),r(J.doc,a,q)}}r(e,null,!0)}function No(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ca(e),Ma(e),Fo(e),e.options.lineWrapping||ji(e),e.options.mode=t.modeOption,_r(e)}function Fo(e){(e.doc.direction=="rtl"?j:E)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Hr(e,function(){Fo(e),_r(e)})}function Zi(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Ia(e,t){var n={from:zt(t.from),to:wn(t),text:kr(e,t.from,t.to)};return jo(e,n,t.from.line,t.to.line+1),Ln(e,function(r){return jo(r,n,t.from.line,t.to.line+1)},!0),n}function Bo(e){for(;e.length;){var t=Le(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Bo(e.done),Le(e.done);if(e.done.length&&!Le(e.done).ranges)return Le(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Le(e.done)}function Uo(e,t,n,r){var a=e.history;a.undone.length=0;var D=+new Date,B,Y;if((a.lastOp==r||a.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&a.lastModTime>D-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(B=pl(a,a.lastOp==r)))Y=Le(B.changes),lt(t.from,t.to)==0&<(t.from,Y.to)==0?Y.to=wn(t):B.changes.push(Ia(e,t));else{var J=Le(a.done);for((!J||!J.ranges)&&Qi(e.sel,a.done),B={changes:[Ia(e,t)],generation:a.generation},a.done.push(B);a.done.length>a.undoDepth;)a.done.shift(),a.done[0].ranges||a.done.shift()}a.done.push(n),a.generation=++a.maxGeneration,a.lastModTime=a.lastSelTime=D,a.lastOp=a.lastSelOp=r,a.lastOrigin=a.lastSelOrigin=t.origin,Y||Be(e,"historyAdded")}function ml(e,t,n,r){var a=t.charAt(0);return a=="*"||a=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,r){var a=e.history,D=r&&r.origin;n==a.lastSelOp||D&&a.lastSelOrigin==D&&(a.lastModTime==a.lastSelTime&&a.lastOrigin==D||ml(e,D,Le(a.done),t))?a.done[a.done.length-1]=t:Qi(t,a.done),a.lastSelTime=+new Date,a.lastSelOrigin=D,a.lastSelOp=n,r&&r.clearRedo!==!1&&Bo(a.undone)}function Qi(e,t){var n=Le(t);n&&n.ranges&&n.equals(e)||t.push(e)}function jo(e,t,n,r){var a=t["spans_"+e.id],D=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(B){B.markedSpans&&((a||(a=t["spans_"+e.id]={}))[D]=B.markedSpans),++D})}function vl(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function yl(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],a=0;a<t.text.length;++a)r.push(vl(n[a]));return r}function Wo(e,t){var n=yl(e,t),r=an(e,t);if(!n)return r;if(!r)return n;for(var a=0;a<n.length;++a){var D=n[a],B=r[a];if(D&&B){e:for(var Y=0;Y<B.length;++Y){for(var J=B[Y],q=0;q<D.length;++q)if(D[q].marker==J.marker)continue e;D.push(J)}}else B&&(n[a]=B)}return n}function ei(e,t,n){for(var r=[],a=0;a<e.length;++a){var D=e[a];if(D.ranges){r.push(n?Jr.prototype.deepCopy.call(D):D);continue}var B=D.changes,Y=[];r.push({changes:Y});for(var J=0;J<B.length;++J){var q=B[J],de=void 0;if(Y.push({from:q.from,to:q.to,text:q.text}),t)for(var pe in q)(de=pe.match(/^spans_(\d+)$/))&&(he(t,Number(de[1]))>-1&&(Le(Y)[pe]=q[pe],delete q[pe]))}}return r}function Na(e,t,n,r){if(r){var a=e.anchor;if(n){var D=lt(t,a)<0;D!=lt(n,a)<0?(a=t,t=n):D!=lt(t,n)<0&&(t=n)}return new Xt(a,t)}else return new Xt(n||t,t)}function qi(e,t,n,r,a){a==null&&(a=e.cm&&(e.cm.display.shift||e.extend)),wr(e,new Jr([Na(e.sel.primary(),t,n,a)],0),r)}function Ho(e,t,n){for(var r=[],a=e.cm&&(e.cm.display.shift||e.extend),D=0;D<e.sel.ranges.length;D++)r[D]=Na(e.sel.ranges[D],t[D],null,a);var B=ln(e.cm,r,e.sel.primIndex);wr(e,B,n)}function Fa(e,t,n,r){var a=e.sel.ranges.slice(0);a[t]=n,wr(e,ln(e.cm,a,e.sel.primIndex),r)}function Go(e,t,n,r){wr(e,Tn(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(a){this.ranges=[];for(var D=0;D<a.length;D++)this.ranges[D]=new Xt(h(e,a[D].anchor),h(e,a[D].head))},origin:n&&n.origin};return Be(e,"beforeSelectionChange",e,r),e.cm&&Be(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?ln(e.cm,r.ranges,r.ranges.length-1):t}function Ko(e,t,n){var r=e.history.done,a=Le(r);a&&a.ranges?(r[r.length-1]=t,ea(e,t,n)):wr(e,t,n)}function wr(e,t,n){ea(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function ea(e,t,n){(me(e,"beforeSelectionChange")||e.cm&&me(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(lt(t.primary().head,e.sel.primary().head)<0?-1:1);zo(e,Xo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&Qn(e.cm)}function zo(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Ee(e.cm)),Cr(e,"cursorActivity",e)}function Vo(e){zo(e,Xo(e,e.sel,null,!1))}function Xo(e,t,n,r){for(var a,D=0;D<t.ranges.length;D++){var B=t.ranges[D],Y=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[D],J=ta(e,B.anchor,Y&&Y.anchor,n,r),q=ta(e,B.head,Y&&Y.head,n,r);(a||J!=B.anchor||q!=B.head)&&(a||(a=t.ranges.slice(0,D)),a[D]=new Xt(J,q))}return a?ln(e.cm,a,t.primIndex):t}function ti(e,t,n,r,a){var D=gt(e,t.line);if(D.markedSpans)for(var B=0;B<D.markedSpans.length;++B){var Y=D.markedSpans[B],J=Y.marker,q="selectLeft"in J?!J.selectLeft:J.inclusiveLeft,de="selectRight"in J?!J.selectRight:J.inclusiveRight;if((Y.from==null||(q?Y.from<=t.ch:Y.from<t.ch))&&(Y.to==null||(de?Y.to>=t.ch:Y.to>t.ch))){if(a&&(Be(J,"beforeCursorEnter"),J.explicitlyCleared))if(D.markedSpans){--B;continue}else break;if(!J.atomic)continue;if(n){var pe=J.find(r<0?1:-1),De=void 0;if((r<0?de:q)&&(pe=Yo(e,pe,-r,pe&&pe.line==t.line?D:null)),pe&&pe.line==t.line&&(De=lt(pe,n))&&(r<0?De<0:De>0))return ti(e,pe,t,r,a)}var we=J.find(r<0?-1:1);return(r<0?q:de)&&(we=Yo(e,we,r,we.line==t.line?D:null)),we?ti(e,we,t,r,a):null}}return t}function ta(e,t,n,r,a){var D=r||1,B=ti(e,t,n,D,a)||!a&&ti(e,t,n,D,!0)||ti(e,t,n,-D,a)||!a&&ti(e,t,n,-D,!0);return B||(e.cantEdit=!0,He(e.first,0))}function Yo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?h(e,He(t.line-1)):null:n>0&&t.ch==(r||gt(e,t.line)).text.length?t.line<e.first+e.size-1?He(t.line+1,0):null:new He(t.line,t.ch+n)}function $o(e){e.setSelection(He(e.firstLine(),0),He(e.lastLine()),ke)}function Jo(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(a,D,B,Y){a&&(r.from=h(e,a)),D&&(r.to=h(e,D)),B&&(r.text=B),Y!==void 0&&(r.origin=Y)}),Be(e,"beforeChange",e,r),e.cm&&Be(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function ri(e,t,n){if(e.cm){if(!e.cm.curOp)return vr(e.cm,ri)(e,t,n);if(e.cm.state.suppressEdits)return}if((me(e,"beforeChange")||e.cm&&me(e.cm,"beforeChange"))&&(t=Jo(e,t,!0),!t))return;var r=Gn&&!n&&kn(e,t.from,t.to);if(r)for(var a=r.length-1;a>=0;--a)Zo(e,{from:r[a].from,to:r[a].to,text:a?[""]:t.text,origin:t.origin});else Zo(e,t)}function Zo(e,t){if(t.text.length==1&&t.text[0]==""&<(t.from,t.to)==0)return;var n=Pa(e,t);Uo(e,t,n,e.cm?e.cm.curOp.id:NaN),Li(e,t,n,an(e,t));var r=[];Ln(e,function(a,D){!D&&he(r,a.history)==-1&&(ts(a.history,t),r.push(a.history)),Li(a,t,null,an(a,t))})}function ra(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var a=e.history,D,B=e.sel,Y=t=="undo"?a.done:a.undone,J=t=="undo"?a.undone:a.done,q=0;q<Y.length&&!(D=Y[q],n?D.ranges&&!D.equals(e.sel):!D.ranges);q++);if(q==Y.length)return;for(a.lastOrigin=a.lastSelOrigin=null;;)if(D=Y.pop(),D.ranges){if(Qi(D,J),n&&!D.equals(e.sel)){wr(e,D,{clearRedo:!1});return}B=D}else if(r){Y.push(D);return}else break;var de=[];Qi(B,J),J.push({changes:de,generation:a.generation}),a.generation=D.generation||++a.maxGeneration;for(var pe=me(e,"beforeChange")||e.cm&&me(e.cm,"beforeChange"),De=function(Xe){var qe=D.changes[Xe];if(qe.origin=t,pe&&!Jo(e,qe,!1))return Y.length=0,{};de.push(Ia(e,qe));var nt=Xe?Pa(e,qe):Le(Y);Li(e,qe,nt,Wo(e,qe)),!Xe&&e.cm&&e.cm.scrollIntoView({from:qe.from,to:wn(qe)});var ut=[];Ln(e,function(it,mt){!mt&&he(ut,it.history)==-1&&(ts(it.history,qe),ut.push(it.history)),Li(it,qe,null,Wo(it,qe))})},we=D.changes.length-1;we>=0;--we){var je=De(we);if(je)return je.v}}function Qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new Jr(xe(e.sel.ranges,function(a){return new Xt(He(a.anchor.line+t,a.anchor.ch),He(a.head.line+t,a.head.ch))}),e.sel.primIndex),e.cm){_r(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Cn(e.cm,r,"gutter")}}function Li(e,t,n,r){if(e.cm&&!e.cm.curOp)return vr(e.cm,Li)(e,t,n,r);if(t.to.line<e.first){Qo(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var a=t.text.length-1-(e.first-t.from.line);Qo(e,a),t={from:He(e.first,0),to:He(t.to.line+a,t.to.ch),text:[Le(t.text)],origin:t.origin}}var D=e.lastLine();t.to.line>D&&(t={from:t.from,to:He(D,gt(e,D).text.length),text:[t.text[0]],origin:t.origin}),t.removed=kr(e,t.from,t.to),n||(n=Pa(e,t)),e.cm?xl(e.cm,t,r):_a(e,t,r),ea(e,n,ke),e.cantEdit&&ta(e,He(e.firstLine(),0))&&(e.cantEdit=!1)}function xl(e,t,n){var r=e.doc,a=e.display,D=t.from,B=t.to,Y=!1,J=D.line;e.options.lineWrapping||(J=Ot(Pr(gt(r,D.line))),r.iter(J,B.line+1,function(we){if(we==a.maxLine)return Y=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Ee(e),_a(r,t,n,mo(e)),e.options.lineWrapping||(r.iter(J,D.line+t.text.length,function(we){var je=Xn(we);je>a.maxLineLength&&(a.maxLine=we,a.maxLineLength=je,a.maxLineChanged=!0,Y=!1)}),Y&&(e.curOp.updateMaxLine=!0)),Qr(r,D.line),Si(e,400);var q=t.text.length-(B.line-D.line)-1;t.full?_r(e):D.line==B.line&&t.text.length==1&&!Io(e.doc,t)?Cn(e,D.line,"text"):_r(e,D.line,B.line+1,q);var de=me(e,"changes"),pe=me(e,"change");if(pe||de){var De={from:D,to:B,text:t.text,removed:t.removed,origin:t.origin};pe&&Cr(e,"change",e,De),de&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(De)}e.display.selForContextMenu=null}function ni(e,t,n,r,a){var D;r||(r=n),lt(r,n)<0&&(D=[r,n],n=D[0],r=D[1]),typeof t=="string"&&(t=e.splitLines(t)),ri(e,{from:n,to:r,text:t,origin:a})}function qo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function es(e,t,n,r){for(var a=0;a<e.length;++a){var D=e[a],B=!0;if(D.ranges){D.copied||(D=e[a]=D.deepCopy(),D.copied=!0);for(var Y=0;Y<D.ranges.length;Y++)qo(D.ranges[Y].anchor,t,n,r),qo(D.ranges[Y].head,t,n,r);continue}for(var J=0;J<D.changes.length;++J){var q=D.changes[J];if(n<q.from.line)q.from=He(q.from.line+r,q.from.ch),q.to=He(q.to.line+r,q.to.ch);else if(t<=q.to.line){B=!1;break}}B||(e.splice(0,a+1),a=0)}}function ts(e,t){var n=t.from.line,r=t.to.line,a=t.text.length-(r-n)-1;es(e.done,n,r,a),es(e.undone,n,r,a)}function Ai(e,t,n,r){var a=t,D=t;return typeof t=="number"?D=gt(e,H(e,t)):a=Ot(t),a==null?null:(r(D,a)&&e.cm&&Cn(e.cm,a,n),D)}function Di(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}Di.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var a=this.lines[n];this.height-=a.height,da(a),Cr(a,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}};function Ri(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var a=e[r];t+=a.chunkSize(),n+=a.height,a.parent=this}this.size=t,this.height=n,this.parent=null}Ri.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],a=r.chunkSize();if(e<a){var D=Math.min(t,a-e),B=r.height;if(r.removeInner(e,D),this.height-=B-r.height,a==D&&(this.children.splice(n--,1),r.parent=null),(t-=D)==0)break;e=0}else e-=a}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Di))){var Y=[];this.collapse(Y),this.children=[new Di(Y)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var a=this.children[r],D=a.chunkSize();if(e<=D){if(a.insertInner(e,t,n),a.lines&&a.lines.length>50){for(var B=a.lines.length%25+25,Y=B;Y<a.lines.length;){var J=new Di(a.lines.slice(Y,Y+=25));a.height-=J.height,this.children.splice(++r,0,J),J.parent=this}a.lines=a.lines.slice(0,B),this.maybeSpill()}break}e-=D}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new Ri(t);if(e.parent){e.size-=n.size,e.height-=n.height;var a=he(e.parent.children,e);e.parent.children.splice(a+1,0,n)}else{var r=new Ri(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var a=this.children[r],D=a.chunkSize();if(e<D){var B=Math.min(t,D-e);if(a.iterN(e,B,n))return!0;if((t-=B)==0)break;e=0}else e-=D}}};var ki=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};ki.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=Ot(n);if(r==null||!t)return;for(var a=0;a<t.length;++a)t[a]==this&&t.splice(a--,1);t.length||(n.widgets=null);var D=gi(this);Tr(n,Math.max(0,n.height-D)),e&&(Hr(e,function(){rs(e,n,-D),Cn(e,r,"widget")}),Cr(e,"lineWidgetCleared",e,this,r))},ki.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var a=gi(this)-t;if(!a)return;Wr(this.doc,r)||Tr(r,r.height+a),n&&Hr(n,function(){n.curOp.forceUpdate=!0,rs(n,r,a),Cr(n,"lineWidgetChanged",n,e,Ot(r))})},ye(ki);function rs(e,t,n){on(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&La(e,n)}function El(e,t,n,r){var a=new ki(e,n,r),D=e.cm;return D&&a.noHScroll&&(D.display.alignWidgets=!0),Ai(e,t,"widget",function(B){var Y=B.widgets||(B.widgets=[]);if(a.insertAt==null?Y.push(a):Y.splice(Math.min(Y.length-1,Math.max(0,a.insertAt)),0,a),a.line=B,D&&!Wr(e,B)){var J=on(B)<e.scrollTop;Tr(B,B.height+gi(a)),J&&La(D,a.height),D.curOp.forceUpdate=!0}return!0}),D&&Cr(D,"lineWidgetAdded",D,a,typeof t=="number"?t:Ot(t)),a}var ns=0,An=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ns};An.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&Un(e),me(this,"clear")){var n=this.find();n&&Cr(this,"clear",n.from,n.to)}for(var r=null,a=null,D=0;D<this.lines.length;++D){var B=this.lines[D],Y=nn(B.markedSpans,this);e&&!this.collapsed?Cn(e,Ot(B),"text"):e&&(Y.to!=null&&(a=Ot(B)),Y.from!=null&&(r=Ot(B))),B.markedSpans=mn(B.markedSpans,Y),Y.from==null&&this.collapsed&&!Wr(this.doc,B)&&e&&Tr(B,$n(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var J=0;J<this.lines.length;++J){var q=Pr(this.lines[J]),de=Xn(q);de>e.display.maxLineLength&&(e.display.maxLine=q,e.display.maxLineLength=de,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&_r(e,r,a+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Vo(e.doc)),e&&Cr(e,"markerCleared",e,this,r,a),t&&jn(e),this.parent&&this.parent.clear()},An.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,a=0;a<this.lines.length;++a){var D=this.lines[a],B=nn(D.markedSpans,this);if(B.from!=null&&(n=He(t?D:Ot(D),B.from),e==-1))return n;if(B.to!=null&&(r=He(t?D:Ot(D),B.to),e==1))return r}return n&&{from:n,to:r}},An.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;Hr(r,function(){var a=t.line,D=Ot(t.line),B=pa(r,D);if(B&&(oo(B),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Wr(n.doc,a)&&n.height!=null){var Y=n.height;n.height=null;var J=gi(n)-Y;J&&Tr(a,a.height+J)}Cr(r,"markerChanged",r,e)})},An.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||he(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},An.prototype.detachLine=function(e){if(this.lines.splice(he(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ye(An);function ii(e,t,n,r,a){if(r&&r.shared)return Cl(e,t,n,r,a);if(e.cm&&!e.cm.curOp)return vr(e.cm,ii)(e,t,n,r,a);var D=new An(e,a),B=lt(t,n);if(r&&F(r,D,!1),B>0||B==0&&D.clearWhenEmpty!==!1)return D;if(D.replacedWith&&(D.collapsed=!0,D.widgetNode=A("span",[D.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||D.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(D.widgetNode.insertLeft=!0)),D.collapsed){if(lr(e,t.line,t,n,D)||t.line!=n.line&&lr(e,n.line,t,n,D))throw new Error("Inserting collapsed marker partially overlapping an existing one");jr()}D.addToHistory&&Uo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var Y=t.line,J=e.cm,q;if(e.iter(Y,n.line+1,function(pe){J&&D.collapsed&&!J.options.lineWrapping&&Pr(pe)==J.display.maxLine&&(q=!0),D.collapsed&&Y!=t.line&&Tr(pe,0),dn(pe,new bn(D,Y==t.line?t.ch:null,Y==n.line?n.ch:null)),++Y}),D.collapsed&&e.iter(t.line,n.line+1,function(pe){Wr(e,pe)&&Tr(pe,0)}),D.clearOnEnter&&Oe(D,"beforeCursorEnter",function(){return D.clear()}),D.readOnly&&(Xr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),D.collapsed&&(D.id=++ns,D.atomic=!0),J){if(q&&(J.curOp.updateMaxLine=!0),D.collapsed)_r(J,t.line,n.line+1);else if(D.className||D.startStyle||D.endStyle||D.css||D.attributes||D.title)for(var de=t.line;de<=n.line;de++)Cn(J,de,"text");D.atomic&&Vo(J.doc),Cr(J,"markerAdded",J,D)}return D}var Oi=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};Oi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Cr(this,"clear")},Oi.prototype.find=function(e,t){return this.primary.find(e,t)},ye(Oi);function Cl(e,t,n,r,a){r=F(r),r.shared=!1;var D=[ii(e,t,n,r,a)],B=D[0],Y=r.widgetNode;return Ln(e,function(J){Y&&(r.widgetNode=Y.cloneNode(!0)),D.push(ii(J,h(J,t),h(J,n),r,a));for(var q=0;q<J.linked.length;++q)if(J.linked[q].isParent)return;B=Le(D)}),new Oi(D,B)}function is(e){return e.findMarks(He(e.first,0),e.clipPos(He(e.lastLine())),function(t){return t.parent})}function Sl(e,t){for(var n=0;n<t.length;n++){var r=t[n],a=r.find(),D=e.clipPos(a.from),B=e.clipPos(a.to);if(lt(D,B)){var Y=ii(e,D,B,r.primary,r.primary.type);r.markers.push(Y),Y.parent=r}}}function Tl(e){for(var t=function(r){var a=e[r],D=[a.primary.doc];Ln(a.primary.doc,function(J){return D.push(J)});for(var B=0;B<a.markers.length;B++){var Y=a.markers[B];he(D,Y.doc)==-1&&(Y.parent=null,a.markers.splice(B--,1))}},n=0;n<e.length;n++)t(n)}var wl=0,Ir=function(e,t,n,r,a){if(!(this instanceof Ir))return new Ir(e,t,n,r,a);n==null&&(n=0),Ri.call(this,[new Di([new Pn("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var D=He(n,0);this.sel=Tn(D),this.history=new Zi(null),this.id=++wl,this.modeOption=t,this.lineSep=r,this.direction=a=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),_a(this,{from:D,to:D,text:e}),wr(this,Tn(D),ke)};Ir.prototype=ae(Ri.prototype,{constructor:Ir,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=tn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:yr(function(e){var t=He(this.first,0),n=this.first+this.size-1;ri(this,{from:t,to:He(n,gt(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&bi(this.cm,0,0),wr(this,Tn(t),ke)}),replaceRange:function(e,t,n,r){t=h(this,t),n=n?h(this,n):t,ni(this,e,t,n,r)},getRange:function(e,t,n){var r=kr(this,h(this,e),h(this,t));return n===!1?r:r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Kr(this,e))return gt(this,e)},getLineNumber:function(e){return Ot(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=gt(this,e)),Pr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return h(this,e)},getCursor:function(e){var t=this.sel.primary(),n;return e==null||e=="head"?n=t.head:e=="anchor"?n=t.anchor:e=="end"||e=="to"||e===!1?n=t.to():n=t.from(),n},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:yr(function(e,t,n){Go(this,h(this,typeof e=="number"?He(e,t||0):e),null,n)}),setSelection:yr(function(e,t,n){Go(this,h(this,e),h(this,t||e),n)}),extendSelection:yr(function(e,t,n){qi(this,h(this,e),t&&h(this,t),n)}),extendSelections:yr(function(e,t){Ho(this,U(this,e),t)}),extendSelectionsBy:yr(function(e,t){var n=xe(this.sel.ranges,e);Ho(this,U(this,n),t)}),setSelections:yr(function(e,t,n){if(!e.length)return;for(var r=[],a=0;a<e.length;a++)r[a]=new Xt(h(this,e[a].anchor),h(this,e[a].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),wr(this,ln(this.cm,r,t),n)}),addSelection:yr(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new Xt(h(this,e),h(this,t||e))),wr(this,ln(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var a=kr(this,t[r].from(),t[r].to());n=n?n.concat(a):a}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var a=kr(this,n[r].from(),n[r].to());e!==!1&&(a=a.join(e||this.lineSeparator())),t[r]=a}return t},replaceSelection:function(e,t,n){for(var r=[],a=0;a<this.sel.ranges.length;a++)r[a]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:yr(function(e,t,n){for(var r=[],a=this.sel,D=0;D<a.ranges.length;D++){var B=a.ranges[D];r[D]={from:B.from(),to:B.to(),text:this.splitLines(e[D]),origin:n}}for(var Y=t&&t!="end"&&cl(this,r,t),J=r.length-1;J>=0;J--)ri(this,r[J]);Y?Ko(this,Y):this.cm&&Qn(this.cm)}),undo:yr(function(){ra(this,"undo")}),redo:yr(function(){ra(this,"redo")}),undoSelection:yr(function(){ra(this,"undo",!0)}),redoSelection:yr(function(){ra(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var a=0;a<e.undone.length;a++)e.undone[a].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new Zi(this.history.maxGeneration),Ln(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:ei(this.history.done),undone:ei(this.history.undone)}},setHistory:function(e){var t=this.history=new Zi(this.history.maxGeneration);t.done=ei(e.done.slice(0),null,!0),t.undone=ei(e.undone.slice(0),null,!0)},setGutterMarker:yr(function(e,t,n){return Ai(this,e,"gutter",function(r){var a=r.gutterMarkers||(r.gutterMarkers={});return a[t]=n,!n&&Ne(a)&&(r.gutterMarkers=null),!0})}),clearGutter:yr(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&Ai(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Ne(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Kr(this,e))return null;if(t=e,e=gt(this,e),!e)return null}else if(t=Ot(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:yr(function(e,t,n){return Ai(this,e,t=="gutter"?"gutter":"class",function(r){var a=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[a])r[a]=n;else{if(L(n).test(r[a]))return!1;r[a]+=" "+n}return!0})}),removeLineClass:yr(function(e,t,n){return Ai(this,e,t=="gutter"?"gutter":"class",function(r){var a=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",D=r[a];if(D)if(n==null)r[a]=null;else{var B=D.match(L(n));if(!B)return!1;var Y=B.index+B[0].length;r[a]=D.slice(0,B.index)+(!B.index||Y==D.length?"":" ")+D.slice(Y)||null}else return!1;return!0})}),addLineWidget:yr(function(e,t,n){return El(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return ii(this,h(this,e),h(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=h(this,e),ii(this,e,e,n,"bookmark")},findMarksAt:function(e){e=h(this,e);var t=[],n=gt(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var a=n[r];(a.from==null||a.from<=e.ch)&&(a.to==null||a.to>=e.ch)&&t.push(a.marker.parent||a.marker)}return t},findMarks:function(e,t,n){e=h(this,e),t=h(this,t);var r=[],a=e.line;return this.iter(e.line,t.line+1,function(D){var B=D.markedSpans;if(B)for(var Y=0;Y<B.length;Y++){var J=B[Y];!(J.to!=null&&a==e.line&&e.ch>=J.to||J.from==null&&a!=e.line||J.from!=null&&a==t.line&&J.from>=t.ch)&&(!n||n(J.marker))&&r.push(J.marker.parent||J.marker)}++a}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(a){var D=a.text.length+r;if(D>e)return t=e,!0;e-=D,++n}),h(this,He(n,t))},indexFromPos:function(e){e=h(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+n}),t},copy:function(e){var t=new Ir(tn(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new Ir(tn(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Sl(r,is(this)),r},unlinkDoc:function(e){if(e instanceof ir&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),Tl(is(this));break}if(e.history==this.history){var r=[e.id];Ln(e,function(a){return r.push(a.id)},!0),e.history=new Zi(null),e.history.done=ei(this.history.done,r),e.history.undone=ei(this.history.undone,r)}},iterLinkedDocs:function(e){Ln(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):wt(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:yr(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&fl(this.cm)})}),Ir.prototype.eachLine=Ir.prototype.iter;var as=0;function Ll(e){var t=this;if(os(t),Ke(t,e)||gn(t.display,e))return;te(e),W&&(as=+new Date);var n=In(t,e,!0),r=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var a=r.length,D=Array(a),B=0,Y=function(){++B==a&&vr(t,function(){n=h(t.doc,n);var we={from:n,to:n,text:t.doc.splitLines(D.filter(function(je){return je!=null}).join(t.doc.lineSeparator())),origin:"paste"};ri(t.doc,we),Ko(t.doc,Tn(h(t.doc,n),h(t.doc,wn(we))))})()},J=function(we,je){if(t.options.allowDropFileTypes&&he(t.options.allowDropFileTypes,we.type)==-1){Y();return}var Xe=new FileReader;Xe.onerror=function(){return Y()},Xe.onload=function(){var qe=Xe.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(qe)){Y();return}D[je]=qe,Y()},Xe.readAsText(we)},q=0;q<r.length;q++)J(r[q],q);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var de=e.dataTransfer.getData("Text");if(de){var pe;if(t.state.draggingText&&!t.state.draggingText.copy&&(pe=t.listSelections()),ea(t.doc,Tn(n,n)),pe)for(var De=0;De<pe.length;++De)ni(t.doc,"",pe[De].anchor,pe[De].head,"drag");t.replaceSelection(de,"around","paste"),t.display.input.focus()}}catch(we){}}}function Al(e,t){if(W&&(!e.state.draggingText||+new Date-as<100)){fe(t);return}if(Ke(e,t)||gn(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!w){var n=u("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",f&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),f&&n.parentNode.removeChild(n)}}function Dl(e,t){var n=In(e,t);if(!n)return;var r=document.createDocumentFragment();yo(e,n,r),e.display.dragCursor||(e.display.dragCursor=u("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),c(e.display.dragCursor,r)}function os(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ss(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var a=t[r].CodeMirror;a&&n.push(a)}n.length&&n[0].operation(function(){for(var D=0;D<n.length;D++)e(n[D])})}var ls=!1;function Rl(){if(ls)return;kl(),ls=!0}function kl(){var e;Oe(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ss(Ol)},100))}),Oe(window,"blur",function(){return ss(Zn)})}function Ol(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Dn={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Pi=0;Pi<10;Pi++)Dn[Pi+48]=Dn[Pi+96]=String(Pi);for(var na=65;na<=90;na++)Dn[na]=String.fromCharCode(na);for(var Mi=1;Mi<=12;Mi++)Dn[Mi+111]=Dn[Mi+63235]="F"+Mi;var vn={};vn.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},vn.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},vn.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},vn.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},vn.default=s?vn.macDefault:vn.pcDefault;function Pl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,a,D,B=0;B<t.length-1;B++){var Y=t[B];if(/^(cmd|meta|m)$/i.test(Y))D=!0;else if(/^a(lt)?$/i.test(Y))n=!0;else if(/^(c|ctrl|control)$/i.test(Y))r=!0;else if(/^s(hift)?$/i.test(Y))a=!0;else throw new Error("Unrecognized modifier name: "+Y)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),D&&(e="Cmd-"+e),a&&(e="Shift-"+e),e}function Ml(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}for(var a=xe(n.split(" "),Pl),D=0;D<a.length;D++){var B=void 0,Y=void 0;D==a.length-1?(Y=a.join(" "),B=r):(Y=a.slice(0,D+1).join(" "),B="...");var J=t[Y];if(!J)t[Y]=B;else if(J!=B)throw new Error("Inconsistent bindings for "+Y)}delete e[n]}for(var q in t)e[q]=t[q];return e}function ai(e,t,n,r){t=ia(t);var a=t.call?t.call(e,r):t[e];if(a===!1)return"nothing";if(a==="...")return"multi";if(a!=null&&n(a))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return ai(e,t.fallthrough,n,r);for(var D=0;D<t.fallthrough.length;D++){var B=ai(e,t.fallthrough[D],n,r);if(B)return B}}}function us(e){var t=typeof e=="string"?e:Dn[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ds(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(v?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(v?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function hs(e,t){if(f&&e.keyCode==34&&e.char)return!1;var n=Dn[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),ds(n,e,t))}function ia(e){return typeof e=="string"?vn[e]:e}function oi(e,t){for(var n=e.doc.sel.ranges,r=[],a=0;a<n.length;a++){for(var D=t(n[a]);r.length&<(D.from,Le(r).to)<=0;){var B=r.pop();if(lt(B.from,D.from)<0){D.from=B.from;break}}r.push(D)}Hr(e,function(){for(var Y=r.length-1;Y>=0;Y--)ni(e.doc,"",r[Y].from,r[Y].to,"+delete");Qn(e)})}function Ba(e,t,n){var r=Fe(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Ua(e,t,n){var r=Ba(e,t.ch,n);return r==null?null:new He(t.line,r,n<0?"after":"before")}function ja(e,t,n,r,a){if(e){t.doc.direction=="rtl"&&(a=-a);var D=$e(n,t.doc.direction);if(D){var B=a<0?Le(D):D[0],Y=a<0==(B.level==1),J=Y?"after":"before",q;if(B.level>0||t.doc.direction=="rtl"){var de=Yn(t,n);q=a<0?n.text.length-1:0;var pe=fn(t,de,q).top;q=et(function(De){return fn(t,de,De).top==pe},a<0==(B.level==1)?B.from:B.to-1,q),J=="before"&&(q=Ba(n,q,1))}else q=a<0?B.to:B.from;return new He(r,q,J)}}return new He(r,a<0?n.text.length:0,a<0?"before":"after")}function _l(e,t,n,r){var a=$e(t,e.doc.direction);if(!a)return Ua(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var D=Ye(a,n.ch,n.sticky),B=a[D];if(e.doc.direction=="ltr"&&B.level%2==0&&(r>0?B.to>n.ch:B.from<n.ch))return Ua(t,n,r);var Y=function(nt,ut){return Ba(t,nt instanceof He?nt.ch:nt,ut)},J,q=function(nt){return e.options.lineWrapping?(J=J||Yn(e,t),po(e,t,J,nt)):{begin:0,end:t.text.length}},de=q(n.sticky=="before"?Y(n,-1):n.ch);if(e.doc.direction=="rtl"||B.level==1){var pe=B.level==1==r<0,De=Y(n,pe?1:-1);if(De!=null&&(pe?De<=B.to&&De<=de.end:De>=B.from&&De>=de.begin)){var we=pe?"before":"after";return new He(n.line,De,we)}}var je=function(nt,ut,it){for(var mt=function(tr,br){return br?new He(n.line,Y(tr,1),"before"):new He(n.line,tr,"after")};nt>=0&&nt<a.length;nt+=ut){var Tt=a[nt],Et=ut>0==(Tt.level!=1),Pt=Et?it.begin:Y(it.end,-1);if(Tt.from<=Pt&&Pt<Tt.to)return mt(Pt,Et);if(Pt=Et?Tt.from:Y(Tt.to,-1),it.begin<=Pt&&Pt<it.end)return mt(Pt,Et)}},Xe=je(D+r,r,de);if(Xe)return Xe;var qe=r>0?de.end:Y(de.begin,-1);return qe!=null&&!(r>0&&qe==t.text.length)&&(Xe=je(r>0?0:a.length-1,r,q(qe)),Xe)?Xe:null}var _i={selectAll:$o,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ke)},killLine:function(e){return oi(e,function(t){if(t.empty()){var n=gt(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:He(t.head.line+1,0)}:{from:t.head,to:He(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return oi(e,function(t){return{from:He(t.from().line,0),to:h(e.doc,He(t.to().line+1,0))}})},delLineLeft:function(e){return oi(e,function(t){return{from:He(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return oi(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return oi(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(He(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(He(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return cs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return fs(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},ce)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},ce)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?fs(e,t.head):r},ce)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,a=0;a<n.length;a++){var D=n[a].from(),B=ee(e.getLine(D.line),D.ch,r);t.push(ne(r-B%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Hr(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var a=t[r].head,D=gt(e.doc,a.line).text;if(D){if(a.ch==D.length&&(a=new He(a.line,a.ch-1)),a.ch>0)a=new He(a.line,a.ch+1),e.replaceRange(D.charAt(a.ch-1)+D.charAt(a.ch-2),He(a.line,a.ch-2),a,"+transpose");else if(a.line>e.doc.first){var B=gt(e.doc,a.line-1).text;B&&(a=new He(a.line,1),e.replaceRange(D.charAt(0)+e.doc.lineSeparator()+B.charAt(B.length-1),He(a.line-1,B.length-1),a,"+transpose"))}}n.push(new Xt(a,a))}e.setSelections(n)})},newlineAndIndent:function(e){return Hr(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);Qn(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function cs(e,t){var n=gt(e.doc,t),r=Pr(n);return r!=n&&(t=Ot(r)),ja(!0,e,r,t,1)}function Il(e,t){var n=gt(e.doc,t),r=zn(n);return r!=n&&(t=Ot(r)),ja(!0,e,n,t,-1)}function fs(e,t){var n=cs(e,t.line),r=gt(e.doc,n.line),a=$e(r,e.doc.direction);if(!a||a[0].level==0){var D=Math.max(n.ch,r.text.search(/\S/)),B=t.line==n.line&&t.ch<=D&&t.ch;return He(n.line,B?0:D,n.sticky)}return n}function aa(e,t,n){if(typeof t=="string"&&(t=_i[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,a=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),a=t(e)!=Ue}finally{e.display.shift=r,e.state.suppressEdits=!1}return a}function Nl(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var a=ai(t,e.state.keyMaps[r],n,e);if(a)return a}return e.options.extraKeys&&ai(t,e.options.extraKeys,n,e)||ai(t,e.options.keyMap,n,e)}var Fl=new se;function Ii(e,t,n,r){var a=e.state.keySeq;if(a){if(us(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Fl.set(50,function(){e.state.keySeq==a&&(e.state.keySeq=null,e.display.input.reset())}),ps(e,a+" "+t,n,r))return!0}return ps(e,t,n,r)}function ps(e,t,n,r){var a=Nl(e,t,r);return a=="multi"&&(e.state.keySeq=t),a=="handled"&&Cr(e,"keyHandled",e,t,n),(a=="handled"||a=="multi")&&(te(n),Sa(e)),!!a}function ms(e,t){var n=hs(t,!0);return n?t.shiftKey&&!e.state.keySeq?Ii(e,"Shift-"+n,t,function(r){return aa(e,r,!0)})||Ii(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return aa(e,r)}):Ii(e,n,t,function(r){return aa(e,r)}):!1}function Bl(e,t,n){return Ii(e,"'"+n+"'",t,function(r){return aa(e,r,!0)})}var Wa=null;function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=_(),Ke(t,e))return;W&&N<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=ms(t,e);f&&(Wa=r?n:null,!r&&n==88&&!Kt&&(s?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),O&&!s&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Ul(t)}function Ul(e){var t=e.display.lineDiv;j(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(E(t,"CodeMirror-crosshair"),at(document,"keyup",n),at(document,"mouseover",n))}Oe(document,"keyup",n),Oe(document,"mouseover",n)}function vs(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ke(this,e)}function ys(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(gn(t.display,e)||Ke(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(f&&n==Wa){Wa=null,te(e);return}if(f&&(!e.which||e.which<10)&&ms(t,e))return;var a=String.fromCharCode(r==null?n:r);if(a=="\b")return;if(Bl(t,e,a))return;t.display.input.onKeyPress(e)}var jl=400,Ha=function(e,t,n){this.time=e,this.pos=t,this.button=n};Ha.prototype.compare=function(e,t,n){return this.time+jl>e&<(t,this.pos)==0&&n==this.button};var Ni,Fi;function Wl(e,t){var n=+new Date;return Fi&&Fi.compare(n,e,t)?(Ni=Fi=null,"triple"):Ni&&Ni.compare(n,e,t)?(Fi=new Ha(n,e,t),Ni=null,"double"):(Ni=new Ha(n,e,t),Fi=null,"single")}function bs(e){var t=this,n=t.display;if(Ke(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,gn(n,e)){P||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ga(t,e))return;var r=In(t,e),a=Se(e),D=r?Wl(r,a):"single";if(window.focus(),a==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,a,r,D,e))return;a==1?r?Kl(t,r,D,e):Pe(e)==n.scroller&&te(e):a==2?(r&&qi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):a==3&&(k?t.display.input.onContextMenu(e):xo(t))}function Hl(e,t,n,r,a){var D="Click";return r=="double"?D="Double"+D:r=="triple"&&(D="Triple"+D),D=(t==1?"Left":t==2?"Middle":"Right")+D,Ii(e,ds(D,a),a,function(B){if(typeof B=="string"&&(B=_i[B]),!B)return!1;var Y=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Y=B(e,n)!=Ue}finally{e.state.suppressEdits=!1}return Y})}function Gl(e,t,n){var r=e.getOption("configureMouse"),a=r?r(e,t,n):{};if(a.unit==null){var D=l?n.shiftKey&&n.metaKey:n.altKey;a.unit=D?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(a.extend==null||e.doc.extend)&&(a.extend=e.doc.extend||n.shiftKey),a.addNew==null&&(a.addNew=s?n.metaKey:n.ctrlKey),a.moveOnDrag==null&&(a.moveOnDrag=!(s?n.altKey:n.ctrlKey)),a}function Kl(e,t,n,r){W?setTimeout(K(bo,e),0):e.curOp.focus=_();var a=Gl(e,n,r),D=e.doc.sel,B;e.options.dragDrop&&ze&&!e.isReadOnly()&&n=="single"&&(B=D.contains(t))>-1&&(lt((B=D.ranges[B]).from(),t)<0||t.xRel>0)&&(lt(B.to(),t)>0||t.xRel<0)?zl(e,r,t,a):Vl(e,r,t,a)}function zl(e,t,n,r){var a=e.display,D=!1,B=vr(e,function(q){P&&(a.scroller.draggable=!1),e.state.draggingText=!1,at(a.wrapper.ownerDocument,"mouseup",B),at(a.wrapper.ownerDocument,"mousemove",Y),at(a.scroller,"dragstart",J),at(a.scroller,"drop",B),D||(te(q),r.addNew||qi(e.doc,n,null,null,r.extend),P&&!w||W&&N==9?setTimeout(function(){a.wrapper.ownerDocument.body.focus({preventScroll:!0}),a.input.focus()},20):a.input.focus())}),Y=function(q){D=D||Math.abs(t.clientX-q.clientX)+Math.abs(t.clientY-q.clientY)>=10},J=function(){return D=!0};P&&(a.scroller.draggable=!0),e.state.draggingText=B,B.copy=!r.moveOnDrag,a.scroller.dragDrop&&a.scroller.dragDrop(),Oe(a.wrapper.ownerDocument,"mouseup",B),Oe(a.wrapper.ownerDocument,"mousemove",Y),Oe(a.scroller,"dragstart",J),Oe(a.scroller,"drop",B),xo(e),setTimeout(function(){return a.input.focus()},20)}function xs(e,t,n){if(n=="char")return new Xt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new Xt(He(t.line,0),h(e.doc,He(t.line+1,0)));var r=n(e,t);return new Xt(r.from,r.to)}function Vl(e,t,n,r){var a=e.display,D=e.doc;te(t);var B,Y,J=D.sel,q=J.ranges;if(r.addNew&&!r.extend?(Y=D.sel.contains(n),Y>-1?B=q[Y]:B=new Xt(n,n)):(B=D.sel.primary(),Y=D.sel.primIndex),r.unit=="rectangle")r.addNew||(B=new Xt(n,n)),n=In(e,t,!0,!0),Y=-1;else{var de=xs(e,n,r.unit);r.extend?B=Na(B,de.anchor,de.head,r.extend):B=de}r.addNew?Y==-1?(Y=q.length,wr(D,ln(e,q.concat([B]),Y),{scroll:!1,origin:"*mouse"})):q.length>1&&q[Y].empty()&&r.unit=="char"&&!r.extend?(wr(D,ln(e,q.slice(0,Y).concat(q.slice(Y+1)),0),{scroll:!1,origin:"*mouse"}),J=D.sel):Fa(D,Y,B,Me):(Y=0,wr(D,new Jr([B],0),Me),J=D.sel);var pe=n;function De(it){if(lt(pe,it)==0)return;if(pe=it,r.unit=="rectangle"){for(var mt=[],Tt=e.options.tabSize,Et=ee(gt(D,n.line).text,n.ch,Tt),Pt=ee(gt(D,it.line).text,it.ch,Tt),tr=Math.min(Et,Pt),br=Math.max(Et,Pt),ar=Math.min(n.line,it.line),Gr=Math.min(e.lastLine(),Math.max(n.line,it.line));ar<=Gr;ar++){var Nr=gt(D,ar).text,cr=ve(Nr,tr,Tt);tr==br?mt.push(new Xt(He(ar,cr),He(ar,cr))):Nr.length>cr&&mt.push(new Xt(He(ar,cr),He(ar,ve(Nr,br,Tt))))}mt.length||mt.push(new Xt(n,n)),wr(D,ln(e,J.ranges.slice(0,Y).concat(mt),Y),{origin:"*mouse",scroll:!1}),e.scrollIntoView(it)}else{var Fr=B,Sr=xs(e,it,r.unit),mr=Fr.anchor,fr;lt(Sr.anchor,mr)>0?(fr=Sr.head,mr=qt(Fr.from(),Sr.anchor)):(fr=Sr.anchor,mr=Yt(Fr.to(),Sr.head));var sr=J.ranges.slice(0);sr[Y]=Xl(e,new Xt(h(D,mr),fr)),wr(D,ln(e,sr,Y),Me)}}var we=a.wrapper.getBoundingClientRect(),je=0;function Xe(it){var mt=++je,Tt=In(e,it,!0,r.unit=="rectangle");if(!Tt)return;if(lt(Tt,pe)!=0){e.curOp.focus=_(),De(Tt);var Et=Xi(a,D);(Tt.line>=Et.to||Tt.line<Et.from)&&setTimeout(vr(e,function(){je==mt&&Xe(it)}),150)}else{var Pt=it.clientY<we.top?-20:it.clientY>we.bottom?20:0;Pt&&setTimeout(vr(e,function(){if(je!=mt)return;a.scroller.scrollTop+=Pt,Xe(it)}),50)}}function qe(it){e.state.selectingText=!1,je=Infinity,it&&(te(it),a.input.focus()),at(a.wrapper.ownerDocument,"mousemove",nt),at(a.wrapper.ownerDocument,"mouseup",ut),D.history.lastSelOrigin=null}var nt=vr(e,function(it){it.buttons===0||!Se(it)?qe(it):Xe(it)}),ut=vr(e,qe);e.state.selectingText=ut,Oe(a.wrapper.ownerDocument,"mousemove",nt),Oe(a.wrapper.ownerDocument,"mouseup",ut)}function Xl(e,t){var n=t.anchor,r=t.head,a=gt(e.doc,n.line);if(lt(n,r)==0&&n.sticky==r.sticky)return t;var D=$e(a);if(!D)return t;var B=Ye(D,n.ch,n.sticky),Y=D[B];if(Y.from!=n.ch&&Y.to!=n.ch)return t;var J=B+(Y.from==n.ch==(Y.level!=1)?0:1);if(J==0||J==D.length)return t;var q;if(r.line!=n.line)q=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var de=Ye(D,r.ch,r.sticky),pe=de-B||(r.ch-n.ch)*(Y.level==1?-1:1);de==J-1||de==J?q=pe<0:q=pe>0}var De=D[J+(q?-1:0)],we=q==(De.level==1),je=we?De.from:De.to,Xe=we?"after":"before";return n.ch==je&&n.sticky==Xe?t:new Xt(new He(n.line,je,Xe),r)}function Es(e,t,n,r){var a,D;if(t.touches)a=t.touches[0].clientX,D=t.touches[0].clientY;else try{a=t.clientX,D=t.clientY}catch(De){return!1}if(a>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&te(t);var B=e.display,Y=B.lineDiv.getBoundingClientRect();if(D>Y.bottom||!me(e,n))return ue(t);D-=Y.top-B.viewOffset;for(var J=0;J<e.display.gutterSpecs.length;++J){var q=B.gutters.childNodes[J];if(q&&q.getBoundingClientRect().right>=a){var de=Ar(e.doc,D),pe=e.display.gutterSpecs[J];return Be(e,n,e,de,pe.className,t),ue(t)}}}function Ga(e,t){return Es(e,t,"gutterClick",!0)}function Cs(e,t){if(gn(e.display,t)||Yl(e,t))return;if(Ke(e,t,"contextmenu"))return;k||e.display.input.onContextMenu(t)}function Yl(e,t){return me(e,"gutterContextMenu")?Es(e,t,"gutterContextMenu",!1):!1}function Ss(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),vi(e)}var si={toString:function(){return"CodeMirror.Init"}},Ts={},oa={};function $l(e){var t=e.optionHandlers;function n(r,a,D,B){e.defaults[r]=a,D&&(t[r]=B?function(Y,J,q){q!=si&&D(Y,J,q)}:D)}e.defineOption=n,e.Init=si,n("value","",function(r,a){return r.setValue(a)},!0),n("mode",null,function(r,a){r.doc.modeOption=a,Ma(r)},!0),n("indentUnit",2,Ma,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){wi(r),vi(r),_r(r)},!0),n("lineSeparator",null,function(r,a){if(r.doc.lineSep=a,!a)return;var D=[],B=r.doc.first;r.doc.iter(function(J){for(var q=0;;){var de=J.text.indexOf(a,q);if(de==-1)break;q=de+a.length,D.push(He(B,de))}B++});for(var Y=D.length-1;Y>=0;Y--)ni(r.doc,a,D[Y],He(D[Y].line,D[Y].ch+a.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,a,D){r.state.specialChars=new RegExp(a.source+(a.test(" ")?"":"| "),"g"),D!=si&&r.refresh()}),n("specialCharPlaceholder",Wt,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",i?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,a){return r.getInputField().spellcheck=a},!0),n("autocorrect",!1,function(r,a){return r.getInputField().autocorrect=a},!0),n("autocapitalize",!1,function(r,a){return r.getInputField().autocapitalize=a},!0),n("rtlMoveVisually",!C),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){Ss(r),Ti(r)},!0),n("keyMap","default",function(r,a,D){var B=ia(a),Y=D!=si&&ia(D);Y&&Y.detach&&Y.detach(r,B),B.attach&&B.attach(r,Y||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Zl,!0),n("gutters",[],function(r,a){r.display.gutterSpecs=Oa(a,r.options.lineNumbers),Ti(r)},!0),n("fixedGutter",!0,function(r,a){r.display.gutters.style.left=a?Ea(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return qn(r)},!0),n("scrollbarStyle","native",function(r){Lo(r),qn(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,a){r.display.gutterSpecs=Oa(r.options.gutters,a),Ti(r)},!0),n("firstLineNumber",1,Ti,!0),n("lineNumberFormatter",function(r){return r},Ti,!0),n("showCursorWhenSelecting",!1,yi,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,a){a=="nocursor"&&(Zn(r),r.display.input.blur()),r.display.input.readOnlyChanged(a)}),n("screenReaderLabel",null,function(r,a){a=a===""?null:a,r.display.input.screenReaderLabelChanged(a)}),n("disableInput",!1,function(r,a){a||r.display.input.reset()},!0),n("dragDrop",!0,Jl),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,yi,!0),n("singleCursorHeightPerLine",!0,yi,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,wi,!0),n("addModeClass",!1,wi,!0),n("pollInterval",100),n("undoDepth",200,function(r,a){return r.doc.history.undoDepth=a}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,wi,!0),n("moveInputWithCursor",!0,function(r,a){a||r.display.input.resetPosition()}),n("tabindex",null,function(r,a){return r.display.input.getField().tabIndex=a||""}),n("autofocus",null),n("direction","ltr",function(r,a){return r.doc.setDirection(a)},!0),n("phrases",null)}function Jl(e,t,n){var r=n&&n!=si;if(!t!=!r){var a=e.display.dragFunctions,D=t?Oe:at;D(e.display.scroller,"dragstart",a.start),D(e.display.scroller,"dragenter",a.enter),D(e.display.scroller,"dragover",a.over),D(e.display.scroller,"dragleave",a.leave),D(e.display.scroller,"drop",a.drop)}}function Zl(e){e.options.lineWrapping?(j(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(E(e.display.wrapper,"CodeMirror-wrap"),ji(e)),Ca(e),_r(e),vi(e),setTimeout(function(){return qn(e)},100)}function ir(e,t){var n=this;if(!(this instanceof ir))return new ir(e,t);this.options=t=t?F(t):{},F(Ts,t,!1);var r=t.value;typeof r=="string"?r=new Ir(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var a=new ir.inputStyles[t.inputStyle](this),D=this.display=new dl(e,r,a,t);D.wrapper.CodeMirror=this,Ss(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Lo(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new se,keySeq:null,specialChars:null},t.autofocus&&!i&&D.input.focus(),W&&N<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Ql(this),Rl(),Un(this),this.curOp.forceUpdate=!0,No(this,r),t.autofocus&&!i||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Ta(n)},20):Zn(this);for(var B in oa)oa.hasOwnProperty(B)&&oa[B](this,t[B],si);Ro(this),t.finishInit&&t.finishInit(this);for(var Y=0;Y<Ka.length;++Y)Ka[Y](this);jn(this),P&&t.lineWrapping&&getComputedStyle(D.lineDiv).textRendering=="optimizelegibility"&&(D.lineDiv.style.textRendering="auto")}ir.defaults=Ts,ir.optionHandlers=oa;function Ql(e){var t=e.display;Oe(t.scroller,"mousedown",vr(e,bs)),W&&N<11?Oe(t.scroller,"dblclick",vr(e,function(J){if(Ke(e,J))return;var q=In(e,J);if(!q||Ga(e,J)||gn(e.display,J))return;te(J);var de=e.findWordAt(q);qi(e.doc,de.anchor,de.head)})):Oe(t.scroller,"dblclick",function(J){return Ke(e,J)||te(J)}),Oe(t.scroller,"contextmenu",function(J){return Cs(e,J)}),Oe(t.input.getField(),"contextmenu",function(J){t.scroller.contains(J.target)||Cs(e,J)});var n,r={end:0};function a(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function D(J){if(J.touches.length!=1)return!1;var q=J.touches[0];return q.radiusX<=1&&q.radiusY<=1}function B(J,q){if(q.left==null)return!0;var de=q.left-J.left,pe=q.top-J.top;return de*de+pe*pe>20*20}Oe(t.scroller,"touchstart",function(J){if(!Ke(e,J)&&!D(J)&&!Ga(e,J)){t.input.ensurePolled(),clearTimeout(n);var q=+new Date;t.activeTouch={start:q,moved:!1,prev:q-r.end<=300?r:null},J.touches.length==1&&(t.activeTouch.left=J.touches[0].pageX,t.activeTouch.top=J.touches[0].pageY)}}),Oe(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Oe(t.scroller,"touchend",function(J){var q=t.activeTouch;if(q&&!gn(t,J)&&q.left!=null&&!q.moved&&new Date-q.start<300){var de=e.coordsChar(t.activeTouch,"page"),pe;!q.prev||B(q,q.prev)?pe=new Xt(de,de):!q.prev.prev||B(q,q.prev.prev)?pe=e.findWordAt(de):pe=new Xt(He(de.line,0),h(e.doc,He(de.line+1,0))),e.setSelection(pe.anchor,pe.head),e.focus(),te(J)}a()}),Oe(t.scroller,"touchcancel",a),Oe(t.scroller,"scroll",function(){t.scroller.clientHeight&&(xi(e,t.scroller.scrollTop),Fn(e,t.scroller.scrollLeft,!0),Be(e,"scroll",e))}),Oe(t.scroller,"mousewheel",function(J){return Po(e,J)}),Oe(t.scroller,"DOMMouseScroll",function(J){return Po(e,J)}),Oe(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(J){Ke(e,J)||fe(J)},over:function(J){Ke(e,J)||(Dl(e,J),fe(J))},start:function(J){return Al(e,J)},drop:vr(e,Ll),leave:function(J){Ke(e,J)||os(e)}};var Y=t.input.getField();Oe(Y,"keyup",function(J){return vs.call(e,J)}),Oe(Y,"keydown",vr(e,gs)),Oe(Y,"keypress",vr(e,ys)),Oe(Y,"focus",function(J){return Ta(e,J)}),Oe(Y,"blur",function(J){return Zn(e,J)})}var Ka=[];ir.defineInitHook=function(e){return Ka.push(e)};function Bi(e,t,n,r){var a=e.doc,D;n==null&&(n="add"),n=="smart"&&(a.mode.indent?D=rt(e,t).state:n="prev");var B=e.options.tabSize,Y=gt(a,t),J=ee(Y.text,null,B);Y.stateAfter&&(Y.stateAfter=null);var q=Y.text.match(/^\s*/)[0],de;if(!r&&!/\S/.test(Y.text))de=0,n="not";else if(n=="smart"&&(de=a.mode.indent(D,Y.text.slice(q.length),Y.text),de==Ue||de>150)){if(!r)return;n="prev"}n=="prev"?t>a.first?de=ee(gt(a,t-1).text,null,B):de=0:n=="add"?de=J+e.options.indentUnit:n=="subtract"?de=J-e.options.indentUnit:typeof n=="number"&&(de=J+n),de=Math.max(0,de);var pe="",De=0;if(e.options.indentWithTabs)for(var we=Math.floor(de/B);we;--we)De+=B,pe+=" ";if(De<de&&(pe+=ne(de-De)),pe!=q)return ni(a,pe,He(t,0),He(t,q.length),"+input"),Y.stateAfter=null,!0;for(var je=0;je<a.sel.ranges.length;je++){var Xe=a.sel.ranges[je];if(Xe.head.line==t&&Xe.head.ch<q.length){var qe=He(t,q.length);Fa(a,je,new Xt(qe,qe));break}}}var un=null;function sa(e){un=e}function za(e,t,n,r,a){var D=e.doc;e.display.shift=!1,r||(r=D.sel);var B=+new Date-200,Y=a=="paste"||e.state.pasteIncoming>B,J=wt(t),q=null;if(Y&&r.ranges.length>1)if(un&&un.text.join(`
|
|
`)==t){if(r.ranges.length%un.text.length==0){q=[];for(var de=0;de<un.text.length;de++)q.push(D.splitLines(un.text[de]))}}else J.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(q=xe(J,function(nt){return[nt]}));for(var pe=e.curOp.updateInput,De=r.ranges.length-1;De>=0;De--){var we=r.ranges[De],je=we.from(),Xe=we.to();we.empty()&&(n&&n>0?je=He(je.line,je.ch-n):e.state.overwrite&&!Y?Xe=He(Xe.line,Math.min(gt(D,Xe.line).text.length,Xe.ch+Le(J).length)):Y&&un&&un.lineWise&&un.text.join(`
|
|
`)==J.join(`
|
|
`)&&(je=Xe=He(je.line,0)));var qe={from:je,to:Xe,text:q?q[De%q.length]:J,origin:a||(Y?"paste":e.state.cutIncoming>B?"cut":"+input")};ri(e.doc,qe),Cr(e,"inputRead",e,qe)}t&&!Y&&Ls(e,t),Qn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=pe),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ws(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Hr(t,function(){return za(t,n,0,null,"paste")}),!0}function Ls(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var a=n.ranges[r];if(a.head.ch>100||r&&n.ranges[r-1].head.line==a.head.line)continue;var D=e.getModeAt(a.head),B=!1;if(D.electricChars){for(var Y=0;Y<D.electricChars.length;Y++)if(t.indexOf(D.electricChars.charAt(Y))>-1){B=Bi(e,a.head.line,"smart");break}}else D.electricInput&&(D.electricInput.test(gt(e.doc,a.head.line).text.slice(0,a.head.ch))&&(B=Bi(e,a.head.line,"smart")));B&&Cr(e,"electricInput",e,a.head.line)}}function As(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var a=e.doc.sel.ranges[r].head.line,D={anchor:He(a,0),head:He(a+1,0)};n.push(D),t.push(e.getRange(D.anchor,D.head))}return{text:t,ranges:n}}function Ds(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Rs(){var e=u("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=u("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return P?e.style.width="1000px":e.setAttribute("wrap","off"),b&&(e.style.border="1px solid black"),Ds(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,a){var D=this.options,B=D[r];if(D[r]==a&&r!="mode")return;D[r]=a,t.hasOwnProperty(r)&&vr(this,t[r])(this,a,B),Be(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,a){this.state.keyMaps[a?"push":"unshift"](ia(r))},removeKeyMap:function(r){for(var a=this.state.keyMaps,D=0;D<a.length;++D)if(a[D]==r||a[D].name==r)return a.splice(D,1),!0},addOverlay:Dr(function(r,a){var D=r.token?r:e.getMode(this.options,r);if(D.startState)throw new Error("Overlays may not be stateful.");Ie(this.state.overlays,{mode:D,modeSpec:r,opaque:a&&a.opaque,priority:a&&a.priority||0},function(B){return B.priority}),this.state.modeGen++,_r(this)}),removeOverlay:Dr(function(r){for(var a=this.state.overlays,D=0;D<a.length;++D){var B=a[D].modeSpec;if(B==r||typeof r=="string"&&B.name==r){a.splice(D,1),this.state.modeGen++,_r(this);return}}}),indentLine:Dr(function(r,a,D){typeof a!="string"&&typeof a!="number"&&(a==null?a=this.options.smartIndent?"smart":"prev":a=a?"add":"subtract"),Kr(this.doc,r)&&Bi(this,r,a,D)}),indentSelection:Dr(function(r){for(var a=this.doc.sel.ranges,D=-1,B=0;B<a.length;B++){var Y=a[B];if(Y.empty())Y.head.line>D&&(Bi(this,Y.head.line,r,!0),D=Y.head.line,B==this.doc.sel.primIndex&&Qn(this));else{var J=Y.from(),q=Y.to(),de=Math.max(D,J.line);D=Math.min(this.lastLine(),q.line-(q.ch?0:1))+1;for(var pe=de;pe<D;++pe)Bi(this,pe,r);var De=this.doc.sel.ranges;J.ch==0&&a.length==De.length&&De[B].from().ch>0&&Fa(this.doc,B,new Xt(J,De[B].to()),ke)}}}),getTokenAt:function(r,a){return er(this,r,a)},getLineTokens:function(r,a){return er(this,He(r),a,!0)},getTokenTypeAt:function(r){r=h(this.doc,r);var a=Ge(this,gt(this.doc,r.line)),D=0,B=(a.length-1)/2,Y=r.ch,J;if(Y==0)J=a[2];else for(;;){var q=D+B>>1;if((q?a[q*2-1]:0)>=Y)B=q;else if(a[q*2+1]<Y)D=q+1;else{J=a[q*2+2];break}}var de=J?J.indexOf("overlay "):-1;return de<0?J:de==0?null:J.slice(0,de-1)},getModeAt:function(r){var a=this.doc.mode;return a.innerMode?e.innerMode(a,this.getTokenAt(r).state).mode:a},getHelper:function(r,a){return this.getHelpers(r,a)[0]},getHelpers:function(r,a){var D=[];if(!n.hasOwnProperty(a))return D;var B=n[a],Y=this.getModeAt(r);if(typeof Y[a]=="string")B[Y[a]]&&D.push(B[Y[a]]);else if(Y[a])for(var J=0;J<Y[a].length;J++){var q=B[Y[a][J]];q&&D.push(q)}else Y.helperType&&B[Y.helperType]?D.push(B[Y.helperType]):B[Y.name]&&D.push(B[Y.name]);for(var de=0;de<B._global.length;de++){var pe=B._global[de];pe.pred(Y,this)&&he(D,pe.val)==-1&&D.push(pe.val)}return D},getStateAfter:function(r,a){var D=this.doc;return r=H(D,r==null?D.first+D.size-1:r),rt(this,r+1,a).state},cursorCoords:function(r,a){var D,B=this.doc.sel.primary();return r==null?D=B.head:typeof r=="object"?D=h(this.doc,r):D=r?B.from():B.to(),sn(this,D,a||"page")},charCoords:function(r,a){return ga(this,h(this.doc,r),a||"page")},coordsChar:function(r,a){return r=ho(this,r,a||"page"),ya(this,r.left,r.top)},lineAtHeight:function(r,a){return r=ho(this,{top:r,left:0},a||"page").top,Ar(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,a,D){var B=!1,Y;if(typeof r=="number"){var J=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>J&&(r=J,B=!0),Y=gt(this.doc,r)}else Y=r;return Gi(this,Y,{top:0,left:0},a||"page",D||B).top+(B?this.doc.height-on(Y):0)},defaultTextHeight:function(){return $n(this.display)},defaultCharWidth:function(){return Jn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,a,D,B,Y){var J=this.display;r=sn(this,h(this.doc,r));var q=r.bottom,de=r.left;if(a.style.position="absolute",a.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(a),J.sizer.appendChild(a),B=="over")q=r.top;else if(B=="above"||B=="near"){var pe=Math.max(J.wrapper.clientHeight,this.doc.height),De=Math.max(J.sizer.clientWidth,J.lineSpace.clientWidth);(B=="above"||r.bottom+a.offsetHeight>pe)&&r.top>a.offsetHeight?q=r.top-a.offsetHeight:r.bottom+a.offsetHeight<=pe&&(q=r.bottom),de+a.offsetWidth>De&&(de=De-a.offsetWidth)}a.style.top=q+"px",a.style.left=a.style.right="",Y=="right"?(de=J.sizer.clientWidth-a.offsetWidth,a.style.right="0px"):(Y=="left"?de=0:Y=="middle"&&(de=(J.sizer.clientWidth-a.offsetWidth)/2),a.style.left=de+"px"),D&&Js(this,{left:de,top:q,right:de+a.offsetWidth,bottom:q+a.offsetHeight})},triggerOnKeyDown:Dr(gs),triggerOnKeyPress:Dr(ys),triggerOnKeyUp:vs,triggerOnMouseDown:Dr(bs),execCommand:function(r){if(_i.hasOwnProperty(r))return _i[r].call(null,this)},triggerElectric:Dr(function(r){Ls(this,r)}),findPosH:function(r,a,D,B){var Y=1;a<0&&(Y=-1,a=-a);for(var J=h(this.doc,r),q=0;q<a&&!(J=Va(this.doc,J,Y,D,B),J.hitSide);++q);return J},moveH:Dr(function(r,a){var D=this;this.extendSelectionsBy(function(B){return D.display.shift||D.doc.extend||B.empty()?Va(D.doc,B.head,r,a,D.options.rtlMoveVisually):r<0?B.from():B.to()},ce)}),deleteH:Dr(function(r,a){var D=this.doc.sel,B=this.doc;D.somethingSelected()?B.replaceSelection("",null,"+delete"):oi(this,function(Y){var J=Va(B,Y.head,r,a,!1);return r<0?{from:J,to:Y.head}:{from:Y.head,to:J}})}),findPosV:function(r,a,D,B){var Y=1,J=B;a<0&&(Y=-1,a=-a);for(var q=h(this.doc,r),de=0;de<a;++de){var pe=sn(this,q,"div");if(J==null?J=pe.left:pe.left=J,q=ks(this,pe,Y,D),q.hitSide)break}return q},moveV:Dr(function(r,a){var D=this,B=this.doc,Y=[],J=!this.display.shift&&!B.extend&&B.sel.somethingSelected();if(B.extendSelectionsBy(function(de){if(J)return r<0?de.from():de.to();var pe=sn(D,de.head,"div");de.goalColumn!=null&&(pe.left=de.goalColumn),Y.push(pe.left);var De=ks(D,pe,r,a);return a=="page"&&de==B.sel.primary()&&La(D,ga(D,De,"div").top-pe.top),De},ce),Y.length)for(var q=0;q<B.sel.ranges.length;q++)B.sel.ranges[q].goalColumn=Y[q]}),findWordAt:function(r){var a=this.doc,D=gt(a,r.line).text,B=r.ch,Y=r.ch;if(D){var J=this.getHelper(r,"wordChars");(r.sticky=="before"||Y==D.length)&&B?--B:++Y;for(var q=D.charAt(B),de=Ae(q,J)?function(pe){return Ae(pe,J)}:/\s/.test(q)?function(pe){return/\s/.test(pe)}:function(pe){return!/\s/.test(pe)&&!Ae(pe)};B>0&&de(D.charAt(B-1));)--B;for(;Y<D.length&&de(D.charAt(Y));)++Y}return new Xt(He(r.line,B),He(r.line,Y))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?j(this.display.cursorDiv,"CodeMirror-overwrite"):E(this.display.cursorDiv,"CodeMirror-overwrite"),Be(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==_()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Dr(function(r,a){bi(this,r,a)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-cn(this)-this.display.barHeight,width:r.scrollWidth-cn(this)-this.display.barWidth,clientHeight:fa(this),clientWidth:Mn(this)}},scrollIntoView:Dr(function(r,a){r==null?(r={from:this.doc.sel.primary().head,to:null},a==null&&(a=this.options.cursorScrollMargin)):typeof r=="number"?r={from:He(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=a||0,r.from.line!=null?Zs(this,r):Co(this,r.from,r.to,r.margin)}),setSize:Dr(function(r,a){var D=this,B=function(J){return typeof J=="number"||/^\d+$/.test(String(J))?J+"px":J};r!=null&&(this.display.wrapper.style.width=B(r)),a!=null&&(this.display.wrapper.style.height=B(a)),this.options.lineWrapping&&so(this);var Y=this.display.viewFrom;this.doc.iter(Y,this.display.viewTo,function(J){if(J.widgets){for(var q=0;q<J.widgets.length;q++)if(J.widgets[q].noHScroll){Cn(D,Y,"widget");break}}++Y}),this.curOp.forceUpdate=!0,Be(this,"refresh",this)}),operation:function(r){return Hr(this,r)},startOperation:function(){return Un(this)},endOperation:function(){return jn(this)},refresh:Dr(function(){var r=this.display.cachedTextHeight;_r(this),this.curOp.forceUpdate=!0,vi(this),bi(this,this.doc.scrollLeft,this.doc.scrollTop),Ra(this.display),(r==null||Math.abs(r-$n(this.display))>.5||this.options.lineWrapping)&&Ca(this),Be(this,"refresh",this)}),swapDoc:Dr(function(r){var a=this.doc;return a.cm=null,this.state.selectingText&&this.state.selectingText(),No(this,r),vi(this),this.display.input.reset(),bi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Cr(this,"swapDoc",this,a),a}),phrase:function(r){var a=this.options.phrases;return a&&Object.prototype.hasOwnProperty.call(a,r)?a[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},ye(e),e.registerHelper=function(r,a,D){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][a]=D},e.registerGlobalHelper=function(r,a,D,B){e.registerHelper(r,a,B),n[r]._global.push({pred:D,val:B})}}function Va(e,t,n,r,a){var D=t,B=n,Y=gt(e,t.line),J=a&&e.direction=="rtl"?-n:n;function q(){var ut=t.line+J;return ut<e.first||ut>=e.first+e.size?!1:(t=new He(ut,t.ch,t.sticky),Y=gt(e,ut))}function de(ut){var it;if(r=="codepoint"){var mt=Y.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(mt)?it=null:it=new He(t.line,Math.max(0,Math.min(Y.text.length,t.ch+n*(mt>=55296&&mt<56320?2:1))),-n)}else a?it=_l(e.cm,Y,t,n):it=Ua(Y,t,n);if(it==null)if(!ut&&q())t=ja(a,e.cm,Y,t.line,J);else return!1;else t=it;return!0}if(r=="char"||r=="codepoint")de();else if(r=="column")de(!0);else if(r=="word"||r=="group")for(var pe=null,De=r=="group",we=e.cm&&e.cm.getHelper(t,"wordChars"),je=!0;!(n<0&&!de(!je));je=!1){var Xe=Y.text.charAt(t.ch)||`
|
|
`,qe=Ae(Xe,we)?"w":De&&Xe==`
|
|
`?"n":!De||/\s/.test(Xe)?null:"p";if(De&&!je&&!qe&&(qe="s"),pe&&pe!=qe){n<0&&(n=1,de(),t.sticky="after");break}if(qe&&(pe=qe),n>0&&!de(!je))break}var nt=ta(e,t,D,B,!0);return Mt(D,nt)&&(nt.hitSide=!0),nt}function ks(e,t,n,r){var a=e.doc,D=t.left,B;if(r=="page"){var Y=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),J=Math.max(Y-.5*$n(e.display),3);B=(n>0?t.bottom:t.top)+n*J}else r=="line"&&(B=n>0?t.bottom+3:t.top-3);for(var q;!(q=ya(e,D,B),!q.outside);){if(n<0?B<=0:B>=a.height){q.hitSide=!0;break}B+=n*5}return q}var Qt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new se,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Qt.prototype.init=function(e){var t=this,n=this,r=n.cm,a=n.div=e.lineDiv;Ds(a,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function D(Y){for(var J=Y.target;J;J=J.parentNode){if(J==a)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(J.className))break}return!1}Oe(a,"paste",function(Y){if(!D(Y)||Ke(r,Y)||ws(Y,r))return;N<=11&&setTimeout(vr(r,function(){return t.updateFromDOM()}),20)}),Oe(a,"compositionstart",function(Y){t.composing={data:Y.data,done:!1}}),Oe(a,"compositionupdate",function(Y){t.composing||(t.composing={data:Y.data,done:!1})}),Oe(a,"compositionend",function(Y){t.composing&&(Y.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Oe(a,"touchstart",function(){return n.forceCompositionEnd()}),Oe(a,"input",function(){t.composing||t.readFromDOMSoon()});function B(Y){if(!D(Y)||Ke(r,Y))return;if(r.somethingSelected())sa({lineWise:!1,text:r.getSelections()}),Y.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var J=As(r);sa({lineWise:!0,text:J.text}),Y.type=="cut"&&r.operation(function(){r.setSelections(J.ranges,0,ke),r.replaceSelection("",null,"cut")})}else return;if(Y.clipboardData){Y.clipboardData.clearData();var q=un.text.join(`
|
|
`);if(Y.clipboardData.setData("Text",q),Y.clipboardData.getData("Text")==q){Y.preventDefault();return}}var de=Rs(),pe=de.firstChild;r.display.lineSpace.insertBefore(de,r.display.lineSpace.firstChild),pe.value=un.text.join(`
|
|
`);var De=document.activeElement;Z(pe),setTimeout(function(){r.display.lineSpace.removeChild(de),De.focus(),De==a&&n.showPrimarySelection()},50)}Oe(a,"copy",B),Oe(a,"cut",B)},Qt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Qt.prototype.prepareSelection=function(){var e=vo(this.cm,!1);return e.focus=document.activeElement==this.div,e},Qt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Qt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Qt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),a=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||a.line<t.display.viewFrom){e.removeAllRanges();return}var D=la(t,e.anchorNode,e.anchorOffset),B=la(t,e.focusNode,e.focusOffset);if(D&&!D.bad&&B&&!B.bad&<(qt(D,B),r)==0&<(Yt(D,B),a)==0)return;var Y=t.display.view,J=r.line>=t.display.viewFrom&&Os(t,r)||{node:Y[0].measure.map[2],offset:0},q=a.line<t.display.viewTo&&Os(t,a);if(!q){var de=Y[Y.length-1].measure,pe=de.maps?de.maps[de.maps.length-1]:de.map;q={node:pe[pe.length-1],offset:pe[pe.length-2]-pe[pe.length-3]}}if(!J||!q){e.removeAllRanges();return}var De=e.rangeCount&&e.getRangeAt(0),we;try{we=S(J.node,J.offset,q.offset,q.node)}catch(je){}we&&(!O&&t.state.focused?(e.collapse(J.node,J.offset),we.collapsed||(e.removeAllRanges(),e.addRange(we))):(e.removeAllRanges(),e.addRange(we)),De&&e.anchorNode==null?e.addRange(De):O&&this.startGracePeriod()),this.rememberSelection()},Qt.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},Qt.prototype.showMultipleSelections=function(e){c(this.cm.display.cursorDiv,e.cursors),c(this.cm.display.selectionDiv,e.selection)},Qt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Qt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return T(this.div,t)},Qt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Qt.prototype.blur=function(){this.div.blur()},Qt.prototype.getField=function(){return this.div},Qt.prototype.supportsTouch=function(){return!0},Qt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Hr(this.cm,function(){return e.cm.curOp.selectionChanged=!0});function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}this.polling.set(this.cm.options.pollInterval,t)},Qt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Qt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(o&&d&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var n=la(t,e.anchorNode,e.anchorOffset),r=la(t,e.focusNode,e.focusOffset);n&&r&&Hr(t,function(){wr(t.doc,Tn(n,r),ke),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Qt.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),a=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=He(r.line-1,gt(e.doc,r.line-1).length)),a.ch==gt(e.doc,a.line).text.length&&a.line<e.lastLine()&&(a=He(a.line+1,0)),r.line<t.viewFrom||a.line>t.viewTo-1)return!1;var D,B,Y;r.line==t.viewFrom||(D=Nn(e,r.line))==0?(B=Ot(t.view[0].line),Y=t.view[0].node):(B=Ot(t.view[D].line),Y=t.view[D-1].node.nextSibling);var J=Nn(e,a.line),q,de;if(J==t.view.length-1?(q=t.viewTo-1,de=t.lineDiv.lastChild):(q=Ot(t.view[J+1].line)-1,de=t.view[J+1].node.previousSibling),!Y)return!1;for(var pe=e.doc.splitLines(tu(e,Y,de,B,q)),De=kr(e.doc,He(B,0),He(q,gt(e.doc,q).text.length));pe.length>1&&De.length>1;)if(Le(pe)==Le(De))pe.pop(),De.pop(),q--;else if(pe[0]==De[0])pe.shift(),De.shift(),B++;else break;for(var we=0,je=0,Xe=pe[0],qe=De[0],nt=Math.min(Xe.length,qe.length);we<nt&&Xe.charCodeAt(we)==qe.charCodeAt(we);)++we;for(var ut=Le(pe),it=Le(De),mt=Math.min(ut.length-(pe.length==1?we:0),it.length-(De.length==1?we:0));je<mt&&ut.charCodeAt(ut.length-je-1)==it.charCodeAt(it.length-je-1);)++je;if(pe.length==1&&De.length==1&&B==r.line)for(;we&&we>r.ch&&ut.charCodeAt(ut.length-je-1)==it.charCodeAt(it.length-je-1);)we--,je++;pe[pe.length-1]=ut.slice(0,ut.length-je).replace(/^\u200b+/,""),pe[0]=pe[0].slice(we).replace(/\u200b+$/,"");var Tt=He(B,we),Et=He(q,De.length?Le(De).length-je:0);if(pe.length>1||pe[0]||lt(Tt,Et))return ni(e.doc,pe,Tt,Et,"+input"),!0},Qt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Qt.prototype.reset=function(){this.forceCompositionEnd()},Qt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Qt.prototype.readFromDOMSoon=function(){var e=this;if(this.readDOMTimeout!=null)return;this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80)},Qt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Hr(this.cm,function(){return _r(e.cm)})},Qt.prototype.setUneditable=function(e){e.contentEditable="false"},Qt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||vr(this.cm,za)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Qt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Qt.prototype.onContextMenu=function(){},Qt.prototype.resetPosition=function(){},Qt.prototype.needsContentAttribute=!0;function Os(e,t){var n=pa(e,t.line);if(!n||n.hidden)return null;var r=gt(e.doc,t.line),a=ro(n,r,t.line),D=$e(r,e.doc.direction),B="left";if(D){var Y=Ye(D,t.ch);B=Y%2?"right":"left"}var J=ao(a.map,t.ch,B);return J.offset=J.collapse=="right"?J.end:J.start,J}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function li(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,a){var D="",B=!1,Y=e.doc.lineSeparator(),J=!1;function q(we){return function(je){return je.id==we}}function de(){B&&(D+=Y,J&&(D+=Y),B=J=!1)}function pe(we){we&&(de(),D+=we)}function De(we){if(we.nodeType==1){var je=we.getAttribute("cm-text");if(je){pe(je);return}var Xe=we.getAttribute("cm-marker"),qe;if(Xe){var nt=e.findMarks(He(r,0),He(a+1,0),q(+Xe));nt.length&&(qe=nt[0].find(0))&&pe(kr(e.doc,qe.from,qe.to).join(Y));return}if(we.getAttribute("contenteditable")=="false")return;var ut=/^(pre|div|p|li|table|br)$/i.test(we.nodeName);if(!/^br$/i.test(we.nodeName)&&we.textContent.length==0)return;ut&&de();for(var it=0;it<we.childNodes.length;it++)De(we.childNodes[it]);/^(pre|p)$/i.test(we.nodeName)&&(J=!0),ut&&(B=!0)}else we.nodeType==3&&pe(we.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(De(t),t==n);)t=t.nextSibling,J=!1;return D}function la(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return li(e.clipPos(He(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var a=0;a<e.display.view.length;a++){var D=e.display.view[a];if(D.node==r)return ru(D,t,n)}}function ru(e,t,n){var r=e.text.firstChild,a=!1;if(!t||!T(r,t))return li(He(Ot(e.line),0),!0);if(t==r&&(a=!0,t=r.childNodes[n],n=0,!t)){var D=e.rest?Le(e.rest):e.line;return li(He(Ot(D),D.text.length),a)}var B=t.nodeType==3?t:null,Y=t;for(!B&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(B=t.firstChild,n&&(n=B.nodeValue.length));Y.parentNode!=r;)Y=Y.parentNode;var J=e.measure,q=J.maps;function de(qe,nt,ut){for(var it=-1;it<(q?q.length:0);it++)for(var mt=it<0?J.map:q[it],Tt=0;Tt<mt.length;Tt+=3){var Et=mt[Tt+2];if(Et==qe||Et==nt){var Pt=Ot(it<0?e.line:e.rest[it]),tr=mt[Tt]+ut;return(ut<0||Et!=qe)&&(tr=mt[Tt+(ut?1:0)]),He(Pt,tr)}}}var pe=de(B,Y,n);if(pe)return li(pe,a);for(var De=Y.nextSibling,we=B?B.nodeValue.length-n:0;De;De=De.nextSibling){if(pe=de(De,De.firstChild,0),pe)return li(He(pe.line,pe.ch-we),a);we+=De.textContent.length}for(var je=Y.previousSibling,Xe=n;je;je=je.previousSibling){if(pe=de(je,je.firstChild,-1),pe)return li(He(pe.line,pe.ch+Xe),a);Xe+=je.textContent.length}}var ur=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new se,this.hasSelection=!1,this.composing=null};ur.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var a=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),b&&(a.style.width="0px"),Oe(a,"input",function(){W&&N>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Oe(a,"paste",function(B){if(Ke(r,B)||ws(B,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function D(B){if(Ke(r,B))return;if(r.somethingSelected())sa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var Y=As(r);sa({lineWise:!0,text:Y.text}),B.type=="cut"?r.setSelections(Y.ranges,null,ke):(n.prevInput="",a.value=Y.text.join(`
|
|
`),Z(a))}else return;B.type=="cut"&&(r.state.cutIncoming=+new Date)}Oe(a,"cut",D),Oe(a,"copy",D),Oe(e.scroller,"paste",function(B){if(gn(e,B)||Ke(r,B))return;if(!a.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var Y=new Event("paste");Y.clipboardData=B.clipboardData,a.dispatchEvent(Y)}),Oe(e.lineSpace,"selectstart",function(B){gn(e,B)||te(B)}),Oe(a,"compositionstart",function(){var B=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:B,range:r.markText(B,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Oe(a,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},ur.prototype.createField=function(e){this.wrapper=Rs(),this.textarea=this.wrapper.firstChild},ur.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},ur.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=vo(e);if(e.options.moveInputWithCursor){var a=sn(e,n.sel.primary().head,"div"),D=t.wrapper.getBoundingClientRect(),B=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,a.top+B.top-D.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,a.left+B.left-D.left))}return r},ur.prototype.showSelection=function(e){var t=this.cm,n=t.display;c(n.cursorDiv,e.cursors),c(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},ur.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&Z(this.textarea),W&&N>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",W&&N>=9&&(this.hasSelection=null))},ur.prototype.getField=function(){return this.textarea},ur.prototype.supportsTouch=function(){return!1},ur.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!i||_()!=this.textarea))try{this.textarea.focus()}catch(e){}},ur.prototype.blur=function(){this.textarea.blur()},ur.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},ur.prototype.receivedFocus=function(){this.slowPoll()},ur.prototype.slowPoll=function(){var e=this;if(this.pollingFast)return;this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},ur.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},ur.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||ft(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var a=n.value;if(a==r&&!t.somethingSelected())return!1;if(W&&N>=9&&this.hasSelection===a||s&&/[\uf700-\uf7ff]/.test(a))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var D=a.charCodeAt(0);if(D==8203&&!r&&(r="\u200B"),D==8666)return this.reset(),this.cm.execCommand("undo")}for(var B=0,Y=Math.min(r.length,a.length);B<Y&&r.charCodeAt(B)==a.charCodeAt(B);)++B;return Hr(t,function(){za(t,a.slice(B),r.length-B,null,e.composing?"*compose":null),a.length>1e3||a.indexOf(`
|
|
`)>-1?n.value=e.prevInput="":e.prevInput=a,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ur.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},ur.prototype.onKeyPress=function(){W&&N>=9&&(this.hasSelection=null),this.fastPoll()},ur.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,a=t.textarea;t.contextMenuPending&&t.contextMenuPending();var D=In(n,e),B=r.scroller.scrollTop;if(!D||f)return;var Y=n.options.resetSelectionOnContextMenu;Y&&n.doc.sel.contains(D)==-1&&vr(n,wr)(n.doc,Tn(D),ke);var J=a.style.cssText,q=t.wrapper.style.cssText,de=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",a.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-de.top-5)+"px; left: "+(e.clientX-de.left-5)+`px;
|
|
z-index: 1000; background: `+(W?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var pe;P&&(pe=window.scrollY),r.input.focus(),P&&window.scrollTo(null,pe),r.input.reset(),n.somethingSelected()||(a.value=t.prevInput=" "),t.contextMenuPending=we,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function De(){if(a.selectionStart!=null){var Xe=n.somethingSelected(),qe="\u200B"+(Xe?a.value:"");a.value="\u21DA",a.value=qe,t.prevInput=Xe?"":"\u200B",a.selectionStart=1,a.selectionEnd=qe.length,r.selForContextMenu=n.doc.sel}}function we(){if(t.contextMenuPending!=we)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=q,a.style.cssText=J,W&&N<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=B),a.selectionStart!=null){(!W||W&&N<9)&&De();var Xe=0,qe=function(){r.selForContextMenu==n.doc.sel&&a.selectionStart==0&&a.selectionEnd>0&&t.prevInput=="\u200B"?vr(n,$o)(n):Xe++<10?r.detectingSelectAll=setTimeout(qe,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(qe,200)}}if(W&&N>=9&&De(),k){fe(e);var je=function(){at(window,"mouseup",je),setTimeout(we,20)};Oe(window,"mouseup",je)}else setTimeout(we,50)},ur.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},ur.prototype.setUneditable=function(){},ur.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?F(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=_();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=Y.getValue()}var a;if(e.form&&(Oe(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var D=e.form;a=D.submit;try{var B=D.submit=function(){r(),D.submit=a,D.submit(),D.submit=B}}catch(J){}}t.finishInit=function(J){J.save=r,J.getTextArea=function(){return e},J.toTextArea=function(){J.toTextArea=isNaN,r(),e.parentNode.removeChild(J.getWrapperElement()),e.style.display="",e.form&&(at(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=a))}},e.style.display="none";var Y=ir(function(J){return e.parentNode.insertBefore(J,e.nextSibling)},t);return Y}function iu(e){e.off=at,e.on=Oe,e.wheelEventPixels=hl,e.Doc=Ir,e.splitLines=wt,e.countColumn=ee,e.findColumn=ve,e.isWordChar=be,e.Pass=Ue,e.signal=Be,e.Line=Pn,e.changeEnd=wn,e.scrollbarModel=wo,e.Pos=He,e.cmpPos=lt,e.modes=Ht,e.mimeModes=kt,e.resolveMode=bt,e.getMode=Ct,e.modeExtensions=st,e.extendMode=xt,e.copyState=Zt,e.startState=rr,e.innerMode=nr,e.commands=_i,e.keyMap=vn,e.keyName=hs,e.isModifierKey=us,e.lookupKey=ai,e.normalizeKeyMap=Ml,e.StringStream=Rt,e.SharedTextMarker=Oi,e.TextMarker=An,e.LineWidget=ki,e.e_preventDefault=te,e.e_stopPropagation=re,e.e_stop=fe,e.addClass=j,e.contains=T,e.rmClass=E,e.keyNames=Dn}$l(ir),ql(ir);var au="iter insert remove copy getEditor constructor".split(" ");for(var ua in Ir.prototype)Ir.prototype.hasOwnProperty(ua)&&he(au,ua)<0&&(ir.prototype[ua]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ir.prototype[ua]));return ye(Ir),ir.inputStyles={textarea:ur,contenteditable:Qt},ir.defineMode=function(e){!ir.defaults.mode&&e!="null"&&(ir.defaults.mode=e),Ur.apply(this,arguments)},ir.defineMIME=Zr,ir.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),ir.defineMIME("text/plain","null"),ir.defineExtension=function(e,t){ir.prototype[e]=t},ir.defineDocExtension=function(e,t){Ir.prototype[e]=t},ir.fromTextArea=nu,iu(ir),ir.version="5.58.2",ir})},Y1PL:function(vt,Te,Q){"use strict";Q.r(Te),Q.d(Te,"ResizableTextArea",function(){return he});var ie=Q("wx14"),$=Q("1OyB"),O=Q("vuIU"),V=Q("Ji7U"),I=Q("LK+K"),M=Q("q1tI"),W=Q("VTBJ"),N=Q("rePB"),P=Q("Zm9Q"),R=Q("Kwbf"),d=Q("c+Xe"),f=Q("m+aA"),w=Q("bdgK"),p=new Map;function g(ke){ke.forEach(function(Me){var ce,ve=Me.target;(ce=p.get(ve))===null||ce===void 0||ce.forEach(function(le){return le(ve)})})}var b=new w.default(g),o=null,i=null;function s(ke,Me){p.has(ke)||(p.set(ke,new Set),b.observe(ke)),p.get(ke).add(Me)}function l(ke,Me){p.has(ke)&&(p.get(ke).delete(Me),p.get(ke).size||(b.unobserve(ke),p.delete(ke)))}var C=function(ke){Object(V.a)(ce,ke);var Me=Object(I.a)(ce);function ce(){return Object($.a)(this,ce),Me.apply(this,arguments)}return Object(O.a)(ce,[{key:"render",value:function(){return this.props.children}}]),ce}(M.Component),m=M.createContext(null);function v(ke){var Me=ke.children,ce=ke.onBatchResize,ve=M.useRef(0),le=M.useRef([]),ne=M.useContext(m),Le=M.useCallback(function(xe,Ie,Re){ve.current+=1;var ae=ve.current;le.current.push({size:xe,element:Ie,data:Re}),Promise.resolve().then(function(){ae===ve.current&&(ce==null||ce(le.current),le.current=[])}),ne==null||ne(xe,Ie,Re)},[ce,ne]);return M.createElement(m.Provider,{value:Le},Me)}function k(ke){var Me=ke.children,ce=ke.disabled,ve=M.useRef(null),le=M.useRef(null),ne=M.useContext(m),Le=M.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),xe=M.isValidElement(Me)&&Object(d.c)(Me),Ie=xe?Me.ref:null,Re=M.useMemo(function(){return Object(d.a)(Ie,ve)},[Ie,ve]),ae=M.useRef(ke);ae.current=ke;var oe=M.useCallback(function(be){var Ae=ae.current,Ne=Ae.onResize,_e=Ae.data,We=be.getBoundingClientRect(),Fe=We.width,et=We.height,Je=be.offsetWidth,Qe=be.offsetHeight,Ye=Math.floor(Fe),dt=Math.floor(et);if(Le.current.width!==Ye||Le.current.height!==dt||Le.current.offsetWidth!==Je||Le.current.offsetHeight!==Qe){var $e={width:Ye,height:dt,offsetWidth:Je,offsetHeight:Qe};Le.current=$e;var tt=Je===Math.round(Fe)?Fe:Je,Oe=Qe===Math.round(et)?et:Qe,Ze=Object(W.a)(Object(W.a)({},$e),{},{offsetWidth:tt,offsetHeight:Oe});ne==null||ne(Ze,be,_e),Ne&&Promise.resolve().then(function(){Ne(Ze,be)})}},[]);return M.useEffect(function(){var be=Object(f.a)(ve.current)||Object(f.a)(le.current);return be&&!ce&&s(be,oe),function(){return l(be,oe)}},[ve.current,ce]),M.createElement(C,{ref:le},xe?M.cloneElement(Me,{ref:Re}):Me)}var L="rc-observer-key";function E(ke){var Me=ke.children,ce=Object(P.a)(Me);return ce.map(function(ve,le){var ne=(ve==null?void 0:ve.key)||"".concat(L,"-").concat(le);return M.createElement(k,Object(ie.a)({},ke,{key:ne}),ve)})}E.Collection=v;var y=E,c=Q("bT9E"),u=Q("TSYQ"),A=Q.n(u),S=`
|
|
min-height:0 !important;
|
|
max-height:none !important;
|
|
height:0 !important;
|
|
visibility:hidden !important;
|
|
overflow:hidden !important;
|
|
position:absolute !important;
|
|
z-index:-1000 !important;
|
|
top:0 !important;
|
|
right:0 !important
|
|
`,T=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],_={},j;function z(ke){var Me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ce=ke.getAttribute("id")||ke.getAttribute("data-reactid")||ke.getAttribute("name");if(Me&&_[ce])return _[ce];var ve=window.getComputedStyle(ke),le=ve.getPropertyValue("box-sizing")||ve.getPropertyValue("-moz-box-sizing")||ve.getPropertyValue("-webkit-box-sizing"),ne=parseFloat(ve.getPropertyValue("padding-bottom"))+parseFloat(ve.getPropertyValue("padding-top")),Le=parseFloat(ve.getPropertyValue("border-bottom-width"))+parseFloat(ve.getPropertyValue("border-top-width")),xe=T.map(function(Re){return"".concat(Re,":").concat(ve.getPropertyValue(Re))}).join(";"),Ie={sizingStyle:xe,paddingSize:ne,borderSize:Le,boxSizing:le};return Me&&ce&&(_[ce]=Ie),Ie}function Z(ke){var Me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ce=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,ve=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;j||(j=document.createElement("textarea"),j.setAttribute("tab-index","-1"),j.setAttribute("aria-hidden","true"),document.body.appendChild(j)),ke.getAttribute("wrap")?j.setAttribute("wrap",ke.getAttribute("wrap")):j.removeAttribute("wrap");var le=z(ke,Me),ne=le.paddingSize,Le=le.borderSize,xe=le.boxSizing,Ie=le.sizingStyle;j.setAttribute("style","".concat(Ie,";").concat(S)),j.value=ke.value||ke.placeholder||"";var Re=Number.MIN_SAFE_INTEGER,ae=Number.MAX_SAFE_INTEGER,oe=j.scrollHeight,be;if(xe==="border-box"?oe+=Le:xe==="content-box"&&(oe-=ne),ce!==null||ve!==null){j.value=" ";var Ae=j.scrollHeight-ne;ce!==null&&(Re=Ae*ce,xe==="border-box"&&(Re=Re+ne+Le),oe=Math.max(Re,oe)),ve!==null&&(ae=Ae*ve,xe==="border-box"&&(ae=ae+ne+Le),be=oe>ae?"":"hidden",oe=Math.min(ae,oe))}return{height:oe,minHeight:Re,maxHeight:ae,overflowY:be,resize:"none"}}var K=Q("Gytx"),F=Q.n(K),ee;(function(ke){ke[ke.NONE=0]="NONE",ke[ke.RESIZING=1]="RESIZING",ke[ke.RESIZED=2]="RESIZED"})(ee||(ee={}));var se=function(ke){Object(V.a)(ce,ke);var Me=Object(I.a)(ce);function ce(ve){var le;return Object($.a)(this,ce),le=Me.call(this,ve),le.nextFrameActionId=void 0,le.resizeFrameId=void 0,le.textArea=void 0,le.saveTextArea=function(ne){le.textArea=ne},le.handleResize=function(ne){var Le=le.state.resizeStatus,xe=le.props,Ie=xe.autoSize,Re=xe.onResize;if(Le!==ee.NONE)return;typeof Re=="function"&&Re(ne),Ie&&le.resizeOnNextFrame()},le.resizeOnNextFrame=function(){cancelAnimationFrame(le.nextFrameActionId),le.nextFrameActionId=requestAnimationFrame(le.resizeTextarea)},le.resizeTextarea=function(){var ne=le.props.autoSize;if(!ne||!le.textArea)return;var Le=ne.minRows,xe=ne.maxRows,Ie=Z(le.textArea,!1,Le,xe);le.setState({textareaStyles:Ie,resizeStatus:ee.RESIZING},function(){cancelAnimationFrame(le.resizeFrameId),le.resizeFrameId=requestAnimationFrame(function(){le.setState({resizeStatus:ee.RESIZED},function(){le.resizeFrameId=requestAnimationFrame(function(){le.setState({resizeStatus:ee.NONE}),le.fixFirefoxAutoScroll()})})})})},le.renderTextArea=function(){var ne=le.props,Le=ne.prefixCls,xe=Le===void 0?"rc-textarea":Le,Ie=ne.autoSize,Re=ne.onResize,ae=ne.className,oe=ne.disabled,be=le.state,Ae=be.textareaStyles,Ne=be.resizeStatus,_e=Object(c.a)(le.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),We=A()(xe,ae,Object(N.a)({},"".concat(xe,"-disabled"),oe));"value"in _e&&(_e.value=_e.value||"");var Fe=Object(W.a)(Object(W.a)(Object(W.a)({},le.props.style),Ae),Ne===ee.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return M.createElement(y,{onResize:le.handleResize,disabled:!(Ie||Re)},M.createElement("textarea",Object(ie.a)({},_e,{className:We,style:Fe,ref:le.saveTextArea})))},le.state={textareaStyles:{},resizeStatus:ee.NONE},le}return Object(O.a)(ce,[{key:"componentDidUpdate",value:function(le){(le.value!==this.props.value||!F()(le.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var le=this.textArea.selectionStart,ne=this.textArea.selectionEnd;this.textArea.setSelectionRange(le,ne)}}catch(Le){}}},{key:"render",value:function(){return this.renderTextArea()}}]),ce}(M.Component),he=se,Ce=function(ke){Object(V.a)(ce,ke);var Me=Object(I.a)(ce);function ce(ve){var le;Object($.a)(this,ce),le=Me.call(this,ve),le.resizableTextArea=void 0,le.focus=function(){le.resizableTextArea.textArea.focus()},le.saveTextArea=function(Le){le.resizableTextArea=Le},le.handleChange=function(Le){var xe=le.props.onChange;le.setValue(Le.target.value,function(){le.resizableTextArea.resizeTextarea()}),xe&&xe(Le)},le.handleKeyDown=function(Le){var xe=le.props,Ie=xe.onPressEnter,Re=xe.onKeyDown;Le.keyCode===13&&Ie&&Ie(Le),Re&&Re(Le)};var ne=typeof ve.value=="undefined"||ve.value===null?ve.defaultValue:ve.value;return le.state={value:ne},le}return Object(O.a)(ce,[{key:"setValue",value:function(le,ne){"value"in this.props||this.setState({value:le},ne)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return M.createElement(he,Object(ie.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(le){return"value"in le?{value:le.value}:null}}]),ce}(M.Component),Ue=Te.default=Ce},ZW9T:function(vt,Te,Q){"use strict";Q.d(Te,"a",function(){return y});var ie=Q("k1fw"),$=Q("oBTY"),O=Q("9og8"),V=Q("miYZ"),I=Q("tsqr"),M=Q("rAM+"),W=Q("tJVT"),N=Q("PpiC"),P=Q("WmNS"),R=Q.n(P),d=Q("q1tI"),f=Q.n(d),w=Q("bdgK");function p(c,u,A,S,T){var _=u.getWordUntilPosition(A),j={startLineNumber:A.lineNumber,endLineNumber:A.lineNumber,startColumn:_.startColumn,endColumn:_.endColumn},z=S.map(function(Z){return{label:Z,kind:c.languages.CompletionItemKind.Keyword,insertText:Z,insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:j}});return T.map(function(Z){z.push(Object(ie.a)(Object(ie.a)({},Z),{},{range:j}))}),z}var g=function(c){var u={label:"ifelse",kind:c.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`),insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet},A=["auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];c.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(j,z){var Z=p(c,j,z,A,[u]);return{suggestions:Z}}});var S=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];c.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(j,z){var Z=[{label:"print",kind:c.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
`),insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet}],K=p(c,j,z,S,Z);return{suggestions:K}}});var T=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];c.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(j,z){var Z=[u,{label:"main",kind:c.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
|
|
`),insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:c.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
|
|
`),insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet}],K=p(c,j,z,T,Z);return{suggestions:K}}})},b="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",o=Q("fjLI"),i=Q("LvDl"),s=Q("+ua5");function l(c){return/^\d+$/.test(c)?"".concat(c,"px"):c}function C(){}var m=!1,v={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python",Scala:"scale"};function k(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],u=c;if(Array.isArray(c)){for(var A=0;A<c.length;A++){var S=v[c[A]];if(S)return S}return u[0]}return v[u]||u}var L=null,E=Te.b=function(c){var u=c.width,A=u===void 0?"100%":u,S=c.height,T=S===void 0?"100%":S,_=c.value,j=c.language,z=j===void 0?"javascript":j,Z=c.style,K=Z===void 0?{}:Z,F=c.options,ee=F===void 0?{}:F,se=c.overrideServices,he=se===void 0?{}:se,Ce=c.theme,Ue=Ce===void 0?"vs-dark":Ce,ke=c.onEditBlur,Me=c.onSave,ce=c.autoHeight,ve=ce===void 0?!1:ce,le=c.forbidCopy,ne=le===void 0?!1:le,Le=c.onChange,xe=Le===void 0?C:Le,Ie=c.editorDidMount,Re=Ie===void 0?C:Ie,ae=c.onFocus,oe=ae===void 0?C:ae,be=c.onBreakPoint,Ae=be===void 0?C:be,Ne=c.breakPointValue,_e=Ne===void 0?[]:Ne,We=c.filename,Fe=We===void 0?"educoder.txt":We,et=c.errorLine,Je=c.errorContent,Qe=Je===void 0?"":Je,Ye=c.highlightLine,dt=c.openBreakPoint,$e=dt===void 0?!1:dt,tt=Object(N.a)(c,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","onBreakPoint","breakPointValue","filename","errorLine","errorContent","highlightLine","openBreakPoint"]),Oe=Object(d.useRef)(),Ze=Object(d.useRef)({}),at=Object(d.useRef)(),Be=Object(d.useRef)(),Ke=Object(d.useRef)([]),Ee=Object(d.useRef)(!1),me=Object(d.useRef)(),ye=Object(d.useState)(!1),te=Object(W.a)(ye,2),re=te[0],ue=te[1];function fe(){var Ct;return Oe.current&&(Ct=new w.default(function(st){var xt=Object(M.a)(st),Zt;try{for(xt.s();!(Zt=xt.n()).done;){var nr=Zt.value;(nr.target.offsetHeight>0||nr.target.offsetWidth>0)&&Ze.current.instance.layout()}}catch(rr){xt.e(rr)}finally{xt.f()}}),Ct.observe(Oe.current)),Ct}function Pe(){I.b.warn({content:decodeURIComponent(b),key:"monaco-editor-tip"})}var Se=function(){var st=Ze.current.instance;if(_!=null&&st&&re){var xt=st.getModel();xt&&_!==xt.getValue()&&(m=!0,xt.setValue(_),st.layout(),m=!1)}};Object(d.useEffect)(function(){try{var Ct,st=Ze.current.instance;Be.current&&clearTimeout(Be.current),Be.current=setTimeout(function(){Se()},500),st==null||((Ct=st.updateOptions)===null||Ct===void 0)||Ct.call(st,{lineNumbersMinChars:Math.max(Math.floor(Math.log10(_.split(/\r\n|\r|\n/g).length))+3,5)})}catch(xt){debugger}},[_,re,Ze.current]),Object(d.useEffect)(function(){try{if(et&&Ze.current&&Ze.current.instance){var Ct=Ze.current.instance;Ct.changeViewZones(function(xt){var Zt=document.createElement("div");Zt.style.padding="10px 20px",Zt.style.width="calc(100% - 20px)",Zt.className="my-error-line-wrp",Zt.innerHTML=Qe,xt.addZone({afterLineNumber:et||11,heightInLines:3,domNode:Zt})});var st={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};Ct.addOverlayWidget(st),Ct.revealPositionInCenter({lineNumber:20,column:1})}}catch(xt){debugger}},[et,Ze.current,re]),Object(d.useEffect)(function(){var Ct;if((Ct=Ze.current)!==null&&Ct!==void 0&&Ct.instance&&re&&$e){var st=Ze.current.instance,xt=st.getModel();if(!xt)return;var Zt=function(){var lt=[],Mt=[],zt=xt.getAllDecorations(),Yt=Object(M.a)(zt),qt;try{for(Yt.s();!(qt=Yt.n()).done;){var H=qt.value;if(H.options.className==="highlighted-line"){var h;lt.push(H==null||((h=H.range)===null||h===void 0)?void 0:h.startLineNumber),Mt.push(H==null?void 0:H.id)}}}catch(U){Yt.e(U)}finally{Yt.f()}xt.deltaDecorations(Mt,[]);var x=xt.getLineCount();!!Ye&&Ye<=x&&(st.deltaDecorations([],[{range:new L.Range(Ye,1,Ye,xt.getLineMaxColumn(Ye)),options:{isWholeLine:!0,className:"highlighted-line"}}]),st.revealLineInCenter(Ye))};Zt();var nr=function(){var lt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,Mt=[],zt=[],Yt=xt.getAllDecorations(),qt=Object(M.a)(Yt),H;try{for(qt.s();!(H=qt.n()).done;){var h=H.value;if(h.options.linesDecorationsClassName==="breakpoints"){var x;Mt.push(h==null||((x=h.range)===null||x===void 0)?void 0:x.startLineNumber),zt.push(h==null?void 0:h.id)}}}catch(U){qt.e(U)}finally{qt.f()}if(lt)return{lines:Mt,ids:zt};Ae(Mt)},rr=function(){var He=Object(O.a)(R.a.mark(function lt(Mt){var zt;return R.a.wrap(function(qt){for(;;)switch(qt.prev=qt.next){case 0:return zt={range:new L.Range(Mt,1,Mt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints"}},qt.next=3,xt.deltaDecorations([],[zt]);case 3:nr();case 4:case"end":return qt.stop()}},lt)}));return function(Mt){return He.apply(this,arguments)}}(),Rt=function(){var He=Object(O.a)(R.a.mark(function lt(Mt){var zt,Yt,qt,H,h;return R.a.wrap(function(U){for(;;)switch(U.prev=U.next){case 0:zt=[],Yt=st.getLineDecorations(Mt),qt=Object(M.a)(Yt);try{for(qt.s();!(H=qt.n()).done;)h=H.value,h.options.linesDecorationsClassName==="breakpoints"&&zt.push(h.id)}catch(X){qt.e(X)}finally{qt.f()}return U.next=6,xt.deltaDecorations(zt,[]);case 6:nr();case 7:case"end":return U.stop()}},lt)}));return function(Mt){return He.apply(this,arguments)}}(),gt=function(lt){var Mt=st.getLineDecorations(lt),zt=Object(M.a)(Mt),Yt;try{for(zt.s();!(Yt=zt.n()).done;){var qt=Yt.value;if(qt.options.linesDecorationsClassName==="breakpoints")return!0}}catch(H){zt.e(H)}finally{zt.f()}return!1};if(!Object(i.isEqual)(_e,nr(!0).lines)){xt.deltaDecorations(nr(!0).ids,[]);var kr=_e.map(function(He){return{range:new L.Range(He,1,He,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints"}}});xt.deltaDecorations([],kr)}var tn=st.onDidChangeModelContent(function(He){var lt=st.getPosition();if(lt){var Mt=lt.lineNumber;xt.getLineContent(Mt).trim()===""?Rt(Mt):gt(Mt)&&(Rt(Mt),rr(Mt))}}),Tr=st.onMouseDown(function(He){var lt,Mt,zt;if(He.target.detail&&(lt=He.target)!==null&<!==void 0&&(Mt=lt.element)!==null&&Mt!==void 0&&(zt=Mt.className)!==null&&zt!==void 0&&zt.includes("line-numbers")){var Yt=He.target.position.lineNumber;if(xt.getLineContent(Yt).trim()==="")return;gt(Yt)?Rt(Yt):rr(Yt)}}),Ot=function(lt){var Mt={range:new L.Range(lt,1,lt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-fake"}};Ke.current=st.deltaDecorations(Ke.current,[Mt])},Ar=function(){Ke.current=st.deltaDecorations(Ke.current,[])},Kr=st.onMouseMove(function(He){var lt,Mt,zt;if(Ar(),He.target.detail&&(lt=He.target)!==null&<!==void 0&&(Mt=lt.element)!==null&&Mt!==void 0&&(zt=Mt.className)!==null&&zt!==void 0&&zt.includes("line-numbers")){var Yt=He.target.position.lineNumber;if(xt.getLineContent(Yt).trim()==="")return;Ot(Yt)}}),rn=st.onMouseLeave(function(){Ar()});return function(){tn.dispose(),Tr.dispose(),Kr.dispose(),rn.dispose()}}},[Ze.current,re,_e,Ye,$e]);function ze(){var Ct=Ze.current.instance;if(Ct){var st=Ct.getSelection(),xt=Ze.current.pastePos||{},Zt=new L.Range(xt.startLineNumber||st.endLineNumber,xt.startColumn||st.endColumn,xt.endLineNumber||st.endLineNumber,xt.endColumn||st.endColumn);setTimeout(function(){Ct.executeEdits("",[{range:Zt,text:""}])},300)}}function ot(Ct){(window.navigator.platform.match("Mac")?Ct.metaKey:Ct.ctrlKey)&&Ct.keyCode==83&&(Ct.preventDefault(),Me())}var ct=function(){if(ve&&Ze.current.instance){var st=Ze.current.instance.getContentHeight();Zr(st<T?T:st)}else Zr(T)};function ht(Ct){var st=document.createEvent("MouseEvents");st.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),Ct.dispatchEvent(st)}var At=function(st){var xt=st.keyCode,Zt=st.ctrlKey,nr=st.metaKey,rr=st.target,Rt=st.type;return(Rt==="paste"||(xt===67||xt===86)&&(nr||Zt))&&rr.nodeName==="TEXTAREA"&&(Pe(),st.preventDefault()),!1};function wt(Ct,st){var xt=window.URL||window.webkitURL||window,Zt=new Blob([st]),nr=document.createElementNS("http://www.w3.org/1999/xhtml","a");nr.href=xt.createObjectURL(Zt),nr.download=Ct,ht(nr)}Object(d.useEffect)(function(){ct()},[ct]),Object(d.useEffect)(function(){Oe.current&&!re&&Q.e(27).then(Q.t.bind(null,"M/lh",7)).then(function(Ct){try{L=Ct,Ze.current.instance=L.editor.create(Oe.current,{value:_,language:k(z),theme:Ue,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0},he);var st=Ze.current.instance,xt=o.c._menuItems,Zt=Object($.a)(xt).find(function(rr){return rr[0]._debugName=="EditorContext"});if(Re(st,L),setTimeout(function(){ct(),Ze.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){wt(Fe||"educoder.txt",st.getValue())}}),st.getDomNode().addEventListener("input",function(){at.current.autoFormat&&st.getAction("editor.action.formatDocument").run()})},500),Ze.current.subscription=st.onDidChangeModelContent(function(rr){debugger;Ee.current?clearTimeout(me.current):(ct(),xe(st.getValue(),rr)),me.current=setTimeout(function(){Ee.current=!1},500)}),window.Monaco||g(L,k(z)),ne&&(Oe.current.classList.add("noCopyPaste"),window.removeEventListener("keydown",At),window.removeEventListener("paste",At),window.addEventListener("keydown",At),window.addEventListener("paste",At)),window.Monaco=L,ke&&st.onDidBlurEditorWidget(function(){ke(st.getValue())}),oe&&st.onDidFocusEditorText(function(){oe(st.getValue())}),ne)try{window.addEventListener("paste",ze)}catch(rr){}var nr=fe();return ue(!0),function(){var rr=Ze.current.instance;rr.dispose();var Rt=rr.getModel();Rt&&Rt.dispose(),Ze.current.subscription&&Ze.current.subscription.dispose(),ne&&window.removeEventListener("paste",ze),nr.unobserve(Oe.current)}}catch(rr){debugger}})},[]),Object(d.useEffect)(function(){var Ct=Ze.current.instance;if(Ct&&re)return document.addEventListener("keydown",ot,!1),function(){document.removeEventListener("keydown",ot)}},[Me,re]),Object(d.useEffect)(function(){var Ct=Ze.current.instance;if(Ct&&re){var st=k(z);L.editor.setModelLanguage(Ct.getModel(),st)}},[z,re]),Object(d.useEffect)(function(){var Ct=Ze.current.instance;Ct&&re&&L.editor.setTheme(Ue)},[Ue,re]),Object(d.useEffect)(function(){var Ct=Ze.current.instance;at.current=ee,Ct&&re&&(Ct.updateOptions(Object(ie.a)({},ee)),setTimeout(function(){Ct.getModel().updateOptions(Object(ie.a)({},ee))},200))},[JSON.stringify(ee),re]),Object(d.useEffect)(function(){var Ct=Ze.current.instance;Ct&&re&&Ct.layout()},[A,T,re]);var ft=Object(d.useState)(l(A)),Kt=Object(W.a)(ft,2),Ft=Kt[0],Jt=Kt[1],Ht=Object(d.useState)(l(T)),kt=Object(W.a)(Ht,2),Ur=kt[0],Zr=kt[1],bt=Object(ie.a)(Object(ie.a)({},K),{},{width:Ft,height:Ur});return f.a.createElement("div",{className:"my-monaco-editor",ref:Oe,style:bt})};function y(c){var u=c.width,A=u===void 0?"100%":u,S=c.height,T=S===void 0?"100%":S,_=c.original,j=c.modified,z=c.language,Z=c.options,K=Z===void 0?{}:Z,F=Object(d.useRef)(),ee=Object(d.useState)(null),se=Object(W.a)(ee,2),he=se[0],Ce=se[1];function Ue(ve){var le;return F.current&&(le=new w.default(function(ne){var Le=Object(M.a)(ne),xe;try{for(Le.s();!(xe=Le.n()).done;){var Ie=xe.value;(Ie.target.offsetHeight>0||Ie.target.offsetWidth>0)&&ve.layout()}}catch(Re){Le.e(Re)}finally{Le.f()}}),le.observe(F.current)),le}Object(d.useEffect)(function(){return F.current&&Q.e(27).then(Q.t.bind(null,"M/lh",7)).then(function(ve){L=ve;var le=L.editor.createDiffEditor(F.current,Object(ie.a)(Object(ie.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",wordWrap:"off",ignoreTrimWhitespace:!1,"semanticHighlighting.enabled":!0,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},K),{},{wordWrap:!0}));Ce(le);var ne=Ue(le);return function(){le.dispose();var Le=le.getModel();Le&&Le.dispose(),ne.unobserve(F.current)}}),function(){window.removeEventListener("keydown",checkPaste),window.removeEventListener("paste",checkPaste)}},[]),Object(d.useEffect)(function(){he&&he.setModel({original:L.editor.createModel(_,z),modified:L.editor.createModel(j,z)})},[_,j,z,he]);var ke=l(A),Me=l(T),ce={width:ke,height:Me};return f.a.createElement("div",{className:"my-diff-editor",ref:F,style:ce})}},ZpRC:function(vt,Te,Q){"use strict";function ie(d){return typeof d=="object"&&d!=null&&d.nodeType===1}function $(d,f){return(!f||d!=="hidden")&&d!=="visible"&&d!=="clip"}function O(d,f){if(d.clientHeight<d.scrollHeight||d.clientWidth<d.scrollWidth){var w=getComputedStyle(d,null);return $(w.overflowY,f)||$(w.overflowX,f)||function(p){var g=function(b){if(!b.ownerDocument||!b.ownerDocument.defaultView)return null;try{return b.ownerDocument.defaultView.frameElement}catch(o){return null}}(p);return!!g&&(g.clientHeight<p.scrollHeight||g.clientWidth<p.scrollWidth)}(d)}return!1}function V(d,f,w,p,g,b,o,i){return b<d&&o>f||b>d&&o<f?0:b<=d&&i<=w||o>=f&&i>=w?b-d-p:o>f&&i<w||b<d&&i>w?o-f+g:0}var I=function(d,f){var w=window,p=f.scrollMode,g=f.block,b=f.inline,o=f.boundary,i=f.skipOverflowHiddenElements,s=typeof o=="function"?o:function(Ae){return Ae!==o};if(!ie(d))throw new TypeError("Invalid target");for(var l=document.scrollingElement||document.documentElement,C=[],m=d;ie(m)&&s(m);){if((m=m.parentElement)===l){C.push(m);break}m!=null&&m===document.body&&O(m)&&!O(document.documentElement)||m!=null&&O(m,i)&&C.push(m)}for(var v=w.visualViewport?w.visualViewport.width:innerWidth,k=w.visualViewport?w.visualViewport.height:innerHeight,L=window.scrollX||pageXOffset,E=window.scrollY||pageYOffset,y=d.getBoundingClientRect(),c=y.height,u=y.width,A=y.top,S=y.right,T=y.bottom,_=y.left,j=g==="start"||g==="nearest"?A:g==="end"?T:A+c/2,z=b==="center"?_+u/2:b==="end"?S:_,Z=[],K=0;K<C.length;K++){var F=C[K],ee=F.getBoundingClientRect(),se=ee.height,he=ee.width,Ce=ee.top,Ue=ee.right,ke=ee.bottom,Me=ee.left;if(p==="if-needed"&&A>=0&&_>=0&&T<=k&&S<=v&&A>=Ce&&T<=ke&&_>=Me&&S<=Ue)return Z;var ce=getComputedStyle(F),ve=parseInt(ce.borderLeftWidth,10),le=parseInt(ce.borderTopWidth,10),ne=parseInt(ce.borderRightWidth,10),Le=parseInt(ce.borderBottomWidth,10),xe=0,Ie=0,Re="offsetWidth"in F?F.offsetWidth-F.clientWidth-ve-ne:0,ae="offsetHeight"in F?F.offsetHeight-F.clientHeight-le-Le:0;if(l===F)xe=g==="start"?j:g==="end"?j-k:g==="nearest"?V(E,E+k,k,le,Le,E+j,E+j+c,c):j-k/2,Ie=b==="start"?z:b==="center"?z-v/2:b==="end"?z-v:V(L,L+v,v,ve,ne,L+z,L+z+u,u),xe=Math.max(0,xe+E),Ie=Math.max(0,Ie+L);else{xe=g==="start"?j-Ce-le:g==="end"?j-ke+Le+ae:g==="nearest"?V(Ce,ke,se,le,Le+ae,j,j+c,c):j-(Ce+se/2)+ae/2,Ie=b==="start"?z-Me-ve:b==="center"?z-(Me+he/2)+Re/2:b==="end"?z-Ue+ne+Re:V(Me,Ue,he,ve,ne+Re,z,z+u,u);var oe=F.scrollLeft,be=F.scrollTop;j+=be-(xe=Math.max(0,Math.min(be+xe,F.scrollHeight-se+ae))),z+=oe-(Ie=Math.max(0,Math.min(oe+Ie,F.scrollWidth-he+Re)))}Z.push({el:F,top:xe,left:Ie})}return Z};function M(d){return d===Object(d)&&Object.keys(d).length!==0}function W(d,f){f===void 0&&(f="auto");var w="scrollBehavior"in document.body.style;d.forEach(function(p){var g=p.el,b=p.top,o=p.left;g.scroll&&w?g.scroll({top:b,left:o,behavior:f}):(g.scrollTop=b,g.scrollLeft=o)})}function N(d){return d===!1?{block:"end",inline:"nearest"}:M(d)?d:{block:"start",inline:"nearest"}}function P(d,f){var w=!d.ownerDocument.documentElement.contains(d);if(M(f)&&typeof f.behavior=="function")return f.behavior(w?[]:I(d,f));if(w)return;var p=N(f);return W(I(d,p),p.behavior)}var R=Te.a=P},bT9E:function(vt,Te,Q){"use strict";Q.d(Te,"a",function(){return $});var ie=Q("VTBJ");function $(O,V){var I=Object(ie.a)({},O);return Array.isArray(V)&&V.forEach(function(M){delete I[M]}),I}},c5Ni:function(vt,Te,Q){},dejd:function(vt,Te,Q){},dmUQ:function(vt,Te,Q){"use strict";var ie=Q("Ff2n"),$=Q("rePB"),O=Q("1OyB"),V=Q("vuIU"),I=Q("Ji7U"),M=Q("md7G"),W=Q("foSv"),N=Q("q1tI"),P=Q.n(N),R=Q("TSYQ"),d=Q.n(R),f=Q("4IlW");function w(c,u){var A=Object.keys(c);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(c);u&&(S=S.filter(function(T){return Object.getOwnPropertyDescriptor(c,T).enumerable})),A.push.apply(A,S)}return A}function p(c){for(var u=1;u<arguments.length;u++){var A=arguments[u]!=null?arguments[u]:{};u%2?w(Object(A),!0).forEach(function(S){Object($.a)(c,S,A[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(c,Object.getOwnPropertyDescriptors(A)):w(Object(A)).forEach(function(S){Object.defineProperty(c,S,Object.getOwnPropertyDescriptor(A,S))})}return c}function g(c){var u=b();return function(){var S=Object(W.a)(c),T;if(u){var _=Object(W.a)(this).constructor;T=Reflect.construct(S,arguments,_)}else T=S.apply(this,arguments);return Object(M.a)(this,T)}}function b(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(c){return!1}}function o(){}function i(c){c.preventDefault()}var s=function(u){return u.replace(/[^\w.-]+/g,"")},l=200,C=600,m=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,v=function(u){return u!=null},k=function(u,A){return A===u||typeof A=="number"&&typeof u=="number"&&isNaN(A)&&isNaN(u)},L=function(c){Object(I.a)(A,c);var u=g(A);function A(S){var T;Object(O.a)(this,A),T=u.call(this,S),T.onKeyDown=function(z){var Z=T.props,K=Z.onKeyDown,F=Z.onPressEnter;if(z.keyCode===f.a.UP){var ee=T.getRatio(z);T.up(z,ee,null),T.stop()}else if(z.keyCode===f.a.DOWN){var se=T.getRatio(z);T.down(z,se,null),T.stop()}else z.keyCode===f.a.ENTER&&F&&F(z);if(T.recordCursorPosition(),T.lastKeyCode=z.keyCode,K){for(var he=arguments.length,Ce=new Array(he>1?he-1:0),Ue=1;Ue<he;Ue++)Ce[Ue-1]=arguments[Ue];K.apply(void 0,[z].concat(Ce))}},T.onKeyUp=function(z){var Z=T.props.onKeyUp;if(T.stop(),T.recordCursorPosition(),Z){for(var K=arguments.length,F=new Array(K>1?K-1:0),ee=1;ee<K;ee++)F[ee-1]=arguments[ee];Z.apply(void 0,[z].concat(F))}},T.onChange=function(z){var Z=T.props.onChange;T.state.focused&&(T.inputting=!0),T.rawInput=T.props.parser(T.getValueFromEvent(z)),T.setState({inputValue:T.rawInput}),Z(T.toNumber(T.rawInput))},T.onMouseUp=function(){var z=T.props.onMouseUp;T.recordCursorPosition(),z&&z.apply(void 0,arguments)},T.onFocus=function(){var z;T.setState({focused:!0}),(z=T.props).onFocus.apply(z,arguments)},T.onBlur=function(){var z=T.props.onBlur;T.inputting=!1,T.setState({focused:!1});var Z=T.getCurrentValidValue(T.state.inputValue),K=T.setValue(Z,o);if(z){var F=T.input.value,ee=T.getInputDisplayValue({focus:!1,value:K});T.input.value=ee&&Number(ee),z.apply(void 0,arguments),T.input.value=F}},T.getRatio=function(z){var Z=1;return z.metaKey||z.ctrlKey?Z=.1:z.shiftKey&&(Z=10),Z},T.getFullNum=function(z){return isNaN(z)?z:/e/i.test(String(z))?Number(z).toFixed(18).replace(/\.?0+$/,""):z},T.getPrecision=function(z){if(v(T.props.precision))return T.props.precision;var Z=String(z);if(Z.indexOf("e-")>=0)return parseInt(Z.slice(Z.indexOf("e-")+2),10);var K=0;return Z.indexOf(".")>=0&&(K=Z.length-Z.indexOf(".")-1),K},T.getInputDisplayValue=function(z){var Z=z||T.state,K=Z.focused,F=Z.inputValue,ee=Z.value,se;K?se=F:se=T.toPrecisionAsStep(ee),se==null&&(se="");var he=T.formatWrapper(se);return v(T.props.decimalSeparator)&&(he=he.toString().replace(".",T.props.decimalSeparator)),he},T.recordCursorPosition=function(){try{T.cursorStart=T.input.selectionStart,T.cursorEnd=T.input.selectionEnd,T.currentValue=T.input.value,T.cursorBefore=T.input.value.substring(0,T.cursorStart),T.cursorAfter=T.input.value.substring(T.cursorEnd)}catch(z){}},T.restoreByAfter=function(z){if(z===void 0)return!1;var Z=T.input.value,K=Z.lastIndexOf(z);if(K===-1)return!1;var F=T.cursorBefore.length;return T.lastKeyCode===f.a.DELETE&&T.cursorBefore.charAt(F-1)===z[0]?(T.fixCaret(F,F),!0):K+z.length===Z.length?(T.fixCaret(K,K),!0):!1},T.partRestoreByAfter=function(z){return z===void 0?!1:Array.prototype.some.call(z,function(Z,K){var F=z.substring(K);return T.restoreByAfter(F)})},T.isNotCompleteNumber=function(z){return isNaN(z)||z===""||z===null||z&&z.toString().indexOf(".")===z.toString().length-1},T.stop=function(){T.autoStepTimer&&clearTimeout(T.autoStepTimer)},T.down=function(z,Z,K){T.pressingUpOrDown=!0,T.step("down",z,Z,K)},T.up=function(z,Z,K){T.pressingUpOrDown=!0,T.step("up",z,Z,K)},T.saveInput=function(z){T.input=z};var _=S.value;_===void 0&&(_=S.defaultValue),T.state={focused:S.autoFocus};var j=T.getValidValue(T.toNumber(_));return T.state=p(p({},T.state),{},{inputValue:T.toPrecisionAsStep(j),value:j}),T}return Object(V.a)(A,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(T){var _=this.props,j=_.value,z=_.onChange,Z=_.max,K=_.min,F=this.state.focused;if(T){if(!k(T.value,j)||!k(T.max,Z)||!k(T.min,K)){var ee=F?j:this.getValidValue(j),se;this.pressingUpOrDown?se=ee:this.inputting?se=this.rawInput:se=this.toPrecisionAsStep(ee),this.setState({value:ee,inputValue:se})}var he="value"in this.props?j:this.state.value;"max"in this.props&&T.max!==Z&&typeof he=="number"&&he>Z&&z&&z(Z),"min"in this.props&&T.min!==K&&typeof he=="number"&&he<K&&z&&z(K)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var Ce=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===f.a.BACKSPACE?Ce=this.cursorStart-1:this.lastKeyCode===f.a.DELETE&&(Ce=this.cursorStart):Ce=this.input.value.length,this.fixCaret(Ce,Ce)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case f.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case f.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Ue){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(T){var _=T;return _===""?_="":this.isNotCompleteNumber(parseFloat(_))?_=this.state.value:_=this.getValidValue(_),this.toNumber(_)}},{key:"getValueFromEvent",value:function(T){var _=T.target.value.trim().replace(/。/g,".");return v(this.props.decimalSeparator)&&(_=_.replace(this.props.decimalSeparator,".")),_}},{key:"getValidValue",value:function(T){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,z=parseFloat(T);return isNaN(z)?T:(z<_&&(z=_),z>j&&(z=j),z)}},{key:"setValue",value:function(T,_){var j=this.props.precision,z=this.isNotCompleteNumber(parseFloat(T))?null:parseFloat(T),Z=this.state.value,K=Z===void 0?null:Z,F=this.state.inputValue,ee=F===void 0?null:F,se=typeof z=="number"?z.toFixed(j):"".concat(z),he=z!==K||se!=="".concat(ee);return"value"in this.props?(ee=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:ee},_)):this.setState({value:z,inputValue:this.toPrecisionAsStep(T)},_),he&&this.props.onChange(z),z}},{key:"getMaxPrecision",value:function(T){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,j=this.props,z=j.precision,Z=j.step;if(v(z))return z;var K=this.getPrecision(_),F=this.getPrecision(Z),ee=this.getPrecision(T);return T?Math.max(ee,K+F):K+F}},{key:"getPrecisionFactor",value:function(T){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,j=this.getMaxPrecision(T,_);return Math.pow(10,j)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(T){return this.props.formatter?this.props.formatter(T):T}},{key:"toPrecisionAsStep",value:function(T){if(this.isNotCompleteNumber(T)||T==="")return T;var _=Math.abs(this.getMaxPrecision(T));return isNaN(_)?T.toString():Number(T).toFixed(_)}},{key:"toNumber",value:function(T){var _=this.props.precision,j=this.state.focused,z=T&&T.length>16&&j;return this.isNotCompleteNumber(T)||z?T:v(_)?Math.round(T*Math.pow(10,_))/Math.pow(10,_):Number(T)}},{key:"upStep",value:function(T,_){var j=this.props.step,z=this.getPrecisionFactor(T,_),Z=Math.abs(this.getMaxPrecision(T,_)),K=((z*T+z*j*_)/z).toFixed(Z);return this.toNumber(K)}},{key:"downStep",value:function(T,_){var j=this.props.step,z=this.getPrecisionFactor(T,_),Z=Math.abs(this.getMaxPrecision(T,_)),K=((z*T-z*j*_)/z).toFixed(Z);return this.toNumber(K)}},{key:"step",value:function(T,_){var j=this,z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,Z=arguments.length>3?arguments[3]:void 0;this.stop(),_&&(_.persist(),_.preventDefault());var K=this.props;if(K.disabled)return;var F=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(F))return;var ee=this["".concat(T,"Step")](F,z),se=ee>K.max||ee<K.min;if(ee>K.max?ee=K.max:ee<K.min&&(ee=K.min),this.setValue(ee,null),this.setState({focused:!0},function(){j.pressingUpOrDown=!1}),se)return;this.autoStepTimer=setTimeout(function(){j[T](_,z,!0)},Z?l:C)}},{key:"fixCaret",value:function(T,_){if(T===void 0||_===void 0||!this.input||!this.input.value)return;try{var j=this.input.selectionStart,z=this.input.selectionEnd;(T!==j||_!==z)&&this.input.setSelectionRange(T,_)}catch(Z){}}},{key:"render",value:function(){var T,_=this.props,j=_.prefixCls,z=_.disabled,Z=_.readOnly,K=_.useTouch,F=_.autoComplete,ee=_.upHandler,se=_.downHandler,he=_.className,Ce=_.max,Ue=_.min,ke=_.style,Me=_.title,ce=_.onMouseEnter,ve=_.onMouseLeave,le=_.onMouseOver,ne=_.onMouseOut,Le=_.required,xe=_.onClick,Ie=_.tabIndex,Re=_.type,ae=_.placeholder,oe=_.id,be=_.inputMode,Ae=_.pattern,Ne=_.step,_e=_.maxLength,We=_.autoFocus,Fe=_.name,et=_.onPaste,Je=_.onInput,Qe=Object(ie.a)(_,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),Ye=this.state,dt=Ye.value,$e=Ye.focused,tt=d()(j,(T={},Object($.a)(T,he,!!he),Object($.a)(T,"".concat(j,"-disabled"),z),Object($.a)(T,"".concat(j,"-focused"),$e),T)),Oe={};Object.keys(Qe).forEach(function(fe){(fe.substr(0,5)==="data-"||fe.substr(0,5)==="aria-"||fe==="role")&&(Oe[fe]=Qe[fe])});var Ze=!Z&&!z,at=this.getInputDisplayValue(null),Be=(dt||dt===0)&&(isNaN(dt)||Number(dt)>=Ce),Ke=(dt||dt===0)&&(isNaN(dt)||Number(dt)<=Ue),Ee=Be||z||Z,me=Ke||z||Z,ye=d()("".concat(j,"-handler"),"".concat(j,"-handler-up"),Object($.a)({},"".concat(j,"-handler-up-disabled"),Ee)),te=d()("".concat(j,"-handler"),"".concat(j,"-handler-down"),Object($.a)({},"".concat(j,"-handler-down-disabled"),me)),re=K?{onTouchStart:Ee?o:this.up,onTouchEnd:this.stop}:{onMouseDown:Ee?o:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},ue=K?{onTouchStart:me?o:this.down,onTouchEnd:this.stop}:{onMouseDown:me?o:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return P.a.createElement("div",{className:tt,style:ke,title:Me,onMouseEnter:ce,onMouseLeave:ve,onMouseOver:le,onMouseOut:ne,onFocus:function(){return null},onBlur:function(){return null}},P.a.createElement("div",{className:"".concat(j,"-handler-wrap")},P.a.createElement("span",Object.assign({unselectable:"on"},re,{role:"button","aria-label":"Increase Value","aria-disabled":Ee,className:ye}),ee||P.a.createElement("span",{unselectable:"on",className:"".concat(j,"-handler-up-inner"),onClick:i})),P.a.createElement("span",Object.assign({unselectable:"on"},ue,{role:"button","aria-label":"Decrease Value","aria-disabled":me,className:te}),se||P.a.createElement("span",{unselectable:"on",className:"".concat(j,"-handler-down-inner"),onClick:i}))),P.a.createElement("div",{className:"".concat(j,"-input-wrap")},P.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Ue,"aria-valuemax":Ce,"aria-valuenow":dt,required:Le,type:Re,placeholder:ae,onPaste:et,onClick:xe,onMouseUp:this.onMouseUp,className:"".concat(j,"-input"),tabIndex:Ie,autoComplete:F,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Ze?this.onKeyDown:o,onKeyUp:Ze?this.onKeyUp:o,autoFocus:We,maxLength:_e,readOnly:Z,disabled:z,max:Ce,min:Ue,step:Ne,name:Fe,title:Me,id:oe,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(at),pattern:Ae,inputMode:be,onInput:Je},Oe))))}}]),A}(P.a.Component);L.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:m,min:-m,step:1,style:{},onChange:o,onKeyDown:o,onPressEnter:o,onFocus:o,onBlur:o,parser:s,required:!1,autoComplete:"off"};var E=L,y=Te.a=E},fjLI:function(vt,Te,Q){"use strict";Q.d(Te,"e",function(){return R}),Q.d(Te,"a",function(){return d}),Q.d(Te,"c",function(){return f}),Q.d(Te,"d",function(){return p}),Q.d(Te,"b",function(){return g});var ie=Q("8HAY"),$=Q("Cg/j"),O=Q("T8No"),V=Q("nnTU"),I=Q("MI8n"),M=function(){var b=function(o,i){return b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,l){s.__proto__=l}||function(s,l){for(var C in l)l.hasOwnProperty(C)&&(s[C]=l[C])},b(o,i)};return function(o,i){b(o,i);function s(){this.constructor=o}o.prototype=i===null?Object.create(i):(s.prototype=i.prototype,new s)}}(),W=function(b,o,i,s){var l=arguments.length,C=l<3?o:s===null?s=Object.getOwnPropertyDescriptor(o,i):s,m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(b,o,i,s);else for(var v=b.length-1;v>=0;v--)(m=b[v])&&(C=(l<3?m(C):l>3?m(o,i,C):m(o,i))||C);return l>3&&C&&Object.defineProperty(o,i,C),C},N=function(b,o){return function(i,s){o(i,s,b)}},P=function(){for(var b=0,o=0,i=arguments.length;o<i;o++)b+=arguments[o].length;for(var s=Array(b),l=0,o=0;o<i;o++)for(var C=arguments[o],m=0,v=C.length;m<v;m++,l++)s[l]=C[m];return s};function R(b){return b.command!==void 0}var d=Object($.c)("menuService"),f=new(function(){function b(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new I.a,this.onDidChangeMenu=this._onDidChangeMenu.event}return b.prototype.addCommand=function(o){var i=this;return this._commands.set(o.id,o),this._onDidChangeMenu.fire(0),{dispose:function(){i._commands.delete(o.id)&&i._onDidChangeMenu.fire(0)}}},b.prototype.getCommand=function(o){return this._commands.get(o)},b.prototype.getCommands=function(){var o=new Map;return this._commands.forEach(function(i,s){return o.set(s,i)}),o},b.prototype.appendMenuItem=function(o,i){var s=this,l=this._menuItems.get(o);return l?l.push(i):(l=[i],this._menuItems.set(o,l)),this._onDidChangeMenu.fire(o),{dispose:function(){var C=l.indexOf(i);C>=0&&(l.splice(C,1),s._onDidChangeMenu.fire(o))}}},b.prototype.getMenuItems=function(o){var i=(this._menuItems.get(o)||[]).slice(0);return o===0&&this._appendImplicitItems(i),i},b.prototype._appendImplicitItems=function(o){for(var i=new Set,s=o.filter(function(L){return R(L)}),l=0,C=s;l<C.length;l++){var m=C[l],v=m.command,k=m.alt;i.add(v.id),k&&i.add(k.id)}this._commands.forEach(function(L,E){i.has(E)||o.push({command:L})})},b}()),w=function(b){M(o,b);function o(i,s,l){var C=b.call(this,i,s)||this;return C._commandService=l,C}return o.prototype.run=function(){for(var i,s=[],l=0;l<arguments.length;l++)s[l]=arguments[l];return(i=this._commandService).executeCommand.apply(i,P([this.id],s))},o=W([N(2,V.b)],o),o}(ie.a),p=function(b){M(o,b);function o(i){var s=this;return typeof i.title=="string"?s=b.call(this,"",i.title,"submenu")||this:s=b.call(this,"",i.title.value,"submenu")||this,s.item=i,s}return o}(ie.a),g=function(b){M(o,b);function o(i,s,l,C,m){var v=this;return typeof i.title=="string"?v=b.call(this,i.id,i.title,m)||this:v=b.call(this,i.id,i.title.value,m)||this,v._cssClass=void 0,v._enabled=!i.precondition||C.contextMatchesRules(i.precondition),v._checked=Boolean(i.toggled&&C.contextMatchesRules(i.toggled)),v._options=l||{},v.item=i,v.alt=s?new o(s,void 0,v._options,C,m):void 0,v}return o.prototype.dispose=function(){this.alt&&this.alt.dispose(),b.prototype.dispose.call(this)},o.prototype.run=function(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];var l=[];return this._options.arg&&(l=P(l,[this._options.arg])),this._options.shouldForwardArgs&&(l=P(l,i)),b.prototype.run.apply(this,l)},o=W([N(3,O.c),N(4,V.b)],o),o}(w)},gJ3r:function(vt,Te,Q){"use strict";Q.d(Te,"a",function(){return ie});var ie=[{value:"\u5317\u4EAC",label:"\u5317\u4EAC",children:[{value:"\u4E1C\u57CE",label:"\u4E1C\u57CE"},{value:"\u897F\u57CE",label:"\u897F\u57CE"},{value:"\u671D\u9633",label:"\u671D\u9633"},{value:"\u4E30\u53F0",label:"\u4E30\u53F0"},{value:"\u77F3\u666F\u5C71",label:"\u77F3\u666F\u5C71"},{value:"\u6D77\u6DC0",label:"\u6D77\u6DC0"},{value:"\u95E8\u5934\u6C9F",label:"\u95E8\u5934\u6C9F"},{value:"\u623F\u5C71",label:"\u623F\u5C71"},{value:"\u901A\u5DDE",label:"\u901A\u5DDE"},{value:"\u987A\u4E49",label:"\u987A\u4E49"},{value:"\u660C\u5E73",label:"\u660C\u5E73"},{value:"\u5927\u5174",label:"\u5927\u5174"},{value:"\u5E73\u8C37",label:"\u5E73\u8C37"},{value:"\u6000\u67D4",label:"\u6000\u67D4"},{value:"\u5BC6\u4E91",label:"\u5BC6\u4E91"},{value:"\u5EF6\u5E86",label:"\u5EF6\u5E86"}]},{value:"\u4E0A\u6D77",label:"\u4E0A\u6D77",children:[{value:"\u5D07\u660E",label:"\u5D07\u660E"},{value:"\u9EC4\u6D66",label:"\u9EC4\u6D66"},{value:"\u5362\u6E7E",label:"\u5362\u6E7E"},{value:"\u5F90\u6C47",label:"\u5F90\u6C47"},{value:"\u957F\u5B81",label:"\u957F\u5B81"},{value:"\u9759\u5B89",label:"\u9759\u5B89"},{value:"\u666E\u9640",label:"\u666E\u9640"},{value:"\u95F8\u5317",label:"\u95F8\u5317"},{value:"\u8679\u53E3",label:"\u8679\u53E3"},{value:"\u6768\u6D66",label:"\u6768\u6D66"},{value:"\u95F5\u884C",label:"\u95F5\u884C"},{value:"\u5B9D\u5C71",label:"\u5B9D\u5C71"},{value:"\u5609\u5B9A",label:"\u5609\u5B9A"},{value:"\u6D66\u4E1C",label:"\u6D66\u4E1C"},{value:"\u91D1\u5C71",label:"\u91D1\u5C71"},{value:"\u677E\u6C5F",label:"\u677E\u6C5F"},{value:"\u9752\u6D66",label:"\u9752\u6D66"},{value:"\u5357\u6C47",label:"\u5357\u6C47"},{value:"\u5949\u8D24",label:"\u5949\u8D24"}]},{value:"\u5E7F\u4E1C",label:"\u5E7F\u4E1C",children:[{value:"\u5E7F\u5DDE",label:"\u5E7F\u5DDE"},{value:"\u6DF1\u5733",label:"\u6DF1\u5733"},{value:"\u73E0\u6D77",label:"\u73E0\u6D77"},{value:"\u4E1C\u839E",label:"\u4E1C\u839E"},{value:"\u4E2D\u5C71",label:"\u4E2D\u5C71"},{value:"\u4F5B\u5C71",label:"\u4F5B\u5C71"},{value:"\u60E0\u5DDE",label:"\u60E0\u5DDE"},{value:"\u6CB3\u6E90",label:"\u6CB3\u6E90"},{value:"\u6F6E\u5DDE",label:"\u6F6E\u5DDE"},{value:"\u6C5F\u95E8",label:"\u6C5F\u95E8"},{value:"\u63ED\u9633",label:"\u63ED\u9633"},{value:"\u8302\u540D",label:"\u8302\u540D"},{value:"\u6885\u5DDE",label:"\u6885\u5DDE"},{value:"\u6E05\u8FDC",label:"\u6E05\u8FDC"},{value:"\u6C55\u5934",label:"\u6C55\u5934"},{value:"\u6C55\u5C3E",label:"\u6C55\u5C3E"},{value:"\u97F6\u5173",label:"\u97F6\u5173"},{value:"\u987A\u5FB7",label:"\u987A\u5FB7"},{value:"\u9633\u6C5F",label:"\u9633\u6C5F"},{value:"\u4E91\u6D6E",label:"\u4E91\u6D6E"},{value:"\u6E5B\u6C5F",label:"\u6E5B\u6C5F"},{value:"\u8087\u5E86",label:"\u8087\u5E86"}]},{value:"\u6C5F\u82CF",label:"\u6C5F\u82CF",children:[{value:"\u5357\u4EAC",label:"\u5357\u4EAC"},{value:"\u5E38\u719F",label:"\u5E38\u719F"},{value:"\u5E38\u5DDE",label:"\u5E38\u5DDE"},{value:"\u6D77\u95E8",label:"\u6D77\u95E8"},{value:"\u6DEE\u5B89",label:"\u6DEE\u5B89"},{value:"\u6C5F\u90FD",label:"\u6C5F\u90FD"},{value:"\u6C5F\u9634",label:"\u6C5F\u9634"},{value:"\u6606\u5C71",label:"\u6606\u5C71"},{value:"\u8FDE\u4E91\u6E2F",label:"\u8FDE\u4E91\u6E2F"},{value:"\u5357\u901A",label:"\u5357\u901A"},{value:"\u542F\u4E1C",label:"\u542F\u4E1C"},{value:"\u6CAD\u9633",label:"\u6CAD\u9633"},{value:"\u5BBF\u8FC1",label:"\u5BBF\u8FC1"},{value:"\u82CF\u5DDE",label:"\u82CF\u5DDE"},{value:"\u592A\u4ED3",label:"\u592A\u4ED3"},{value:"\u6CF0\u5DDE",label:"\u6CF0\u5DDE"},{value:"\u540C\u91CC",label:"\u540C\u91CC"},{value:"\u65E0\u9521",label:"\u65E0\u9521"},{value:"\u5F90\u5DDE",label:"\u5F90\u5DDE"},{value:"\u76D0\u57CE",label:"\u76D0\u57CE"},{value:"\u626C\u5DDE",label:"\u626C\u5DDE"},{value:"\u5B9C\u5174",label:"\u5B9C\u5174"},{value:"\u4EEA\u5F81",label:"\u4EEA\u5F81"},{value:"\u5F20\u5BB6\u6E2F",label:"\u5F20\u5BB6\u6E2F"},{value:"\u9547\u6C5F",label:"\u9547\u6C5F"}]},{value:"\u91CD\u5E86",label:"\u91CD\u5E86",children:[{value:"\u4E07\u5DDE",label:"\u4E07\u5DDE"},{value:"\u6DAA\u9675",label:"\u6DAA\u9675"},{value:"\u6E1D\u4E2D",label:"\u6E1D\u4E2D"},{value:"\u5927\u6E21\u53E3",label:"\u5927\u6E21\u53E3"},{value:"\u6C5F\u5317",label:"\u6C5F\u5317"},{value:"\u6C99\u576A\u575D",label:"\u6C99\u576A\u575D"},{value:"\u4E5D\u9F99\u5761",label:"\u4E5D\u9F99\u5761"},{value:"\u5357\u5CB8",label:"\u5357\u5CB8"},{value:"\u5317\u789A",label:"\u5317\u789A"},{value:"\u4E07\u76DB",label:"\u4E07\u76DB"},{value:"\u53CC\u6322",label:"\u53CC\u6322"},{value:"\u6E1D\u5317",label:"\u6E1D\u5317"},{value:"\u5DF4\u5357",label:"\u5DF4\u5357"},{value:"\u9ED4\u6C5F",label:"\u9ED4\u6C5F"},{value:"\u957F\u5BFF",label:"\u957F\u5BFF"},{value:"\u7DA6\u6C5F",label:"\u7DA6\u6C5F"},{value:"\u6F7C\u5357",label:"\u6F7C\u5357"},{value:"\u94DC\u6881",label:"\u94DC\u6881"},{value:"\u5927\u8DB3",label:"\u5927\u8DB3"},{value:"\u8363\u660C",label:"\u8363\u660C"},{value:"\u58C1\u5C71",label:"\u58C1\u5C71"},{value:"\u6881\u5E73",label:"\u6881\u5E73"},{value:"\u57CE\u53E3",label:"\u57CE\u53E3"},{value:"\u4E30\u90FD",label:"\u4E30\u90FD"},{value:"\u57AB\u6C5F",label:"\u57AB\u6C5F"},{value:"\u6B66\u9686",label:"\u6B66\u9686"},{value:"\u5FE0\u53BF",label:"\u5FE0\u53BF"},{value:"\u5F00\u53BF",label:"\u5F00\u53BF"},{value:"\u4E91\u9633",label:"\u4E91\u9633"},{value:"\u5949\u8282",label:"\u5949\u8282"},{value:"\u5DEB\u5C71",label:"\u5DEB\u5C71"},{value:"\u5DEB\u6EAA",label:"\u5DEB\u6EAA"},{value:"\u77F3\u67F1",label:"\u77F3\u67F1"},{value:"\u79C0\u5C71",label:"\u79C0\u5C71"},{value:"\u9149\u9633",label:"\u9149\u9633"},{value:"\u5F6D\u6C34",label:"\u5F6D\u6C34"},{value:"\u6C5F\u6D25",label:"\u6C5F\u6D25"},{value:"\u5408\u5DDD",label:"\u5408\u5DDD"},{value:"\u6C38\u5DDD",label:"\u6C38\u5DDD"},{value:"\u5357\u5DDD",label:"\u5357\u5DDD"}]},{value:"\u5B89\u5FBD",label:"\u5B89\u5FBD",children:[{value:"\u5408\u80A5",label:"\u5408\u80A5"},{value:"\u5B89\u5E86",label:"\u5B89\u5E86"},{value:"\u868C\u57E0",label:"\u868C\u57E0"},{value:"\u4EB3\u5DDE",label:"\u4EB3\u5DDE"},{value:"\u5DE2\u6E56",label:"\u5DE2\u6E56"},{value:"\u6EC1\u5DDE",label:"\u6EC1\u5DDE"},{value:"\u961C\u9633",label:"\u961C\u9633"},{value:"\u8D35\u6C60",label:"\u8D35\u6C60"},{value:"\u6DEE\u5317",label:"\u6DEE\u5317"},{value:"\u6DEE\u5316",label:"\u6DEE\u5316"},{value:"\u6DEE\u5357",label:"\u6DEE\u5357"},{value:"\u9EC4\u5C71",label:"\u9EC4\u5C71"},{value:"\u4E5D\u534E\u5C71",label:"\u4E5D\u534E\u5C71"},{value:"\u516D\u5B89",label:"\u516D\u5B89"},{value:"\u9A6C\u978D\u5C71",label:"\u9A6C\u978D\u5C71"},{value:"\u5BBF\u5DDE",label:"\u5BBF\u5DDE"},{value:"\u94DC\u9675",label:"\u94DC\u9675"},{value:"\u5C6F\u6EAA",label:"\u5C6F\u6EAA"},{value:"\u829C\u6E56",label:"\u829C\u6E56"},{value:"\u5BA3\u57CE",label:"\u5BA3\u57CE"}]},{value:"\u798F\u5EFA",label:"\u798F\u5EFA",children:[{value:"\u798F\u5DDE",label:"\u798F\u5DDE"},{value:"\u53A6\u95E8",label:"\u53A6\u95E8"},{value:"\u6CC9\u5DDE",label:"\u6CC9\u5DDE"},{value:"\u6F33\u5DDE",label:"\u6F33\u5DDE"},{value:"\u9F99\u5CA9",label:"\u9F99\u5CA9"},{value:"\u5357\u5E73",label:"\u5357\u5E73"},{value:"\u5B81\u5FB7",label:"\u5B81\u5FB7"},{value:"\u8386\u7530",label:"\u8386\u7530"},{value:"\u4E09\u660E",label:"\u4E09\u660E"}]},{value:"\u7518\u8083",label:"\u7518\u8083",children:[{value:"\u5170\u5DDE",label:"\u5170\u5DDE"},{value:"\u5609\u5CEA\u5173",label:"\u5609\u5CEA\u5173"},{value:"\u767D\u94F6",label:"\u767D\u94F6"},{value:"\u5B9A\u897F",label:"\u5B9A\u897F"},{value:"\u6566\u714C",label:"\u6566\u714C"},{value:"\u7518\u5357",label:"\u7518\u5357"},{value:"\u91D1\u660C",label:"\u91D1\u660C"},{value:"\u9152\u6CC9",label:"\u9152\u6CC9"},{value:"\u4E34\u590F",label:"\u4E34\u590F"},{value:"\u5E73\u51C9",label:"\u5E73\u51C9"},{value:"\u5929\u6C34",label:"\u5929\u6C34"},{value:"\u9647\u5357",label:"\u9647\u5357"},{value:"\u6B66\u5A01",label:"\u6B66\u5A01"},{value:"\u897F\u5CF0",label:"\u897F\u5CF0"},{value:"\u5F20\u6396",label:"\u5F20\u6396"}]},{value:"\u5E7F\u897F",label:"\u5E7F\u897F",children:[{value:"\u5357\u5B81",label:"\u5357\u5B81"},{value:"\u6765\u5BBE",label:"\u6765\u5BBE"},{value:"\u767E\u8272",label:"\u767E\u8272"},{value:"\u5317\u6D77",label:"\u5317\u6D77"},{value:"\u6842\u6797",label:"\u6842\u6797"},{value:"\u9632\u57CE\u6E2F",label:"\u9632\u57CE\u6E2F"},{value:"\u8D35\u6E2F",label:"\u8D35\u6E2F"},{value:"\u6CB3\u6C60",label:"\u6CB3\u6C60"},{value:"\u8D3A\u5DDE",label:"\u8D3A\u5DDE"},{value:"\u67F3\u5DDE",label:"\u67F3\u5DDE"},{value:"\u94A6\u5DDE",label:"\u94A6\u5DDE"},{value:"\u68A7\u5DDE",label:"\u68A7\u5DDE"},{value:"\u7389\u6797",label:"\u7389\u6797"}]},{value:"\u8D35\u5DDE",label:"\u8D35\u5DDE",children:[{value:"\u8D35\u9633",label:"\u8D35\u9633"},{value:"\u5B89\u987A",label:"\u5B89\u987A"},{value:"\u6BD5\u8282",label:"\u6BD5\u8282"},{value:"\u90FD\u5300",label:"\u90FD\u5300"},{value:"\u51EF\u91CC",label:"\u51EF\u91CC"},{value:"\u516D\u76D8\u6C34",label:"\u516D\u76D8\u6C34"},{value:"\u94DC\u4EC1",label:"\u94DC\u4EC1"},{value:"\u5174\u4E49",label:"\u5174\u4E49"},{value:"\u7389\u5C4F",label:"\u7389\u5C4F"},{value:"\u9075\u4E49",label:"\u9075\u4E49"}]},{value:"\u6D77\u5357",label:"\u6D77\u5357",children:[{value:"\u6D77\u53E3",label:"\u6D77\u53E3"},{value:"\u510B\u53BF",label:"\u510B\u53BF"},{value:"\u9675\u6C34",label:"\u9675\u6C34"},{value:"\u743C\u6D77",label:"\u743C\u6D77"},{value:"\u4E09\u4E9A",label:"\u4E09\u4E9A"},{value:"\u901A\u4EC0",label:"\u901A\u4EC0"},{value:"\u4E07\u5B81",label:"\u4E07\u5B81"}]},{value:"\u6CB3\u5317",label:"\u6CB3\u5317",children:[{value:"\u77F3\u5BB6\u5E84",label:"\u77F3\u5BB6\u5E84"},{value:"\u4FDD\u5B9A",label:"\u4FDD\u5B9A"},{value:"\u5317\u6234\u6CB3",label:"\u5317\u6234\u6CB3"},{value:"\u6CA7\u5DDE",label:"\u6CA7\u5DDE"},{value:"\u627F\u5FB7",label:"\u627F\u5FB7"},{value:"\u4E30\u6DA6",label:"\u4E30\u6DA6"},{value:"\u90AF\u90F8",label:"\u90AF\u90F8"},{value:"\u8861\u6C34",label:"\u8861\u6C34"},{value:"\u5ECA\u574A",label:"\u5ECA\u574A"},{value:"\u5357\u6234\u6CB3",label:"\u5357\u6234\u6CB3"},{value:"\u79E6\u7687\u5C9B",label:"\u79E6\u7687\u5C9B"},{value:"\u5510\u5C71",label:"\u5510\u5C71"},{value:"\u65B0\u57CE",label:"\u65B0\u57CE"},{value:"\u90A2\u53F0",label:"\u90A2\u53F0"},{value:"\u5F20\u5BB6\u53E3",label:"\u5F20\u5BB6\u53E3"}]},{value:"\u9ED1\u9F99\u6C5F",label:"\u9ED1\u9F99\u6C5F",children:[{value:"\u54C8\u5C14\u6EE8",label:"\u54C8\u5C14\u6EE8"},{value:"\u5317\u5B89",label:"\u5317\u5B89"},{value:"\u5927\u5E86",label:"\u5927\u5E86"},{value:"\u5927\u5174\u5B89\u5CAD",label:"\u5927\u5174\u5B89\u5CAD"},{value:"\u9E64\u5C97",label:"\u9E64\u5C97"},{value:"\u9ED1\u6CB3",label:"\u9ED1\u6CB3"},{value:"\u4F73\u6728\u65AF",label:"\u4F73\u6728\u65AF"},{value:"\u9E21\u897F",label:"\u9E21\u897F"},{value:"\u7261\u4E39\u6C5F",label:"\u7261\u4E39\u6C5F"},{value:"\u9F50\u9F50\u54C8\u5C14",label:"\u9F50\u9F50\u54C8\u5C14"},{value:"\u4E03\u53F0\u6CB3",label:"\u4E03\u53F0\u6CB3"},{value:"\u53CC\u9E2D\u5C71",label:"\u53CC\u9E2D\u5C71"},{value:"\u7EE5\u5316",label:"\u7EE5\u5316"},{value:"\u4F0A\u6625",label:"\u4F0A\u6625"}]},{value:"\u6CB3\u5357",label:"\u6CB3\u5357",children:[{value:"\u90D1\u5DDE",label:"\u90D1\u5DDE"},{value:"\u5B89\u9633",label:"\u5B89\u9633"},{value:"\u9E64\u58C1",label:"\u9E64\u58C1"},{value:"\u6F62\u5DDD",label:"\u6F62\u5DDD"},{value:"\u7126\u4F5C",label:"\u7126\u4F5C"},{value:"\u6D4E\u6E90",label:"\u6D4E\u6E90"},{value:"\u5F00\u5C01",label:"\u5F00\u5C01"},{value:"\u6F2F\u6CB3",label:"\u6F2F\u6CB3"},{value:"\u6D1B\u9633",label:"\u6D1B\u9633"},{value:"\u5357\u9633",label:"\u5357\u9633"},{value:"\u5E73\u9876\u5C71",label:"\u5E73\u9876\u5C71"},{value:"\u6FEE\u9633",label:"\u6FEE\u9633"},{value:"\u4E09\u95E8\u5CE1",label:"\u4E09\u95E8\u5CE1"},{value:"\u5546\u4E18",label:"\u5546\u4E18"},{value:"\u65B0\u4E61",label:"\u65B0\u4E61"},{value:"\u4FE1\u9633",label:"\u4FE1\u9633"},{value:"\u8BB8\u660C",label:"\u8BB8\u660C"},{value:"\u5468\u53E3",label:"\u5468\u53E3"},{value:"\u9A7B\u9A6C\u5E97",label:"\u9A7B\u9A6C\u5E97"}]},{value:"\u9999\u6E2F",label:"\u9999\u6E2F",children:[{value:"\u9999\u6E2F",label:"\u9999\u6E2F"},{value:"\u4E5D\u9F99",label:"\u4E5D\u9F99"},{value:"\u65B0\u754C",label:"\u65B0\u754C"}]},{value:"\u6E56\u5317",label:"\u6E56\u5317",children:[{value:"\u6B66\u6C49",label:"\u6B66\u6C49"},{value:"\u5929\u95E8",label:"\u5929\u95E8"},{value:"\u6069\u65BD",label:"\u6069\u65BD"},{value:"\u9102\u5DDE",label:"\u9102\u5DDE"},{value:"\u9EC4\u5188",label:"\u9EC4\u5188"},{value:"\u9EC4\u77F3",label:"\u9EC4\u77F3"},{value:"\u8346\u95E8",label:"\u8346\u95E8"},{value:"\u8346\u5DDE",label:"\u8346\u5DDE"},{value:"\u6F5C\u6C5F",label:"\u6F5C\u6C5F"},{value:"\u5341\u5830",label:"\u5341\u5830"},{value:"\u968F\u5DDE",label:"\u968F\u5DDE"},{value:"\u6B66\u7A74",label:"\u6B66\u7A74"},{value:"\u4ED9\u6843",label:"\u4ED9\u6843"},{value:"\u54B8\u5B81",label:"\u54B8\u5B81"},{value:"\u8944\u9633",label:"\u8944\u9633"},{value:"\u8944\u6A0A",label:"\u8944\u6A0A"},{value:"\u5B5D\u611F",label:"\u5B5D\u611F"},{value:"\u5B9C\u660C",label:"\u5B9C\u660C"}]},{value:"\u6E56\u5357",label:"\u6E56\u5357",children:[{value:"\u957F\u6C99",label:"\u957F\u6C99"},{value:"\u5E38\u5FB7",label:"\u5E38\u5FB7"},{value:"\u90F4\u5DDE",label:"\u90F4\u5DDE"},{value:"\u8861\u9633",label:"\u8861\u9633"},{value:"\u6000\u5316",label:"\u6000\u5316"},{value:"\u5409\u9996",label:"\u5409\u9996"},{value:"\u5A04\u5E95",label:"\u5A04\u5E95"},{value:"\u90B5\u9633",label:"\u90B5\u9633"},{value:"\u6E58\u6F6D",label:"\u6E58\u6F6D"},{value:"\u76CA\u9633",label:"\u76CA\u9633"},{value:"\u5CB3\u9633",label:"\u5CB3\u9633"},{value:"\u6C38\u5DDE",label:"\u6C38\u5DDE"},{value:"\u5F20\u5BB6\u754C",label:"\u5F20\u5BB6\u754C"},{value:"\u682A\u6D32",label:"\u682A\u6D32"}]},{value:"\u6C5F\u897F",label:"\u6C5F\u897F",children:[{value:"\u5357\u660C",label:"\u5357\u660C"},{value:"\u629A\u5DDE",label:"\u629A\u5DDE"},{value:"\u8D63\u5DDE",label:"\u8D63\u5DDE"},{value:"\u5409\u5B89",label:"\u5409\u5B89"},{value:"\u666F\u5FB7\u9547",label:"\u666F\u5FB7\u9547"},{value:"\u4E95\u5188\u5C71",label:"\u4E95\u5188\u5C71"},{value:"\u4E5D\u6C5F",label:"\u4E5D\u6C5F"},{value:"\u5E90\u5C71",label:"\u5E90\u5C71"},{value:"\u840D\u4E61",label:"\u840D\u4E61"},{value:"\u4E0A\u9976",label:"\u4E0A\u9976"},{value:"\u65B0\u4F59",label:"\u65B0\u4F59"},{value:"\u5B9C\u6625",label:"\u5B9C\u6625"},{value:"\u9E70\u6F6D",label:"\u9E70\u6F6D"}]},{value:"\u5409\u6797",label:"\u5409\u6797",children:[{value:"\u957F\u6625",label:"\u957F\u6625"},{value:"\u5409\u6797",label:"\u5409\u6797"},{value:"\u767D\u57CE",label:"\u767D\u57CE"},{value:"\u767D\u5C71",label:"\u767D\u5C71"},{value:"\u73F2\u6625",label:"\u73F2\u6625"},{value:"\u8FBD\u6E90",label:"\u8FBD\u6E90"},{value:"\u6885\u6CB3",label:"\u6885\u6CB3"},{value:"\u56DB\u5E73",label:"\u56DB\u5E73"},{value:"\u677E\u539F",label:"\u677E\u539F"},{value:"\u901A\u5316",label:"\u901A\u5316"},{value:"\u5EF6\u5409",label:"\u5EF6\u5409"}]},{value:"\u8FBD\u5B81",label:"\u8FBD\u5B81",children:[{value:"\u6C88\u9633",label:"\u6C88\u9633"},{value:"\u978D\u5C71",label:"\u978D\u5C71"},{value:"\u672C\u6EAA",label:"\u672C\u6EAA"},{value:"\u671D\u9633",label:"\u671D\u9633"},{value:"\u5927\u8FDE",label:"\u5927\u8FDE"},{value:"\u4E39\u4E1C",label:"\u4E39\u4E1C"},{value:"\u629A\u987A",label:"\u629A\u987A"},{value:"\u961C\u65B0",label:"\u961C\u65B0"},{value:"\u846B\u82A6\u5C9B",label:"\u846B\u82A6\u5C9B"},{value:"\u9526\u5DDE",label:"\u9526\u5DDE"},{value:"\u8FBD\u9633",label:"\u8FBD\u9633"},{value:"\u76D8\u9526",label:"\u76D8\u9526"},{value:"\u94C1\u5CAD",label:"\u94C1\u5CAD"},{value:"\u8425\u53E3",label:"\u8425\u53E3"}]},{value:"\u6FB3\u95E8",label:"\u6FB3\u95E8",children:[{value:"\u6FB3\u95E8",label:"\u6FB3\u95E8"}]},{value:"\u5185\u8499\u53E4",label:"\u5185\u8499\u53E4",children:[{value:"\u547C\u548C\u6D69\u7279",label:"\u547C\u548C\u6D69\u7279"},{value:"\u963F\u62C9\u5584\u76DF",label:"\u963F\u62C9\u5584\u76DF"},{value:"\u5305\u5934",label:"\u5305\u5934"},{value:"\u8D64\u5CF0",label:"\u8D64\u5CF0"},{value:"\u4E1C\u80DC",label:"\u4E1C\u80DC"},{value:"\u6D77\u62C9\u5C14",label:"\u6D77\u62C9\u5C14"},{value:"\u96C6\u5B81",label:"\u96C6\u5B81"},{value:"\u4E34\u6CB3",label:"\u4E34\u6CB3"},{value:"\u901A\u8FBD",label:"\u901A\u8FBD"},{value:"\u4E4C\u6D77",label:"\u4E4C\u6D77"},{value:"\u4E4C\u5170\u6D69\u7279",label:"\u4E4C\u5170\u6D69\u7279"},{value:"\u9521\u6797\u6D69\u7279",label:"\u9521\u6797\u6D69\u7279"}]},{value:"\u5B81\u590F",label:"\u5B81\u590F",children:[{value:"\u94F6\u5DDD",label:"\u94F6\u5DDD"},{value:"\u56FA\u6E90",label:"\u56FA\u6E90"},{value:"\u77F3\u5634\u5C71",label:"\u77F3\u5634\u5C71"},{value:"\u5434\u5FE0",label:"\u5434\u5FE0"}]},{value:"\u9752\u6D77",label:"\u9752\u6D77",children:[{value:"\u897F\u5B81",label:"\u897F\u5B81"},{value:"\u5FB7\u4EE4\u54C8",label:"\u5FB7\u4EE4\u54C8"},{value:"\u683C\u5C14\u6728",label:"\u683C\u5C14\u6728"},{value:"\u5171\u548C",label:"\u5171\u548C"},{value:"\u6D77\u4E1C",label:"\u6D77\u4E1C"},{value:"\u6D77\u664F",label:"\u6D77\u664F"},{value:"\u739B\u6C81",label:"\u739B\u6C81"},{value:"\u540C\u4EC1",label:"\u540C\u4EC1"},{value:"\u7389\u6811",label:"\u7389\u6811"}]},{value:"\u5C71\u4E1C",label:"\u5C71\u4E1C",children:[{value:"\u6D4E\u5357",label:"\u6D4E\u5357"},{value:"\u6EE8\u5DDE",label:"\u6EE8\u5DDE"},{value:"\u5156\u5DDE",label:"\u5156\u5DDE"},{value:"\u5FB7\u5DDE",label:"\u5FB7\u5DDE"},{value:"\u4E1C\u8425",label:"\u4E1C\u8425"},{value:"\u83CF\u6CFD",label:"\u83CF\u6CFD"},{value:"\u6D4E\u5B81",label:"\u6D4E\u5B81"},{value:"\u83B1\u829C",label:"\u83B1\u829C"},{value:"\u804A\u57CE",label:"\u804A\u57CE"},{value:"\u4E34\u6C82",label:"\u4E34\u6C82"},{value:"\u84EC\u83B1",label:"\u84EC\u83B1"},{value:"\u9752\u5C9B",label:"\u9752\u5C9B"},{value:"\u66F2\u961C",label:"\u66F2\u961C"},{value:"\u65E5\u7167",label:"\u65E5\u7167"},{value:"\u6CF0\u5B89",label:"\u6CF0\u5B89"},{value:"\u6F4D\u574A",label:"\u6F4D\u574A"},{value:"\u5A01\u6D77",label:"\u5A01\u6D77"},{value:"\u70DF\u53F0",label:"\u70DF\u53F0"},{value:"\u67A3\u5E84",label:"\u67A3\u5E84"},{value:"\u6DC4\u535A",label:"\u6DC4\u535A"}]},{value:"\u5C71\u897F",label:"\u5C71\u897F",children:[{value:"\u592A\u539F",label:"\u592A\u539F"},{value:"\u5415\u6881",label:"\u5415\u6881"},{value:"\u957F\u6CBB",label:"\u957F\u6CBB"},{value:"\u5927\u540C",label:"\u5927\u540C"},{value:"\u5019\u9A6C",label:"\u5019\u9A6C"},{value:"\u664B\u57CE",label:"\u664B\u57CE"},{value:"\u79BB\u77F3",label:"\u79BB\u77F3"},{value:"\u4E34\u6C7E",label:"\u4E34\u6C7E"},{value:"\u5B81\u6B66",label:"\u5B81\u6B66"},{value:"\u6714\u5DDE",label:"\u6714\u5DDE"},{value:"\u5FFB\u5DDE",label:"\u5FFB\u5DDE"},{value:"\u9633\u6CC9",label:"\u9633\u6CC9"},{value:"\u6986\u6B21",label:"\u6986\u6B21"},{value:"\u664B\u4E2D",label:"\u664B\u4E2D"},{value:"\u8FD0\u57CE",label:"\u8FD0\u57CE"}]},{value:"\u9655\u897F",label:"\u9655\u897F",children:[{value:"\u897F\u5B89",label:"\u897F\u5B89"},{value:"\u5B89\u5EB7",label:"\u5B89\u5EB7"},{value:"\u5B9D\u9E21",label:"\u5B9D\u9E21"},{value:"\u6C49\u4E2D",label:"\u6C49\u4E2D"},{value:"\u6E2D\u5357",label:"\u6E2D\u5357"},{value:"\u5546\u5DDE",label:"\u5546\u5DDE"},{value:"\u7EE5\u5FB7",label:"\u7EE5\u5FB7"},{value:"\u94DC\u5DDD",label:"\u94DC\u5DDD"},{value:"\u54B8\u9633",label:"\u54B8\u9633"},{value:"\u5EF6\u5B89",label:"\u5EF6\u5B89"},{value:"\u6986\u6797",label:"\u6986\u6797"}]},{value:"\u56DB\u5DDD",label:"\u56DB\u5DDD",children:[{value:"\u6210\u90FD",label:"\u6210\u90FD"},{value:"\u5DF4\u4E2D",label:"\u5DF4\u4E2D"},{value:"\u8FBE\u5DDD",label:"\u8FBE\u5DDD"},{value:"\u5FB7\u9633",label:"\u5FB7\u9633"},{value:"\u90FD\u6C5F\u5830",label:"\u90FD\u6C5F\u5830"},{value:"\u5CE8\u7709\u5C71",label:"\u5CE8\u7709\u5C71"},{value:"\u6DAA\u9675",label:"\u6DAA\u9675"},{value:"\u5E7F\u5B89",label:"\u5E7F\u5B89"},{value:"\u5E7F\u5143",label:"\u5E7F\u5143"},{value:"\u4E5D\u5BE8\u6C9F",label:"\u4E5D\u5BE8\u6C9F"},{value:"\u5EB7\u5B9A",label:"\u5EB7\u5B9A"},{value:"\u4E50\u5C71",label:"\u4E50\u5C71"},{value:"\u6CF8\u5DDE",label:"\u6CF8\u5DDE"},{value:"\u9A6C\u5C14\u5EB7",label:"\u9A6C\u5C14\u5EB7"},{value:"\u7EF5\u9633",label:"\u7EF5\u9633"},{value:"\u7709\u5C71",label:"\u7709\u5C71"},{value:"\u5357\u5145",label:"\u5357\u5145"},{value:"\u5185\u6C5F",label:"\u5185\u6C5F"},{value:"\u6500\u679D\u82B1",label:"\u6500\u679D\u82B1"},{value:"\u9042\u5B81",label:"\u9042\u5B81"},{value:"\u6C76\u5DDD",label:"\u6C76\u5DDD"},{value:"\u897F\u660C",label:"\u897F\u660C"},{value:"\u96C5\u5B89",label:"\u96C5\u5B89"},{value:"\u5B9C\u5BBE",label:"\u5B9C\u5BBE"},{value:"\u81EA\u8D21",label:"\u81EA\u8D21"},{value:"\u8D44\u9633",label:"\u8D44\u9633"}]},{value:"\u53F0\u6E7E",label:"\u53F0\u6E7E",children:[{value:"\u53F0\u5317",label:"\u53F0\u5317"},{value:"\u57FA\u9686",label:"\u57FA\u9686"},{value:"\u53F0\u5357",label:"\u53F0\u5357"},{value:"\u53F0\u4E2D",label:"\u53F0\u4E2D"},{value:"\u9AD8\u96C4",label:"\u9AD8\u96C4"},{value:"\u5C4F\u4E1C",label:"\u5C4F\u4E1C"},{value:"\u5357\u6295",label:"\u5357\u6295"},{value:"\u4E91\u6797",label:"\u4E91\u6797"},{value:"\u65B0\u7AF9",label:"\u65B0\u7AF9"},{value:"\u5F70\u5316",label:"\u5F70\u5316"},{value:"\u82D7\u6817",label:"\u82D7\u6817"},{value:"\u5609\u4E49",label:"\u5609\u4E49"},{value:"\u6843\u56ED",label:"\u6843\u56ED"},{value:"\u5B9C\u5170",label:"\u5B9C\u5170"},{value:"\u53F0\u4E1C",label:"\u53F0\u4E1C"},{value:"\u91D1\u95E8",label:"\u91D1\u95E8"},{value:"\u9A6C\u7956",label:"\u9A6C\u7956"},{value:"\u6F8E\u6E56",label:"\u6F8E\u6E56"}]},{value:"\u5929\u6D25",label:"\u5929\u6D25",children:[{value:"\u5929\u6D25",label:"\u5929\u6D25"},{value:"\u548C\u5E73",label:"\u548C\u5E73"},{value:"\u4E1C\u4E3D",label:"\u4E1C\u4E3D"},{value:"\u6CB3\u4E1C",label:"\u6CB3\u4E1C"},{value:"\u897F\u9752",label:"\u897F\u9752"},{value:"\u6CB3\u897F",label:"\u6CB3\u897F"},{value:"\u6D25\u5357",label:"\u6D25\u5357"},{value:"\u5357\u5F00",label:"\u5357\u5F00"},{value:"\u5317\u8FB0",label:"\u5317\u8FB0"},{value:"\u6CB3\u5317",label:"\u6CB3\u5317"},{value:"\u6B66\u6E05",label:"\u6B66\u6E05"},{value:"\u7EA2\u6322",label:"\u7EA2\u6322"},{value:"\u5858\u6CBD",label:"\u5858\u6CBD"},{value:"\u6C49\u6CBD",label:"\u6C49\u6CBD"},{value:"\u5927\u6E2F",label:"\u5927\u6E2F"},{value:"\u5B81\u6CB3",label:"\u5B81\u6CB3"},{value:"\u9759\u6D77",label:"\u9759\u6D77"},{value:"\u5B9D\u577B",label:"\u5B9D\u577B"},{value:"\u84DF\u53BF",label:"\u84DF\u53BF"}]},{value:"\u65B0\u7586",label:"\u65B0\u7586",children:[{value:"\u4E4C\u9C81\u6728\u9F50",label:"\u4E4C\u9C81\u6728\u9F50"},{value:"\u963F\u514B\u82CF",label:"\u963F\u514B\u82CF"},{value:"\u963F\u52D2\u6CF0",label:"\u963F\u52D2\u6CF0"},{value:"\u963F\u56FE\u4EC0",label:"\u963F\u56FE\u4EC0"},{value:"\u535A\u4E50",label:"\u535A\u4E50"},{value:"\u660C\u5409",label:"\u660C\u5409"},{value:"\u4E1C\u5C71",label:"\u4E1C\u5C71"},{value:"\u54C8\u5BC6",label:"\u54C8\u5BC6"},{value:"\u548C\u7530",label:"\u548C\u7530"},{value:"\u5580\u4EC0",label:"\u5580\u4EC0"},{value:"\u514B\u62C9\u739B\u4F9D",label:"\u514B\u62C9\u739B\u4F9D"},{value:"\u5E93\u8F66",label:"\u5E93\u8F66"},{value:"\u5E93\u5C14\u52D2",label:"\u5E93\u5C14\u52D2"},{value:"\u594E\u5C6F",label:"\u594E\u5C6F"},{value:"\u77F3\u6CB3\u5B50",label:"\u77F3\u6CB3\u5B50"},{value:"\u5854\u57CE",label:"\u5854\u57CE"},{value:"\u5410\u9C81\u756A",label:"\u5410\u9C81\u756A"},{value:"\u4F0A\u5B81",label:"\u4F0A\u5B81"}]},{value:"\u897F\u85CF",label:"\u897F\u85CF",children:[{value:"\u62C9\u8428",label:"\u62C9\u8428"},{value:"\u963F\u91CC",label:"\u963F\u91CC"},{value:"\u660C\u90FD",label:"\u660C\u90FD"},{value:"\u6797\u829D",label:"\u6797\u829D"},{value:"\u90A3\u66F2",label:"\u90A3\u66F2"},{value:"\u65E5\u5580\u5219",label:"\u65E5\u5580\u5219"},{value:"\u5C71\u5357",label:"\u5C71\u5357"}]},{value:"\u4E91\u5357",label:"\u4E91\u5357",children:[{value:"\u6606\u660E",label:"\u6606\u660E"},{value:"\u5927\u7406",label:"\u5927\u7406"},{value:"\u4FDD\u5C71",label:"\u4FDD\u5C71"},{value:"\u695A\u96C4",label:"\u695A\u96C4"},{value:"\u5927\u7406",label:"\u5927\u7406"},{value:"\u4E1C\u5DDD",label:"\u4E1C\u5DDD"},{value:"\u4E2A\u65E7",label:"\u4E2A\u65E7"},{value:"\u666F\u6D2A",label:"\u666F\u6D2A"},{value:"\u5F00\u8FDC",label:"\u5F00\u8FDC"},{value:"\u4E34\u6CA7",label:"\u4E34\u6CA7"},{value:"\u4E3D\u6C5F",label:"\u4E3D\u6C5F"},{value:"\u516D\u5E93",label:"\u516D\u5E93"},{value:"\u6F5E\u897F",label:"\u6F5E\u897F"},{value:"\u66F2\u9756",label:"\u66F2\u9756"},{value:"\u601D\u8305",label:"\u601D\u8305"},{value:"\u6587\u5C71",label:"\u6587\u5C71"},{value:"\u897F\u53CC\u7248\u7EB3",label:"\u897F\u53CC\u7248\u7EB3"},{value:"\u7389\u6EAA",label:"\u7389\u6EAA"},{value:"\u4E2D\u7538",label:"\u4E2D\u7538"},{value:"\u662D\u901A",label:"\u662D\u901A"}]},{value:"\u6D59\u6C5F",label:"\u6D59\u6C5F",children:[{value:"\u676D\u5DDE",label:"\u676D\u5DDE"},{value:"\u6E29\u5DDE",label:"\u6E29\u5DDE"},{value:"\u5B89\u5409",label:"\u5B89\u5409"},{value:"\u6148\u6EAA",label:"\u6148\u6EAA"},{value:"\u5B9A\u6D77",label:"\u5B9A\u6D77"},{value:"\u5949\u5316",label:"\u5949\u5316"},{value:"\u6D77\u76D0",label:"\u6D77\u76D0"},{value:"\u9EC4\u5CA9",label:"\u9EC4\u5CA9"},{value:"\u6E56\u5DDE",label:"\u6E56\u5DDE"},{value:"\u5609\u5174",label:"\u5609\u5174"},{value:"\u91D1\u534E",label:"\u91D1\u534E"},{value:"\u4E34\u5B89",label:"\u4E34\u5B89"},{value:"\u4E34\u6D77",label:"\u4E34\u6D77"},{value:"\u4E3D\u6C34",label:"\u4E3D\u6C34"},{value:"\u5B81\u6CE2",label:"\u5B81\u6CE2"},{value:"\u74EF\u6D77",label:"\u74EF\u6D77"},{value:"\u5E73\u6E56",label:"\u5E73\u6E56"},{value:"\u5343\u5C9B\u6E56",label:"\u5343\u5C9B\u6E56"},{value:"\u8862\u5DDE",label:"\u8862\u5DDE"},{value:"\u6C5F\u5C71",label:"\u6C5F\u5C71"},{value:"\u745E\u5B89",label:"\u745E\u5B89"},{value:"\u7ECD\u5174",label:"\u7ECD\u5174"},{value:"\u5D4A\u5DDE",label:"\u5D4A\u5DDE"},{value:"\u53F0\u5DDE",label:"\u53F0\u5DDE"},{value:"\u6E29\u5CAD",label:"\u6E29\u5CAD"},{value:"\u4F59\u59DA",label:"\u4F59\u59DA"},{value:"\u821F\u5C71",label:"\u821F\u5C71"}]},{value:"\u6D77\u5916",label:"\u6D77\u5916",children:[{value:"\u7F8E\u56FD",label:"\u7F8E\u56FD"},{value:"\u65E5\u672C",label:"\u65E5\u672C"},{value:"\u82F1\u56FD",label:"\u82F1\u56FD"},{value:"\u6CD5\u56FD",label:"\u6CD5\u56FD"},{value:"\u5FB7\u56FD",label:"\u5FB7\u56FD"},{value:"\u5176\u4ED6",label:"\u5176\u4ED6"}]}]},kSUc:function(vt,Te,Q){},lZu9:function(vt,Te,Q){(function(ie){ie(Q("VrN/"),Q("1eCo"),Q("8EBN"))})(function(ie){"use strict";ie.defineMode("markdown",function($,O){var V=ie.getMode($,"text/html"),I=V.name=="null";function M(K){if(ie.findModeByName){var F=ie.findModeByName(K);F&&(K=F.mime||F.mimes[0])}var ee=ie.getMode($,K);return ee.name=="null"?null:ee}O.highlightFormatting===void 0&&(O.highlightFormatting=!1),O.maxBlockquoteDepth===void 0&&(O.maxBlockquoteDepth=0),O.taskLists===void 0&&(O.taskLists=!1),O.strikethrough===void 0&&(O.strikethrough=!1),O.emoji===void 0&&(O.emoji=!1),O.fencedCodeBlockHighlighting===void 0&&(O.fencedCodeBlockHighlighting=!0),O.fencedCodeBlockDefaultMode===void 0&&(O.fencedCodeBlockDefaultMode="text/plain"),O.xml===void 0&&(O.xml=!0),O.tokenTypeOverrides===void 0&&(O.tokenTypeOverrides={});var W={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var N in W)W.hasOwnProperty(N)&&O.tokenTypeOverrides[N]&&(W[N]=O.tokenTypeOverrides[N]);var P=/^([*\-_])(?:\s*\1){2,}\s*$/,R=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,d=/^\[(x| )\](?=\s)/i,f=O.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,w=/^ {0,3}(?:\={1,}|-{2,})\s*$/,p=/^[^#!\[\]*_\\<>` "'(~:]+/,g=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,b=/^\s*\[[^\]]+?\]:.*$/,o=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,i=" ";function s(K,F,ee){return F.f=F.inline=ee,ee(K,F)}function l(K,F,ee){return F.f=F.block=ee,ee(K,F)}function C(K){return!K||!/\S/.test(K.string)}function m(K){if(K.linkTitle=!1,K.linkHref=!1,K.linkText=!1,K.em=!1,K.strong=!1,K.strikethrough=!1,K.quote=0,K.indentedCode=!1,K.f==k){var F=I;if(!F){var ee=ie.innerMode(V,K.htmlState);F=ee.mode.name=="xml"&&ee.state.tagStart===null&&!ee.state.context&&ee.state.tokenize.isInText}F&&(K.f=c,K.block=v,K.htmlState=null)}return K.trailingSpace=0,K.trailingSpaceNewLine=!1,K.prevLine=K.thisLine,K.thisLine={stream:null},null}function v(K,F){var ee=K.column()===F.indentation,se=C(F.prevLine.stream),he=F.indentedCode,Ce=F.prevLine.hr,Ue=F.list!==!1,ke=(F.listStack[F.listStack.length-1]||0)+3;F.indentedCode=!1;var Me=F.indentation;if(F.indentationDiff===null&&(F.indentationDiff=F.indentation,Ue)){for(F.list=null;Me<F.listStack[F.listStack.length-1];)F.listStack.pop(),F.listStack.length?F.indentation=F.listStack[F.listStack.length-1]:F.list=!1;F.list!==!1&&(F.indentationDiff=Me-F.listStack[F.listStack.length-1])}var ce=!se&&!Ce&&!F.prevLine.header&&(!Ue||!he)&&!F.prevLine.fencedCodeEnd,ve=(F.list===!1||Ce||se)&&F.indentation<=ke&&K.match(P),le=null;if(F.indentationDiff>=4&&(he||F.prevLine.fencedCodeEnd||F.prevLine.header||se))return K.skipToEnd(),F.indentedCode=!0,W.code;if(K.eatSpace())return null;if(ee&&F.indentation<=ke&&(le=K.match(f))&&le[1].length<=6)return F.quote=0,F.header=le[1].length,F.thisLine.header=!0,O.highlightFormatting&&(F.formatting="header"),F.f=F.inline,E(F);if(F.indentation<=ke&&K.eat(">"))return F.quote=ee?1:F.quote+1,O.highlightFormatting&&(F.formatting="quote"),K.eatSpace(),E(F);if(!ve&&!F.setext&&ee&&F.indentation<=ke&&(le=K.match(R))){var ne=le[1]?"ol":"ul";return F.indentation=Me+K.current().length,F.list=!0,F.quote=0,F.listStack.push(F.indentation),F.em=!1,F.strong=!1,F.code=!1,F.strikethrough=!1,O.taskLists&&K.match(d,!1)&&(F.taskList=!0),F.f=F.inline,O.highlightFormatting&&(F.formatting=["list","list-"+ne]),E(F)}else{if(ee&&F.indentation<=ke&&(le=K.match(g,!0)))return F.quote=0,F.fencedEndRE=new RegExp(le[1]+"+ *$"),F.localMode=O.fencedCodeBlockHighlighting&&M(le[2]||O.fencedCodeBlockDefaultMode),F.localMode&&(F.localState=ie.startState(F.localMode)),F.f=F.block=L,O.highlightFormatting&&(F.formatting="code-block"),F.code=-1,E(F);if(F.setext||(!ce||!Ue)&&!F.quote&&F.list===!1&&!F.code&&!ve&&!b.test(K.string)&&(le=K.lookAhead(1))&&(le=le.match(w)))return F.setext?(F.header=F.setext,F.setext=0,K.skipToEnd(),O.highlightFormatting&&(F.formatting="header")):(F.header=le[0].charAt(0)=="="?1:2,F.setext=F.header),F.thisLine.header=!0,F.f=F.inline,E(F);if(ve)return K.skipToEnd(),F.hr=!0,F.thisLine.hr=!0,W.hr;if(K.peek()==="[")return s(K,F,_)}return s(K,F,F.inline)}function k(K,F){var ee=V.token(K,F.htmlState);if(!I){var se=ie.innerMode(V,F.htmlState);(se.mode.name=="xml"&&se.state.tagStart===null&&!se.state.context&&se.state.tokenize.isInText||F.md_inside&&K.current().indexOf(">")>-1)&&(F.f=c,F.block=v,F.htmlState=null)}return ee}function L(K,F){var ee=F.listStack[F.listStack.length-1]||0,se=F.indentation<ee,he=ee+3;if(F.fencedEndRE&&F.indentation<=he&&(se||K.match(F.fencedEndRE))){O.highlightFormatting&&(F.formatting="code-block");var Ce;return se||(Ce=E(F)),F.localMode=F.localState=null,F.block=v,F.f=c,F.fencedEndRE=null,F.code=0,F.thisLine.fencedCodeEnd=!0,se?l(K,F,F.block):Ce}else return F.localMode?F.localMode.token(K,F.localState):(K.skipToEnd(),W.code)}function E(K){var F=[];if(K.formatting){F.push(W.formatting),typeof K.formatting=="string"&&(K.formatting=[K.formatting]);for(var ee=0;ee<K.formatting.length;ee++)F.push(W.formatting+"-"+K.formatting[ee]),K.formatting[ee]==="header"&&F.push(W.formatting+"-"+K.formatting[ee]+"-"+K.header),K.formatting[ee]==="quote"&&(!O.maxBlockquoteDepth||O.maxBlockquoteDepth>=K.quote?F.push(W.formatting+"-"+K.formatting[ee]+"-"+K.quote):F.push("error"))}if(K.taskOpen)return F.push("meta"),F.length?F.join(" "):null;if(K.taskClosed)return F.push("property"),F.length?F.join(" "):null;if(K.linkHref?F.push(W.linkHref,"url"):(K.strong&&F.push(W.strong),K.em&&F.push(W.em),K.strikethrough&&F.push(W.strikethrough),K.emoji&&F.push(W.emoji),K.linkText&&F.push(W.linkText),K.code&&F.push(W.code),K.image&&F.push(W.image),K.imageAltText&&F.push(W.imageAltText,"link"),K.imageMarker&&F.push(W.imageMarker)),K.header&&F.push(W.header,W.header+"-"+K.header),K.quote&&(F.push(W.quote),!O.maxBlockquoteDepth||O.maxBlockquoteDepth>=K.quote?F.push(W.quote+"-"+K.quote):F.push(W.quote+"-"+O.maxBlockquoteDepth)),K.list!==!1){var se=(K.listStack.length-1)%3;se?se===1?F.push(W.list2):F.push(W.list3):F.push(W.list1)}return K.trailingSpaceNewLine?F.push("trailing-space-new-line"):K.trailingSpace&&F.push("trailing-space-"+(K.trailingSpace%2?"a":"b")),F.length?F.join(" "):null}function y(K,F){return K.match(p,!0)?E(F):void 0}function c(K,F){var ee=F.text(K,F);if(typeof ee!="undefined")return ee;if(F.list)return F.list=null,E(F);if(F.taskList){var se=K.match(d,!0)[1]===" ";return se?F.taskOpen=!0:F.taskClosed=!0,O.highlightFormatting&&(F.formatting="task"),F.taskList=!1,E(F)}if(F.taskOpen=!1,F.taskClosed=!1,F.header&&K.match(/^#+$/,!0))return O.highlightFormatting&&(F.formatting="header"),E(F);var he=K.next();if(F.linkTitle){F.linkTitle=!1;var Ce=he;he==="("&&(Ce=")"),Ce=(Ce+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Ue="^\\s*(?:[^"+Ce+"\\\\]+|\\\\\\\\|\\\\.)"+Ce;if(K.match(new RegExp(Ue),!0))return W.linkHref}if(he==="`"){var ke=F.formatting;O.highlightFormatting&&(F.formatting="code"),K.eatWhile("`");var Me=K.current().length;if(F.code==0&&(!F.quote||Me==1))return F.code=Me,E(F);if(Me==F.code){var ce=E(F);return F.code=0,ce}else return F.formatting=ke,E(F)}else if(F.code)return E(F);if(he==="\\"&&(K.next(),O.highlightFormatting)){var ve=E(F),le=W.formatting+"-escape";return ve?ve+" "+le:le}if(he==="!"&&K.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return F.imageMarker=!0,F.image=!0,O.highlightFormatting&&(F.formatting="image"),E(F);if(he==="["&&F.imageMarker&&K.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return F.imageMarker=!1,F.imageAltText=!0,O.highlightFormatting&&(F.formatting="image"),E(F);if(he==="]"&&F.imageAltText){O.highlightFormatting&&(F.formatting="image");var ve=E(F);return F.imageAltText=!1,F.image=!1,F.inline=F.f=A,ve}if(he==="["&&!F.image)return F.linkText&&K.match(/^.*?\]/)||(F.linkText=!0,O.highlightFormatting&&(F.formatting="link")),E(F);if(he==="]"&&F.linkText){O.highlightFormatting&&(F.formatting="link");var ve=E(F);return F.linkText=!1,F.inline=F.f=K.match(/\(.*?\)| ?\[.*?\]/,!1)?A:c,ve}if(he==="<"&&K.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){F.f=F.inline=u,O.highlightFormatting&&(F.formatting="link");var ve=E(F);return ve?ve+=" ":ve="",ve+W.linkInline}if(he==="<"&&K.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){F.f=F.inline=u,O.highlightFormatting&&(F.formatting="link");var ve=E(F);return ve?ve+=" ":ve="",ve+W.linkEmail}if(O.xml&&he==="<"&&K.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var ne=K.string.indexOf(">",K.pos);if(ne!=-1){var Le=K.string.substring(K.start,ne);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Le)&&(F.md_inside=!0)}return K.backUp(1),F.htmlState=ie.startState(V),l(K,F,k)}if(O.xml&&he==="<"&&K.match(/^\/\w*?>/))return F.md_inside=!1,"tag";if(he==="*"||he==="_"){for(var xe=1,Ie=K.pos==1?" ":K.string.charAt(K.pos-2);xe<3&&K.eat(he);)xe++;var Re=K.peek()||" ",ae=!/\s/.test(Re)&&(!o.test(Re)||/\s/.test(Ie)||o.test(Ie)),oe=!/\s/.test(Ie)&&(!o.test(Ie)||/\s/.test(Re)||o.test(Re)),be=null,Ae=null;if(xe%2&&(!F.em&&ae&&(he==="*"||!oe||o.test(Ie))?be=!0:F.em==he&&oe&&(he==="*"||!ae||o.test(Re))&&(be=!1)),xe>1&&(!F.strong&&ae&&(he==="*"||!oe||o.test(Ie))?Ae=!0:F.strong==he&&oe&&(he==="*"||!ae||o.test(Re))&&(Ae=!1)),Ae!=null||be!=null){O.highlightFormatting&&(F.formatting=be==null?"strong":Ae==null?"em":"strong em"),be===!0&&(F.em=he),Ae===!0&&(F.strong=he);var ce=E(F);return be===!1&&(F.em=!1),Ae===!1&&(F.strong=!1),ce}}else if(he===" "&&(K.eat("*")||K.eat("_"))){if(K.peek()===" ")return E(F);K.backUp(1)}if(O.strikethrough){if(he==="~"&&K.eatWhile(he)){if(F.strikethrough){O.highlightFormatting&&(F.formatting="strikethrough");var ce=E(F);return F.strikethrough=!1,ce}else if(K.match(/^[^\s]/,!1))return F.strikethrough=!0,O.highlightFormatting&&(F.formatting="strikethrough"),E(F)}else if(he===" "&&K.match(/^~~/,!0)){if(K.peek()===" ")return E(F);K.backUp(2)}}if(O.emoji&&he===":"&&K.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){F.emoji=!0,O.highlightFormatting&&(F.formatting="emoji");var Ne=E(F);return F.emoji=!1,Ne}return he===" "&&(K.match(/^ +$/,!1)?F.trailingSpace++:F.trailingSpace&&(F.trailingSpaceNewLine=!0)),E(F)}function u(K,F){var ee=K.next();if(ee===">"){F.f=F.inline=c,O.highlightFormatting&&(F.formatting="link");var se=E(F);return se?se+=" ":se="",se+W.linkInline}return K.match(/^[^>]+/,!0),W.linkInline}function A(K,F){if(K.eatSpace())return null;var ee=K.next();return ee==="("||ee==="["?(F.f=F.inline=T(ee==="("?")":"]"),O.highlightFormatting&&(F.formatting="link-string"),F.linkHref=!0,E(F)):"error"}var S={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function T(K){return function(F,ee){var se=F.next();if(se===K){ee.f=ee.inline=c,O.highlightFormatting&&(ee.formatting="link-string");var he=E(ee);return ee.linkHref=!1,he}return F.match(S[K]),ee.linkHref=!0,E(ee)}}function _(K,F){return K.match(/^([^\]\\]|\\.)*\]:/,!1)?(F.f=j,K.next(),O.highlightFormatting&&(F.formatting="link"),F.linkText=!0,E(F)):s(K,F,c)}function j(K,F){if(K.match(/^\]:/,!0)){F.f=F.inline=z,O.highlightFormatting&&(F.formatting="link");var ee=E(F);return F.linkText=!1,ee}return K.match(/^([^\]\\]|\\.)+/,!0),W.linkText}function z(K,F){return K.eatSpace()?null:(K.match(/^[^\s]+/,!0),K.peek()===void 0?F.linkTitle=!0:K.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),F.f=F.inline=c,W.linkHref+" url")}var Z={startState:function(){return{f:v,prevLine:{stream:null},thisLine:{stream:null},block:v,htmlState:null,indentation:0,inline:c,text:y,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(K){return{f:K.f,prevLine:K.prevLine,thisLine:K.thisLine,block:K.block,htmlState:K.htmlState&&ie.copyState(V,K.htmlState),indentation:K.indentation,localMode:K.localMode,localState:K.localMode?ie.copyState(K.localMode,K.localState):null,inline:K.inline,text:K.text,formatting:!1,linkText:K.linkText,linkTitle:K.linkTitle,linkHref:K.linkHref,code:K.code,em:K.em,strong:K.strong,strikethrough:K.strikethrough,emoji:K.emoji,header:K.header,setext:K.setext,hr:K.hr,taskList:K.taskList,list:K.list,listStack:K.listStack.slice(0),quote:K.quote,indentedCode:K.indentedCode,trailingSpace:K.trailingSpace,trailingSpaceNewLine:K.trailingSpaceNewLine,md_inside:K.md_inside,fencedEndRE:K.fencedEndRE}},token:function(K,F){if(F.formatting=!1,K!=F.thisLine.stream){if(F.header=0,F.hr=!1,K.match(/^\s*$/,!0))return m(F),null;if(F.prevLine=F.thisLine,F.thisLine={stream:K},F.taskList=!1,F.trailingSpace=0,F.trailingSpaceNewLine=!1,!F.localState&&(F.f=F.block,F.f!=k)){var ee=K.match(/^\s*/,!0)[0].replace(/\t/g,i).length;if(F.indentation=ee,F.indentationDiff=null,ee>0)return null}}return F.f(K,F)},innerMode:function(K){return K.block==k?{state:K.htmlState,mode:V}:K.localState?{state:K.localState,mode:K.localMode}:{state:K,mode:Z}},indent:function(K,F,ee){return K.block==k&&V.indent?V.indent(K.htmlState,F,ee):K.localState&&K.localMode.indent?K.localMode.indent(K.localState,F,ee):ie.Pass},blankLine:m,getType:E,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return Z},"xml"),ie.defineMIME("text/markdown","markdown"),ie.defineMIME("text/x-markdown","markdown")})},m7e3:function(vt,Te,Q){vt.exports={flex_box_center:"flex_box_center___cDhGq",flex_space_between:"flex_space_between___3OXHk",flex_box_vertical_center:"flex_box_vertical_center___3g3vC",flex_box_center_end:"flex_box_center_end___2QmKm",flex_box_column:"flex_box_column___2Id0h",bg:"bg___1JEmc",title:"title___3bVR_",titleLeft:"titleLeft___2rmGK",titleRight:"titleRight___1YZFf",btns:"btns___2IVL7"}},nnTU:function(vt,Te,Q){"use strict";Q.d(Te,"b",function(){return N}),Q.d(Te,"a",function(){return P});var ie=Q("pmY6"),$=Q("746U"),O=Q("Cg/j"),V=Q("MI8n"),I=Q("24hK"),M=Q("QDVR"),W=function(){for(var R=0,d=0,f=arguments.length;d<f;d++)R+=arguments[d].length;for(var w=Array(R),p=0,d=0;d<f;d++)for(var g=arguments[d],b=0,o=g.length;b<o;b++,p++)w[p]=g[b];return w},N=Object(O.c)("commandService"),P=new(function(){function R(){this._commands=new Map,this._onDidRegisterCommand=new V.a,this.onDidRegisterCommand=this._onDidRegisterCommand.event}return R.prototype.registerCommand=function(d,f){var w=this;if(!d)throw new Error("invalid command");if(typeof d=="string"){if(!f)throw new Error("invalid command");return this.registerCommand({id:d,handler:f})}if(d.description){for(var p=[],g=0,b=d.description.args;g<b.length;g++){var o=b[g];p.push(o.constraint)}var i=d.handler;d.handler=function(v){for(var k=[],L=1;L<arguments.length;L++)k[L-1]=arguments[L];return Object($.m)(k,p),i.apply(void 0,W([v],k))}}var s=d.id,l=this._commands.get(s);l||(l=new I.a,this._commands.set(s,l));var C=l.unshift(d),m=Object(ie.h)(function(){C();var v=w._commands.get(s);(v==null?void 0:v.isEmpty())&&w._commands.delete(s)});return this._onDidRegisterCommand.fire(s),m},R.prototype.registerCommandAlias=function(d,f){return P.registerCommand(d,function(w){for(var p,g=[],b=1;b<arguments.length;b++)g[b-1]=arguments[b];return(p=w.get(N)).executeCommand.apply(p,W([f],g))})},R.prototype.getCommand=function(d){var f=this._commands.get(d);return!f||f.isEmpty()?void 0:f.iterator().next().value},R.prototype.getCommands=function(){for(var d=new Map,f=0,w=Object(M.d)(this._commands);f<w.length;f++){var p=w[f],g=this.getCommand(p);g&&d.set(p,g)}return d},R}())},osHv:function(vt,Te,Q){(function(ie){ie(Q("VrN/"))})(function(ie){"use strict";var $=ie.Pos;function O(o,i){return o.line-i.line||o.ch-i.ch}var V="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",I=V+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",M=new RegExp("<(/?)(["+V+"]["+I+"]*)","g");function W(o,i,s,l){this.line=i,this.ch=s,this.cm=o,this.text=o.getLine(i),this.min=l?Math.max(l.from,o.firstLine()):o.firstLine(),this.max=l?Math.min(l.to-1,o.lastLine()):o.lastLine()}function N(o,i){var s=o.cm.getTokenTypeAt($(o.line,i));return s&&/\btag\b/.test(s)}function P(o){return o.line>=o.max?void 0:(o.ch=0,o.text=o.cm.getLine(++o.line),!0)}function R(o){return o.line<=o.min?void 0:(o.text=o.cm.getLine(--o.line),o.ch=o.text.length,!0)}function d(o){for(;;){var i=o.text.indexOf(">",o.ch);if(i==-1){if(P(o))continue;return}if(!N(o,i+1)){o.ch=i+1;continue}var s=o.text.lastIndexOf("/",i),l=s>-1&&!/\S/.test(o.text.slice(s+1,i));return o.ch=i+1,l?"selfClose":"regular"}}function f(o){for(;;){var i=o.ch?o.text.lastIndexOf("<",o.ch-1):-1;if(i==-1){if(R(o))continue;return}if(!N(o,i+1)){o.ch=i;continue}M.lastIndex=i,o.ch=i;var s=M.exec(o.text);if(s&&s.index==i)return s}}function w(o){for(;;){M.lastIndex=o.ch;var i=M.exec(o.text);if(!i){if(P(o))continue;return}if(!N(o,i.index+1)){o.ch=i.index+1;continue}return o.ch=i.index+i[0].length,i}}function p(o){for(;;){var i=o.ch?o.text.lastIndexOf(">",o.ch-1):-1;if(i==-1){if(R(o))continue;return}if(!N(o,i+1)){o.ch=i;continue}var s=o.text.lastIndexOf("/",i),l=s>-1&&!/\S/.test(o.text.slice(s+1,i));return o.ch=i+1,l?"selfClose":"regular"}}function g(o,i){for(var s=[];;){var l=w(o),C,m=o.line,v=o.ch-(l?l[0].length:0);if(!l||!(C=d(o)))return;if(C=="selfClose")continue;if(l[1]){for(var k=s.length-1;k>=0;--k)if(s[k]==l[2]){s.length=k;break}if(k<0&&(!i||i==l[2]))return{tag:l[2],from:$(m,v),to:$(o.line,o.ch)}}else s.push(l[2])}}function b(o,i){for(var s=[];;){var l=p(o);if(!l)return;if(l=="selfClose"){f(o);continue}var C=o.line,m=o.ch,v=f(o);if(!v)return;if(v[1])s.push(v[2]);else{for(var k=s.length-1;k>=0;--k)if(s[k]==v[2]){s.length=k;break}if(k<0&&(!i||i==v[2]))return{tag:v[2],from:$(o.line,o.ch),to:$(C,m)}}}}ie.registerHelper("fold","xml",function(o,i){for(var s=new W(o,i.line,0);;){var l=w(s);if(!l||s.line!=i.line)return;var C=d(s);if(!C)return;if(!l[1]&&C!="selfClose"){var m=$(s.line,s.ch),v=g(s,l[2]);return v&&O(v.from,m)>0?{from:m,to:v.from}:null}}}),ie.findMatchingTag=function(o,i,s){var l=new W(o,i.line,i.ch,s);if(l.text.indexOf(">")==-1&&l.text.indexOf("<")==-1)return;var C=d(l),m=C&&$(l.line,l.ch),v=C&&f(l);if(!C||!v||O(l,i)>0)return;var k={from:$(l.line,l.ch),to:m,tag:v[2]};return C=="selfClose"?{open:k,close:null,at:"open"}:v[1]?{open:b(l,v[2]),close:k,at:"close"}:(l=new W(o,m.line,m.ch,s),{open:k,close:g(l,v[2]),at:"open"})},ie.findEnclosingTag=function(o,i,s,l){for(var C=new W(o,i.line,i.ch,s);;){var m=b(C,l);if(!m)break;var v=new W(o,i.line,i.ch,s),k=g(v,m.tag);if(k)return{open:m,close:k}}},ie.scanForClosingTag=function(o,i,s,l){var C=new W(o,i.line,i.ch,l?{from:0,to:l}:null);return g(C,s)}})},p5ED:function(vt,Te,Q){"use strict";var ie=Q("+L6B"),$=Q("2/Rp"),O=Q("5Dmo"),V=Q("3S7+"),I=Q("k1fw"),M=Q("9og8"),W=Q("tJVT"),N=Q("WmNS"),P=Q.n(N),R=Q("q1tI"),d=Q.n(R),f=Q("vHTk"),w=Q.n(f),p=Q("yEEn"),g=Q("ZW9T"),b=Q("1vsH"),o=Q("V0Rq"),i=Q("m3rI");Te.a=function(s){var l,C,m,v,k,L,E=s.editOffice,y=E===void 0?"view":E,c=s.name,u=s.data,A=s.theme,S=s.type,T=s.filename,_=s.monacoEditor,j=s.className,z=s.style,Z=s.close,K=s.onClose,F=s.hasMask,ee=s.disabledDownload,se=s.onImgDimensions,he=s.otherData,Ce=Object(R.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),Ue=Object(W.a)(Ce,2),ke=Ue[0],Me=Ue[1],ce=Object(R.useState)(""),ve=Object(W.a)(ce,2),le=ve[0],ne=ve[1],Le=Object(R.useState)(),xe=Object(W.a)(Le,2),Ie=xe[0],Re=xe[1],ae=window.ENV==="build"?"/react/build":"",oe=location.host.startsWith("localhost")?i.a.PROXY_SERVER:i.a.API_SERVER,be,Ae=1024*1024,Ne=10*Ae,_e=Object(R.useRef)();(l=u)!==null&&l!==void 0&&l.startsWith("/api")&&S!=="txt"&&(u=i.a.API_SERVER+u),S==="office"&&(be=Object(b.P)(u).filesize,be>Ne&&(S="other")),T&&(_.filename=T),Object(R.useEffect)(function(){var Je,Qe,Ye=(Je=document.cookie)===null||Je===void 0||((Qe=Je.replace(/\s/g,""))===null||Qe===void 0)?void 0:Qe.split(";");Ye==null||Ye.map(function(dt){var $e=dt.split("=");$e[0]==="_educoder_session"&&ne($e[1])})},[]),Object(R.useEffect)(function(){S==="office"&&We()},[S,u]);var We=function(){var Je=Object(M.a)(P.a.mark(function Qe(){var Ye,dt,$e;return P.a.wrap(function(Oe){for(;;)switch(Oe.prev=Oe.next){case 0:return console.log("data:",u),Ye=u,u.startsWith("http")||(Ye=location.origin+Ye),dt=new URL(Ye).pathname.split("/").pop(),Oe.next=6,Object(o.U)({attachment_id:dt});case 6:$e=Oe.sent,Re($e);case 8:case"end":return Oe.stop()}},Qe)}));return function(){return Je.apply(this,arguments)}}(),Fe=function(){if(u.startsWith("http")||u.startsWith("blob:")){et();return}Object(b.x)(T||"educoder",u,T)},et=function(){Object(b.v)(T||"educoder",decodeURIComponent(u))};return d.a.createElement("div",{style:Object(I.a)({},z||{}),className:"".concat(F&&w.a.bgBlack," ").concat(S?w.a.wrp:"hide")},Z&&d.a.createElement("div",{className:w.a.close,ref:_e},!!se&&d.a.createElement(V.a,{title:"\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",getPopupContainer:function(){return _e.current}},d.a.createElement("span",{onClick:function(){K(),se()}},d.a.createElement("i",{className:"icon-yulanpizhu"}))),!ee&&d.a.createElement(V.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return _e.current}},d.a.createElement("span",{onClick:et},d.a.createElement("i",{className:"icon-quxiaozhiding"}))),d.a.createElement(V.a,{title:"\u5173\u95ED",getPopupContainer:function(){return _e.current}},d.a.createElement("span",{className:"",onClick:K},d.a.createElement("i",{className:"icon-guanbi1"})))),d.a.createElement("div",{className:"".concat(w.a[j]," ").concat(j," ").concat(w.a.monaco," ").concat(S==="txt"?"show":"hide")},S==="txt"&&d.a.createElement(g.b,_)),S==="audio"&&d.a.createElement("audio",{src:"".concat(((C=u)===null||C===void 0?void 0:C.indexOf("http://"))>-1||((m=u)===null||m===void 0?void 0:m.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(u),autoPlay:!0}),S==="video"&&d.a.createElement(d.a.Fragment,null,((v=u)===null||v===void 0?void 0:v.indexOf("http"))>-1?d.a.createElement("video",{controls:!0,src:"".concat(u),autoPlay:!0}):d.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(u),autoPlay:!0})),S==="office"&&Ie&&d.a.createElement("iframe",{src:"".concat(ae,"/office.html?key=").concat(Ie.key,"&url=").concat(oe+Ie.url,"&callbackUrl=").concat(oe+Ie.callbackUrl,"&fileType=").concat(Ie.fileType,"&title=").concat(Ie.title,"&model=").concat(y,"&officeServer=").concat(i.a.OFFICE_SERVER,"&disabledDownload=").concat(!!ee)}),(S==="xlsx"||S==="doc"||S==="pptx"||S==="docx")&&d.a.createElement("iframe",{src:"/react/build/office.html?key=".concat(he.key,"&url=").concat(i.a.API_SERVER+he.url,"&callbackUrl=").concat(i.a.API_SERVER+he.callbackUrl,"&fileType=").concat(he.fileType,"&title=").concat(he.title,"&model=").concat(he.model)}),S==="html"&&d.a.createElement("iframe",{src:u+"&disposition=inline"}),S==="pdf"&&d.a.createElement("embed",{className:w.a.embed,src:u}),S==="image"&&d.a.createElement("img",{src:"".concat(((k=u)===null||k===void 0?void 0:k.indexOf("http://"))>-1||((L=u)===null||L===void 0?void 0:L.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(u)}),S==="other"&&d.a.createElement("div",null,d.a.createElement($.a,{type:"primary",size:"large",onClick:Fe},d.a.createElement(p.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),S==="download"&&d.a.createElement($.a,{type:"primary",size:"large",onClick:Fe},d.a.createElement(p.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(vt,Te,Q){},pmY6:function(vt,Te,Q){"use strict";Q.d(Te,"g",function(){return I}),Q.d(Te,"f",function(){return M}),Q.d(Te,"e",function(){return W}),Q.d(Te,"h",function(){return N}),Q.d(Te,"b",function(){return P}),Q.d(Te,"a",function(){return R}),Q.d(Te,"d",function(){return d}),Q.d(Te,"c",function(){return f});var ie=!1,$="__is_disposable_tracked__";function O(w){if(!ie)return;if(w&&w!==R.None)try{w[$]=!0}catch(p){}}function V(w){if(!ie)return w;var p=new Error("Potentially leaked disposable").stack;return setTimeout(function(){w[$]||console.log(p)},3e3),w}function I(w){return typeof w.dispose=="function"&&w.dispose.length===0}function M(w){return Array.isArray(w)?(w.forEach(function(p){p&&(O(p),p.dispose())}),[]):w?(O(w),w.dispose(),w):void 0}function W(){for(var w=[],p=0;p<arguments.length;p++)w[p]=arguments[p];return w.forEach(O),V({dispose:function(){return M(w)}})}function N(w){var p=V({dispose:function(){O(p),w()}});return p}var P=function(){function w(){this._toDispose=new Set,this._isDisposed=!1}return w.prototype.dispose=function(){if(this._isDisposed)return;O(this),this._isDisposed=!0,this.clear()},w.prototype.clear=function(){this._toDispose.forEach(function(p){return p.dispose()}),this._toDispose.clear()},w.prototype.add=function(p){if(!p)return p;if(p===this)throw new Error("Cannot register a disposable on itself!");return O(p),this._isDisposed?console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(p),p},w}(),R=function(){function w(){this._store=new P,V(this)}return w.prototype.dispose=function(){O(this),this._store.dispose()},w.prototype._register=function(p){if(p===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(p)},w.None=Object.freeze({dispose:function(){}}),w}(),d=function(){function w(){this._isDisposed=!1,V(this)}return Object.defineProperty(w.prototype,"value",{get:function(){return this._isDisposed?void 0:this._value},set:function(p){if(this._isDisposed||p===this._value)return;this._value&&this._value.dispose(),p&&O(p),this._value=p},enumerable:!0,configurable:!0}),w.prototype.clear=function(){this.value=void 0},w.prototype.dispose=function(){this._isDisposed=!0,O(this),this._value&&this._value.dispose(),this._value=void 0},w}(),f=function(){function w(p){this.object=p}return w.prototype.dispose=function(){},w}()},"rAM+":function(vt,Te,Q){"use strict";Q.d(Te,"a",function(){return $});var ie=Q("Qw5x");function $(O,V){var I;if(typeof Symbol=="undefined"||O[Symbol.iterator]==null){if(Array.isArray(O)||(I=Object(ie.a)(O))||V&&O&&typeof O.length=="number"){I&&(O=I);var M=0,W=function(){};return{s:W,n:function(){return M>=O.length?{done:!0}:{done:!1,value:O[M++]}},e:function(f){throw f},f:W}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var N=!0,P=!1,R;return{s:function(){I=O[Symbol.iterator]()},n:function(){var f=I.next();return N=f.done,f},e:function(f){P=!0,R=f},f:function(){try{!N&&I.return!=null&&I.return()}finally{if(P)throw R}}}}},rUJ1:function(vt,Te){const Q=/[&<>"']/,ie=/[&<>"']/g,$=/[<>"']|&(?!#?\w+;)/,O=/[<>"']|&(?!#?\w+;)/g,V={"&":"&","<":"<",">":">",'"':""","'":"'"},I=L=>V[L];function M(L,E){if(E){if(Q.test(L))return L.replace(ie,I)}else if($.test(L))return L.replace(O,I);return L}const W=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function N(L){return L.replace(W,(E,y)=>(y=y.toLowerCase(),y==="colon"?":":y.charAt(0)==="#"?y.charAt(1)==="x"?String.fromCharCode(parseInt(y.substring(2),16)):String.fromCharCode(+y.substring(1)):""))}const P=/(^|[^\[])\^/g;function R(L,E){L=L.source||L,E=E||"";const y={replace:(c,u)=>(u=u.source||u,u=u.replace(P,"$1"),L=L.replace(c,u),y),getRegex:()=>new RegExp(L,E)};return y}const d=/[^\w:]/g,f=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function w(L,E,y){if(L){let c;try{c=decodeURIComponent(N(y)).replace(d,"").toLowerCase()}catch(u){return null}if(c.indexOf("javascript:")===0||c.indexOf("vbscript:")===0||c.indexOf("data:")===0)return null}E&&!f.test(y)&&(y=i(E,y));try{y=encodeURI(y).replace(/%25/g,"%")}catch(c){return null}return y}const p={},g=/^[^:]+:\/*[^/]*$/,b=/^([^:]+:)[\s\S]*$/,o=/^([^:]+:\/*[^/]*)[\s\S]*$/;function i(L,E){p[" "+L]||(g.test(L)?p[" "+L]=L+"/":p[" "+L]=m(L,"/",!0)),L=p[" "+L];const y=L.indexOf(":")===-1;return E.substring(0,2)==="//"?y?E:L.replace(b,"$1")+E:E.charAt(0)==="/"?y?E:L.replace(o,"$1")+E:L+E}const s={exec:function(){}};function l(L){let E=1,y,c;for(;E<arguments.length;E++){y=arguments[E];for(c in y)Object.prototype.hasOwnProperty.call(y,c)&&(L[c]=y[c])}return L}function C(L,E){const y=L.replace(/\|/g,(A,S,T)=>{let _=!1,j=S;for(;--j>=0&&T[j]==="\\";)_=!_;return _?"|":" |"}),c=y.split(/ \|/);let u=0;if(c.length>E)c.splice(E);else for(;c.length<E;)c.push("");for(;u<c.length;u++)c[u]=c[u].trim().replace(/\\\|/g,"|");return c}function m(L,E,y){const c=L.length;if(c===0)return"";let u=0;for(;u<c;){const A=L.charAt(c-u-1);if(A===E&&!y)u++;else if(A!==E&&y)u++;else break}return L.substr(0,c-u)}function v(L,E){if(L.indexOf(E[1])===-1)return-1;const y=L.length;let c=0,u=0;for(;u<y;u++)if(L[u]==="\\")u++;else if(L[u]===E[0])c++;else if(L[u]===E[1]&&(c--,c<0))return u;return-1}function k(L){L&&L.sanitize&&!L.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}vt.exports={escape:M,unescape:N,edit:R,cleanUrl:w,resolveUrl:i,noopTest:s,merge:l,splitCells:C,rtrim:m,findClosingBracket:v,checkSanitizeDeprecation:k}},uK0f:function(vt,Te,Q){(function(ie,$){vt.exports=$()})(this,function(){"use strict";function ie($,O,V){V=V||{},V.childrenKeyName=V.childrenKeyName||"children";var I=$||[],M=[],W=0;do{var N=I.filter(function(P){return O(P,W)})[0];if(!N)break;M.push(N),I=N[V.childrenKeyName]||[],W+=1}while(I.length>0);return M}return ie})},ulZh:function(vt,Te,Q){typeof window!="undefined"&&function($,O){vt.exports=O()}(this,function(){return function(ie){var $={};function O(V){if($[V])return $[V].exports;var I=$[V]={i:V,l:!1,exports:{}};return ie[V].call(I.exports,I,I.exports,O),I.l=!0,I.exports}return O.m=ie,O.c=$,O.d=function(V,I,M){O.o(V,I)||Object.defineProperty(V,I,{enumerable:!0,get:M})},O.r=function(V){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(V,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(V,"__esModule",{value:!0})},O.t=function(V,I){if(I&1&&(V=O(V)),I&8)return V;if(I&4&&typeof V=="object"&&V&&V.__esModule)return V;var M=Object.create(null);if(O.r(M),Object.defineProperty(M,"default",{enumerable:!0,value:V}),I&2&&typeof V!="string")for(var W in V)O.d(M,W,function(N){return V[N]}.bind(null,W));return M},O.n=function(V){var I=V&&V.__esModule?function(){return V.default}:function(){return V};return O.d(I,"a",I),I},O.o=function(V,I){return Object.prototype.hasOwnProperty.call(V,I)},O.p="/dist/",O(O.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ie,$,O){"use strict";var V=Object.prototype.hasOwnProperty,I="~";function M(){}Object.create&&(M.prototype=Object.create(null),new M().__proto__||(I=!1));function W(d,f,w){this.fn=d,this.context=f,this.once=w||!1}function N(d,f,w,p,g){if(typeof w!="function")throw new TypeError("The listener must be a function");var b=new W(w,p||d,g),o=I?I+f:f;return d._events[o]?d._events[o].fn?d._events[o]=[d._events[o],b]:d._events[o].push(b):(d._events[o]=b,d._eventsCount++),d}function P(d,f){--d._eventsCount===0?d._events=new M:delete d._events[f]}function R(){this._events=new M,this._eventsCount=0}R.prototype.eventNames=function(){var f=[],w,p;if(this._eventsCount===0)return f;for(p in w=this._events)V.call(w,p)&&f.push(I?p.slice(1):p);return Object.getOwnPropertySymbols?f.concat(Object.getOwnPropertySymbols(w)):f},R.prototype.listeners=function(f){var w=I?I+f:f,p=this._events[w];if(!p)return[];if(p.fn)return[p.fn];for(var g=0,b=p.length,o=new Array(b);g<b;g++)o[g]=p[g].fn;return o},R.prototype.listenerCount=function(f){var w=I?I+f:f,p=this._events[w];return p?p.fn?1:p.length:0},R.prototype.emit=function(f,w,p,g,b,o){var i=I?I+f:f;if(!this._events[i])return!1;var s=this._events[i],l=arguments.length,C,m;if(s.fn){s.once&&this.removeListener(f,s.fn,void 0,!0);switch(l){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,w),!0;case 3:return s.fn.call(s.context,w,p),!0;case 4:return s.fn.call(s.context,w,p,g),!0;case 5:return s.fn.call(s.context,w,p,g,b),!0;case 6:return s.fn.call(s.context,w,p,g,b,o),!0}for(m=1,C=new Array(l-1);m<l;m++)C[m-1]=arguments[m];s.fn.apply(s.context,C)}else{var v=s.length,k;for(m=0;m<v;m++){s[m].once&&this.removeListener(f,s[m].fn,void 0,!0);switch(l){case 1:s[m].fn.call(s[m].context);break;case 2:s[m].fn.call(s[m].context,w);break;case 3:s[m].fn.call(s[m].context,w,p);break;case 4:s[m].fn.call(s[m].context,w,p,g);break;default:if(!C)for(k=1,C=new Array(l-1);k<l;k++)C[k-1]=arguments[k];s[m].fn.apply(s[m].context,C)}}}return!0},R.prototype.on=function(f,w,p){return N(this,f,w,p,!1)},R.prototype.once=function(f,w,p){return N(this,f,w,p,!0)},R.prototype.removeListener=function(f,w,p,g){var b=I?I+f:f;if(!this._events[b])return this;if(!w)return P(this,b),this;var o=this._events[b];if(o.fn)o.fn===w&&(!g||o.once)&&(!p||o.context===p)&&P(this,b);else{for(var i=0,s=[],l=o.length;i<l;i++)(o[i].fn!==w||g&&!o[i].once||p&&o[i].context!==p)&&s.push(o[i]);s.length?this._events[b]=s.length===1?s[0]:s:P(this,b)}return this},R.prototype.removeAllListeners=function(f){var w;return f?(w=I?I+f:f,this._events[w]&&P(this,w)):(this._events=new M,this._eventsCount=0),this},R.prototype.off=R.prototype.removeListener,R.prototype.addListener=R.prototype.on,R.prefixed=I,R.EventEmitter=R,ie.exports=R},"./node_modules/url-toolkit/src/url-toolkit.js":function(ie,$,O){(function(V){var I=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,M=/^([^\/?#]*)([^]*)$/,W=/(?:\/|^)\.(?=\/)/g,N=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,P={buildAbsoluteURL:function(R,d,f){if(f=f||{},R=R.trim(),d=d.trim(),!d){if(!f.alwaysNormalize)return R;var w=P.parseURL(R);if(!w)throw new Error("Error trying to parse base URL.");return w.path=P.normalizePath(w.path),P.buildURLFromParts(w)}var p=P.parseURL(d);if(!p)throw new Error("Error trying to parse relative URL.");if(p.scheme)return f.alwaysNormalize?(p.path=P.normalizePath(p.path),P.buildURLFromParts(p)):d;var g=P.parseURL(R);if(!g)throw new Error("Error trying to parse base URL.");if(!g.netLoc&&g.path&&g.path[0]!=="/"){var b=M.exec(g.path);g.netLoc=b[1],g.path=b[2]}g.netLoc&&!g.path&&(g.path="/");var o={scheme:g.scheme,netLoc:p.netLoc,path:null,params:p.params,query:p.query,fragment:p.fragment};if(!p.netLoc&&(o.netLoc=g.netLoc,p.path[0]!=="/"))if(!p.path)o.path=g.path,p.params||(o.params=g.params,p.query||(o.query=g.query));else{var i=g.path,s=i.substring(0,i.lastIndexOf("/")+1)+p.path;o.path=P.normalizePath(s)}return o.path===null&&(o.path=f.alwaysNormalize?P.normalizePath(p.path):p.path),P.buildURLFromParts(o)},parseURL:function(R){var d=I.exec(R);return d?{scheme:d[1]||"",netLoc:d[2]||"",path:d[3]||"",params:d[4]||"",query:d[5]||"",fragment:d[6]||""}:null},normalizePath:function(R){for(R=R.split("").reverse().join("").replace(W,"");R.length!==(R=R.replace(N,"")).length;);return R.split("").reverse().join("")},buildURLFromParts:function(R){return R.scheme+R.netLoc+R.path+R.params+R.query+R.fragment}};ie.exports=P})(this)},"./node_modules/webworkify-webpack/index.js":function(ie,$,O){function V(f){var w={};function p(b){if(w[b])return w[b].exports;var o=w[b]={i:b,l:!1,exports:{}};return f[b].call(o.exports,o,o.exports,p),o.l=!0,o.exports}p.m=f,p.c=w,p.i=function(b){return b},p.d=function(b,o,i){p.o(b,o)||Object.defineProperty(b,o,{configurable:!1,enumerable:!0,get:i})},p.r=function(b){Object.defineProperty(b,"__esModule",{value:!0})},p.n=function(b){var o=b&&b.__esModule?function(){return b.default}:function(){return b};return p.d(o,"a",o),o},p.o=function(b,o){return Object.prototype.hasOwnProperty.call(b,o)},p.p="/",p.oe=function(b){throw console.error(b),b};var g=p(p.s=ENTRY_MODULE);return g.default||g}var I="[\\.|\\-|\\+|\\w|/|@]+",M="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+I+").*?\\)";function W(f){return(f+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function N(f){return!isNaN(1*f)}function P(f,w,p){var g={};g[p]=[];var b=w.toString(),o=b.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!o)return g;for(var i=o[1],s=new RegExp("(\\\\n|\\W)"+W(i)+M,"g"),l;l=s.exec(b);){if(l[3]==="dll-reference")continue;g[p].push(l[3])}for(s=new RegExp("\\("+W(i)+'\\("(dll-reference\\s('+I+'))"\\)\\)'+M,"g");l=s.exec(b);)f[l[2]]||(g[p].push(l[1]),f[l[2]]=O(l[1]).m),g[l[2]]=g[l[2]]||[],g[l[2]].push(l[4]);for(var C=Object.keys(g),m=0;m<C.length;m++)for(var v=0;v<g[C[m]].length;v++)N(g[C[m]][v])&&(g[C[m]][v]=1*g[C[m]][v]);return g}function R(f){var w=Object.keys(f);return w.reduce(function(p,g){return p||f[g].length>0},!1)}function d(f,w){for(var p={main:[w]},g={main:[]},b={main:{}};R(p);)for(var o=Object.keys(p),i=0;i<o.length;i++){var s=o[i],l=p[s],C=l.pop();if(b[s]=b[s]||{},b[s][C]||!f[s][C])continue;b[s][C]=!0,g[s]=g[s]||[],g[s].push(C);for(var m=P(f,f[s][C],s),v=Object.keys(m),k=0;k<v.length;k++)p[v[k]]=p[v[k]]||[],p[v[k]]=p[v[k]].concat(m[v[k]])}return g}ie.exports=function(f,w){w=w||{};var p={main:O.m},g=w.all?{main:Object.keys(p.main)}:d(p,f),b="";Object.keys(g).filter(function(C){return C!=="main"}).forEach(function(C){for(var m=0;g[C][m];)m++;g[C].push(m),p[C][m]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",b=b+"var "+C+" = ("+V.toString().replace("ENTRY_MODULE",JSON.stringify(m))+")({"+g[C].map(function(v){return""+JSON.stringify(v)+": "+p[C][v].toString()}).join(",")+`});
|
|
`}),b=b+"new (("+V.toString().replace("ENTRY_MODULE",JSON.stringify(f))+")({"+g.main.map(function(C){return""+JSON.stringify(C)+": "+p.main[C].toString()}).join(",")+"}))(self);";var o=new window.Blob([b],{type:"text/javascript"});if(w.bare)return o;var i=window.URL||window.webkitURL||window.mozURL||window.msURL,s=i.createObjectURL(o),l=new window.Worker(s);return l.objectURL=s,l}},"./src/config.ts":function(ie,$,O){"use strict";O.r($),O.d($,"hlsDefaultConfig",function(){return k}),O.d($,"mergeConfig",function(){return E}),O.d($,"enableStreamingMode",function(){return y});var V=O("./src/controller/abr-controller.ts"),I=O("./src/controller/audio-stream-controller.ts"),M=O("./src/controller/audio-track-controller.ts"),W=O("./src/controller/subtitle-stream-controller.ts"),N=O("./src/controller/subtitle-track-controller.ts"),P=O("./src/controller/buffer-controller.ts"),R=O("./src/controller/timeline-controller.ts"),d=O("./src/controller/cap-level-controller.ts"),f=O("./src/controller/fps-controller.ts"),w=O("./src/controller/eme-controller.ts"),p=O("./src/controller/cmcd-controller.ts"),g=O("./src/utils/xhr-loader.ts"),b=O("./src/utils/fetch-loader.ts"),o=O("./src/utils/cues.ts"),i=O("./src/utils/mediakeys-helper.ts"),s=O("./src/utils/logger.ts");function l(){return l=Object.assign||function(c){for(var u=1;u<arguments.length;u++){var A=arguments[u];for(var S in A)Object.prototype.hasOwnProperty.call(A,S)&&(c[S]=A[S])}return c},l.apply(this,arguments)}function C(c,u){var A=Object.keys(c);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(c);u&&(S=S.filter(function(T){return Object.getOwnPropertyDescriptor(c,T).enumerable})),A.push.apply(A,S)}return A}function m(c){for(var u=1;u<arguments.length;u++){var A=arguments[u]!=null?arguments[u]:{};u%2?C(Object(A),!0).forEach(function(S){v(c,S,A[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(c,Object.getOwnPropertyDescriptors(A)):C(Object(A)).forEach(function(S){Object.defineProperty(c,S,Object.getOwnPropertyDescriptor(A,S))})}return c}function v(c,u,A){return u in c?Object.defineProperty(c,u,{value:A,enumerable:!0,configurable:!0,writable:!0}):c[u]=A,c}var k=m(m({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:g.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:V.default,bufferController:P.default,capLevelController:d.default,fpsController:f.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:i.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},L()),{},{subtitleStreamController:W.SubtitleStreamController,subtitleTrackController:N.default,timelineController:R.TimelineController,audioStreamController:I.default,audioTrackController:M.default,emeController:w.default,cmcdController:p.default});function L(){return{cueHandler:o.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function E(c,u){if((u.liveSyncDurationCount||u.liveMaxLatencyDurationCount)&&(u.liveSyncDuration||u.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(u.liveMaxLatencyDurationCount!==void 0&&(u.liveSyncDurationCount===void 0||u.liveMaxLatencyDurationCount<=u.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(u.liveMaxLatencyDuration!==void 0&&(u.liveSyncDuration===void 0||u.liveMaxLatencyDuration<=u.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return l({},c,u)}function y(c){var u=c.loader;if(u!==b.default&&u!==g.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),c.progressive=!1;else{var A=Object(b.fetchSupported)();A&&(c.loader=b.default,c.progressive=!0,c.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ie,$,O){"use strict";O.r($);var V=O("./src/polyfills/number.ts"),I=O("./src/utils/ewma-bandwidth-estimator.ts"),M=O("./src/events.ts"),W=O("./src/utils/buffer-helper.ts"),N=O("./src/errors.ts"),P=O("./src/types/loader.ts"),R=O("./src/utils/logger.ts");function d(p,g){for(var b=0;b<g.length;b++){var o=g[b];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(p,o.key,o)}}function f(p,g,b){return g&&d(p.prototype,g),b&&d(p,b),p}var w=function(){function p(b){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=b;var o=b.config;this.bwEstimator=new I.default(o.abrEwmaSlowVoD,o.abrEwmaFastVoD,o.abrEwmaDefaultEstimate),this.registerListeners()}var g=p.prototype;return g.registerListeners=function(){var o=this.hls;o.on(M.Events.FRAG_LOADING,this.onFragLoading,this),o.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),o.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this),o.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.on(M.Events.ERROR,this.onError,this)},g.unregisterListeners=function(){var o=this.hls;o.off(M.Events.FRAG_LOADING,this.onFragLoading,this),o.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),o.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this),o.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.off(M.Events.ERROR,this.onError,this)},g.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},g.onFragLoading=function(o,i){var s=i.frag;if(s.type===P.PlaylistLevelType.MAIN&&!this.timer){var l;this.fragCurrent=s,this.partCurrent=(l=i.part)!=null?l:null,this.timer=self.setInterval(this.onCheck,100)}},g.onLevelLoaded=function(o,i){var s=this.hls.config;i.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},g._abandonRulesCheck=function(){var o=this.fragCurrent,i=this.partCurrent,s=this.hls,l=s.autoLevelEnabled,C=s.config,m=s.media;if(!o||!m)return;var v=i?i.stats:o.stats,k=i?i.duration:o.duration;if(v.aborted){R.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!l||m.paused||!m.playbackRate||!m.readyState)return;var L=performance.now()-v.loading.start,E=Math.abs(m.playbackRate);if(L<=500*k/E)return;var y=s.levels,c=s.minAutoLevel,u=y[o.level],A=v.total||Math.max(v.loaded,Math.round(k*u.maxBitrate/8)),S=Math.max(1,v.bwEstimate?v.bwEstimate/8:v.loaded*1e3/L),T=(A-v.loaded)/S,_=m.currentTime,j=(W.BufferHelper.bufferInfo(m,_,C.maxBufferHole).end-_)/E;if(j>=2*k/E||T<=j)return;var z=Number.POSITIVE_INFINITY,Z;for(Z=o.level-1;Z>c;Z--){var K=y[Z].maxBitrate;if(z=k*K/(8*.8*S),z<j)break}if(z>=T)return;var F=this.bwEstimator.getEstimate();R.logger.warn("Fragment "+o.sn+(i?" part "+i.index:"")+" of level "+o.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+Z+`
|
|
Current BW estimate: `+(Object(V.isFiniteNumber)(F)?(F/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+T.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+z.toFixed(3)+` s
|
|
Time to underbuffer: `+j.toFixed(3)+" s"),s.nextLoadLevel=Z,this.bwEstimator.sample(L,v.loaded),this.clearTimer(),o.loader&&(this.fragCurrent=this.partCurrent=null,o.loader.abort()),s.trigger(M.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:o,part:i,stats:v})},g.onFragLoaded=function(o,i){var s=i.frag,l=i.part;if(s.type===P.PlaylistLevelType.MAIN&&Object(V.isFiniteNumber)(s.sn)){var C=l?l.stats:s.stats,m=l?l.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var v=this.hls.levels[s.level],k=(v.loaded?v.loaded.bytes:0)+C.loaded,L=(v.loaded?v.loaded.duration:0)+m;v.loaded={bytes:k,duration:L},v.realBitrate=Math.round(8*k/L)}if(s.bitrateTest){var E={stats:C,frag:s,part:l,id:s.type};this.onFragBuffered(M.Events.FRAG_BUFFERED,E),s.bitrateTest=!1}}},g.onFragBuffered=function(o,i){var s=i.frag,l=i.part,C=l?l.stats:s.stats;if(C.aborted)return;if(s.type!==P.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var m=C.parsing.end-C.loading.start;this.bwEstimator.sample(m,C.loaded),C.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=m/1e3:this.bitrateTestDelay=0},g.onError=function(o,i){switch(i.details){case N.ErrorDetails.FRAG_LOAD_ERROR:case N.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},g.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},g.getNextABRAutoLevel=function(){var o=this.fragCurrent,i=this.partCurrent,s=this.hls,l=s.maxAutoLevel,C=s.config,m=s.minAutoLevel,v=s.media,k=i?i.duration:o?o.duration:0,L=v?v.currentTime:0,E=v&&v.playbackRate!==0?Math.abs(v.playbackRate):1,y=this.bwEstimator?this.bwEstimator.getEstimate():C.abrEwmaDefaultEstimate,c=(W.BufferHelper.bufferInfo(v,L,C.maxBufferHole).end-L)/E,u=this.findBestLevel(y,m,l,c,C.abrBandWidthFactor,C.abrBandWidthUpFactor);if(u>=0)return u;R.logger.trace((c?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var A=k?Math.min(k,C.maxStarvationDelay):C.maxStarvationDelay,S=C.abrBandWidthFactor,T=C.abrBandWidthUpFactor;if(!c){var _=this.bitrateTestDelay;if(_){var j=k?Math.min(k,C.maxLoadingDelay):C.maxLoadingDelay;A=j-_,R.logger.trace("bitrate test took "+Math.round(1e3*_)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*A)+" ms"),S=T=1}}return u=this.findBestLevel(y,m,l,c+A,S,T),Math.max(u,0)},g.findBestLevel=function(o,i,s,l,C,m){for(var v,k=this.fragCurrent,L=this.partCurrent,E=this.lastLoadedFragLevel,y=this.hls.levels,c=y[E],u=!!(c!=null&&(v=c.details)!==null&&v!==void 0&&v.live),A=c==null?void 0:c.codecSet,S=L?L.duration:k?k.duration:0,T=s;T>=i;T--){var _=y[T];if(!_||A&&_.codecSet!==A)continue;var j=_.details,z=(L?j==null?void 0:j.partTarget:j==null?void 0:j.averagetargetduration)||S,Z=void 0;T<=E?Z=C*o:Z=m*o;var K=y[T].maxBitrate,F=K*z/Z;if(R.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+T+"/"+Math.round(Z)+"/"+K+"/"+z+"/"+l+"/"+F),Z>K&&(!F||u&&!this.bitrateTestDelay||F<l))return T}return-1},f(p,[{key:"nextAutoLevel",get:function(){var o=this._nextAutoLevel,i=this.bwEstimator;if(o!==-1&&(!i||!i.canEstimate()))return o;var s=this.getNextABRAutoLevel();return o!==-1&&(s=Math.min(o,s)),s},set:function(o){this._nextAutoLevel=o}}]),p}();$.default=w},"./src/controller/audio-stream-controller.ts":function(ie,$,O){"use strict";O.r($);var V=O("./src/polyfills/number.ts"),I=O("./src/controller/base-stream-controller.ts"),M=O("./src/events.ts"),W=O("./src/utils/buffer-helper.ts"),N=O("./src/controller/fragment-tracker.ts"),P=O("./src/types/level.ts"),R=O("./src/types/loader.ts"),d=O("./src/loader/fragment.ts"),f=O("./src/demux/chunk-cache.ts"),w=O("./src/demux/transmuxer-interface.ts"),p=O("./src/types/transmuxer.ts"),g=O("./src/controller/fragment-finders.ts"),b=O("./src/utils/discontinuities.ts"),o=O("./src/errors.ts"),i=O("./src/utils/logger.ts");function s(){return s=Object.assign||function(k){for(var L=1;L<arguments.length;L++){var E=arguments[L];for(var y in E)Object.prototype.hasOwnProperty.call(E,y)&&(k[y]=E[y])}return k},s.apply(this,arguments)}function l(k,L){k.prototype=Object.create(L.prototype),k.prototype.constructor=k,C(k,L)}function C(k,L){return C=Object.setPrototypeOf||function(y,c){return y.__proto__=c,y},C(k,L)}var m=100,v=function(k){l(L,k);function L(y,c){var u;return u=k.call(this,y,c,"[audio-stream-controller]")||this,u.videoBuffer=null,u.videoTrackCC=-1,u.waitingVideoCC=-1,u.audioSwitch=!1,u.trackId=-1,u.waitingData=null,u.mainDetails=null,u.bufferFlushed=!1,u._registerListeners(),u}var E=L.prototype;return E.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},E._registerListeners=function(){var c=this.hls;c.on(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),c.on(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),c.on(M.Events.ERROR,this.onError,this),c.on(M.Events.BUFFER_RESET,this.onBufferReset,this),c.on(M.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),c.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},E._unregisterListeners=function(){var c=this.hls;c.off(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),c.off(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),c.off(M.Events.ERROR,this.onError,this),c.off(M.Events.BUFFER_RESET,this.onBufferReset,this),c.off(M.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),c.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},E.onInitPtsFound=function(c,u){var A=u.frag,S=u.id,T=u.initPTS;if(S==="main"){var _=A.cc;this.initPTS[A.cc]=T,this.log("InitPTS for cc: "+_+" found from main: "+T),this.videoTrackCC=_,this.state===I.State.WAITING_INIT_PTS&&this.tick()}},E.startLoad=function(c){if(!this.levels){this.startPosition=c,this.state=I.State.STOPPED;return}var u=this.lastCurrentTime;this.stopLoad(),this.setInterval(m),this.fragLoadError=0,u>0&&c===-1?(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),this.state=I.State.IDLE):(this.loadedmetadata=!1,this.state=I.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()},E.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_TRACK:{var c,u=this.levels,A=this.trackId,S=u==null||((c=u[A])===null||c===void 0)?void 0:c.details;if(S){if(this.waitForCdnTuneIn(S))break;this.state=I.State.WAITING_INIT_PTS}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var T,_=performance.now(),j=this.retryDate;(!j||_>=j||(T=this.media)!==null&&T!==void 0&&T.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=I.State.IDLE);break}case I.State.WAITING_INIT_PTS:{var z=this.waitingData;if(z){var Z=z.frag,K=z.part,F=z.cache,ee=z.complete;if(this.initPTS[Z.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.FRAG_LOADING;var se=F.flush(),he={frag:Z,part:K,payload:se,networkDetails:null};this._handleFragmentLoadProgress(he),ee&&k.prototype._handleFragmentLoadComplete.call(this,he)}else if(this.videoTrackCC!==this.waitingVideoCC)i.logger.log("Waiting fragment cc ("+Z.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var Ce=this.getLoadPosition(),Ue=W.BufferHelper.bufferInfo(this.mediaBuffer,Ce,this.config.maxBufferHole),ke=Object(g.fragmentWithinToleranceTest)(Ue.end,this.config.maxFragLookUpTolerance,Z);ke<0&&(i.logger.log("Waiting fragment cc ("+Z.cc+") @ "+Z.start+" cancelled because another fragment at "+Ue.end+" is needed"),this.clearWaitingFragment())}}else this.state=I.State.IDLE}}this.onTickEnd()},E.clearWaitingFragment=function(){var c=this.waitingData;c&&(this.fragmentTracker.removeFragment(c.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.IDLE)},E.onTickEnd=function(){var c=this.media;if(!c||!c.readyState)return;var u=this.mediaBuffer?this.mediaBuffer:c,A=u.buffered;!this.loadedmetadata&&A.length&&(this.loadedmetadata=!0),this.lastCurrentTime=c.currentTime},E.doTickIdle=function(){var c,u,A=this.hls,S=this.levels,T=this.media,_=this.trackId,j=A.config;if(!S||!S[_])return;if(!T&&(this.startFragRequested||!j.startFragPrefetch))return;var z=S[_],Z=z.details;if(!Z||Z.live&&this.levelLastLoaded!==_||this.waitForCdnTuneIn(Z)){this.state=I.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,d.ElementaryStreamTypes.AUDIO,R.PlaylistLevelType.AUDIO));var K=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,R.PlaylistLevelType.AUDIO);if(K===null)return;var F=K.len,ee=this.getMaxBufferLength(),se=this.audioSwitch;if(F>=ee&&!se)return;if(!se&&this._streamEnded(K,Z)){A.trigger(M.Events.BUFFER_EOS,{type:"audio"}),this.state=I.State.ENDED;return}var he=Z.fragments,Ce=he[0].start,Ue=K.end;if(se){var ke=this.getLoadPosition();Ue=ke,Z.PTSKnown&&ke<Ce&&((K.end>Ce||K.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),T.currentTime=Ce+.05))}var Me=this.getNextFragment(Ue,Z);if(!Me){this.bufferFlushed=!0;return}((c=Me.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((u=Me.decryptdata)!==null&&u!==void 0&&u.key)?this.loadKey(Me,Z):this.loadFragment(Me,Z,Ue)},E.getMaxBufferLength=function(){var c=k.prototype.getMaxBufferLength.call(this),u=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,R.PlaylistLevelType.MAIN);return u===null?c:Math.max(c,u.len)},E.onMediaDetaching=function(){this.videoBuffer=null,k.prototype.onMediaDetaching.call(this)},E.onAudioTracksUpdated=function(c,u){var A=u.audioTracks;this.resetTransmuxer(),this.levels=A.map(function(S){return new P.Level(S)})},E.onAudioTrackSwitching=function(c,u){var A=!!u.url;this.trackId=u.id;var S=this.fragCurrent;S!=null&&S.loader&&S.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),A?this.setInterval(m):this.resetTransmuxer(),A?(this.audioSwitch=!0,this.state=I.State.IDLE):this.state=I.State.STOPPED,this.tick()},E.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},E.onLevelLoaded=function(c,u){this.mainDetails=u.details},E.onAudioTrackLoaded=function(c,u){var A,S=this.levels,T=u.details,_=u.id;if(!S){this.warn("Audio tracks were reset while loading level "+_);return}this.log("Track "+_+" loaded ["+T.startSN+","+T.endSN+"],duration:"+T.totalduration);var j=S[_],z=0;if(T.live||(A=j.details)!==null&&A!==void 0&&A.live){var Z=this.mainDetails;if(T.fragments[0]||(T.deltaUpdateFailed=!0),T.deltaUpdateFailed||!Z)return;!j.details&&T.hasProgramDateTime&&Z.hasProgramDateTime?(Object(b.alignMediaPlaylistByPDT)(T,Z),z=T.fragments[0].start):z=this.alignPlaylists(T,j.details)}j.details=T,this.levelLastLoaded=_,!this.startFragRequested&&(this.mainDetails||!T.live)&&this.setStartPosition(j.details,z),this.state===I.State.WAITING_TRACK&&!this.waitForCdnTuneIn(T)&&(this.state=I.State.IDLE),this.tick()},E._handleFragmentLoadProgress=function(c){var u,A=c.frag,S=c.part,T=c.payload,_=this.config,j=this.trackId,z=this.levels;if(!z){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+A.sn+" of level "+A.level+" will not be buffered");return}var Z=z[j];console.assert(Z,"Audio track is defined on fragment load progress");var K=Z.details;console.assert(K,"Audio track details are defined on fragment load progress");var F=_.defaultAudioCodec||Z.audioCodec||"mp4a.40.2",ee=this.transmuxer;ee||(ee=this.transmuxer=new w.default(this.hls,R.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var se=this.initPTS[A.cc],he=(u=A.initSegment)===null||u===void 0?void 0:u.data;if(se!==void 0){var Ce=!1,Ue=S?S.index:-1,ke=Ue!==-1,Me=new p.ChunkMetadata(A.level,A.sn,A.stats.chunkCount,T.byteLength,Ue,ke);ee.push(T,he,F,"",A,S,K.totalduration,Ce,Me,se)}else{i.logger.log("Unknown video PTS for cc "+A.cc+", waiting for video PTS before demuxing audio frag "+A.sn+" of ["+K.startSN+" ,"+K.endSN+"],track "+j);var ce=this.waitingData=this.waitingData||{frag:A,part:S,cache:new f.default,complete:!1},ve=ce.cache;ve.push(new Uint8Array(T)),this.waitingVideoCC=this.videoTrackCC,this.state=I.State.WAITING_INIT_PTS}},E._handleFragmentLoadComplete=function(c){if(this.waitingData){this.waitingData.complete=!0;return}k.prototype._handleFragmentLoadComplete.call(this,c)},E.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},E.onBufferCreated=function(c,u){var A=u.tracks.audio;A&&(this.mediaBuffer=A.buffer),u.tracks.video&&(this.videoBuffer=u.tracks.video.buffer)},E.onFragBuffered=function(c,u){var A=u.frag,S=u.part;if(A.type!==R.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(A)){this.warn("Fragment "+A.sn+(S?" p: "+S.index:"")+" of level "+A.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}A.sn!=="initSegment"&&(this.fragPrevious=A,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(M.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(A,S)},E.onError=function(c,u){switch(u.details){case o.ErrorDetails.FRAG_LOAD_ERROR:case o.ErrorDetails.FRAG_LOAD_TIMEOUT:case o.ErrorDetails.KEY_LOAD_ERROR:case o.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.AUDIO,u);break;case o.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case o.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==I.State.ERROR&&this.state!==I.State.STOPPED&&(this.state=u.fatal?I.State.ERROR:I.State.IDLE,this.warn(u.details+" while loading frag, switching to "+this.state+" state"));break;case o.ErrorDetails.BUFFER_FULL_ERROR:if(u.parent==="audio"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var A=!0,S=this.getFwdBufferInfo(this.mediaBuffer,R.PlaylistLevelType.AUDIO);S&&S.len>.5&&(A=!this.reduceMaxBufferLength(S.len)),A&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,k.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},E.onBufferFlushed=function(c,u){var A=u.type;A===d.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},E._handleTransmuxComplete=function(c){var u,A="audio",S=this.hls,T=c.remuxResult,_=c.chunkMeta,j=this.getCurrentContext(_);if(!j){this.warn("The loading context changed while buffering fragment "+_.sn+" of level "+_.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(_.level);return}var z=j.frag,Z=j.part,K=T.audio,F=T.text,ee=T.id3,se=T.initSegment;if(this.fragContextChanged(z))return;if(this.state=I.State.PARSING,this.audioSwitch&&K&&this.completeAudioSwitch(),se!=null&&se.tracks&&(this._bufferInitSegment(se.tracks,z,_),S.trigger(M.Events.FRAG_PARSING_INIT_SEGMENT,{frag:z,id:A,tracks:se.tracks})),K){var he=K.startPTS,Ce=K.endPTS,Ue=K.startDTS,ke=K.endDTS;Z&&(Z.elementaryStreams[d.ElementaryStreamTypes.AUDIO]={startPTS:he,endPTS:Ce,startDTS:Ue,endDTS:ke}),z.setElementaryStreamInfo(d.ElementaryStreamTypes.AUDIO,he,Ce,Ue,ke),this.bufferFragmentData(K,z,Z,_)}if(ee!=null&&(u=ee.samples)!==null&&u!==void 0&&u.length){var Me=s({frag:z,id:A},ee);S.trigger(M.Events.FRAG_PARSING_METADATA,Me)}if(F){var ce=s({frag:z,id:A},F);S.trigger(M.Events.FRAG_PARSING_USERDATA,ce)}},E._bufferInitSegment=function(c,u,A){if(this.state!==I.State.PARSING)return;c.video&&delete c.video;var S=c.audio;if(!S)return;S.levelCodec=S.codec,S.id="audio",this.log("Init audio buffer, container:"+S.container+", codecs[parsed]=["+S.codec+"]"),this.hls.trigger(M.Events.BUFFER_CODECS,c);var T=S.initSegment;if(T!=null&&T.byteLength){var _={type:"audio",frag:u,part:null,chunkMeta:A,parent:u.type,data:T};this.hls.trigger(M.Events.BUFFER_APPENDING,_)}this.tick()},E.loadFragment=function(c,u,A){var S=this.fragmentTracker.getState(c);this.fragCurrent=c,(this.audioSwitch||S===N.FragmentState.NOT_LOADED||S===N.FragmentState.PARTIAL)&&(c.sn==="initSegment"?this._loadInitSegment(c):u.live&&!Object(V.isFiniteNumber)(this.initPTS[c.cc])?(this.log("Waiting for video PTS in continuity counter "+c.cc+" of live stream before loading audio fragment "+c.sn+" of level "+this.trackId),this.state=I.State.WAITING_INIT_PTS):(this.startFragRequested=!0,k.prototype.loadFragment.call(this,c,u,A)))},E.completeAudioSwitch=function(){var c=this.hls,u=this.media,A=this.trackId;u&&(this.log("Switching audio track : flushing all audio"),k.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,c.trigger(M.Events.AUDIO_TRACK_SWITCHED,{id:A})},L}(I.default);$.default=v},"./src/controller/audio-track-controller.ts":function(ie,$,O){"use strict";O.r($);var V=O("./src/events.ts"),I=O("./src/errors.ts"),M=O("./src/controller/base-playlist-controller.ts"),W=O("./src/types/loader.ts");function N(w,p){for(var g=0;g<p.length;g++){var b=p[g];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(w,b.key,b)}}function P(w,p,g){return p&&N(w.prototype,p),g&&N(w,g),w}function R(w,p){w.prototype=Object.create(p.prototype),w.prototype.constructor=w,d(w,p)}function d(w,p){return d=Object.setPrototypeOf||function(b,o){return b.__proto__=o,b},d(w,p)}var f=function(w){R(p,w);function p(b){var o;return o=w.call(this,b,"[audio-track-controller]")||this,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.trackName="",o.selectDefaultTrack=!0,o.registerListeners(),o}var g=p.prototype;return g.registerListeners=function(){var o=this.hls;o.on(V.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(V.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(V.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(V.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(V.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),o.on(V.Events.ERROR,this.onError,this)},g.unregisterListeners=function(){var o=this.hls;o.off(V.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(V.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(V.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(V.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(V.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),o.off(V.Events.ERROR,this.onError,this)},g.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,w.prototype.destroy.call(this)},g.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},g.onManifestParsed=function(o,i){this.tracks=i.audioTracks||[]},g.onAudioTrackLoaded=function(o,i){var s=i.id,l=i.details,C=this.tracksInGroup[s];if(!C){this.warn("Invalid audio track id "+s);return}var m=C.details;C.details=i.details,this.log("audioTrack "+s+" loaded ["+l.startSN+"-"+l.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,i,m))},g.onLevelLoading=function(o,i){this.switchLevel(i.level)},g.onLevelSwitching=function(o,i){this.switchLevel(i.level)},g.switchLevel=function(o){var i=this.hls.levels[o];if(!(i!=null&&i.audioGroupIds))return;var s=i.audioGroupIds[i.urlId];if(this.groupId!==s){this.groupId=s;var l=this.tracks.filter(function(m){return!s||m.groupId===s});this.selectDefaultTrack&&!l.some(function(m){return m.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=l;var C={audioTracks:l};this.log("Updating audio tracks, "+l.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(V.Events.AUDIO_TRACKS_UPDATED,C),this.selectInitialTrack()}},g.onError=function(o,i){if(w.prototype.onError.call(this,o,i),i.fatal||!i.context)return;i.context.type===W.PlaylistContextType.AUDIO_TRACK&&i.context.id===this.trackId&&i.context.groupId===this.groupId&&this.retryLoadingOrFail(i)},g.setAudioTrack=function(o){var i=this.tracksInGroup;if(o<0||o>=i.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=i[this.trackId];this.log("Now switching to audio-track index "+o);var l=i[o],C=l.id,m=l.groupId,v=m===void 0?"":m,k=l.name,L=l.type,E=l.url;if(this.trackId=o,this.trackName=k,this.selectDefaultTrack=!1,this.hls.trigger(V.Events.AUDIO_TRACK_SWITCHING,{id:C,groupId:v,name:k,type:L,url:E}),l.details&&!l.details.live)return;var y=this.switchParams(l.url,s==null?void 0:s.details);this.loadPlaylist(y)},g.selectInitialTrack=function(){var o=this.tracksInGroup;console.assert(o.length,"Initial audio track should be selected when tracks are known");var i=this.trackName,s=this.findTrackId(i)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(V.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},g.findTrackId=function(o){for(var i=this.tracksInGroup,s=0;s<i.length;s++){var l=i[s];if((!this.selectDefaultTrack||l.default)&&(!o||o===l.name))return l.id}return-1},g.loadPlaylist=function(o){var i=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(i)){var s=i.id,l=i.groupId,C=i.url;if(o)try{C=o.addDirectives(C)}catch(m){this.warn("Could not construct new URL with HLS Delivery Directives: "+m)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(V.Events.AUDIO_TRACK_LOADING,{url:C,id:s,groupId:l,deliveryDirectives:o||null})}},P(p,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1,this.setAudioTrack(o)}}]),p}(M.default);$.default=f},"./src/controller/base-playlist-controller.ts":function(ie,$,O){"use strict";O.r($),O.d($,"default",function(){return P});var V=O("./src/polyfills/number.ts"),I=O("./src/types/level.ts"),M=O("./src/controller/level-helper.ts"),W=O("./src/utils/logger.ts"),N=O("./src/errors.ts"),P=function(){function R(f,w){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=W.logger.log.bind(W.logger,w+":"),this.warn=W.logger.warn.bind(W.logger,w+":"),this.hls=f}var d=R.prototype;return d.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},d.onError=function(w,p){p.fatal&&p.type===N.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},d.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},d.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},d.stopLoad=function(){this.canLoad=!1,this.clearTimer()},d.switchParams=function(w,p){var g=p==null?void 0:p.renditionReports;if(g)for(var b=0;b<g.length;b++){var o=g[b],i=""+o.URI;if(i===w.substr(-i.length)){var s=parseInt(o["LAST-MSN"]),l=parseInt(o["LAST-PART"]);if(p&&this.hls.config.lowLatencyMode){var C=Math.min(p.age-p.partTarget,p.targetduration);l!==void 0&&C>p.partTarget&&(l+=1)}if(Object(V.isFiniteNumber)(s))return new I.HlsUrlParameters(s,Object(V.isFiniteNumber)(l)?l:void 0,I.HlsSkip.No)}}},d.loadPlaylist=function(w){},d.shouldLoadTrack=function(w){return this.canLoad&&w&&!!w.url&&(!w.details||w.details.live)},d.playlistLoaded=function(w,p,g){var b=this,o=p.details,i=p.stats,s=i.loading.end?Math.max(0,self.performance.now()-i.loading.end):0;if(o.advancedDateTime=Date.now()-s,o.live||g!=null&&g.live){if(o.reloaded(g),g&&this.log("live playlist "+w+" "+(o.advanced?"REFRESHED "+o.lastPartSn+"-"+o.lastPartIndex:"MISSED")),g&&o.fragments.length>0&&Object(M.mergeDetails)(g,o),!this.canLoad||!o.live)return;var l,C=void 0,m=void 0;if(o.canBlockReload&&o.endSN&&o.advanced){var v=this.hls.config.lowLatencyMode,k=o.lastPartSn,L=o.endSN,E=o.lastPartIndex,y=E!==-1,c=k===L,u=v?0:E;y?(C=c?L+1:k,m=c?u:E+1):C=L+1;var A=o.age,S=A+o.ageHeader,T=Math.min(S-o.partTarget,o.targetduration*1.5);if(T>0){if(g&&T>g.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+g.tuneInGoal+" to: "+T+" with playlist age: "+o.age),T=0;else{var _=Math.floor(T/o.targetduration);if(C+=_,m!==void 0){var j=Math.round(T%o.targetduration/o.partTarget);m+=j}this.log("CDN Tune-in age: "+o.ageHeader+"s last advanced "+A.toFixed(2)+"s goal: "+T+" skip sn "+_+" to part "+m)}o.tuneInGoal=T}if(l=this.getDeliveryDirectives(o,p.deliveryDirectives,C,m),v||!c){this.loadPlaylist(l);return}}else l=this.getDeliveryDirectives(o,p.deliveryDirectives,C,m);var z=Object(M.computeReloadInterval)(o,i);C!==void 0&&o.canBlockReload&&(z-=o.partTarget||1),this.log("reload live playlist "+w+" in "+Math.round(z)+" ms"),this.timer=self.setTimeout(function(){return b.loadPlaylist(l)},z)}else this.clearTimer()},d.getDeliveryDirectives=function(w,p,g,b){var o=Object(I.getSkipValue)(w,g);return p!=null&&p.skip&&w.deltaUpdateFailed&&(g=p.msn,b=p.part,o=I.HlsSkip.No),new I.HlsUrlParameters(g,b,o)},d.retryLoadingOrFail=function(w){var p=this,g=this.hls.config,b=this.retryCount<g.levelLoadingMaxRetry;if(b){var o;if(this.retryCount++,w.details.indexOf("LoadTimeOut")>-1&&(o=w.context)!==null&&o!==void 0&&o.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+w.details+'"'),this.loadPlaylist();else{var i=Math.min(Math.pow(2,this.retryCount)*g.levelLoadingRetryDelay,g.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return p.loadPlaylist()},i),this.warn("retry playlist loading #"+this.retryCount+" in "+i+' ms after "'+w.details+'"')}}else this.warn('cannot recover from error "'+w.details+'"'),this.clearTimer(),w.fatal=!0;return b},R}()},"./src/controller/base-stream-controller.ts":function(ie,$,O){"use strict";O.r($),O.d($,"State",function(){return L}),O.d($,"default",function(){return E});var V=O("./src/polyfills/number.ts"),I=O("./src/task-loop.ts"),M=O("./src/controller/fragment-tracker.ts"),W=O("./src/utils/buffer-helper.ts"),N=O("./src/utils/logger.ts"),P=O("./src/events.ts"),R=O("./src/errors.ts"),d=O("./src/types/transmuxer.ts"),f=O("./src/utils/mp4-tools.ts"),w=O("./src/utils/discontinuities.ts"),p=O("./src/controller/fragment-finders.ts"),g=O("./src/controller/level-helper.ts"),b=O("./src/loader/fragment-loader.ts"),o=O("./src/crypt/decrypter.ts"),i=O("./src/utils/time-ranges.ts"),s=O("./src/types/loader.ts");function l(y,c){for(var u=0;u<c.length;u++){var A=c[u];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(y,A.key,A)}}function C(y,c,u){return c&&l(y.prototype,c),u&&l(y,u),y}function m(y){if(y===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return y}function v(y,c){y.prototype=Object.create(c.prototype),y.prototype.constructor=y,k(y,c)}function k(y,c){return k=Object.setPrototypeOf||function(A,S){return A.__proto__=S,A},k(y,c)}var L={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},E=function(y){v(c,y);function c(A,S,T){var _;return _=y.call(this)||this,_.hls=void 0,_.fragPrevious=null,_.fragCurrent=null,_.fragmentTracker=void 0,_.transmuxer=null,_._state=L.STOPPED,_.media=void 0,_.mediaBuffer=void 0,_.config=void 0,_.bitrateTest=!1,_.lastCurrentTime=0,_.nextLoadPosition=0,_.startPosition=0,_.loadedmetadata=!1,_.fragLoadError=0,_.retryDate=0,_.levels=null,_.fragmentLoader=void 0,_.levelLastLoaded=null,_.startFragRequested=!1,_.decrypter=void 0,_.initPTS=[],_.onvseeking=null,_.onvended=null,_.logPrefix="",_.log=void 0,_.warn=void 0,_.logPrefix=T,_.log=N.logger.log.bind(N.logger,T+":"),_.warn=N.logger.warn.bind(N.logger,T+":"),_.hls=A,_.fragmentLoader=new b.default(A.config),_.fragmentTracker=S,_.config=A.config,_.decrypter=new o.default(A,A.config),A.on(P.Events.KEY_LOADED,_.onKeyLoaded,m(_)),_}var u=c.prototype;return u.doTick=function(){this.onTickEnd()},u.onTickEnd=function(){},u.startLoad=function(S){},u.stopLoad=function(){this.fragmentLoader.abort();var S=this.fragCurrent;S&&this.fragmentTracker.removeFragment(S),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=L.STOPPED},u._streamEnded=function(S,T){var _=this.fragCurrent,j=this.fragmentTracker;if(!T.live&&_&&_.sn===T.endSN&&!S.nextStart){var z=j.getState(_);return z===M.FragmentState.PARTIAL||z===M.FragmentState.OK}return!1},u.onMediaAttached=function(S,T){var _=this.media=this.mediaBuffer=T.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),_.addEventListener("seeking",this.onvseeking),_.addEventListener("ended",this.onvended);var j=this.config;this.levels&&j.autoStartLoad&&this.state===L.STOPPED&&this.startLoad(j.startPosition)},u.onMediaDetaching=function(){var S=this.media;S!=null&&S.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),S&&(S.removeEventListener("seeking",this.onvseeking),S.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},u.onMediaSeeking=function(){var S=this.config,T=this.fragCurrent,_=this.media,j=this.mediaBuffer,z=this.state,Z=_?_.currentTime:0,K=W.BufferHelper.bufferInfo(j||_,Z,S.maxBufferHole);if(this.log("media seeking to "+(Object(V.isFiniteNumber)(Z)?Z.toFixed(3):Z)+", state: "+z),z===L.ENDED)this.resetLoadingState();else if(T&&!K.len){var F=S.maxFragLookUpTolerance,ee=T.start-F,se=T.start+T.duration+F,he=Z>se;(Z<ee||he)&&(he&&T.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),T.loader.abort()),this.resetLoadingState())}_&&(this.lastCurrentTime=Z),!this.loadedmetadata&&!K.len&&(this.nextLoadPosition=this.startPosition=Z),this.tickImmediate()},u.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},u.onKeyLoaded=function(S,T){if(this.state!==L.KEY_LOADING||T.frag!==this.fragCurrent||!this.levels)return;this.state=L.IDLE;var _=this.levels[T.frag.level].details;_&&this.loadFragment(T.frag,_,T.frag.start)},u.onHandlerDestroying=function(){this.stopLoad(),y.prototype.onHandlerDestroying.call(this)},u.onHandlerDestroyed=function(){this.state=L.STOPPED,this.hls.off(P.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,y.prototype.onHandlerDestroyed.call(this)},u.loadKey=function(S,T){this.log("Loading key for "+S.sn+" of ["+T.startSN+"-"+T.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+S.level),this.state=L.KEY_LOADING,this.fragCurrent=S,this.hls.trigger(P.Events.KEY_LOADING,{frag:S})},u.loadFragment=function(S,T,_){this._loadFragForPlayback(S,T,_)},u._loadFragForPlayback=function(S,T,_){var j=this,z=function(K){if(j.fragContextChanged(S)){j.warn("Fragment "+S.sn+(K.part?" p: "+K.part.index:"")+" of level "+S.level+" was dropped during download."),j.fragmentTracker.removeFragment(S);return}S.stats.chunkCount++,j._handleFragmentLoadProgress(K)};this._doFragLoad(S,T,_,z).then(function(Z){if(!Z)return;j.fragLoadError=0;var K=j.state;if(j.fragContextChanged(S)){(K===L.FRAG_LOADING||K===L.BACKTRACKING||!j.fragCurrent&&K===L.PARSING)&&(j.fragmentTracker.removeFragment(S),j.state=L.IDLE);return}if("payload"in Z&&(j.log("Loaded fragment "+S.sn+" of level "+S.level),j.hls.trigger(P.Events.FRAG_LOADED,Z),j.state===L.BACKTRACKING)){j.fragmentTracker.backtrack(S,Z),j.resetFragmentLoading(S);return}j._handleFragmentLoadComplete(Z)}).catch(function(Z){j.warn(Z),j.resetFragmentLoading(S)})},u.flushMainBuffer=function(S,T,_){if(_===void 0&&(_=null),!(S-T))return;var j={startOffset:S,endOffset:T,type:_};this.fragLoadError=0,this.hls.trigger(P.Events.BUFFER_FLUSHING,j)},u._loadInitSegment=function(S){var T=this;this._doFragLoad(S).then(function(_){if(!_||T.fragContextChanged(S)||!T.levels)throw new Error("init load aborted");return _}).then(function(_){var j=T.hls,z=_.payload,Z=S.decryptdata;if(z&&z.byteLength>0&&Z&&Z.key&&Z.iv&&Z.method==="AES-128"){var K=self.performance.now();return T.decrypter.webCryptoDecrypt(new Uint8Array(z),Z.key.buffer,Z.iv.buffer).then(function(F){var ee=self.performance.now();return j.trigger(P.Events.FRAG_DECRYPTED,{frag:S,payload:F,stats:{tstart:K,tdecrypt:ee}}),_.payload=F,_})}return _}).then(function(_){var j=T.fragCurrent,z=T.hls,Z=T.levels;if(!Z)throw new Error("init load aborted, missing levels");var K=Z[S.level].details;console.assert(K,"Level details are defined when init segment is loaded");var F=S.stats;T.state=L.IDLE,T.fragLoadError=0,S.data=new Uint8Array(_.payload),F.parsing.start=F.buffering.start=self.performance.now(),F.parsing.end=F.buffering.end=self.performance.now(),_.frag===j&&z.trigger(P.Events.FRAG_BUFFERED,{stats:F,frag:j,part:null,id:S.type}),T.tick()}).catch(function(_){T.warn(_),T.resetFragmentLoading(S)})},u.fragContextChanged=function(S){var T=this.fragCurrent;return!S||!T||S.level!==T.level||S.sn!==T.sn||S.urlId!==T.urlId},u.fragBufferedComplete=function(S,T){var _=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+S.type+" sn: "+S.sn+(T?" part: "+T.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+S.level+" "+i.default.toString(W.BufferHelper.getBuffered(_))),this.state=L.IDLE,this.tick()},u._handleFragmentLoadComplete=function(S){var T=this.transmuxer;if(!T)return;var _=S.frag,j=S.part,z=S.partsLoaded,Z=!z||z.length===0||z.some(function(F){return!F}),K=new d.ChunkMetadata(_.level,_.sn,_.stats.chunkCount+1,0,j?j.index:-1,!Z);T.flush(K)},u._handleFragmentLoadProgress=function(S){},u._doFragLoad=function(S,T,_,j){var z=this;if(_===void 0&&(_=null),!this.levels)throw new Error("frag load aborted, missing levels");if(_=Math.max(S.start,_||0),this.config.lowLatencyMode&&T){var Z=T.partList;if(Z&&j){_>S.end&&T.fragmentHint&&(S=T.fragmentHint);var K=this.getNextPart(Z,S,_);if(K>-1){var F=Z[K];return this.log("Loading part sn: "+S.sn+" p: "+F.index+" cc: "+S.cc+" of playlist ["+T.startSN+"-"+T.endSN+"] parts [0-"+K+"-"+(Z.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+S.level+", target: "+parseFloat(_.toFixed(3))),this.nextLoadPosition=F.start+F.duration,this.state=L.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:S,part:Z[K],targetBufferTime:_}),this.doFragPartsLoad(S,Z,K,j).catch(function(ee){return z.handleFragLoadError(ee)})}else if(!S.url||this.loadedEndOfParts(Z,_))return Promise.resolve(null)}}return this.log("Loading fragment "+S.sn+" cc: "+S.cc+" "+(T?"of ["+T.startSN+"-"+T.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+S.level+", target: "+parseFloat(_.toFixed(3))),Object(V.isFiniteNumber)(S.sn)&&!this.bitrateTest&&(this.nextLoadPosition=S.start+S.duration),this.state=L.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:S,targetBufferTime:_}),this.fragmentLoader.load(S,j).catch(function(ee){return z.handleFragLoadError(ee)})},u.doFragPartsLoad=function(S,T,_,j){var z=this;return new Promise(function(Z,K){var F=[],ee=function se(he){var Ce=T[he];z.fragmentLoader.loadPart(S,Ce,j).then(function(Ue){F[Ce.index]=Ue;var ke=Ue.part;z.hls.trigger(P.Events.FRAG_LOADED,Ue);var Me=T[he+1];if(Me&&Me.fragment===S)se(he+1);else return Z({frag:S,part:ke,partsLoaded:F})}).catch(K)};ee(_)})},u.handleFragLoadError=function(S){var T=S.data;return T&&T.details===R.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(T.frag,T.part):this.hls.trigger(P.Events.ERROR,T),null},u._handleTransmuxerFlush=function(S){var T=this.getCurrentContext(S);if(!T||this.state!==L.PARSING){this.fragCurrent||(this.state=L.IDLE);return}var _=T.frag,j=T.part,z=T.level,Z=self.performance.now();_.stats.parsing.end=Z,j&&(j.stats.parsing.end=Z),this.updateLevelTiming(_,j,z,S.partial)},u.getCurrentContext=function(S){var T=this.levels,_=S.level,j=S.sn,z=S.part;if(!T||!T[_])return this.warn("Levels object was unset while buffering fragment "+j+" of level "+_+". The current chunk will not be buffered."),null;var Z=T[_],K=z>-1?Object(g.getPartWith)(Z,j,z):null,F=K?K.fragment:Object(g.getFragmentWithSN)(Z,j,this.fragCurrent);return F?{frag:F,part:K,level:Z}:null},u.bufferFragmentData=function(S,T,_,j){if(!S||this.state!==L.PARSING)return;var z=S.data1,Z=S.data2,K=z;if(z&&Z&&(K=Object(f.appendUint8Array)(z,Z)),!K||!K.length)return;var F={type:S.type,frag:T,part:_,chunkMeta:j,parent:T.type,data:K};this.hls.trigger(P.Events.BUFFER_APPENDING,F),S.dropped&&S.independent&&!_&&this.flushBufferGap(T)},u.flushBufferGap=function(S){var T=this.media;if(!T)return;if(!W.BufferHelper.isBuffered(T,T.currentTime)){this.flushMainBuffer(0,S.start);return}var _=T.currentTime,j=W.BufferHelper.bufferInfo(T,_,0),z=S.duration,Z=Math.min(this.config.maxFragLookUpTolerance*2,z*.25),K=Math.max(Math.min(S.start-Z,j.end-Z),_+Z);S.start-K>Z&&this.flushMainBuffer(K,S.start)},u.getFwdBufferInfo=function(S,T){var _=this.config,j=this.getLoadPosition();if(!Object(V.isFiniteNumber)(j))return null;var z=W.BufferHelper.bufferInfo(S,j,_.maxBufferHole);if(z.len===0&&z.nextStart!==void 0){var Z=this.fragmentTracker.getBufferedFrag(j,T);if(Z&&z.nextStart<Z.end)return W.BufferHelper.bufferInfo(S,j,Math.max(z.nextStart,_.maxBufferHole))}return z},u.getMaxBufferLength=function(S){var T=this.config,_;return S?_=Math.max(8*T.maxBufferSize/S,T.maxBufferLength):_=T.maxBufferLength,Math.min(_,T.maxMaxBufferLength)},u.reduceMaxBufferLength=function(S){var T=this.config,_=S||T.maxBufferLength;return T.maxMaxBufferLength>=_?(T.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+T.maxMaxBufferLength+"s"),!0):!1},u.getNextFragment=function(S,T){var _,j,z=T.fragments,Z=z.length;if(!Z)return null;var K=this.config,F=z[0].start,ee;if(T.live){var se=K.initialLiveManifestSize;if(Z<se)return this.warn("Not enough fragments to start playback (have: "+Z+", need: "+se+")"),null;!T.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(ee=this.getInitialLiveFragment(T,z),this.startPosition=ee?this.hls.liveSyncPosition||ee.start:S)}else S<=F&&(ee=z[0]);if(!ee){var he=K.lowLatencyMode?T.partEnd:T.fragmentEnd;ee=this.getFragmentAtPosition(S,he,T)}return(_=ee)!==null&&_!==void 0&&_.initSegment&&!((j=ee)!==null&&j!==void 0&&j.initSegment.data)&&!this.bitrateTest&&(ee=ee.initSegment),ee},u.getNextPart=function(S,T,_){for(var j=-1,z=!1,Z=!0,K=0,F=S.length;K<F;K++){var ee=S[K];if(Z=Z&&!ee.independent,j>-1&&_<ee.start)break;var se=ee.loaded;!se&&(z||ee.independent||Z)&&ee.fragment===T&&(j=K),z=se}return j},u.loadedEndOfParts=function(S,T){var _=S[S.length-1];return _&&T>_.start&&_.loaded},u.getInitialLiveFragment=function(S,T){var _=this.fragPrevious,j=null;if(_){if(S.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+_.programDateTime),j=Object(p.findFragmentByPDT)(T,_.endProgramDateTime,this.config.maxFragLookUpTolerance)),!j){var z=_.sn+1;if(z>=S.startSN&&z<=S.endSN){var Z=T[z-S.startSN];_.cc===Z.cc&&(j=Z,this.log("Live playlist, switching playlist, load frag with next SN: "+j.sn))}j||(j=Object(p.findFragWithCC)(T,_.cc),j&&this.log("Live playlist, switching playlist, load frag with same CC: "+j.sn))}}else{var K=this.hls.liveSyncPosition;K!==null&&(j=this.getFragmentAtPosition(K,this.bitrateTest?S.fragmentEnd:S.edge,S))}return j},u.getFragmentAtPosition=function(S,T,_){var j=this.config,z=this.fragPrevious,Z=_.fragments,K=_.endSN,F=_.fragmentHint,ee=j.maxFragLookUpTolerance,se=!!(j.lowLatencyMode&&_.partList&&F);se&&F&&!this.bitrateTest&&(Z=Z.concat(F),K=F.sn);var he;if(S<T){var Ce=S>T-ee?0:ee;he=Object(p.findFragmentByPTS)(z,Z,S,Ce)}else he=Z[Z.length-1];if(he){var Ue=he.sn-_.startSN,ke=z&&he.level===z.level,Me=Z[Ue+1],ce=this.fragmentTracker.getState(he);if(ce===M.FragmentState.BACKTRACKED){he=null;for(var ve=Ue;Z[ve]&&this.fragmentTracker.getState(Z[ve])===M.FragmentState.BACKTRACKED;)z?he=Z[ve--]:he=Z[--ve];he||(he=Me)}else z&&he.sn===z.sn&&!se&&(ke&&(he.sn<K&&this.fragmentTracker.getState(Me)!==M.FragmentState.OK?(this.log("SN "+he.sn+" just loaded, load next one: "+Me.sn),he=Me):he=null))}return he},u.synchronizeToLiveEdge=function(S){var T=this.config,_=this.media;if(!_)return;var j=this.hls.liveSyncPosition,z=_.currentTime,Z=S.fragments[0].start,K=S.edge,F=z>=Z-T.maxFragLookUpTolerance&&z<=K;if(j!==null&&_.duration>j&&(z<j||!F)){var ee=T.liveMaxLatencyDuration!==void 0?T.liveMaxLatencyDuration:T.liveMaxLatencyDurationCount*S.targetduration;(!F&&_.readyState<4||z<K-ee)&&(this.loadedmetadata||(this.nextLoadPosition=j),_.readyState&&(this.warn("Playback: "+z.toFixed(3)+" is located too far from the end of live sliding playlist: "+K+", reset currentTime to : "+j.toFixed(3)),_.currentTime=j))}},u.alignPlaylists=function(S,T){var _=this.levels,j=this.levelLastLoaded,z=this.fragPrevious,Z=j!==null?_[j]:null,K=S.fragments.length;if(!K)return this.warn("No fragments in live playlist"),0;var F=S.fragments[0].start,ee=!T,se=S.alignedSliding&&Object(V.isFiniteNumber)(F);if(ee||!se&&!F){Object(w.alignStream)(z,Z,S);var he=S.fragments[0].start;return this.log("Live playlist sliding: "+he.toFixed(2)+" start-sn: "+(T?T.startSN:"na")+"->"+S.startSN+" prev-sn: "+(z?z.sn:"na")+" fragments: "+K),he}return F},u.waitForCdnTuneIn=function(S){var T=3;return S.live&&S.canBlockReload&&S.tuneInGoal>Math.max(S.partHoldBack,S.partTarget*T)},u.setStartPosition=function(S,T){var _=this.startPosition;if(_<T&&(_=-1),_===-1||this.lastCurrentTime===-1){var j=S.startTimeOffset;Object(V.isFiniteNumber)(j)?(_=T+j,j<0&&(_+=S.totalduration),_=Math.min(Math.max(T,_),T+S.totalduration),this.log("Start time offset "+j+" found in playlist, adjust startPosition to "+_),this.startPosition=_):S.live?_=this.hls.liveSyncPosition||T:this.startPosition=_=0,this.lastCurrentTime=_}this.nextLoadPosition=_},u.getLoadPosition=function(){var S=this.media,T=0;return this.loadedmetadata&&S?T=S.currentTime:this.nextLoadPosition&&(T=this.nextLoadPosition),T},u.handleFragLoadAborted=function(S,T){this.transmuxer&&S.sn!=="initSegment"&&S.stats.aborted&&(this.warn("Fragment "+S.sn+(T?" part"+T.index:"")+" of level "+S.level+" was aborted"),this.resetFragmentLoading(S))},u.resetFragmentLoading=function(S){(!this.fragCurrent||!this.fragContextChanged(S))&&(this.state=L.IDLE)},u.onFragmentOrKeyLoadError=function(S,T){if(T.fatal)return;var _=T.frag;if(!_||_.type!==S)return;var j=this.fragCurrent;console.assert(j&&_.sn===j.sn&&_.level===j.level&&_.urlId===j.urlId,"Frag load error must match current frag to retry");var z=this.config;if(this.fragLoadError+1<=z.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(_.level))return;var Z=Math.min(Math.pow(2,this.fragLoadError)*z.fragLoadingRetryDelay,z.fragLoadingMaxRetryTimeout);this.warn("Fragment "+_.sn+" of "+S+" "+_.level+" failed to load, retrying in "+Z+"ms"),this.retryDate=self.performance.now()+Z,this.fragLoadError++,this.state=L.FRAG_LOADING_WAITING_RETRY}else T.levelRetry?(S===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=L.IDLE):(N.logger.error(T.details+" reaches max retry, redispatch as fatal ..."),T.fatal=!0,this.hls.stopLoad(),this.state=L.ERROR)},u.afterBufferFlushed=function(S,T,_){if(!S)return;var j=W.BufferHelper.getBuffered(S);this.fragmentTracker.detectEvictedFragments(T,j,_),this.state===L.ENDED&&this.resetLoadingState()},u.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=L.IDLE},u.resetLiveStartWhenNotLoaded=function(S){if(!this.loadedmetadata){this.startFragRequested=!1;var T=this.levels?this.levels[S].details:null;if(T!=null&&T.live)return this.startPosition=-1,this.setStartPosition(T,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},u.updateLevelTiming=function(S,T,_,j){var z=this,Z=_.details;console.assert(!!Z,"level.details must be defined");var K=Object.keys(S.elementaryStreams).reduce(function(F,ee){var se=S.elementaryStreams[ee];if(se){var he=se.endPTS-se.startPTS;if(he<=0)return z.warn("Could not parse fragment "+S.sn+" "+ee+" duration reliably ("+he+") resetting transmuxer to fallback to playlist timing"),z.resetTransmuxer(),F||!1;var Ce=j?0:Object(g.updateFragPTSDTS)(Z,S,se.startPTS,se.endPTS,se.startDTS,se.endDTS);return z.hls.trigger(P.Events.LEVEL_PTS_UPDATED,{details:Z,level:_,drift:Ce,type:ee,frag:S,start:se.startPTS,end:se.endPTS}),!0}return F},!1);K?(this.state=L.PARSED,this.hls.trigger(P.Events.FRAG_PARSED,{frag:S,part:T})):this.resetLoadingState()},u.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},C(c,[{key:"state",get:function(){return this._state},set:function(S){var T=this._state;T!==S&&(this._state=S,this.log(T+"->"+S))}}]),c}(I.default)},"./src/controller/buffer-controller.ts":function(ie,$,O){"use strict";O.r($),O.d($,"default",function(){return p});var V=O("./src/polyfills/number.ts"),I=O("./src/events.ts"),M=O("./src/utils/logger.ts"),W=O("./src/errors.ts"),N=O("./src/utils/buffer-helper.ts"),P=O("./src/utils/mediasource-helper.ts"),R=O("./src/loader/fragment.ts"),d=O("./src/controller/buffer-operation-queue.ts"),f=Object(P.getMediaSource)(),w=/([ha]vc.)(?:\.[^.,]+)+/,p=function(){function g(o){var i=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var s=i.hls,l=i.media,C=i.mediaSource;M.logger.log("[buffer-controller]: Media source opened"),l&&(i.updateMediaElementDuration(),s.trigger(I.Events.MEDIA_ATTACHED,{media:l})),C&&C.removeEventListener("sourceopen",i._onMediaSourceOpen),i.checkPendingTracks()},this._onMediaSourceClose=function(){M.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){M.logger.log("[buffer-controller]: Media source ended")},this.hls=o,this._initSourceBuffer(),this.registerListeners()}var b=g.prototype;return b.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},b.destroy=function(){this.unregisterListeners(),this.details=null},b.registerListeners=function(){var i=this.hls;i.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),i.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.on(I.Events.BUFFER_RESET,this.onBufferReset,this),i.on(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),i.on(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),i.on(I.Events.BUFFER_EOS,this.onBufferEos,this),i.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),i.on(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),i.on(I.Events.FRAG_PARSED,this.onFragParsed,this),i.on(I.Events.FRAG_CHANGED,this.onFragChanged,this)},b.unregisterListeners=function(){var i=this.hls;i.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),i.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.off(I.Events.BUFFER_RESET,this.onBufferReset,this),i.off(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),i.off(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),i.off(I.Events.BUFFER_EOS,this.onBufferEos,this),i.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),i.off(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),i.off(I.Events.FRAG_PARSED,this.onFragParsed,this),i.off(I.Events.FRAG_CHANGED,this.onFragChanged,this)},b._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new d.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},b.onManifestParsed=function(i,s){var l=2;(s.audio&&!s.video||!s.altAudio)&&(l=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=l,this.details=null,M.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},b.onMediaAttaching=function(i,s){var l=this.media=s.media;if(l&&f){var C=this.mediaSource=new f;C.addEventListener("sourceopen",this._onMediaSourceOpen),C.addEventListener("sourceended",this._onMediaSourceEnded),C.addEventListener("sourceclose",this._onMediaSourceClose),l.src=self.URL.createObjectURL(C),this._objectUrl=l.src}},b.onMediaDetaching=function(){var i=this.media,s=this.mediaSource,l=this._objectUrl;if(s){if(M.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(C){M.logger.warn("[buffer-controller]: onMediaDetaching: "+C.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),i&&(l&&self.URL.revokeObjectURL(l),i.src===l?(i.removeAttribute("src"),i.load()):M.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(I.Events.MEDIA_DETACHED,void 0)},b.onBufferReset=function(){var i=this;this.getSourceBufferTypes().forEach(function(s){var l=i.sourceBuffer[s];try{l&&(i.removeBufferListeners(s),i.mediaSource&&i.mediaSource.removeSourceBuffer(l),i.sourceBuffer[s]=void 0)}catch(C){M.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",C)}}),this._initSourceBuffer()},b.onBufferCodecs=function(i,s){var l=this,C=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(m){if(C){var v=l.tracks[m];if(v&&typeof v.buffer.changeType=="function"){var k=s[m],L=k.codec,E=k.levelCodec,y=k.container,c=(v.levelCodec||v.codec).replace(w,"$1"),u=(E||L).replace(w,"$1");if(c!==u){var A=y+";codecs="+(E||L);l.appendChangeType(m,A)}}}else l.pendingTracks[m]=s[m]}),C)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},b.appendChangeType=function(i,s){var l=this,C=this.operationQueue,m={execute:function(){var k=l.sourceBuffer[i];k&&(M.logger.log("[buffer-controller]: changing "+i+" sourceBuffer type to "+s),k.changeType(s)),C.shiftAndExecuteNext(i)},onStart:function(){},onComplete:function(){},onError:function(k){M.logger.warn("[buffer-controller]: Failed to change "+i+" SourceBuffer type",k)}};C.append(m,i)},b.onBufferAppending=function(i,s){var l=this,C=this.hls,m=this.operationQueue,v=this.tracks,k=s.data,L=s.type,E=s.frag,y=s.part,c=s.chunkMeta,u=c.buffering[L],A=self.performance.now();u.start=A;var S=E.stats.buffering,T=y?y.stats.buffering:null;S.start===0&&(S.start=A),T&&T.start===0&&(T.start=A);var _=v.audio,j=L==="audio"&&c.id===1&&(_==null?void 0:_.container)==="audio/mpeg",z={execute:function(){if(u.executeStart=self.performance.now(),j){var K=l.sourceBuffer[L];if(K){var F=E.start-K.timestampOffset;Math.abs(F)>=.1&&(M.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+E.start+" (delta: "+F+") sn: "+E.sn+")"),K.timestampOffset=E.start)}}l.appendExecutor(k,L)},onStart:function(){},onComplete:function(){var K=self.performance.now();u.executeEnd=u.end=K,S.first===0&&(S.first=K),T&&T.first===0&&(T.first=K);var F=l.sourceBuffer,ee={};for(var se in F)ee[se]=N.BufferHelper.getBuffered(F[se]);l.appendError=0,l.hls.trigger(I.Events.BUFFER_APPENDED,{type:L,frag:E,part:y,chunkMeta:c,parent:E.type,timeRanges:ee})},onError:function(K){M.logger.error("[buffer-controller]: Error encountered while trying to append to the "+L+" SourceBuffer",K);var F={type:W.ErrorTypes.MEDIA_ERROR,parent:E.type,details:W.ErrorDetails.BUFFER_APPEND_ERROR,err:K,fatal:!1};K.code===DOMException.QUOTA_EXCEEDED_ERR?F.details=W.ErrorDetails.BUFFER_FULL_ERROR:(l.appendError++,F.details=W.ErrorDetails.BUFFER_APPEND_ERROR,l.appendError>C.config.appendErrorMaxRetry&&(M.logger.error("[buffer-controller]: Failed "+C.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),F.fatal=!0)),C.trigger(I.Events.ERROR,F)}};m.append(z,L)},b.onBufferFlushing=function(i,s){var l=this,C=this.operationQueue,m=function(k){return{execute:l.removeExecutor.bind(l,k,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){l.hls.trigger(I.Events.BUFFER_FLUSHED,{type:k})},onError:function(E){M.logger.warn("[buffer-controller]: Failed to remove from "+k+" SourceBuffer",E)}}};s.type?C.append(m(s.type),s.type):this.getSourceBufferTypes().forEach(function(v){C.append(m(v),v)})},b.onFragParsed=function(i,s){var l=this,C=s.frag,m=s.part,v=[],k=m?m.elementaryStreams:C.elementaryStreams;k[R.ElementaryStreamTypes.AUDIOVIDEO]?v.push("audiovideo"):(k[R.ElementaryStreamTypes.AUDIO]&&v.push("audio"),k[R.ElementaryStreamTypes.VIDEO]&&v.push("video"));var L=function(){var y=self.performance.now();C.stats.buffering.end=y,m&&(m.stats.buffering.end=y);var c=m?m.stats:C.stats;l.hls.trigger(I.Events.FRAG_BUFFERED,{frag:C,part:m,stats:c,id:C.type})};v.length===0&&M.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+C.type+" level: "+C.level+" sn: "+C.sn),this.blockBuffers(L,v)},b.onFragChanged=function(i,s){this.flushBackBuffer()},b.onBufferEos=function(i,s){var l=this,C=this.getSourceBufferTypes().reduce(function(m,v){var k=l.sourceBuffer[v];return(!s.type||s.type===v)&&(k&&!k.ended&&(k.ended=!0,M.logger.log("[buffer-controller]: "+v+" sourceBuffer now EOS"))),m&&!!(!k||k.ended)},!0);C&&this.blockBuffers(function(){var m=l.mediaSource;if(!m||m.readyState!=="open")return;m.endOfStream()})},b.onLevelUpdated=function(i,s){var l=s.details;if(!l.fragments.length)return;this.details=l,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},b.flushBackBuffer=function(){var i=this.hls,s=this.details,l=this.media,C=this.sourceBuffer;if(!l||s===null)return;var m=this.getSourceBufferTypes();if(!m.length)return;var v=s.live&&i.config.liveBackBufferLength!==null?i.config.liveBackBufferLength:i.config.backBufferLength;if(!Object(V.isFiniteNumber)(v)||v<0)return;var k=l.currentTime,L=s.levelTargetDuration,E=Math.max(v,L),y=Math.floor(k/L)*L-E;m.forEach(function(c){var u=C[c];if(u){var A=N.BufferHelper.getBuffered(u);A.length>0&&y>A.start(0)&&(i.trigger(I.Events.BACK_BUFFER_REACHED,{bufferEnd:y}),s.live&&i.trigger(I.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:y}),i.trigger(I.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:y,type:c}))}})},b.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var i=this.details,s=this.hls,l=this.media,C=this.mediaSource,m=i.fragments[0].start+i.totalduration,v=l.duration,k=Object(V.isFiniteNumber)(C.duration)?C.duration:0;i.live&&s.config.liveDurationInfinity?(M.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),C.duration=Infinity,this.updateSeekableRange(i)):(m>k&&m>v||!Object(V.isFiniteNumber)(v))&&(M.logger.log("[buffer-controller]: Updating Media Source duration to "+m.toFixed(3)),C.duration=m)},b.updateSeekableRange=function(i){var s=this.mediaSource,l=i.fragments,C=l.length;if(C&&i.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var m=Math.max(0,l[0].start),v=Math.max(m,m+i.totalduration);s.setLiveSeekableRange(m,v)}},b.checkPendingTracks=function(){var i=this.bufferCodecEventsExpected,s=this.operationQueue,l=this.pendingTracks,C=Object.keys(l).length;if(C&&!i||C===2){this.createSourceBuffers(l),this.pendingTracks={};var m=this.getSourceBufferTypes();if(m.length===0){this.hls.trigger(I.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}m.forEach(function(v){s.executeNext(v)})}},b.createSourceBuffers=function(i){var s=this.sourceBuffer,l=this.mediaSource;if(!l)throw Error("createSourceBuffers called when mediaSource was null");var C=0;for(var m in i)if(!s[m]){var v=i[m];if(!v)throw Error("source buffer exists for track "+m+", however track does not");var k=v.levelCodec||v.codec,L=v.container+";codecs="+k;M.logger.log("[buffer-controller]: creating sourceBuffer("+L+")");try{var E=s[m]=l.addSourceBuffer(L),y=m;this.addBufferListener(y,"updatestart",this._onSBUpdateStart),this.addBufferListener(y,"updateend",this._onSBUpdateEnd),this.addBufferListener(y,"error",this._onSBUpdateError),this.tracks[m]={buffer:E,codec:k,container:v.container,levelCodec:v.levelCodec,id:v.id},C++}catch(c){M.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+c.message),this.hls.trigger(I.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:c,mimeType:L})}}C&&this.hls.trigger(I.Events.BUFFER_CREATED,{tracks:this.tracks})},b._onSBUpdateStart=function(i){var s=this.operationQueue,l=s.current(i);l.onStart()},b._onSBUpdateEnd=function(i){var s=this.operationQueue,l=s.current(i);l.onComplete(),s.shiftAndExecuteNext(i)},b._onSBUpdateError=function(i,s){M.logger.error("[buffer-controller]: "+i+" SourceBuffer error",s),this.hls.trigger(I.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var l=this.operationQueue.current(i);l&&l.onError(s)},b.removeExecutor=function(i,s,l){var C=this.media,m=this.mediaSource,v=this.operationQueue,k=this.sourceBuffer,L=k[i];if(!C||!m||!L){M.logger.warn("[buffer-controller]: Attempting to remove from the "+i+" SourceBuffer, but it does not exist"),v.shiftAndExecuteNext(i);return}var E=Object(V.isFiniteNumber)(C.duration)?C.duration:Infinity,y=Object(V.isFiniteNumber)(m.duration)?m.duration:Infinity,c=Math.max(0,s),u=Math.min(l,E,y);u>c?(M.logger.log("[buffer-controller]: Removing ["+c+","+u+"] from the "+i+" SourceBuffer"),console.assert(!L.updating,i+" sourceBuffer must not be updating"),L.remove(c,u)):v.shiftAndExecuteNext(i)},b.appendExecutor=function(i,s){var l=this.operationQueue,C=this.sourceBuffer,m=C[s];if(!m){M.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),l.shiftAndExecuteNext(s);return}m.ended=!1,console.assert(!m.updating,s+" sourceBuffer must not be updating"),m.appendBuffer(i)},b.blockBuffers=function(i,s){var l=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){M.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(i);return}var C=this.operationQueue,m=s.map(function(v){return C.appendBlocker(v)});Promise.all(m).then(function(){i(),s.forEach(function(v){var k=l.sourceBuffer[v];(!k||!k.updating)&&C.shiftAndExecuteNext(v)})})},b.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},b.addBufferListener=function(i,s,l){var C=this.sourceBuffer[i];if(!C)return;var m=l.bind(this,i);this.listeners[i].push({event:s,listener:m}),C.addEventListener(s,m)},b.removeBufferListeners=function(i){var s=this.sourceBuffer[i];if(!s)return;this.listeners[i].forEach(function(l){s.removeEventListener(l.event,l.listener)})},g}()},"./src/controller/buffer-operation-queue.ts":function(ie,$,O){"use strict";O.r($),O.d($,"default",function(){return I});var V=O("./src/utils/logger.ts"),I=function(){function M(N){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=N}var W=M.prototype;return W.append=function(P,R){var d=this.queues[R];d.push(P),d.length===1&&this.buffers[R]&&this.executeNext(R)},W.insertAbort=function(P,R){var d=this.queues[R];d.unshift(P),this.executeNext(R)},W.appendBlocker=function(P){var R,d=new Promise(function(w){R=w}),f={execute:R,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(f,P),d},W.executeNext=function(P){var R=this.buffers,d=this.queues,f=R[P],w=d[P];if(w.length){var p=w[0];try{p.execute()}catch(g){V.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),p.onError(g),(!f||!f.updating)&&(w.shift(),this.executeNext(P))}}},W.shiftAndExecuteNext=function(P){this.queues[P].shift(),this.executeNext(P)},W.current=function(P){return this.queues[P][0]},M}()},"./src/controller/cap-level-controller.ts":function(ie,$,O){"use strict";O.r($);var V=O("./src/events.ts");function I(N,P){for(var R=0;R<P.length;R++){var d=P[R];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(N,d.key,d)}}function M(N,P,R){return P&&I(N.prototype,P),R&&I(N,R),N}var W=function(){function N(R){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=R,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var P=N.prototype;return P.setStreamController=function(d){this.streamController=d},P.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},P.registerListeners=function(){var d=this.hls;d.on(V.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),d.on(V.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.on(V.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(V.Events.BUFFER_CODECS,this.onBufferCodecs,this),d.on(V.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.unregisterListener=function(){var d=this.hls;d.off(V.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),d.off(V.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.off(V.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(V.Events.BUFFER_CODECS,this.onBufferCodecs,this),d.off(V.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.onFpsDropLevelCapping=function(d,f){N.isLevelAllowed(f.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(f.droppedLevel)},P.onMediaAttaching=function(d,f){this.media=f.media instanceof HTMLVideoElement?f.media:null},P.onManifestParsed=function(d,f){var w=this.hls;this.restrictedLevels=[],this.firstLevel=f.firstLevel,w.config.capLevelToPlayerSize&&f.video&&this.startCapping()},P.onBufferCodecs=function(d,f){var w=this.hls;w.config.capLevelToPlayerSize&&f.video&&this.startCapping()},P.onMediaDetaching=function(){this.stopCapping()},P.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var d=this.hls.levels;if(d.length){var f=this.hls;f.autoLevelCapping=this.getMaxLevel(d.length-1),f.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=f.autoLevelCapping}}},P.getMaxLevel=function(d){var f=this,w=this.hls.levels;if(!w.length)return-1;var p=w.filter(function(g,b){return N.isLevelAllowed(b,f.restrictedLevels)&&b<=d});return this.clientRect=null,N.getMaxLevelByMediaSize(p,this.mediaWidth,this.mediaHeight)},P.startCapping=function(){if(this.timer)return;this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize()},P.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},P.getDimensions=function(){if(this.clientRect)return this.clientRect;var d=this.media,f={width:0,height:0};if(d){var w=d.getBoundingClientRect();f.width=w.width,f.height=w.height,!f.width&&!f.height&&(f.width=w.right-w.left||d.width||0,f.height=w.bottom-w.top||d.height||0)}return this.clientRect=f,f},N.isLevelAllowed=function(d,f){return f===void 0&&(f=[]),f.indexOf(d)===-1},N.getMaxLevelByMediaSize=function(d,f,w){if(!d||!d.length)return-1;for(var p=function(s,l){return l?s.width!==l.width||s.height!==l.height:!0},g=d.length-1,b=0;b<d.length;b+=1){var o=d[b];if((o.width>=f||o.height>=w)&&p(o,d[b+1])){g=b;break}}return g},M(N,[{key:"mediaWidth",get:function(){return this.getDimensions().width*N.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*N.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var d=1;try{d=self.devicePixelRatio}catch(f){}return d}}]),N}();$.default=W},"./src/controller/cmcd-controller.ts":function(ie,$,O){"use strict";O.r($),O.d($,"default",function(){return p});var V=O("./src/events.ts"),I=O("./src/types/cmcd.ts"),M=O("./src/utils/buffer-helper.ts"),W=O("./src/utils/logger.ts");function N(g,b){for(var o=0;o<b.length;o++){var i=b[o];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(g,i.key,i)}}function P(g,b,o){return b&&N(g.prototype,b),o&&N(g,o),g}function R(g,b){var o=typeof Symbol!="undefined"&&g[Symbol.iterator]||g["@@iterator"];if(o)return(o=o.call(g)).next.bind(o);if(Array.isArray(g)||(o=d(g))||b&&g&&typeof g.length=="number"){o&&(g=o);var i=0;return function(){return i>=g.length?{done:!0}:{done:!1,value:g[i++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function d(g,b){if(!g)return;if(typeof g=="string")return f(g,b);var o=Object.prototype.toString.call(g).slice(8,-1);if(o==="Object"&&g.constructor&&(o=g.constructor.name),o==="Map"||o==="Set")return Array.from(g);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return f(g,b)}function f(g,b){(b==null||b>g.length)&&(b=g.length);for(var o=0,i=new Array(b);o<b;o++)i[o]=g[o];return i}function w(){return w=Object.assign||function(g){for(var b=1;b<arguments.length;b++){var o=arguments[b];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(g[i]=o[i])}return g},w.apply(this,arguments)}var p=function(){function g(o){var i=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){i.initialized&&(i.starved=!0),i.buffering=!0},this.onPlaying=function(){i.initialized||(i.initialized=!0),i.buffering=!1},this.applyPlaylistData=function(C){try{i.apply(C,{ot:I.CMCDObjectType.MANIFEST,su:!i.initialized})}catch(m){W.logger.warn("Could not generate manifest CMCD data.",m)}},this.applyFragmentData=function(C){try{var m=C.frag,v=i.hls.levels[m.level],k=i.getObjectType(m),L={d:m.duration*1e3,ot:k};(k===I.CMCDObjectType.VIDEO||k===I.CMCDObjectType.AUDIO||k==I.CMCDObjectType.MUXED)&&(L.br=v.bitrate/1e3,L.tb=i.getTopBandwidth(k),L.bl=i.getBufferLength(k)),i.apply(C,L)}catch(E){W.logger.warn("Could not generate segment CMCD data.",E)}},this.hls=o;var s=this.config=o.config,l=s.cmcd;l!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=l.sessionId||g.uuid(),this.cid=l.contentId,this.useHeaders=l.useHeaders===!0,this.registerListeners())}var b=g.prototype;return b.registerListeners=function(){var i=this.hls;i.on(V.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.on(V.Events.MEDIA_DETACHED,this.onMediaDetached,this),i.on(V.Events.BUFFER_CREATED,this.onBufferCreated,this)},b.unregisterListeners=function(){var i=this.hls;i.off(V.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.off(V.Events.MEDIA_DETACHED,this.onMediaDetached,this),i.off(V.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},b.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},b.onMediaAttached=function(i,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},b.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},b.onBufferCreated=function(i,s){var l,C;this.audioBuffer=(l=s.tracks.audio)===null||l===void 0?void 0:l.buffer,this.videoBuffer=(C=s.tracks.video)===null||C===void 0?void 0:C.buffer},b.createData=function(){var i;return{v:I.CMCDVersion,sf:I.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(i=this.media)===null||i===void 0?void 0:i.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},b.apply=function(i,s){s===void 0&&(s={}),w(s,this.createData());var l=s.ot===I.CMCDObjectType.INIT||s.ot===I.CMCDObjectType.VIDEO||s.ot===I.CMCDObjectType.MUXED;if(this.starved&&l&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var C=g.toHeaders(s);if(!Object.keys(C).length)return;i.headers||(i.headers={}),w(i.headers,C)}else{var m=g.toQuery(s);if(!m)return;i.url=g.appendQueryToUri(i.url,m)}},b.getObjectType=function(i){var s=i.type;return s==="subtitle"?I.CMCDObjectType.TIMED_TEXT:i.sn==="initSegment"?I.CMCDObjectType.INIT:s==="audio"?I.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?I.CMCDObjectType.VIDEO:I.CMCDObjectType.MUXED:void 0},b.getTopBandwidth=function(i){for(var s=0,l=i===I.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,C=R(l),m;!(m=C()).done;){var v=m.value;v.bitrate>s&&(s=v.bitrate)}return s>0?s:NaN},b.getBufferLength=function(i){var s=this.hls.media,l=i===I.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!l||!s)return NaN;var C=M.BufferHelper.bufferInfo(l,s.currentTime,this.config.maxBufferHole);return C.len*1e3},b.createPlaylistLoader=function(){var i=this.config.pLoader,s=this.applyPlaylistData,l=i||this.config.loader;return function(){function C(v){this.loader=void 0,this.loader=new l(v)}var m=C.prototype;return m.destroy=function(){this.loader.destroy()},m.abort=function(){this.loader.abort()},m.load=function(k,L,E){s(k),this.loader.load(k,L,E)},P(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},b.createFragmentLoader=function(){var i=this.config.fLoader,s=this.applyFragmentData,l=i||this.config.loader;return function(){function C(v){this.loader=void 0,this.loader=new l(v)}var m=C.prototype;return m.destroy=function(){this.loader.destroy()},m.abort=function(){this.loader.abort()},m.load=function(k,L,E){s(k),this.loader.load(k,L,E)},P(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},g.uuid=function(){var i=URL.createObjectURL(new Blob),s=i.toString();return URL.revokeObjectURL(i),s.substr(s.lastIndexOf("/")+1)},g.serialize=function(i){for(var s=[],l=function(j){return!Number.isNaN(j)&&j!=null&&j!==""&&j!==!1},C=function(j){return Math.round(j)},m=function(j){return C(j/100)*100},v=function(j){return encodeURIComponent(j)},k={br:C,d:C,bl:m,dl:m,mtp:m,nor:v,rtp:m,tb:C},L=Object.keys(i||{}).sort(),E=R(L),y;!(y=E()).done;){var c=y.value,u=i[c];if(!l(u))continue;if(c==="v"&&u===1)continue;if(c=="pr"&&u===1)continue;var A=k[c];A&&(u=A(u));var S=typeof u,T=void 0;c==="ot"||c==="sf"||c==="st"?T=c+"="+u:S==="boolean"?T=c:S==="number"?T=c+"="+u:T=c+"="+JSON.stringify(u),s.push(T)}return s.join(",")},g.toHeaders=function(i){for(var s=Object.keys(i),l={},C=["Object","Request","Session","Status"],m=[{},{},{},{}],v={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},k=0,L=s;k<L.length;k++){var E=L[k],y=v[E]!=null?v[E]:1;m[y][E]=i[E]}for(var c=0;c<m.length;c++){var u=g.serialize(m[c]);u&&(l["CMCD-"+C[c]]=u)}return l},g.toQuery=function(i){return"CMCD="+encodeURIComponent(g.serialize(i))},g.appendQueryToUri=function(i,s){if(!s)return i;var l=i.includes("?")?"&":"?";return""+i+l+s},g}()},"./src/controller/eme-controller.ts":function(ie,$,O){"use strict";O.r($);var V=O("./src/events.ts"),I=O("./src/errors.ts"),M=O("./src/utils/logger.ts"),W=O("./src/utils/mediakeys-helper.ts");function N(p,g){for(var b=0;b<g.length;b++){var o=g[b];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(p,o.key,o)}}function P(p,g,b){return g&&N(p.prototype,g),b&&N(p,b),p}var R=3,d=function(g,b,o){var i={audioCapabilities:[],videoCapabilities:[]};return g.forEach(function(s){i.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:o.audioRobustness||""})}),b.forEach(function(s){i.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:o.videoRobustness||""})}),[i]},f=function(g,b,o,i){switch(g){case W.KeySystems.WIDEVINE:return d(b,o,i);default:throw new Error("Unknown key-system: "+g)}},w=function(){function p(b){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=b,this._config=b.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var g=p.prototype;return g.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},g._registerListeners=function(){this.hls.on(V.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(V.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(V.Events.MANIFEST_PARSED,this.onManifestParsed,this)},g._unregisterListeners=function(){this.hls.off(V.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(V.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(V.Events.MANIFEST_PARSED,this.onManifestParsed,this)},g.getLicenseServerUrl=function(o){switch(o){case W.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+o+'"')},g._attemptKeySystemAccess=function(o,i,s){var l=this,C=f(o,i,s,this._drmSystemOptions);M.logger.log("Requesting encrypted media key-system access");var m=this.requestMediaKeySystemAccess(o,C);this.mediaKeysPromise=m.then(function(v){return l._onMediaKeySystemAccessObtained(o,v)}),m.catch(function(v){M.logger.error('Failed to obtain key-system "'+o+'" access:',v)})},g._onMediaKeySystemAccessObtained=function(o,i){var s=this;M.logger.log('Access for key-system "'+o+'" obtained');var l={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:i,mediaKeySystemDomain:o};this._mediaKeysList.push(l);var C=Promise.resolve().then(function(){return i.createMediaKeys()}).then(function(m){return l.mediaKeys=m,M.logger.log('Media-keys created for key-system "'+o+'"'),s._onMediaKeysCreated(),m});return C.catch(function(m){M.logger.error("Failed to create media-keys:",m)}),C},g._onMediaKeysCreated=function(){var o=this;this._mediaKeysList.forEach(function(i){i.mediaKeysSession||(i.mediaKeysSession=i.mediaKeys.createSession(),o._onNewMediaKeySession(i.mediaKeysSession))})},g._onNewMediaKeySession=function(o){var i=this;M.logger.log("New key-system session "+o.sessionId),o.addEventListener("message",function(s){i._onKeySessionMessage(o,s.message)},!1)},g._onKeySessionMessage=function(o,i){M.logger.log("Got EME message event, creating license request"),this._requestLicense(i,function(s){M.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),o.update(s)})},g.onMediaEncrypted=function(o){var i=this;if(M.logger.log('Media is encrypted using "'+o.initDataType+'" init data type'),!this.mediaKeysPromise){M.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(V.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(C){if(!i._media)return;i._attemptSetMediaKeys(C),i._generateRequestWithPreferredKeySession(o.initDataType,o.initData)};this.mediaKeysPromise.then(s).catch(s)},g._attemptSetMediaKeys=function(o){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var i=this._mediaKeysList[0];if(!i||!i.mediaKeys){M.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(V.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}M.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(i.mediaKeys),this._hasSetMediaKeys=!0}},g._generateRequestWithPreferredKeySession=function(o,i){var s=this,l=this._mediaKeysList[0];if(!l){M.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(V.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(l.mediaKeysSessionInitialized){M.logger.warn("Key-Session already initialized but requested again");return}var C=l.mediaKeysSession;if(!C){M.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(V.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!i){M.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(V.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}M.logger.log('Generating key-session request for "'+o+'" init data type'),l.mediaKeysSessionInitialized=!0,C.generateRequest(o,i).then(function(){M.logger.debug("Key-session generation succeeded")}).catch(function(m){M.logger.error("Error generating key-session request:",m),s.hls.trigger(V.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},g._createLicenseXhr=function(o,i,s){var l=new XMLHttpRequest;l.responseType="arraybuffer",l.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,l,o,i,s);var C=this._licenseXhrSetup;if(C)try{C.call(this.hls,l,o),C=void 0}catch(m){M.logger.error(m)}try{l.readyState||l.open("POST",o,!0),C&&C.call(this.hls,l,o)}catch(m){throw new Error("issue setting up KeySystem license XHR "+m)}return l},g._onLicenseRequestReadyStageChange=function(o,i,s,l){switch(o.readyState){case 4:if(o.status===200){this._requestLicenseFailureCount=0,M.logger.log("License request succeeded");var C=o.response,m=this._licenseResponseCallback;if(m)try{C=m.call(this.hls,o,i)}catch(k){M.logger.error(k)}l(C)}else{if(M.logger.error("License Request XHR failed ("+i+"). Status: "+o.status+" ("+o.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>R){this.hls.trigger(V.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var v=R-this._requestLicenseFailureCount+1;M.logger.warn("Retrying license request, "+v+" attempts left"),this._requestLicense(s,l)}break}},g._generateLicenseRequestChallenge=function(o,i){switch(o.mediaKeySystemDomain){case W.KeySystems.WIDEVINE:return i}throw new Error("unsupported key-system: "+o.mediaKeySystemDomain)},g._requestLicense=function(o,i){M.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){M.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(V.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var l=this.getLicenseServerUrl(s.mediaKeySystemDomain),C=this._createLicenseXhr(l,o,i);M.logger.log("Sending license request to URL: "+l);var m=this._generateLicenseRequestChallenge(s,o);C.send(m)}catch(v){M.logger.error("Failure requesting DRM license: "+v),this.hls.trigger(V.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},g.onMediaAttached=function(o,i){if(!this._emeEnabled)return;var s=i.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},g.onMediaDetached=function(){var o=this._media,i=this._mediaKeysList;if(!o)return;o.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(i.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return o.setMediaKeys(null)}).catch(function(){})},g.onManifestParsed=function(o,i){if(!this._emeEnabled)return;var s=i.levels.map(function(C){return C.audioCodec}).filter(function(C){return!!C}),l=i.levels.map(function(C){return C.videoCodec}).filter(function(C){return!!C});this._attemptKeySystemAccess(W.KeySystems.WIDEVINE,s,l)},P(p,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),p}();$.default=w},"./src/controller/fps-controller.ts":function(ie,$,O){"use strict";O.r($);var V=O("./src/events.ts"),I=O("./src/utils/logger.ts"),M=function(){function W(P){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=P,this.registerListeners()}var N=W.prototype;return N.setStreamController=function(R){this.streamController=R},N.registerListeners=function(){this.hls.on(V.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},N.unregisterListeners=function(){this.hls.off(V.Events.MEDIA_ATTACHING,this.onMediaAttaching)},N.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},N.onMediaAttaching=function(R,d){var f=this.hls.config;if(f.capLevelOnFPSDrop){var w=d.media instanceof self.HTMLVideoElement?d.media:null;this.media=w,w&&typeof w.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),f.fpsDroppedMonitoringPeriod)}},N.checkFPS=function(R,d,f){var w=performance.now();if(d){if(this.lastTime){var p=w-this.lastTime,g=f-this.lastDroppedFrames,b=d-this.lastDecodedFrames,o=1e3*g/p,i=this.hls;if(i.trigger(V.Events.FPS_DROP,{currentDropped:g,currentDecoded:b,totalDroppedFrames:f}),o>0&&g>i.config.fpsDroppedMonitoringThreshold*b){var s=i.currentLevel;I.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(i.autoLevelCapping===-1||i.autoLevelCapping>=s)&&(s=s-1,i.trigger(V.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:i.currentLevel}),i.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=w,this.lastDroppedFrames=f,this.lastDecodedFrames=d}},N.checkFPSInterval=function(){var R=this.media;if(R)if(this.isVideoPlaybackQualityAvailable){var d=R.getVideoPlaybackQuality();this.checkFPS(R,d.totalVideoFrames,d.droppedVideoFrames)}else this.checkFPS(R,R.webkitDecodedFrameCount,R.webkitDroppedFrameCount)},W}();$.default=M},"./src/controller/fragment-finders.ts":function(ie,$,O){"use strict";O.r($),O.d($,"findFragmentByPDT",function(){return M}),O.d($,"findFragmentByPTS",function(){return W}),O.d($,"fragmentWithinToleranceTest",function(){return N}),O.d($,"pdtWithinToleranceTest",function(){return P}),O.d($,"findFragWithCC",function(){return R});var V=O("./src/polyfills/number.ts"),I=O("./src/utils/binary-search.ts");function M(d,f,w){if(f===null||!Array.isArray(d)||!d.length||!Object(V.isFiniteNumber)(f))return null;var p=d[0].programDateTime;if(f<(p||0))return null;var g=d[d.length-1].endProgramDateTime;if(f>=(g||0))return null;w=w||0;for(var b=0;b<d.length;++b){var o=d[b];if(P(f,w,o))return o}return null}function W(d,f,w,p){w===void 0&&(w=0),p===void 0&&(p=0);var g=null;if(d?g=f[d.sn-f[0].sn+1]||null:w===0&&f[0].start===0&&(g=f[0]),g&&N(w,p,g)===0)return g;var b=I.default.search(f,N.bind(null,w,p));return b||g}function N(d,f,w){d===void 0&&(d=0),f===void 0&&(f=0);var p=Math.min(f,w.duration+(w.deltaPTS?w.deltaPTS:0));return w.start+w.duration-p<=d?1:w.start-p>d&&w.start?-1:0}function P(d,f,w){var p=Math.min(f,w.duration+(w.deltaPTS?w.deltaPTS:0))*1e3,g=w.endProgramDateTime||0;return g-p>d}function R(d,f){return I.default.search(d,function(w){return w.cc<f?1:w.cc>f?-1:0})}},"./src/controller/fragment-tracker.ts":function(ie,$,O){"use strict";O.r($),O.d($,"FragmentState",function(){return M}),O.d($,"FragmentTracker",function(){return W});var V=O("./src/events.ts"),I=O("./src/types/loader.ts"),M;(function(R){R.NOT_LOADED="NOT_LOADED",R.BACKTRACKED="BACKTRACKED",R.APPENDING="APPENDING",R.PARTIAL="PARTIAL",R.OK="OK"})(M||(M={}));var W=function(){function R(f){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=f,this._registerListeners()}var d=R.prototype;return d._registerListeners=function(){var w=this.hls;w.on(V.Events.BUFFER_APPENDED,this.onBufferAppended,this),w.on(V.Events.FRAG_BUFFERED,this.onFragBuffered,this),w.on(V.Events.FRAG_LOADED,this.onFragLoaded,this)},d._unregisterListeners=function(){var w=this.hls;w.off(V.Events.BUFFER_APPENDED,this.onBufferAppended,this),w.off(V.Events.FRAG_BUFFERED,this.onFragBuffered,this),w.off(V.Events.FRAG_LOADED,this.onFragLoaded,this)},d.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},d.getAppendedFrag=function(w,p){if(p===I.PlaylistLevelType.MAIN){var g=this.activeFragment,b=this.activeParts;if(!g)return null;if(b)for(var o=b.length;o--;){var i=b[o],s=i?i.end:g.appendedPTS;if(i.start<=w&&s!==void 0&&w<=s)return o>9&&(this.activeParts=b.slice(o-9)),i}else if(g.start<=w&&g.appendedPTS!==void 0&&w<=g.appendedPTS)return g}return this.getBufferedFrag(w,p)},d.getBufferedFrag=function(w,p){for(var g=this.fragments,b=Object.keys(g),o=b.length;o--;){var i=g[b[o]];if((i==null?void 0:i.body.type)===p&&i.buffered){var s=i.body;if(s.start<=w&&w<=s.end)return s}}return null},d.detectEvictedFragments=function(w,p,g){var b=this;Object.keys(this.fragments).forEach(function(o){var i=b.fragments[o];if(!i)return;if(!i.buffered){i.body.type===g&&b.removeFragment(i.body);return}var s=i.range[w];if(!s)return;s.time.some(function(l){var C=!b.isTimeBuffered(l.startPTS,l.endPTS,p);return C&&b.removeFragment(i.body),C})})},d.detectPartialFragments=function(w){var p=this,g=this.timeRanges,b=w.frag,o=w.part;if(!g||b.sn==="initSegment")return;var i=P(b),s=this.fragments[i];if(!s)return;Object.keys(g).forEach(function(l){var C=b.elementaryStreams[l];if(!C)return;var m=g[l],v=o!==null||C.partial===!0;s.range[l]=p.getBufferedTimes(b,o,v,m)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},d.fragBuffered=function(w){var p=P(w),g=this.fragments[p];g&&(g.backtrack=g.loaded=null,g.buffered=!0)},d.getBufferedTimes=function(w,p,g,b){for(var o={time:[],partial:g},i=p?p.start:w.start,s=p?p.end:w.end,l=w.minEndPTS||s,C=w.maxStartPTS||i,m=0;m<b.length;m++){var v=b.start(m)-this.bufferPadding,k=b.end(m)+this.bufferPadding;if(C>=v&&l<=k){o.time.push({startPTS:Math.max(i,b.start(m)),endPTS:Math.min(s,b.end(m))});break}else if(i<k&&s>v)o.partial=!0,o.time.push({startPTS:Math.max(i,b.start(m)),endPTS:Math.min(s,b.end(m))});else if(s<=v)break}return o},d.getPartialFragment=function(w){var p=null,g,b,o,i=0,s=this.bufferPadding,l=this.fragments;return Object.keys(l).forEach(function(C){var m=l[C];if(!m)return;N(m)&&(b=m.body.start-s,o=m.body.end+s,w>=b&&w<=o&&(g=Math.min(w-b,o-w),i<=g&&(p=m.body,i=g)))}),p},d.getState=function(w){var p=P(w),g=this.fragments[p];return g?g.buffered?N(g)?M.PARTIAL:M.OK:g.backtrack?M.BACKTRACKED:M.APPENDING:M.NOT_LOADED},d.backtrack=function(w,p){var g=P(w),b=this.fragments[g];if(!b||b.backtrack)return null;var o=b.backtrack=p||b.loaded;return b.loaded=null,o},d.getBacktrackData=function(w){var p=P(w),g=this.fragments[p];if(g){var b,o=g.backtrack;if(o!=null&&(b=o.payload)!==null&&b!==void 0&&b.byteLength)return o;this.removeFragment(w)}return null},d.isTimeBuffered=function(w,p,g){for(var b,o,i=0;i<g.length;i++){if(b=g.start(i)-this.bufferPadding,o=g.end(i)+this.bufferPadding,w>=b&&p<=o)return!0;if(p<=b)return!1}return!1},d.onFragLoaded=function(w,p){var g=p.frag,b=p.part;if(g.sn==="initSegment"||g.bitrateTest||b)return;var o=P(g);this.fragments[o]={body:g,loaded:p,backtrack:null,buffered:!1,range:Object.create(null)}},d.onBufferAppended=function(w,p){var g=this,b=p.frag,o=p.part,i=p.timeRanges;if(b.type===I.PlaylistLevelType.MAIN)if(this.activeFragment=b,o){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(o)}else this.activeParts=null;this.timeRanges=i,Object.keys(i).forEach(function(l){var C=i[l];if(g.detectEvictedFragments(l,C),!o)for(var m=0;m<C.length;m++)b.appendedPTS=Math.max(C.end(m),b.appendedPTS||0)})},d.onFragBuffered=function(w,p){this.detectPartialFragments(p)},d.hasFragment=function(w){var p=P(w);return!!this.fragments[p]},d.removeFragmentsInRange=function(w,p,g){var b=this;Object.keys(this.fragments).forEach(function(o){var i=b.fragments[o];if(!i)return;if(i.buffered){var s=i.body;s.type===g&&s.start<p&&s.end>w&&b.removeFragment(s)}})},d.removeFragment=function(w){var p=P(w);w.stats.loaded=0,w.clearElementaryStreamInfo(),delete this.fragments[p]},d.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},R}();function N(R){var d,f;return R.buffered&&(((d=R.range.video)===null||d===void 0?void 0:d.partial)||((f=R.range.audio)===null||f===void 0?void 0:f.partial))}function P(R){return R.type+"_"+R.level+"_"+R.urlId+"_"+R.sn}},"./src/controller/gap-controller.ts":function(ie,$,O){"use strict";O.r($),O.d($,"STALL_MINIMUM_DURATION_MS",function(){return N}),O.d($,"MAX_START_GAP_JUMP",function(){return P}),O.d($,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return R}),O.d($,"SKIP_BUFFER_RANGE_START",function(){return d}),O.d($,"default",function(){return f});var V=O("./src/utils/buffer-helper.ts"),I=O("./src/errors.ts"),M=O("./src/events.ts"),W=O("./src/utils/logger.ts"),N=250,P=2,R=.1,d=.05,f=function(){function w(g,b,o,i){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=g,this.media=b,this.fragmentTracker=o,this.hls=i}var p=w.prototype;return p.destroy=function(){this.hls=this.fragmentTracker=this.media=null},p.poll=function(b){var o=this.config,i=this.media,s=this.stalled,l=i.currentTime,C=i.seeking,m=this.seeking&&!C,v=!this.seeking&&C;if(this.seeking=C,l!==b){if(this.moved=!0,s!==null){if(this.stallReported){var k=self.performance.now()-s;W.logger.warn("playback not stuck anymore @"+l+", after "+Math.round(k)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((v||m)&&(this.stalled=null),i.paused||i.ended||i.playbackRate===0||!V.BufferHelper.getBuffered(i).length)return;var L=V.BufferHelper.bufferInfo(i,l,0),E=L.len>0,y=L.nextStart||0;if(!E&&!y)return;if(C){var c=L.len>P,u=!y||y-l>P&&!this.fragmentTracker.getPartialFragment(l);if(c||u)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var A,S=Math.max(y,L.start||0)-l,T=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,_=T==null||((A=T.details)===null||A===void 0)?void 0:A.live,j=_?T.details.targetduration*2:P;if(S>0&&S<=j){this._trySkipBufferHole(null);return}}var z=self.performance.now();if(s===null){this.stalled=z;return}var Z=z-s;!C&&Z>=N&&this._reportStall(L.len);var K=V.BufferHelper.bufferInfo(i,l,o.maxBufferHole);this._tryFixBufferStall(K,Z)},p._tryFixBufferStall=function(b,o){var i=this.config,s=this.fragmentTracker,l=this.media,C=l.currentTime,m=s.getPartialFragment(C);if(m){var v=this._trySkipBufferHole(m);if(v)return}b.len>i.maxBufferHole&&o>i.highBufferWatchdogPeriod*1e3&&(W.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},p._reportStall=function(b){var o=this.hls,i=this.media,s=this.stallReported;s||(this.stallReported=!0,W.logger.warn("Playback stalling at @"+i.currentTime+" due to low buffer (buffer="+b+")"),o.trigger(M.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:b}))},p._trySkipBufferHole=function(b){for(var o=this.config,i=this.hls,s=this.media,l=s.currentTime,C=0,m=V.BufferHelper.getBuffered(s),v=0;v<m.length;v++){var k=m.start(v);if(l+o.maxBufferHole>=C&&l<k){var L=Math.max(k+d,s.currentTime+R);return W.logger.warn("skipping hole, adjusting currentTime from "+l+" to "+L),this.moved=!0,this.stalled=null,s.currentTime=L,b&&i.trigger(M.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+l+" to "+L,frag:b}),L}C=m.end(v)}return 0},p._tryNudgeBuffer=function(){var b=this.config,o=this.hls,i=this.media,s=i.currentTime,l=(this.nudgeRetry||0)+1;if(this.nudgeRetry=l,l<b.nudgeMaxRetry){var C=s+l*b.nudgeOffset;W.logger.warn("Nudging 'currentTime' from "+s+" to "+C),i.currentTime=C,o.trigger(M.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else W.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+b.nudgeMaxRetry+" nudges"),o.trigger(M.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},w}()},"./src/controller/id3-track-controller.ts":function(ie,$,O){"use strict";O.r($);var V=O("./src/events.ts"),I=O("./src/utils/texttrack-utils.ts"),M=O("./src/demux/id3.ts"),W=.25,N=function(){function P(d){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=d,this._registerListeners()}var R=P.prototype;return R.destroy=function(){this._unregisterListeners()},R._registerListeners=function(){var f=this.hls;f.on(V.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.on(V.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.on(V.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),f.on(V.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R._unregisterListeners=function(){var f=this.hls;f.off(V.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.off(V.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.off(V.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),f.off(V.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R.onMediaAttached=function(f,w){this.media=w.media},R.onMediaDetaching=function(){if(!this.id3Track)return;Object(I.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},R.getID3Track=function(f){if(!this.media)return;for(var w=0;w<f.length;w++){var p=f[w];if(p.kind==="metadata"&&p.label==="id3")return Object(I.sendAddTrackEvent)(p,this.media),p}return this.media.addTextTrack("metadata","id3")},R.onFragParsingMetadata=function(f,w){if(!this.media)return;var p=w.frag,g=w.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var b=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,o=0;o<g.length;o++){var i=M.getID3Frames(g[o].data);if(i){var s=g[o].pts,l=o<g.length-1?g[o+1].pts:p.end,C=l-s;C<=0&&(l=s+W);for(var m=0;m<i.length;m++){var v=i[m];if(!M.isTimeStampFrame(v)){var k=new b(s,l,"");k.value=v,this.id3Track.addCue(k)}}}}},R.onBufferFlushing=function(f,w){var p=w.startOffset,g=w.endOffset,b=w.type;if(!b||b==="audio"){var o=this.id3Track;o&&Object(I.removeCuesInRange)(o,p,g)}},P}();$.default=N},"./src/controller/latency-controller.ts":function(ie,$,O){"use strict";O.r($),O.d($,"default",function(){return P});var V=O("./src/errors.ts"),I=O("./src/events.ts"),M=O("./src/utils/logger.ts");function W(R,d){for(var f=0;f<d.length;f++){var w=d[f];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(R,w.key,w)}}function N(R,d,f){return d&&W(R.prototype,d),f&&W(R,f),R}var P=function(){function R(f){var w=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return w.timeupdate()},this.hls=f,this.config=f.config,this.registerListeners()}var d=R.prototype;return d.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},d.registerListeners=function(){this.hls.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(I.Events.ERROR,this.onError,this)},d.unregisterListeners=function(){this.hls.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(I.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(I.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(I.Events.ERROR,this.onError)},d.onMediaAttached=function(w,p){this.media=p.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},d.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},d.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},d.onLevelUpdated=function(w,p){var g=p.details;this.levelDetails=g,g.advanced&&this.timeupdate(),!g.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},d.onError=function(w,p){if(p.details!==V.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,M.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},d.timeupdate=function(){var w=this.media,p=this.levelDetails;if(!w||!p)return;this.currentTime=w.currentTime;var g=this.computeLatency();if(g===null)return;this._latency=g;var b=this.config,o=b.lowLatencyMode,i=b.maxLiveSyncPlaybackRate;if(!o||i===1)return;var s=this.targetLatency;if(s===null)return;var l=g-s,C=Math.min(this.maxLatency,s+p.targetduration),m=l<C;if(p.live&&m&&l>.05&&this.forwardBufferLength>1){var v=Math.min(2,Math.max(1,i)),k=Math.round(2/(1+Math.exp(-.75*l-this.edgeStalled))*20)/20;w.playbackRate=Math.min(v,Math.max(1,k))}else w.playbackRate!==1&&w.playbackRate!==0&&(w.playbackRate=1)},d.estimateLiveEdge=function(){var w=this.levelDetails;return w===null?null:w.edge+w.age},d.computeLatency=function(){var w=this.estimateLiveEdge();return w===null?null:w-this.currentTime},N(R,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var w=this.config,p=this.levelDetails;return w.liveMaxLatencyDuration!==void 0?w.liveMaxLatencyDuration:p?w.liveMaxLatencyDurationCount*p.targetduration:0}},{key:"targetLatency",get:function(){var w=this.levelDetails;if(w===null)return null;var p=w.holdBack,g=w.partHoldBack,b=w.targetduration,o=this.config,i=o.liveSyncDuration,s=o.liveSyncDurationCount,l=o.lowLatencyMode,C=this.hls.userConfig,m=l&&g||p;(C.liveSyncDuration||C.liveSyncDurationCount||m===0)&&(m=i!==void 0?i:s*b);var v=b,k=1;return m+Math.min(this.stallCount*k,v)}},{key:"liveSyncPosition",get:function(){var w=this.estimateLiveEdge(),p=this.targetLatency,g=this.levelDetails;if(w===null||p===null||g===null)return null;var b=g.edge,o=w-p-this.edgeStalled,i=b-g.totalduration,s=b-(this.config.lowLatencyMode&&g.partTarget||g.targetduration);return Math.min(Math.max(i,o),s)}},{key:"drift",get:function(){var w=this.levelDetails;return w===null?1:w.drift}},{key:"edgeStalled",get:function(){var w=this.levelDetails;if(w===null)return 0;var p=(this.config.lowLatencyMode&&w.partTarget||w.targetduration)*3;return Math.max(w.age-p,0)}},{key:"forwardBufferLength",get:function(){var w=this.media,p=this.levelDetails;if(!w||!p)return 0;var g=w.buffered.length;return g?w.buffered.end(g-1):p.edge-this.currentTime}}]),R}()},"./src/controller/level-controller.ts":function(ie,$,O){"use strict";O.r($),O.d($,"default",function(){return o});var V=O("./src/types/level.ts"),I=O("./src/events.ts"),M=O("./src/errors.ts"),W=O("./src/utils/codecs.ts"),N=O("./src/controller/level-helper.ts"),P=O("./src/controller/base-playlist-controller.ts"),R=O("./src/types/loader.ts");function d(){return d=Object.assign||function(i){for(var s=1;s<arguments.length;s++){var l=arguments[s];for(var C in l)Object.prototype.hasOwnProperty.call(l,C)&&(i[C]=l[C])}return i},d.apply(this,arguments)}function f(i,s){for(var l=0;l<s.length;l++){var C=s[l];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(i,C.key,C)}}function w(i,s,l){return s&&f(i.prototype,s),l&&f(i,l),i}function p(i,s){i.prototype=Object.create(s.prototype),i.prototype.constructor=i,g(i,s)}function g(i,s){return g=Object.setPrototypeOf||function(C,m){return C.__proto__=m,C},g(i,s)}var b=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),o=function(i){p(s,i);function s(C){var m;return m=i.call(this,C,"[level-controller]")||this,m._levels=[],m._firstLevel=-1,m._startLevel=void 0,m.currentLevelIndex=-1,m.manualLevelIndex=-1,m.onParsedComplete=void 0,m._registerListeners(),m}var l=s.prototype;return l._registerListeners=function(){var m=this.hls;m.on(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),m.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.on(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),m.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),m.on(I.Events.ERROR,this.onError,this)},l._unregisterListeners=function(){var m=this.hls;m.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),m.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.off(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),m.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),m.off(I.Events.ERROR,this.onError,this)},l.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,i.prototype.destroy.call(this)},l.startLoad=function(){var m=this._levels;m.forEach(function(v){v.loadError=0}),i.prototype.startLoad.call(this)},l.onManifestLoaded=function(m,v){var k=[],L=[],E=[],y,c={},u,A=!1,S=!1,T=!1;if(v.levels.forEach(function(Z){var K=Z.attrs;A=A||!!(Z.width&&Z.height),S=S||!!Z.videoCodec,T=T||!!Z.audioCodec,b&&Z.audioCodec&&Z.audioCodec.indexOf("mp4a.40.34")!==-1&&(Z.audioCodec=void 0);var F=Z.bitrate+"-"+Z.attrs.RESOLUTION+"-"+Z.attrs.CODECS;u=c[F],u?u.url.push(Z.url):(u=new V.Level(Z),c[F]=u,k.push(u)),K&&(K.AUDIO&&Object(N.addGroupId)(u,"audio",K.AUDIO),K.SUBTITLES&&Object(N.addGroupId)(u,"text",K.SUBTITLES))}),(A||S)&&T&&(k=k.filter(function(Z){var K=Z.videoCodec,F=Z.width,ee=Z.height;return!!K||!!(F&&ee)})),k=k.filter(function(Z){var K=Z.audioCodec,F=Z.videoCodec;return(!K||Object(W.isCodecSupportedInMp4)(K,"audio"))&&(!F||Object(W.isCodecSupportedInMp4)(F,"video"))}),v.audioTracks&&(L=v.audioTracks.filter(function(Z){return!Z.audioCodec||Object(W.isCodecSupportedInMp4)(Z.audioCodec,"audio")}),Object(N.assignTrackIdsByGroup)(L)),v.subtitles&&(E=v.subtitles,Object(N.assignTrackIdsByGroup)(E)),k.length>0){y=k[0].bitrate,k.sort(function(Z,K){return Z.bitrate-K.bitrate}),this._levels=k;for(var _=0;_<k.length;_++)if(k[_].bitrate===y){this._firstLevel=_,this.log("manifest loaded, "+k.length+" level(s) found, first bitrate: "+y);break}var j=T&&!S,z={levels:k,audioTracks:L,subtitleTracks:E,firstLevel:this._firstLevel,stats:v.stats,audio:T,video:S,altAudio:!j&&L.some(function(Z){return!!Z.url})};this.hls.trigger(I.Events.MANIFEST_PARSED,z),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(I.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:v.url,reason:"no level with compatible codecs found in manifest"})},l.onError=function(m,v){if(i.prototype.onError.call(this,m,v),v.fatal)return;var k=v.context,L=this._levels[this.currentLevelIndex];if(k&&(k.type===R.PlaylistContextType.AUDIO_TRACK&&L.audioGroupIds&&k.groupId===L.audioGroupIds[L.urlId]||k.type===R.PlaylistContextType.SUBTITLE_TRACK&&L.textGroupIds&&k.groupId===L.textGroupIds[L.urlId])){this.redundantFailover(this.currentLevelIndex);return}var E=!1,y=!0,c;switch(v.details){case M.ErrorDetails.FRAG_LOAD_ERROR:case M.ErrorDetails.FRAG_LOAD_TIMEOUT:case M.ErrorDetails.KEY_LOAD_ERROR:case M.ErrorDetails.KEY_LOAD_TIMEOUT:if(v.frag){var u=this._levels[v.frag.level];u?(u.fragmentError++,u.fragmentError>this.hls.config.fragLoadingMaxRetry&&(c=v.frag.level)):c=v.frag.level}break;case M.ErrorDetails.LEVEL_LOAD_ERROR:case M.ErrorDetails.LEVEL_LOAD_TIMEOUT:k&&(k.deliveryDirectives&&(y=!1),c=k.level),E=!0;break;case M.ErrorDetails.REMUX_ALLOC_ERROR:c=v.level,E=!0;break}c!==void 0&&this.recoverLevel(v,c,E,y)},l.recoverLevel=function(m,v,k,L){var E=m.details,y=this._levels[v];if(y.loadError++,k){var c=this.retryLoadingOrFail(m);if(c)m.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(L){var u=y.url.length;if(u>1&&y.loadError<u)m.levelRetry=!0,this.redundantFailover(v);else if(this.manualLevelIndex===-1){var A=v===0?this._levels.length-1:v-1;this.currentLevelIndex!==A&&this._levels[A].loadError===0&&(this.warn(E+": switch to "+A),m.levelRetry=!0,this.hls.nextAutoLevel=A)}}},l.redundantFailover=function(m){var v=this._levels[m],k=v.url.length;if(k>1){var L=(v.urlId+1)%k;this.warn("Switching to redundant URL-id "+L),this._levels.forEach(function(E){E.urlId=L}),this.level=m}},l.onFragLoaded=function(m,v){var k=v.frag;if(k!==void 0&&k.type===R.PlaylistLevelType.MAIN){var L=this._levels[k.level];L!==void 0&&(L.fragmentError=0,L.loadError=0)}},l.onLevelLoaded=function(m,v){var k,L=v.level,E=v.details,y=this._levels[L];if(!y){var c;this.warn("Invalid level index "+L),(c=v.deliveryDirectives)!==null&&c!==void 0&&c.skip&&(E.deltaUpdateFailed=!0);return}L===this.currentLevelIndex?(y.fragmentError===0&&(y.loadError=0,this.retryCount=0),this.playlistLoaded(L,v,y.details)):(k=v.deliveryDirectives)!==null&&k!==void 0&&k.skip&&(E.deltaUpdateFailed=!0)},l.onAudioTrackSwitched=function(m,v){var k=this.hls.levels[this.currentLevelIndex];if(!k)return;if(k.audioGroupIds){for(var L=-1,E=this.hls.audioTracks[v.id].groupId,y=0;y<k.audioGroupIds.length;y++)if(k.audioGroupIds[y]===E){L=y;break}L!==k.urlId&&(k.urlId=L,this.startLoad())}},l.loadPlaylist=function(m){var v=this.currentLevelIndex,k=this._levels[v];if(this.canLoad&&k&&k.url.length>0){var L=k.urlId,E=k.url[L];if(m)try{E=m.addDirectives(E)}catch(y){this.warn("Could not construct new URL with HLS Delivery Directives: "+y)}this.log("Attempt loading level index "+v+(m?" at sn "+m.msn+" part "+m.part:"")+" with URL-id "+L+" "+E),this.clearTimer(),this.hls.trigger(I.Events.LEVEL_LOADING,{url:E,level:v,id:L,deliveryDirectives:m||null})}},l.removeLevel=function(m,v){var k=function(y,c){return c!==v},L=this._levels.filter(function(E,y){return y!==m?!0:E.url.length>1&&v!==void 0?(E.url=E.url.filter(k),E.audioGroupIds&&(E.audioGroupIds=E.audioGroupIds.filter(k)),E.textGroupIds&&(E.textGroupIds=E.textGroupIds.filter(k)),E.urlId=0,!0):!1}).map(function(E,y){var c=E.details;return c!=null&&c.fragments&&c.fragments.forEach(function(u){u.level=y}),E});this._levels=L,this.hls.trigger(I.Events.LEVELS_UPDATED,{levels:L})},w(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(m){var v,k=this._levels;if(k.length===0)return;if(this.currentLevelIndex===m&&(v=k[m])!==null&&v!==void 0&&v.details)return;if(m<0||m>=k.length){var L=m<0;if(this.hls.trigger(I.Events.ERROR,{type:M.ErrorTypes.OTHER_ERROR,details:M.ErrorDetails.LEVEL_SWITCH_ERROR,level:m,fatal:L,reason:"invalid level idx"}),L)return;m=Math.min(m,k.length-1)}this.clearTimer();var E=this.currentLevelIndex,y=k[E],c=k[m];this.log("switching to level "+m+" from "+E),this.currentLevelIndex=m;var u=d({},c,{level:m,maxBitrate:c.maxBitrate,uri:c.uri,urlId:c.urlId});delete u._urlId,this.hls.trigger(I.Events.LEVEL_SWITCHING,u);var A=c.details;if(!A||A.live){var S=this.switchParams(c.uri,y==null?void 0:y.details);this.loadPlaylist(S)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(m){this.manualLevelIndex=m,this._startLevel===void 0&&(this._startLevel=m),m!==-1&&(this.level=m)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(m){this._firstLevel=m}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var m=this.hls.config.startLevel;return m!==void 0?m:this._firstLevel}else return this._startLevel},set:function(m){this._startLevel=m}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(m){this.level=m,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=m)}}]),s}(P.default)},"./src/controller/level-helper.ts":function(ie,$,O){"use strict";O.r($),O.d($,"addGroupId",function(){return M}),O.d($,"assignTrackIdsByGroup",function(){return W}),O.d($,"updatePTS",function(){return N}),O.d($,"updateFragPTSDTS",function(){return R}),O.d($,"mergeDetails",function(){return d}),O.d($,"mapPartIntersection",function(){return f}),O.d($,"mapFragmentIntersection",function(){return w}),O.d($,"adjustSliding",function(){return p}),O.d($,"addSliding",function(){return g}),O.d($,"computeReloadInterval",function(){return b}),O.d($,"getFragmentWithSN",function(){return o}),O.d($,"getPartWith",function(){return i});var V=O("./src/polyfills/number.ts"),I=O("./src/utils/logger.ts");function M(s,l,C){switch(l){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(C);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(C);break}}function W(s){var l={};s.forEach(function(C){var m=C.groupId||"";C.id=l[m]=l[m]||0,l[m]++})}function N(s,l,C){var m=s[l],v=s[C];P(m,v)}function P(s,l){var C=l.startPTS;if(Object(V.isFiniteNumber)(C)){var m=0,v;l.sn>s.sn?(m=C-s.start,v=s):(m=s.start-C,v=l),v.duration!==m&&(v.duration=m)}else if(l.sn>s.sn){var k=s.cc===l.cc;k&&s.minEndPTS?l.start=s.start+(s.minEndPTS-s.start):l.start=s.start+s.duration}else l.start=Math.max(s.start-l.duration,0)}function R(s,l,C,m,v,k){var L=m-C;L<=0&&(I.logger.warn("Fragment should have a positive duration",l),m=C+l.duration,k=v+l.duration);var E=C,y=m,c=l.startPTS,u=l.endPTS;if(Object(V.isFiniteNumber)(c)){var A=Math.abs(c-C);Object(V.isFiniteNumber)(l.deltaPTS)?l.deltaPTS=Math.max(A,l.deltaPTS):l.deltaPTS=A,E=Math.max(C,c),C=Math.min(C,c),v=Math.min(v,l.startDTS),y=Math.min(m,u),m=Math.max(m,u),k=Math.max(k,l.endDTS)}l.duration=m-C;var S=C-l.start;l.appendedPTS=m,l.start=l.startPTS=C,l.maxStartPTS=E,l.startDTS=v,l.endPTS=m,l.minEndPTS=y,l.endDTS=k;var T=l.sn;if(!s||T<s.startSN||T>s.endSN)return 0;var _,j=T-s.startSN,z=s.fragments;for(z[j]=l,_=j;_>0;_--)P(z[_],z[_-1]);for(_=j;_<z.length-1;_++)P(z[_],z[_+1]);return s.fragmentHint&&P(z[z.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,S}function d(s,l){for(var C=null,m=s.fragments,v=m.length-1;v>=0;v--){var k=m[v].initSegment;if(k){C=k;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var L=0,E;if(w(s,l,function(_,j){_.relurl&&(L=_.cc-j.cc),Object(V.isFiniteNumber)(_.startPTS)&&Object(V.isFiniteNumber)(_.endPTS)&&(j.start=j.startPTS=_.startPTS,j.startDTS=_.startDTS,j.appendedPTS=_.appendedPTS,j.maxStartPTS=_.maxStartPTS,j.endPTS=_.endPTS,j.endDTS=_.endDTS,j.minEndPTS=_.minEndPTS,j.duration=_.endPTS-_.startPTS,j.duration&&(E=j),l.PTSKnown=l.alignedSliding=!0),j.elementaryStreams=_.elementaryStreams,j.loader=_.loader,j.stats=_.stats,j.urlId=_.urlId,_.initSegment&&(j.initSegment=_.initSegment,C=_.initSegment)}),C){var y=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments;y.forEach(function(_){var j;(!_.initSegment||_.initSegment.relurl===((j=C)===null||j===void 0?void 0:j.relurl))&&(_.initSegment=C)})}if(l.skippedSegments&&(l.deltaUpdateFailed=l.fragments.some(function(_){return!_}),l.deltaUpdateFailed)){I.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var c=l.skippedSegments;c--;)l.fragments.shift();l.startSN=l.fragments[0].sn,l.startCC=l.fragments[0].cc}var u=l.fragments;if(L){I.logger.warn("discontinuity sliding from playlist, take drift into account");for(var A=0;A<u.length;A++)u[A].cc+=L}l.skippedSegments&&(l.startCC=l.fragments[0].cc),f(s.partList,l.partList,function(_,j){j.elementaryStreams=_.elementaryStreams,j.stats=_.stats}),E?R(l,E,E.startPTS,E.endPTS,E.startDTS,E.endDTS):p(s,l),u.length&&(l.totalduration=l.edge-u[0].start),l.driftStartTime=s.driftStartTime,l.driftStart=s.driftStart;var S=l.advancedDateTime;if(l.advanced&&S){var T=l.edge;l.driftStart||(l.driftStartTime=S,l.driftStart=T),l.driftEndTime=S,l.driftEnd=T}else l.driftEndTime=s.driftEndTime,l.driftEnd=s.driftEnd,l.advancedDateTime=s.advancedDateTime}function f(s,l,C){if(s&&l)for(var m=0,v=0,k=s.length;v<=k;v++){var L=s[v],E=l[v+m];L&&E&&L.index===E.index&&L.fragment.sn===E.fragment.sn?C(L,E):m--}}function w(s,l,C){for(var m=l.skippedSegments,v=Math.max(s.startSN,l.startSN)-l.startSN,k=(s.fragmentHint?1:0)+(m?l.endSN:Math.min(s.endSN,l.endSN))-l.startSN,L=l.startSN-s.startSN,E=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,y=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,c=v;c<=k;c++){var u=y[L+c],A=E[c];m&&!A&&c<m&&(A=l.fragments[c]=u),u&&A&&C(u,A)}}function p(s,l){var C=l.startSN+l.skippedSegments-s.startSN,m=s.fragments;if(C<0||C>=m.length)return;g(l,m[C].start)}function g(s,l){if(l){for(var C=s.fragments,m=s.skippedSegments;m<C.length;m++)C[m].start+=l;s.fragmentHint&&(s.fragmentHint.start+=l)}}function b(s,l){var C=1e3*s.levelTargetDuration,m=C/2,v=s.age,k=v>0&&v<C*3,L=l.loading.end-l.loading.start,E,y=s.availabilityDelay;if(s.updated===!1)if(k){var c=333*s.misses;E=Math.max(Math.min(m,L*2),c),s.availabilityDelay=(s.availabilityDelay||0)+E}else E=m;else k?(y=Math.min(y||C/2,v),s.availabilityDelay=y,E=y+C-v):E=C-L;return Math.round(E)}function o(s,l,C){if(!s||!s.details)return null;var m=s.details,v=m.fragments[l-m.startSN];return v||(v=m.fragmentHint,v&&v.sn===l?v:l<m.startSN&&C&&C.sn===l?C:null)}function i(s,l,C){if(!s||!s.details)return null;var m=s.details.partList;if(m)for(var v=m.length;v--;){var k=m[v];if(k.index===C&&k.fragment.sn===l)return k}return null}},"./src/controller/stream-controller.ts":function(ie,$,O){"use strict";O.r($),O.d($,"default",function(){return m});var V=O("./src/polyfills/number.ts"),I=O("./src/controller/base-stream-controller.ts"),M=O("./src/is-supported.ts"),W=O("./src/events.ts"),N=O("./src/utils/buffer-helper.ts"),P=O("./src/controller/fragment-tracker.ts"),R=O("./src/types/loader.ts"),d=O("./src/loader/fragment.ts"),f=O("./src/demux/transmuxer-interface.ts"),w=O("./src/types/transmuxer.ts"),p=O("./src/controller/gap-controller.ts"),g=O("./src/errors.ts"),b=O("./src/utils/logger.ts");function o(v,k){for(var L=0;L<k.length;L++){var E=k[L];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(v,E.key,E)}}function i(v,k,L){return k&&o(v.prototype,k),L&&o(v,L),v}function s(v,k){v.prototype=Object.create(k.prototype),v.prototype.constructor=v,l(v,k)}function l(v,k){return l=Object.setPrototypeOf||function(E,y){return E.__proto__=y,E},l(v,k)}var C=100,m=function(v){s(k,v);function k(E,y){var c;return c=v.call(this,E,y,"[stream-controller]")||this,c.audioCodecSwap=!1,c.gapController=null,c.level=-1,c._forceStartLoad=!1,c.altAudio=!1,c.audioOnly=!1,c.fragPlaying=null,c.onvplaying=null,c.onvseeked=null,c.fragLastKbps=0,c.stalled=!1,c.couldBacktrack=!1,c.audioCodecSwitch=!1,c.videoBuffer=null,c._registerListeners(),c}var L=k.prototype;return L._registerListeners=function(){var y=this.hls;y.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),y.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),y.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),y.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.on(W.Events.LEVEL_LOADING,this.onLevelLoading,this),y.on(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),y.on(W.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),y.on(W.Events.ERROR,this.onError,this),y.on(W.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),y.on(W.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),y.on(W.Events.BUFFER_CREATED,this.onBufferCreated,this),y.on(W.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),y.on(W.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),y.on(W.Events.FRAG_BUFFERED,this.onFragBuffered,this)},L._unregisterListeners=function(){var y=this.hls;y.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),y.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),y.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),y.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.off(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),y.off(W.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),y.off(W.Events.ERROR,this.onError,this),y.off(W.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),y.off(W.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),y.off(W.Events.BUFFER_CREATED,this.onBufferCreated,this),y.off(W.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),y.off(W.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),y.off(W.Events.FRAG_BUFFERED,this.onFragBuffered,this)},L.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},L.startLoad=function(y){if(this.levels){var c=this.lastCurrentTime,u=this.hls;if(this.stopLoad(),this.setInterval(C),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var A=u.startLevel;A===-1&&(u.config.testBandwidth?(A=0,this.bitrateTest=!0):A=u.nextAutoLevel),this.level=u.nextLoadLevel=A,this.loadedmetadata=!1}c>0&&y===-1&&(this.log("Override startPosition with lastCurrentTime @"+c.toFixed(3)),y=c),this.state=I.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=y,this.tick()}else this._forceStartLoad=!0,this.state=I.State.STOPPED},L.stopLoad=function(){this._forceStartLoad=!1,v.prototype.stopLoad.call(this)},L.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_LEVEL:{var y,c=this.levels,u=this.level,A=c==null||((y=c[u])===null||y===void 0)?void 0:y.details;if(A&&(!A.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(A))break;this.state=I.State.IDLE;break}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var S,T=self.performance.now(),_=this.retryDate;(!_||T>=_||(S=this.media)!==null&&S!==void 0&&S.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=I.State.IDLE)}break;default:break}this.onTickEnd()},L.onTickEnd=function(){v.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},L.doTickIdle=function(){var y,c,u=this.hls,A=this.levelLastLoaded,S=this.levels,T=this.media,_=u.config,j=u.nextLoadLevel;if(A===null||!T&&(this.startFragRequested||!_.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!S||!S[j])return;var z=S[j];this.level=u.nextLoadLevel=j;var Z=z.details;if(!Z||this.state===I.State.WAITING_LEVEL||Z.live&&this.levelLastLoaded!==j){this.state=I.State.WAITING_LEVEL;return}var K=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:T,R.PlaylistLevelType.MAIN);if(K===null)return;var F=K.len,ee=this.getMaxBufferLength(z.maxBitrate);if(F>=ee)return;if(this._streamEnded(K,Z)){var se={};this.altAudio&&(se.type="video"),this.hls.trigger(W.Events.BUFFER_EOS,se),this.state=I.State.ENDED;return}var he=K.end,Ce=this.getNextFragment(he,Z);if(this.couldBacktrack&&!this.fragPrevious&&Ce&&Ce.sn!=="initSegment"){var Ue=Ce.sn-Z.startSN;Ue>1&&(Ce=Z.fragments[Ue-1],this.fragmentTracker.removeFragment(Ce))}if(Ce&&this.fragmentTracker.getState(Ce)===P.FragmentState.OK&&this.nextLoadPosition>he){var ke=this.audioOnly&&!this.altAudio?d.ElementaryStreamTypes.AUDIO:d.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(T,ke,R.PlaylistLevelType.MAIN),Ce=this.getNextFragment(this.nextLoadPosition,Z)}if(!Ce)return;Ce.initSegment&&!Ce.initSegment.data&&!this.bitrateTest&&(Ce=Ce.initSegment),((y=Ce.decryptdata)===null||y===void 0?void 0:y.keyFormat)==="identity"&&!((c=Ce.decryptdata)!==null&&c!==void 0&&c.key)?this.loadKey(Ce,Z):this.loadFragment(Ce,Z,he)},L.loadFragment=function(y,c,u){var A,S=this.fragmentTracker.getState(y);if(this.fragCurrent=y,S===P.FragmentState.BACKTRACKED){var T=this.fragmentTracker.getBacktrackData(y);if(T){this._handleFragmentLoadProgress(T),this._handleFragmentLoadComplete(T);return}else S=P.FragmentState.NOT_LOADED}S===P.FragmentState.NOT_LOADED||S===P.FragmentState.PARTIAL?y.sn==="initSegment"?this._loadInitSegment(y):this.bitrateTest?(y.bitrateTest=!0,this.log("Fragment "+y.sn+" of level "+y.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(y)):(this.startFragRequested=!0,v.prototype.loadFragment.call(this,y,c,u)):S===P.FragmentState.APPENDING?this.reduceMaxBufferLength(y.duration)&&this.fragmentTracker.removeFragment(y):((A=this.media)===null||A===void 0?void 0:A.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},L.getAppendedFrag=function(y){var c=this.fragmentTracker.getAppendedFrag(y,R.PlaylistLevelType.MAIN);return c&&"fragment"in c?c.fragment:c},L.getBufferedFrag=function(y){return this.fragmentTracker.getBufferedFrag(y,R.PlaylistLevelType.MAIN)},L.followingBufferedFrag=function(y){return y?this.getBufferedFrag(y.end+.5):null},L.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},L.nextLevelSwitch=function(){var y=this.levels,c=this.media;if(c!=null&&c.readyState){var u,A=this.getAppendedFrag(c.currentTime);if(A&&A.start>1&&this.flushMainBuffer(0,A.start-1),!c.paused&&y){var S=this.hls.nextLoadLevel,T=y[S],_=this.fragLastKbps;_&&this.fragCurrent?u=this.fragCurrent.duration*T.maxBitrate/(1e3*_)+1:u=0}else u=0;var j=this.getBufferedFrag(c.currentTime+u);if(j){var z=this.followingBufferedFrag(j);if(z){this.abortCurrentFrag();var Z=z.maxStartPTS?z.maxStartPTS:z.start,K=z.duration,F=Math.max(j.end,Z+Math.min(Math.max(K-this.config.maxFragLookUpTolerance,K*.5),K*.75));this.flushMainBuffer(F,Number.POSITIVE_INFINITY)}}}},L.abortCurrentFrag=function(){var y=this.fragCurrent;this.fragCurrent=null,y!=null&&y.loader&&y.loader.abort(),this.state===I.State.KEY_LOADING&&(this.state=I.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},L.flushMainBuffer=function(y,c){v.prototype.flushMainBuffer.call(this,y,c,this.altAudio?"video":null)},L.onMediaAttached=function(y,c){v.prototype.onMediaAttached.call(this,y,c);var u=c.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),u.addEventListener("playing",this.onvplaying),u.addEventListener("seeked",this.onvseeked),this.gapController=new p.default(this.config,u,this.fragmentTracker,this.hls)},L.onMediaDetaching=function(){var y=this.media;y&&(y.removeEventListener("playing",this.onvplaying),y.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),v.prototype.onMediaDetaching.call(this)},L.onMediaPlaying=function(){this.tick()},L.onMediaSeeked=function(){var y=this.media,c=y?y.currentTime:null;Object(V.isFiniteNumber)(c)&&this.log("Media seeked to "+c.toFixed(3)),this.tick()},L.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(W.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},L.onManifestParsed=function(y,c){var u=!1,A=!1,S;c.levels.forEach(function(T){S=T.audioCodec,S&&(S.indexOf("mp4a.40.2")!==-1&&(u=!0),S.indexOf("mp4a.40.5")!==-1&&(A=!0))}),this.audioCodecSwitch=u&&A&&!Object(M.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=c.levels,this.startFragRequested=!1},L.onLevelLoading=function(y,c){var u=this.levels;if(!u||this.state!==I.State.IDLE)return;var A=u[c.level];(!A.details||A.details.live&&this.levelLastLoaded!==c.level||this.waitForCdnTuneIn(A.details))&&(this.state=I.State.WAITING_LEVEL)},L.onLevelLoaded=function(y,c){var u,A=this.levels,S=c.level,T=c.details,_=T.totalduration;if(!A){this.warn("Levels were reset while loading level "+S);return}this.log("Level "+S+" loaded ["+T.startSN+","+T.endSN+"], cc ["+T.startCC+", "+T.endCC+"] duration:"+_);var j=this.fragCurrent;j&&(this.state===I.State.FRAG_LOADING||this.state===I.State.FRAG_LOADING_WAITING_RETRY)&&(j.level!==c.level&&j.loader&&(this.state=I.State.IDLE,j.loader.abort()));var z=A[S],Z=0;if(T.live||(u=z.details)!==null&&u!==void 0&&u.live){if(T.fragments[0]||(T.deltaUpdateFailed=!0),T.deltaUpdateFailed)return;Z=this.alignPlaylists(T,z.details)}if(z.details=T,this.levelLastLoaded=S,this.hls.trigger(W.Events.LEVEL_UPDATED,{details:T,level:S}),this.state===I.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(T))return;this.state=I.State.IDLE}this.startFragRequested?T.live&&this.synchronizeToLiveEdge(T):this.setStartPosition(T,Z),this.tick()},L._handleFragmentLoadProgress=function(y){var c,u=y.frag,A=y.part,S=y.payload,T=this.levels;if(!T){this.warn("Levels were reset while fragment load was in progress. Fragment "+u.sn+" of level "+u.level+" will not be buffered");return}var _=T[u.level],j=_.details;if(!j){this.warn("Dropping fragment "+u.sn+" of level "+u.level+" after level details were reset");return}var z=_.videoCodec,Z=j.PTSKnown||!j.live,K=(c=u.initSegment)===null||c===void 0?void 0:c.data,F=this._getAudioCodec(_),ee=this.transmuxer=this.transmuxer||new f.default(this.hls,R.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),se=A?A.index:-1,he=se!==-1,Ce=new w.ChunkMetadata(u.level,u.sn,u.stats.chunkCount,S.byteLength,se,he),Ue=this.initPTS[u.cc];ee.push(S,K,F,z,u,A,j.totalduration,Z,Ce,Ue)},L.onAudioTrackSwitching=function(y,c){var u=this.altAudio,A=!!c.url,S=c.id;if(!A){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var T=this.fragCurrent;T!=null&&T.loader&&(this.log("Switching to main audio track, cancel main fragment load"),T.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var _=this.hls;u&&_.trigger(W.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),_.trigger(W.Events.AUDIO_TRACK_SWITCHED,{id:S})}},L.onAudioTrackSwitched=function(y,c){var u=c.id,A=!!this.hls.audioTracks[u].url;if(A){var S=this.videoBuffer;S&&this.mediaBuffer!==S&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=S)}this.altAudio=A,this.tick()},L.onBufferCreated=function(y,c){var u=c.tracks,A,S,T=!1;for(var _ in u){var j=u[_];if(j.id==="main"){if(S=_,A=j,_==="video"){var z=u[_];z&&(this.videoBuffer=z.buffer)}}else T=!0}T&&A?(this.log("Alternate track found, use "+S+".buffered to schedule main fragment loading"),this.mediaBuffer=A.buffer):this.mediaBuffer=this.media},L.onFragBuffered=function(y,c){var u=c.frag,A=c.part;if(u&&u.type!==R.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(u)){this.warn("Fragment "+u.sn+(A?" p: "+A.index:"")+" of level "+u.level+" finished buffering, but was aborted. state: "+this.state),this.state===I.State.PARSED&&(this.state=I.State.IDLE);return}var S=A?A.stats:u.stats;this.fragLastKbps=Math.round(8*S.total/(S.buffering.end-S.loading.first)),u.sn!=="initSegment"&&(this.fragPrevious=u),this.fragBufferedComplete(u,A)},L.onError=function(y,c){switch(c.details){case g.ErrorDetails.FRAG_LOAD_ERROR:case g.ErrorDetails.FRAG_LOAD_TIMEOUT:case g.ErrorDetails.KEY_LOAD_ERROR:case g.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.MAIN,c);break;case g.ErrorDetails.LEVEL_LOAD_ERROR:case g.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==I.State.ERROR&&(c.fatal?(this.warn(""+c.details),this.state=I.State.ERROR):!c.levelRetry&&this.state===I.State.WAITING_LEVEL&&(this.state=I.State.IDLE));break;case g.ErrorDetails.BUFFER_FULL_ERROR:if(c.parent==="main"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var u=!0,A=this.getFwdBufferInfo(this.media,R.PlaylistLevelType.MAIN);A&&A.len>.5&&(u=!this.reduceMaxBufferLength(A.len)),u&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},L.checkBuffer=function(){var y=this.media,c=this.gapController;if(!y||!c||!y.readyState)return;var u=N.BufferHelper.getBuffered(y);!this.loadedmetadata&&u.length?(this.loadedmetadata=!0,this.seekToStartPos()):c.poll(this.lastCurrentTime),this.lastCurrentTime=y.currentTime},L.onFragLoadEmergencyAborted=function(){this.state=I.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},L.onBufferFlushed=function(y,c){var u=c.type;if(u!==d.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var A=(u===d.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(A,u,R.PlaylistLevelType.MAIN)}},L.onLevelsUpdated=function(y,c){this.levels=c.levels},L.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},L.seekToStartPos=function(){var y=this.media,c=y.currentTime,u=this.startPosition;if(u>=0&&c<u){if(y.seeking){b.logger.log("could not seek to "+u+", already seeking at "+c);return}var A=N.BufferHelper.getBuffered(y),S=A.length?A.start(0):0,T=S-u;T>0&&(T<this.config.maxBufferHole||T<this.config.maxFragLookUpTolerance)&&(b.logger.log("adjusting start position by "+T+" to match buffer start"),u+=T,this.startPosition=u),this.log("seek to target start position "+u+" from current time "+c),y.currentTime=u}},L._getAudioCodec=function(y){var c=this.config.defaultAudioCodec||y.audioCodec;return this.audioCodecSwap&&c&&(this.log("Swapping audio codec"),c.indexOf("mp4a.40.5")!==-1?c="mp4a.40.2":c="mp4a.40.5"),c},L._loadBitrateTestFrag=function(y){var c=this;this._doFragLoad(y).then(function(u){var A=c.hls;if(!u||A.nextLoadLevel||c.fragContextChanged(y))return;c.fragLoadError=0,c.state=I.State.IDLE,c.startFragRequested=!1,c.bitrateTest=!1;var S=y.stats;S.parsing.start=S.parsing.end=S.buffering.start=S.buffering.end=self.performance.now(),A.trigger(W.Events.FRAG_LOADED,u)})},L._handleTransmuxComplete=function(y){var c,u="main",A=this.hls,S=y.remuxResult,T=y.chunkMeta,_=this.getCurrentContext(T);if(!_){this.warn("The loading context changed while buffering fragment "+T.sn+" of level "+T.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(T.level);return}var j=_.frag,z=_.part,Z=_.level,K=S.video,F=S.text,ee=S.id3,se=S.initSegment,he=this.altAudio?void 0:S.audio;if(this.fragContextChanged(j))return;if(this.state=I.State.PARSING,se){se.tracks&&(this._bufferInitSegment(Z,se.tracks,j,T),A.trigger(W.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:u,tracks:se.tracks}));var Ce=se.initPTS,Ue=se.timescale;Object(V.isFiniteNumber)(Ce)&&(this.initPTS[j.cc]=Ce,A.trigger(W.Events.INIT_PTS_FOUND,{frag:j,id:u,initPTS:Ce,timescale:Ue}))}if(K&&S.independent!==!1){if(Z.details){var ke=K.startPTS,Me=K.endPTS,ce=K.startDTS,ve=K.endDTS;if(z)z.elementaryStreams[K.type]={startPTS:ke,endPTS:Me,startDTS:ce,endDTS:ve};else if(K.firstKeyFrame&&K.independent&&(this.couldBacktrack=!0),K.dropped&&K.independent){var le=this.getLoadPosition()+this.config.maxBufferHole;if(le<ke){this.backtrack(j);return}j.setElementaryStreamInfo(K.type,j.start,Me,j.start,ve,!0)}j.setElementaryStreamInfo(K.type,ke,Me,ce,ve),this.bufferFragmentData(K,j,z,T)}}else if(S.independent===!1){this.backtrack(j);return}if(he){var ne=he.startPTS,Le=he.endPTS,xe=he.startDTS,Ie=he.endDTS;z&&(z.elementaryStreams[d.ElementaryStreamTypes.AUDIO]={startPTS:ne,endPTS:Le,startDTS:xe,endDTS:Ie}),j.setElementaryStreamInfo(d.ElementaryStreamTypes.AUDIO,ne,Le,xe,Ie),this.bufferFragmentData(he,j,z,T)}if(ee!=null&&(c=ee.samples)!==null&&c!==void 0&&c.length){var Re={frag:j,id:u,samples:ee.samples};A.trigger(W.Events.FRAG_PARSING_METADATA,Re)}if(F){var ae={frag:j,id:u,samples:F.samples};A.trigger(W.Events.FRAG_PARSING_USERDATA,ae)}},L._bufferInitSegment=function(y,c,u,A){var S=this;if(this.state!==I.State.PARSING)return;this.audioOnly=!!c.audio&&!c.video,this.altAudio&&!this.audioOnly&&delete c.audio;var T=c.audio,_=c.video,j=c.audiovideo;if(T){var z=y.audioCodec,Z=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(z&&(z.indexOf("mp4a.40.5")!==-1?z="mp4a.40.2":z="mp4a.40.5"),T.metadata.channelCount!==1&&Z.indexOf("firefox")===-1&&(z="mp4a.40.5")),Z.indexOf("android")!==-1&&T.container!=="audio/mpeg"&&(z="mp4a.40.2",this.log("Android: force audio codec to "+z)),y.audioCodec&&y.audioCodec!==z&&this.log('Swapping manifest audio codec "'+y.audioCodec+'" for "'+z+'"'),T.levelCodec=z,T.id="main",this.log("Init audio buffer, container:"+T.container+", codecs[selected/level/parsed]=["+(z||"")+"/"+(y.audioCodec||"")+"/"+T.codec+"]")}_&&(_.levelCodec=y.videoCodec,_.id="main",this.log("Init video buffer, container:"+_.container+", codecs[level/parsed]=["+(y.videoCodec||"")+"/"+_.codec+"]")),j&&this.log("Init audiovideo buffer, container:"+j.container+", codecs[level/parsed]=["+(y.attrs.CODECS||"")+"/"+j.codec+"]"),this.hls.trigger(W.Events.BUFFER_CODECS,c),Object.keys(c).forEach(function(K){var F=c[K],ee=F.initSegment;ee!=null&&ee.byteLength&&S.hls.trigger(W.Events.BUFFER_APPENDING,{type:K,data:ee,frag:u,part:null,chunkMeta:A,parent:u.type})}),this.tick()},L.backtrack=function(y){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(y);var c=this.fragmentTracker.backtrack(y);this.fragPrevious=null,this.nextLoadPosition=y.start,c?this.resetFragmentLoading(y):this.state=I.State.BACKTRACKING},L.checkFragmentChanged=function(){var y=this.media,c=null;if(y&&y.readyState>1&&y.seeking===!1){var u=y.currentTime;if(N.BufferHelper.isBuffered(y,u)?c=this.getAppendedFrag(u):N.BufferHelper.isBuffered(y,u+.1)&&(c=this.getAppendedFrag(u+.1)),c){var A=this.fragPlaying,S=c.level;(!A||c.sn!==A.sn||A.level!==S||c.urlId!==A.urlId)&&(this.hls.trigger(W.Events.FRAG_CHANGED,{frag:c}),(!A||A.level!==S)&&this.hls.trigger(W.Events.LEVEL_SWITCHED,{level:S}),this.fragPlaying=c)}}},i(k,[{key:"nextLevel",get:function(){var y=this.nextBufferedFrag;return y?y.level:-1}},{key:"currentLevel",get:function(){var y=this.media;if(y){var c=this.getAppendedFrag(y.currentTime);if(c)return c.level}return-1}},{key:"nextBufferedFrag",get:function(){var y=this.media;if(y){var c=this.getAppendedFrag(y.currentTime);return this.followingBufferedFrag(c)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),k}(I.default)},"./src/controller/subtitle-stream-controller.ts":function(ie,$,O){"use strict";O.r($),O.d($,"SubtitleStreamController",function(){return s});var V=O("./src/events.ts"),I=O("./src/utils/logger.ts"),M=O("./src/utils/buffer-helper.ts"),W=O("./src/controller/fragment-finders.ts"),N=O("./src/utils/discontinuities.ts"),P=O("./src/controller/level-helper.ts"),R=O("./src/controller/fragment-tracker.ts"),d=O("./src/controller/base-stream-controller.ts"),f=O("./src/types/loader.ts"),w=O("./src/types/level.ts");function p(l,C){for(var m=0;m<C.length;m++){var v=C[m];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(l,v.key,v)}}function g(l,C,m){return C&&p(l.prototype,C),m&&p(l,m),l}function b(l,C){l.prototype=Object.create(C.prototype),l.prototype.constructor=l,o(l,C)}function o(l,C){return o=Object.setPrototypeOf||function(v,k){return v.__proto__=k,v},o(l,C)}var i=500,s=function(l){b(C,l);function C(v,k){var L;return L=l.call(this,v,k,"[subtitle-stream-controller]")||this,L.levels=[],L.currentTrackId=-1,L.tracksBuffered=[],L.mainDetails=null,L._registerListeners(),L}var m=C.prototype;return m.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},m._registerListeners=function(){var k=this.hls;k.on(V.Events.MEDIA_ATTACHED,this.onMediaAttached,this),k.on(V.Events.MEDIA_DETACHING,this.onMediaDetaching,this),k.on(V.Events.MANIFEST_LOADING,this.onManifestLoading,this),k.on(V.Events.LEVEL_LOADED,this.onLevelLoaded,this),k.on(V.Events.ERROR,this.onError,this),k.on(V.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),k.on(V.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),k.on(V.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),k.on(V.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),k.on(V.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},m._unregisterListeners=function(){var k=this.hls;k.off(V.Events.MEDIA_ATTACHED,this.onMediaAttached,this),k.off(V.Events.MEDIA_DETACHING,this.onMediaDetaching,this),k.off(V.Events.MANIFEST_LOADING,this.onManifestLoading,this),k.off(V.Events.LEVEL_LOADED,this.onLevelLoaded,this),k.off(V.Events.ERROR,this.onError,this),k.off(V.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),k.off(V.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),k.off(V.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),k.off(V.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),k.off(V.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},m.startLoad=function(){this.stopLoad(),this.state=d.State.IDLE,this.setInterval(i),this.tick()},m.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},m.onLevelLoaded=function(k,L){this.mainDetails=L.details},m.onSubtitleFragProcessed=function(k,L){var E=L.frag,y=L.success;if(this.fragPrevious=E,this.state=d.State.IDLE,!y)return;var c=this.tracksBuffered[this.currentTrackId];if(!c)return;for(var u,A=E.start,S=0;S<c.length;S++)if(A>=c[S].start&&A<=c[S].end){u=c[S];break}var T=E.start+E.duration;u?u.end=T:(u={start:A,end:T},c.push(u)),this.fragmentTracker.fragBuffered(E)},m.onBufferFlushing=function(k,L){var E=L.startOffset,y=L.endOffset;if(E===0&&y!==Number.POSITIVE_INFINITY){var c=this.currentTrackId,u=this.levels;if(!u.length||!u[c]||!u[c].details)return;var A=u[c].details,S=A.targetduration,T=y-S;if(T<=0)return;L.endOffsetSubtitles=Math.max(0,T),this.tracksBuffered.forEach(function(_){for(var j=0;j<_.length;){if(_[j].end<=T){_.shift();continue}else if(_[j].start<T)_[j].start=T;else break;j++}}),this.fragmentTracker.removeFragmentsInRange(E,T,f.PlaylistLevelType.SUBTITLE)}},m.onError=function(k,L){var E,y=L.frag;if(!y||y.type!==f.PlaylistLevelType.SUBTITLE)return;(E=this.fragCurrent)!==null&&E!==void 0&&E.loader&&this.fragCurrent.loader.abort(),this.state=d.State.IDLE},m.onSubtitleTracksUpdated=function(k,L){var E=this,y=L.subtitleTracks;this.tracksBuffered=[],this.levels=y.map(function(c){return new w.Level(c)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(c){E.tracksBuffered[c.id]=[]}),this.mediaBuffer=null},m.onSubtitleTrackSwitch=function(k,L){if(this.currentTrackId=L.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var E=this.levels[this.currentTrackId];E!=null&&E.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,E&&this.setInterval(i)},m.onSubtitleTrackLoaded=function(k,L){var E,y=L.details,c=L.id,u=this.currentTrackId,A=this.levels;if(!A.length)return;var S=A[u];if(c>=A.length||c!==u||!S)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,y.live||(E=S.details)!==null&&E!==void 0&&E.live){var T=this.mainDetails;if(y.deltaUpdateFailed||!T)return;var _=T.fragments[0];if(!S.details)y.hasProgramDateTime&&T.hasProgramDateTime?Object(N.alignMediaPlaylistByPDT)(y,T):_&&Object(P.addSliding)(y,_.start);else{var j=this.alignPlaylists(y,S.details);j===0&&_&&Object(P.addSliding)(y,_.start)}}if(S.details=y,this.levelLastLoaded=c,this.tick(),y.live&&!this.fragCurrent&&this.media&&this.state===d.State.IDLE){var z=Object(W.findFragmentByPTS)(null,y.fragments,this.media.currentTime,0);z||(this.warn("Subtitle playlist not aligned with playback"),S.details=void 0)}},m._handleFragmentLoadComplete=function(k){var L=k.frag,E=k.payload,y=L.decryptdata,c=this.hls;if(this.fragContextChanged(L))return;if(E&&E.byteLength>0&&y&&y.key&&y.iv&&y.method==="AES-128"){var u=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(E),y.key.buffer,y.iv.buffer).then(function(A){var S=performance.now();c.trigger(V.Events.FRAG_DECRYPTED,{frag:L,payload:A,stats:{tstart:u,tdecrypt:S}})})}},m.doTick=function(){if(!this.media){this.state=d.State.IDLE;return}if(this.state===d.State.IDLE){var k,L=this.currentTrackId,E=this.levels;if(!E.length||!E[L]||!E[L].details)return;var y=E[L].details,c=y.targetduration,u=this.config,A=this.media,S=M.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,A.currentTime-c,u.maxBufferHole),T=S.end,_=S.len,j=this.getMaxBufferLength()+c;if(_>j)return;console.assert(y,"Subtitle track details are defined on idle subtitle stream controller tick");var z=y.fragments,Z=z.length,K=y.edge,F,ee=this.fragPrevious;if(T<K){var se=u.maxFragLookUpTolerance;ee&&y.hasProgramDateTime&&(F=Object(W.findFragmentByPDT)(z,ee.endProgramDateTime,se)),F||(F=Object(W.findFragmentByPTS)(ee,z,T,se),!F&&ee&&ee.start<z[0].start&&(F=z[0]))}else F=z[Z-1];(k=F)!==null&&k!==void 0&&k.encrypted?(I.logger.log("Loading key for "+F.sn),this.state=d.State.KEY_LOADING,this.hls.trigger(V.Events.KEY_LOADING,{frag:F})):F&&this.fragmentTracker.getState(F)===R.FragmentState.NOT_LOADED&&this.loadFragment(F,y,T)}},m.loadFragment=function(k,L,E){this.fragCurrent=k,l.prototype.loadFragment.call(this,k,L,E)},g(C,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),C}(d.default)},"./src/controller/subtitle-track-controller.ts":function(ie,$,O){"use strict";O.r($);var V=O("./src/events.ts"),I=O("./src/utils/texttrack-utils.ts"),M=O("./src/controller/base-playlist-controller.ts"),W=O("./src/types/loader.ts");function N(p,g){for(var b=0;b<g.length;b++){var o=g[b];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(p,o.key,o)}}function P(p,g,b){return g&&N(p.prototype,g),b&&N(p,b),p}function R(p,g){p.prototype=Object.create(g.prototype),p.prototype.constructor=p,d(p,g)}function d(p,g){return d=Object.setPrototypeOf||function(o,i){return o.__proto__=i,o},d(p,g)}var f=function(p){R(g,p);function g(o){var i;return i=p.call(this,o,"[subtitle-track-controller]")||this,i.media=null,i.tracks=[],i.groupId=null,i.tracksInGroup=[],i.trackId=-1,i.selectDefaultTrack=!0,i.queuedDefaultTrack=-1,i.trackChangeListener=function(){return i.onTextTracksChanged()},i.asyncPollTrackChange=function(){return i.pollTrackChange(0)},i.useTextTrackPolling=!1,i.subtitlePollingInterval=-1,i.subtitleDisplay=!0,i.registerListeners(),i}var b=g.prototype;return b.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,p.prototype.destroy.call(this)},b.registerListeners=function(){var i=this.hls;i.on(V.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.on(V.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.on(V.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.on(V.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.on(V.Events.LEVEL_LOADING,this.onLevelLoading,this),i.on(V.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),i.on(V.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),i.on(V.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){var i=this.hls;i.off(V.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.off(V.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.off(V.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.off(V.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.off(V.Events.LEVEL_LOADING,this.onLevelLoading,this),i.off(V.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),i.off(V.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),i.off(V.Events.ERROR,this.onError,this)},b.onMediaAttached=function(i,s){if(this.media=s.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},b.pollTrackChange=function(i){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,i)},b.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var i=w(this.media.textTracks);i.forEach(function(s){Object(I.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},b.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},b.onManifestParsed=function(i,s){this.tracks=s.subtitleTracks},b.onSubtitleTrackLoaded=function(i,s){var l=s.id,C=s.details,m=this.trackId,v=this.tracksInGroup[m];if(!v){this.warn("Invalid subtitle track id "+l);return}var k=v.details;v.details=s.details,this.log("subtitle track "+l+" loaded ["+C.startSN+"-"+C.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,s,k))},b.onLevelLoading=function(i,s){this.switchLevel(s.level)},b.onLevelSwitching=function(i,s){this.switchLevel(s.level)},b.switchLevel=function(i){var s=this.hls.levels[i];if(!(s!=null&&s.textGroupIds))return;var l=s.textGroupIds[s.urlId];if(this.groupId!==l){var C=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,m=this.tracks.filter(function(L){return!l||L.groupId===l});this.tracksInGroup=m;var v=this.findTrackId(C==null?void 0:C.name)||this.findTrackId();this.groupId=l;var k={subtitleTracks:m};this.log("Updating subtitle tracks, "+m.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(V.Events.SUBTITLE_TRACKS_UPDATED,k),v!==-1&&this.setSubtitleTrack(v,C)}},b.findTrackId=function(i){for(var s=this.tracksInGroup,l=0;l<s.length;l++){var C=s[l];if((!this.selectDefaultTrack||C.default)&&(!i||i===C.name))return C.id}return-1},b.onError=function(i,s){if(p.prototype.onError.call(this,i,s),s.fatal||!s.context)return;s.context.type===W.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},b.loadPlaylist=function(i){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var l=s.id,C=s.groupId,m=s.url;if(i)try{m=i.addDirectives(m)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("Loading subtitle playlist for id "+l),this.hls.trigger(V.Events.SUBTITLE_TRACK_LOADING,{url:m,id:l,groupId:C,deliveryDirectives:i||null})}},b.toggleTrackModes=function(i){var s=this,l=this.media,C=this.subtitleDisplay,m=this.trackId;if(!l)return;var v=w(l.textTracks),k=v.filter(function(y){return y.groupId===s.groupId});if(i===-1)[].slice.call(v).forEach(function(y){y.mode="disabled"});else{var L=k[m];L&&(L.mode="disabled")}var E=k[i];E&&(E.mode=C?"showing":"hidden")},b.setSubtitleTrack=function(i,s){var l,C=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=i;return}if(this.trackId!==i&&this.toggleTrackModes(i),this.trackId===i&&(i===-1||(l=C[i])!==null&&l!==void 0&&l.details)||i<-1||i>=C.length)return;this.clearTimer();var m=C[i];if(this.log("Switching to subtitle track "+i),this.trackId=i,m){var v=m.id,k=m.groupId,L=k===void 0?"":k,E=m.name,y=m.type,c=m.url;this.hls.trigger(V.Events.SUBTITLE_TRACK_SWITCH,{id:v,groupId:L,name:E,type:y,url:c});var u=this.switchParams(m.url,s==null?void 0:s.details);this.loadPlaylist(u)}else this.hls.trigger(V.Events.SUBTITLE_TRACK_SWITCH,{id:i})},b.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var i=-1,s=w(this.media.textTracks),l=0;l<s.length;l++)if(s[l].mode==="hidden")i=l;else if(s[l].mode==="showing"){i=l;break}this.subtitleTrack!==i&&(this.subtitleTrack=i)},P(g,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(i){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(i,s)}}]),g}(M.default);function w(p){for(var g=[],b=0;b<p.length;b++){var o=p[b];o.kind==="subtitles"&&o.label&&g.push(p[b])}return g}$.default=f},"./src/controller/timeline-controller.ts":function(ie,$,O){"use strict";O.r($),O.d($,"TimelineController",function(){return w});var V=O("./src/polyfills/number.ts"),I=O("./src/events.ts"),M=O("./src/utils/cea-608-parser.ts"),W=O("./src/utils/output-filter.ts"),N=O("./src/utils/webvtt-parser.ts"),P=O("./src/utils/texttrack-utils.ts"),R=O("./src/utils/imsc1-ttml-parser.ts"),d=O("./src/types/loader.ts"),f=O("./src/utils/logger.ts"),w=function(){function o(s){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=b(),this.captionsProperties=void 0,this.hls=s,this.config=s.config,this.Cues=s.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var l=new W.default(this,"textTrack1"),C=new W.default(this,"textTrack2"),m=new W.default(this,"textTrack3"),v=new W.default(this,"textTrack4");this.cea608Parser1=new M.default(1,l,C),this.cea608Parser2=new M.default(3,m,v)}s.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(I.Events.FRAG_LOADING,this.onFragLoading,this),s.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(I.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(I.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(I.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var i=o.prototype;return i.destroy=function(){var l=this.hls;l.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.off(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.off(I.Events.FRAG_LOADING,this.onFragLoading,this),l.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(I.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.off(I.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.off(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.off(I.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},i.addCues=function(l,C,m,v,k){for(var L=!1,E=k.length;E--;){var y=k[E],c=g(y[0],y[1],C,m);if(c>=0&&(y[0]=Math.min(y[0],C),y[1]=Math.max(y[1],m),L=!0,c/(m-C)>.5))return}if(L||k.push([C,m]),this.config.renderTextTracksNatively){var u=this.captionsTracks[l];this.Cues.newCue(u,C,m,v)}else{var A=this.Cues.newCue(null,C,m,v);this.hls.trigger(I.Events.CUES_PARSED,{type:"captions",cues:A,track:l})}},i.onInitPtsFound=function(l,C){var m=this,v=C.frag,k=C.id,L=C.initPTS,E=C.timescale,y=this.unparsedVttFrags;k==="main"&&(this.initPTS[v.cc]=L,this.timescale[v.cc]=E),y.length&&(this.unparsedVttFrags=[],y.forEach(function(c){m.onFragLoaded(I.Events.FRAG_LOADED,c)}))},i.getExistingTrack=function(l){var C=this.media;if(C)for(var m=0;m<C.textTracks.length;m++){var v=C.textTracks[m];if(v[l])return v}return null},i.createCaptionsTrack=function(l){this.config.renderTextTracksNatively?this.createNativeTrack(l):this.createNonNativeTrack(l)},i.createNativeTrack=function(l){if(this.captionsTracks[l])return;var C=this.captionsProperties,m=this.captionsTracks,v=this.media,k=C[l],L=k.label,E=k.languageCode,y=this.getExistingTrack(l);if(y)m[l]=y,Object(P.clearCurrentCues)(m[l]),Object(P.sendAddTrackEvent)(m[l],v);else{var c=this.createTextTrack("captions",L,E);c&&(c[l]=!0,m[l]=c)}},i.createNonNativeTrack=function(l){if(this.nonNativeCaptionsTracks[l])return;var C=this.captionsProperties[l];if(!C)return;var m=C.label,v={_id:l,label:m,kind:"captions",default:C.media?!!C.media.default:!1,closedCaptions:C.media};this.nonNativeCaptionsTracks[l]=v,this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[v]})},i.createTextTrack=function(l,C,m){var v=this.media;return v?v.addTextTrack(l,C,m):void 0},i.onMediaAttaching=function(l,C){this.media=C.media,this._cleanTracks()},i.onMediaDetaching=function(){var l=this.captionsTracks;Object.keys(l).forEach(function(C){Object(P.clearCurrentCues)(l[C]),delete l[C]}),this.nonNativeCaptionsTracks={}},i.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=b(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},i._cleanTracks=function(){var l=this.media;if(!l)return;var C=l.textTracks;if(C)for(var m=0;m<C.length;m++)Object(P.clearCurrentCues)(C[m])},i.onSubtitleTracksUpdated=function(l,C){var m=this;this.textTracks=[];var v=C.subtitleTracks||[],k=v.some(function(c){return c.textCodec===R.IMSC1_CODEC});if(this.config.enableWebVTT||k&&this.config.enableIMSC1){var L=this.tracks&&v&&this.tracks.length===v.length;if(this.tracks=v||[],this.config.renderTextTracksNatively){var E=this.media?this.media.textTracks:[];this.tracks.forEach(function(c,u){var A;if(u<E.length){for(var S=null,T=0;T<E.length;T++)if(p(E[T],c)){S=E[T];break}S&&(A=S)}A?Object(P.clearCurrentCues)(A):(A=m.createTextTrack("subtitles",c.name,c.lang),A&&(A.mode="disabled")),A&&(A.groupId=c.groupId,m.textTracks.push(A))})}else if(!L&&this.tracks&&this.tracks.length){var y=this.tracks.map(function(c){return{label:c.name,kind:c.type.toLowerCase(),default:c.default,subtitleTrack:c}});this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:y})}}},i.onManifestLoaded=function(l,C){var m=this;this.config.enableCEA708Captions&&C.captions&&C.captions.forEach(function(v){var k=/(?:CC|SERVICE)([1-4])/.exec(v.instreamId);if(!k)return;var L="textTrack"+k[1],E=m.captionsProperties[L];if(!E)return;E.label=v.name,v.lang&&(E.languageCode=v.lang),E.media=v})},i.onFragLoading=function(l,C){var m=this.cea608Parser1,v=this.cea608Parser2,k=this.lastSn,L=this.lastPartIndex;if(!this.enabled||!(m&&v))return;if(C.frag.type===d.PlaylistLevelType.MAIN){var E,y,c=C.frag.sn,u=(E=C==null||((y=C.part)===null||y===void 0)?void 0:y.index)!=null?E:-1;c===k+1||c===k&&u===L+1||(m.reset(),v.reset()),this.lastSn=c,this.lastPartIndex=u}},i.onFragLoaded=function(l,C){var m=C.frag,v=C.payload,k=this.initPTS,L=this.unparsedVttFrags;if(m.type===d.PlaylistLevelType.SUBTITLE)if(v.byteLength){if(!Object(V.isFiniteNumber)(k[m.cc])){L.push(C),k.length&&this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:m,error:new Error("Missing initial subtitle PTS")});return}var E=m.decryptdata;if(E==null||E.key==null||E.method!=="AES-128"){var y=this.tracks[m.level],c=this.vttCCs;c[m.cc]||(c[m.cc]={start:m.start,prevCC:this.prevCC,new:!0},this.prevCC=m.cc),y&&y.textCodec===R.IMSC1_CODEC?this._parseIMSC1(m,v):this._parseVTTs(m,v,c)}}else this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:m,error:new Error("Empty subtitle payload")})},i._parseIMSC1=function(l,C){var m=this,v=this.hls;Object(R.parseIMSC1)(C,this.initPTS[l.cc],this.timescale[l.cc],function(k){m._appendCues(k,l.level),v.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(k){f.logger.log("Failed to parse IMSC1: "+k),v.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:k})})},i._parseVTTs=function(l,C,m){var v=this,k=this.hls;Object(N.parseWebVTT)(C,this.initPTS[l.cc],this.timescale[l.cc],m,l.cc,l.start,function(L){v._appendCues(L,l.level),k.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(L){v._fallbackToIMSC1(l,C),f.logger.log("Failed to parse VTT cue: "+L),k.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:L})})},i._fallbackToIMSC1=function(l,C){var m=this,v=this.tracks[l.level];v.textCodec||Object(R.parseIMSC1)(C,this.initPTS[l.cc],this.timescale[l.cc],function(){v.textCodec=R.IMSC1_CODEC,m._parseIMSC1(l,C)},function(){v.textCodec="wvtt"})},i._appendCues=function(l,C){var m=this.hls;if(this.config.renderTextTracksNatively){var v=this.textTracks[C];if(v.mode==="disabled")return;l.forEach(function(E){return Object(P.addCueToTrack)(v,E)})}else{var k=this.tracks[C],L=k.default?"default":"subtitles"+C;m.trigger(I.Events.CUES_PARSED,{type:"subtitles",cues:l,track:L})}},i.onFragDecrypted=function(l,C){var m=C.frag;if(m.type===d.PlaylistLevelType.SUBTITLE){if(!Object(V.isFiniteNumber)(this.initPTS[m.cc])){this.unparsedVttFrags.push(C);return}this.onFragLoaded(I.Events.FRAG_LOADED,C)}},i.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},i.onFragParsingUserdata=function(l,C){var m=this.cea608Parser1,v=this.cea608Parser2;if(!this.enabled||!(m&&v))return;for(var k=0;k<C.samples.length;k++){var L=C.samples[k].bytes;if(L){var E=this.extractCea608Data(L);m.addData(C.samples[k].pts,E[0]),v.addData(C.samples[k].pts,E[1])}}},i.onBufferFlushing=function(l,C){var m=C.startOffset,v=C.endOffset,k=C.endOffsetSubtitles,L=C.type,E=this.media;if(!E||E.currentTime<v)return;if(!L||L==="video"){var y=this.captionsTracks;Object.keys(y).forEach(function(u){return Object(P.removeCuesInRange)(y[u],m,v)})}if(this.config.renderTextTracksNatively&&(m===0&&k!==void 0)){var c=this.textTracks;Object.keys(c).forEach(function(u){return Object(P.removeCuesInRange)(c[u],m,k)})}},i.extractCea608Data=function(l){for(var C=l[0]&31,m=2,v=[[],[]],k=0;k<C;k++){var L=l[m++],E=127&l[m++],y=127&l[m++],c=(4&L)!==0,u=3&L;if(E===0&&y===0)continue;c&&((u===0||u===1)&&(v[u].push(E),v[u].push(y)))}return v},o}();function p(o,i){return o&&o.label===i.name&&!(o.textTrack1||o.textTrack2)}function g(o,i,s,l){return Math.min(i,l)-Math.max(o,s)}function b(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ie,$,O){"use strict";O.r($),O.d($,"default",function(){return V});var V=function(){function I(W,N){this.subtle=void 0,this.aesIV=void 0,this.subtle=W,this.aesIV=N}var M=I.prototype;return M.decrypt=function(N,P){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},P,N)},I}()},"./src/crypt/aes-decryptor.ts":function(ie,$,O){"use strict";O.r($),O.d($,"removePadding",function(){return I}),O.d($,"default",function(){return M});var V=O("./src/utils/typed-array.ts");function I(W){var N=W.byteLength,P=N&&new DataView(W.buffer).getUint8(N-1);return P?Object(V.sliceUint8)(W,0,N-P):W}var M=function(){function W(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var N=W.prototype;return N.uint8ArrayToUint32Array_=function(R){for(var d=new DataView(R),f=new Uint32Array(4),w=0;w<4;w++)f[w]=d.getUint32(w*4);return f},N.initTable=function(){var R=this.sBox,d=this.invSBox,f=this.subMix,w=f[0],p=f[1],g=f[2],b=f[3],o=this.invSubMix,i=o[0],s=o[1],l=o[2],C=o[3],m=new Uint32Array(256),v=0,k=0,L=0;for(L=0;L<256;L++)L<128?m[L]=L<<1:m[L]=L<<1^283;for(L=0;L<256;L++){var E=k^k<<1^k<<2^k<<3^k<<4;E=E>>>8^E&255^99,R[v]=E,d[E]=v;var y=m[v],c=m[y],u=m[c],A=m[E]*257^E*16843008;w[v]=A<<24|A>>>8,p[v]=A<<16|A>>>16,g[v]=A<<8|A>>>24,b[v]=A,A=u*16843009^c*65537^y*257^v*16843008,i[E]=A<<24|A>>>8,s[E]=A<<16|A>>>16,l[E]=A<<8|A>>>24,C[E]=A,v?(v=y^m[m[m[u^y]]],k^=m[m[k]]):v=k=1}},N.expandKey=function(R){for(var d=this.uint8ArrayToUint32Array_(R),f=!0,w=0;w<d.length&&f;)f=d[w]===this.key[w],w++;if(f)return;this.key=d;var p=this.keySize=d.length;if(p!==4&&p!==6&&p!==8)throw new Error("Invalid aes key size="+p);var g=this.ksRows=(p+6+1)*4,b,o,i=this.keySchedule=new Uint32Array(g),s=this.invKeySchedule=new Uint32Array(g),l=this.sBox,C=this.rcon,m=this.invSubMix,v=m[0],k=m[1],L=m[2],E=m[3],y,c;for(b=0;b<g;b++){if(b<p){y=i[b]=d[b];continue}c=y,b%p===0?(c=c<<8|c>>>24,c=l[c>>>24]<<24|l[c>>>16&255]<<16|l[c>>>8&255]<<8|l[c&255],c^=C[b/p|0]<<24):p>6&&b%p===4&&(c=l[c>>>24]<<24|l[c>>>16&255]<<16|l[c>>>8&255]<<8|l[c&255]),i[b]=y=(i[b-p]^c)>>>0}for(o=0;o<g;o++)b=g-o,o&3?c=i[b]:c=i[b-4],o<4||b<=4?s[o]=c:s[o]=v[l[c>>>24]]^k[l[c>>>16&255]]^L[l[c>>>8&255]]^E[l[c&255]],s[o]=s[o]>>>0},N.networkToHostOrderSwap=function(R){return R<<24|(R&65280)<<8|(R&16711680)>>8|R>>>24},N.decrypt=function(R,d,f){for(var w=this.keySize+6,p=this.invKeySchedule,g=this.invSBox,b=this.invSubMix,o=b[0],i=b[1],s=b[2],l=b[3],C=this.uint8ArrayToUint32Array_(f),m=C[0],v=C[1],k=C[2],L=C[3],E=new Int32Array(R),y=new Int32Array(E.length),c,u,A,S,T,_,j,z,Z,K,F,ee,se,he,Ce=this.networkToHostOrderSwap;d<E.length;){for(Z=Ce(E[d]),K=Ce(E[d+1]),F=Ce(E[d+2]),ee=Ce(E[d+3]),T=Z^p[0],_=ee^p[1],j=F^p[2],z=K^p[3],se=4,he=1;he<w;he++)c=o[T>>>24]^i[_>>16&255]^s[j>>8&255]^l[z&255]^p[se],u=o[_>>>24]^i[j>>16&255]^s[z>>8&255]^l[T&255]^p[se+1],A=o[j>>>24]^i[z>>16&255]^s[T>>8&255]^l[_&255]^p[se+2],S=o[z>>>24]^i[T>>16&255]^s[_>>8&255]^l[j&255]^p[se+3],T=c,_=u,j=A,z=S,se=se+4;c=g[T>>>24]<<24^g[_>>16&255]<<16^g[j>>8&255]<<8^g[z&255]^p[se],u=g[_>>>24]<<24^g[j>>16&255]<<16^g[z>>8&255]<<8^g[T&255]^p[se+1],A=g[j>>>24]<<24^g[z>>16&255]<<16^g[T>>8&255]<<8^g[_&255]^p[se+2],S=g[z>>>24]<<24^g[T>>16&255]<<16^g[_>>8&255]<<8^g[j&255]^p[se+3],y[d]=Ce(c^m),y[d+1]=Ce(S^v),y[d+2]=Ce(A^k),y[d+3]=Ce(u^L),m=Z,v=K,k=F,L=ee,d=d+4}return y.buffer},W}()},"./src/crypt/decrypter.ts":function(ie,$,O){"use strict";O.r($),O.d($,"default",function(){return d});var V=O("./src/crypt/aes-crypto.ts"),I=O("./src/crypt/fast-aes-key.ts"),M=O("./src/crypt/aes-decryptor.ts"),W=O("./src/utils/logger.ts"),N=O("./src/utils/mp4-tools.ts"),P=O("./src/utils/typed-array.ts"),R=16,d=function(){function f(p,g,b){var o=b===void 0?{}:b,i=o.removePKCS7Padding,s=i===void 0?!0:i;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=p,this.config=g,this.removePKCS7Padding=s,s)try{var l=self.crypto;l&&(this.subtle=l.subtle||l.webkitSubtle)}catch(C){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var w=f.prototype;return w.destroy=function(){this.observer=null},w.isSync=function(){return this.config.enableSoftwareAES},w.flush=function(){var g=this.currentResult;if(!g){this.reset();return}var b=new Uint8Array(g);return this.reset(),this.removePKCS7Padding?Object(M.removePadding)(b):b},w.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},w.decrypt=function(g,b,o,i){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(g),b,o);var s=this.flush();s&&i(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(g),b,o).then(i)},w.softwareDecrypt=function(g,b,o){var i=this.currentIV,s=this.currentResult,l=this.remainderData;this.logOnce("JS AES decrypt"),l&&(g=Object(N.appendUint8Array)(l,g),this.remainderData=null);var C=this.getValidChunk(g);if(!C.length)return null;i&&(o=i);var m=this.softwareDecrypter;m||(m=this.softwareDecrypter=new M.default),m.expandKey(b);var v=s;return this.currentResult=m.decrypt(C.buffer,0,o),this.currentIV=Object(P.sliceUint8)(C,-16).buffer,v||null},w.webCryptoDecrypt=function(g,b,o){var i=this,s=this.subtle;return(this.key!==b||!this.fastAesKey)&&(this.key=b,this.fastAesKey=new I.default(s,b)),this.fastAesKey.expandKey().then(function(l){if(!s)return Promise.reject(new Error("web crypto not initialized"));var C=new V.default(s,o);return C.decrypt(g.buffer,l)}).catch(function(l){return i.onWebCryptoError(l,g,b,o)})},w.onWebCryptoError=function(g,b,o,i){return W.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",g),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(b,o,i)},w.getValidChunk=function(g){var b=g,o=g.length-g.length%R;return o!==g.length&&(b=Object(P.sliceUint8)(g,0,o),this.remainderData=Object(P.sliceUint8)(g,o)),b},w.logOnce=function(g){if(!this.logEnabled)return;W.logger.log("[decrypter.ts]: "+g),this.logEnabled=!1},f}()},"./src/crypt/fast-aes-key.ts":function(ie,$,O){"use strict";O.r($),O.d($,"default",function(){return V});var V=function(){function I(W,N){this.subtle=void 0,this.key=void 0,this.subtle=W,this.key=N}var M=I.prototype;return M.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},I}()},"./src/demux/aacdemuxer.ts":function(ie,$,O){"use strict";O.r($);var V=O("./src/demux/base-audio-demuxer.ts"),I=O("./src/demux/adts.ts"),M=O("./src/utils/logger.ts"),W=O("./src/demux/id3.ts");function N(d,f){d.prototype=Object.create(f.prototype),d.prototype.constructor=d,P(d,f)}function P(d,f){return P=Object.setPrototypeOf||function(p,g){return p.__proto__=g,p},P(d,f)}var R=function(d){N(f,d);function f(p,g){var b;return b=d.call(this)||this,b.observer=void 0,b.config=void 0,b.observer=p,b.config=g,b}var w=f.prototype;return w.resetInitSegment=function(g,b,o){d.prototype.resetInitSegment.call(this,g,b,o),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:g,duration:o,inputTimeScale:9e4,dropped:0}},f.probe=function(g){if(!g)return!1;for(var b=W.getID3Data(g,0)||[],o=b.length,i=g.length;o<i;o++)if(I.probe(g,o))return M.logger.log("ADTS sync word found !"),!0;return!1},w.canParse=function(g,b){return I.canParse(g,b)},w.appendFrame=function(g,b,o){I.initTrackConfig(g,this.observer,b,o,g.manifestCodec);var i=I.appendFrame(g,b,o,this.initPTS,this.frameIndex);if(i&&i.missing===0)return i},f}(V.default);R.minProbeByteLength=9,$.default=R},"./src/demux/adts.ts":function(ie,$,O){"use strict";O.r($),O.d($,"getAudioConfig",function(){return W}),O.d($,"isHeaderPattern",function(){return N}),O.d($,"getHeaderLength",function(){return P}),O.d($,"getFullFrameLength",function(){return R}),O.d($,"canGetFrameLength",function(){return d}),O.d($,"isHeader",function(){return f}),O.d($,"canParse",function(){return w}),O.d($,"probe",function(){return p}),O.d($,"initTrackConfig",function(){return g}),O.d($,"getFrameDuration",function(){return b}),O.d($,"parseFrameHeader",function(){return o}),O.d($,"appendFrame",function(){return i});var V=O("./src/utils/logger.ts"),I=O("./src/errors.ts"),M=O("./src/events.ts");function W(s,l,C,m){var v,k,L,E,y=navigator.userAgent.toLowerCase(),c=m,u=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];v=((l[C+2]&192)>>>6)+1;var A=(l[C+2]&60)>>>2;if(A>u.length-1){s.trigger(M.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+A});return}return L=(l[C+2]&1)<<2,L|=(l[C+3]&192)>>>6,V.logger.log("manifest codec:"+m+", ADTS type:"+v+", samplingIndex:"+A),/firefox/i.test(y)?A>=6?(v=5,E=new Array(4),k=A-3):(v=2,E=new Array(2),k=A):y.indexOf("android")!==-1?(v=2,E=new Array(2),k=A):(v=5,E=new Array(4),m&&(m.indexOf("mp4a.40.29")!==-1||m.indexOf("mp4a.40.5")!==-1)||!m&&A>=6?k=A-3:((m&&m.indexOf("mp4a.40.2")!==-1&&(A>=6&&L===1||/vivaldi/i.test(y))||!m&&L===1)&&(v=2,E=new Array(2)),k=A)),E[0]=v<<3,E[0]|=(A&14)>>1,E[1]|=(A&1)<<7,E[1]|=L<<3,v===5&&(E[1]|=(k&14)>>1,E[2]=(k&1)<<7,E[2]|=2<<2,E[3]=0),{config:E,samplerate:u[A],channelCount:L,codec:"mp4a.40."+v,manifestCodec:c}}function N(s,l){return s[l]===255&&(s[l+1]&246)===240}function P(s,l){return s[l+1]&1?7:9}function R(s,l){return(s[l+3]&3)<<11|s[l+4]<<3|(s[l+5]&224)>>>5}function d(s,l){return l+5<s.length}function f(s,l){return l+1<s.length&&N(s,l)}function w(s,l){return d(s,l)&&N(s,l)&&R(s,l)<=s.length-l}function p(s,l){if(f(s,l)){var C=P(s,l);if(l+C>=s.length)return!1;var m=R(s,l);if(m<=C)return!1;var v=l+m;return v===s.length||f(s,v)}return!1}function g(s,l,C,m,v){if(!s.samplerate){var k=W(l,C,m,v);if(!k)return;s.config=k.config,s.samplerate=k.samplerate,s.channelCount=k.channelCount,s.codec=k.codec,s.manifestCodec=k.manifestCodec,V.logger.log("parsed codec:"+s.codec+", rate:"+k.samplerate+", channels:"+k.channelCount)}}function b(s){return 1024*9e4/s}function o(s,l,C,m,v){var k=P(s,l),L=R(s,l);if(L-=k,L>0){var E=C+m*v;return{headerLength:k,frameLength:L,stamp:E}}}function i(s,l,C,m,v){var k=b(s.samplerate),L=o(l,C,m,v,k);if(L){var E=L.frameLength,y=L.headerLength,c=L.stamp,u=y+E,A=Math.max(0,C+u-l.length),S;A?(S=new Uint8Array(u-y),S.set(l.subarray(C+y,l.length),0)):S=l.subarray(C+y,C+u);var T={unit:S,pts:c};return A||s.samples.push(T),{sample:T,length:u,missing:A}}}},"./src/demux/base-audio-demuxer.ts":function(ie,$,O){"use strict";O.r($),O.d($,"initPTSFn",function(){return R});var V=O("./src/polyfills/number.ts"),I=O("./src/demux/id3.ts"),M=O("./src/demux/dummy-demuxed-track.ts"),W=O("./src/utils/mp4-tools.ts"),N=O("./src/utils/typed-array.ts"),P=function(){function d(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var f=d.prototype;return f.resetInitSegment=function(p,g,b){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},f.resetTimeStamp=function(){},f.resetContiguity=function(){},f.canParse=function(p,g){return!1},f.appendFrame=function(p,g,b){},f.demux=function(p,g){this.cachedData&&(p=Object(W.appendUint8Array)(this.cachedData,p),this.cachedData=null);var b=I.getID3Data(p,0),o=b?b.length:0,i,s,l=this._audioTrack,C=this._id3Track,m=b?I.getTimeStamp(b):void 0,v=p.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=R(m,g)),b&&b.length>0&&C.samples.push({pts:this.initPTS,dts:this.initPTS,data:b}),s=this.initPTS;o<v;){if(this.canParse(p,o)){var k=this.appendFrame(l,p,o);k?(this.frameIndex++,s=k.sample.pts,o+=k.length,i=o):o=v}else I.canParse(p,o)?(b=I.getID3Data(p,o),C.samples.push({pts:s,dts:s,data:b}),o+=b.length,i=o):o++;if(o===v&&i!==v){var L=Object(N.sliceUint8)(p,i);this.cachedData?this.cachedData=Object(W.appendUint8Array)(this.cachedData,L):this.cachedData=L}}return{audioTrack:l,avcTrack:Object(M.dummyTrack)(),id3Track:C,textTrack:Object(M.dummyTrack)()}},f.demuxSampleAes=function(p,g,b){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},f.flush=function(p){var g=this.cachedData;return g&&(this.cachedData=null,this.demux(g,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(M.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(M.dummyTrack)()}},f.destroy=function(){},d}(),R=function(f,w){return Object(V.isFiniteNumber)(f)?f*90:w*9e4};$.default=P},"./src/demux/chunk-cache.ts":function(ie,$,O){"use strict";O.r($),O.d($,"default",function(){return V});var V=function(){function M(){this.chunks=[],this.dataLength=0}var W=M.prototype;return W.push=function(P){this.chunks.push(P),this.dataLength+=P.length},W.flush=function(){var P=this.chunks,R=this.dataLength,d;if(P.length)P.length===1?d=P[0]:d=I(P,R);else return new Uint8Array(0);return this.reset(),d},W.reset=function(){this.chunks.length=0,this.dataLength=0},M}();function I(M,W){for(var N=new Uint8Array(W),P=0,R=0;R<M.length;R++){var d=M[R];N.set(d,P),P+=d.length}return N}},"./src/demux/dummy-demuxed-track.ts":function(ie,$,O){"use strict";O.r($),O.d($,"dummyTrack",function(){return V});function V(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ie,$,O){"use strict";O.r($);var V=O("./src/utils/logger.ts"),I=function(){function M(N){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=N,this.bytesAvailable=N.byteLength,this.word=0,this.bitsAvailable=0}var W=M.prototype;return W.loadWord=function(){var P=this.data,R=this.bytesAvailable,d=P.byteLength-R,f=new Uint8Array(4),w=Math.min(4,R);if(w===0)throw new Error("no bytes available");f.set(P.subarray(d,d+w)),this.word=new DataView(f.buffer).getUint32(0),this.bitsAvailable=w*8,this.bytesAvailable-=w},W.skipBits=function(P){var R;this.bitsAvailable>P?(this.word<<=P,this.bitsAvailable-=P):(P-=this.bitsAvailable,R=P>>3,P-=R>>3,this.bytesAvailable-=R,this.loadWord(),this.word<<=P,this.bitsAvailable-=P)},W.readBits=function(P){var R=Math.min(this.bitsAvailable,P),d=this.word>>>32-R;return P>32&&V.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=R,this.bitsAvailable>0?this.word<<=R:this.bytesAvailable>0&&this.loadWord(),R=P-R,R>0&&this.bitsAvailable?d<<R|this.readBits(R):d},W.skipLZ=function(){var P;for(P=0;P<this.bitsAvailable;++P)if((this.word&2147483648>>>P)!==0)return this.word<<=P,this.bitsAvailable-=P,P;return this.loadWord(),P+this.skipLZ()},W.skipUEG=function(){this.skipBits(1+this.skipLZ())},W.skipEG=function(){this.skipBits(1+this.skipLZ())},W.readUEG=function(){var P=this.skipLZ();return this.readBits(P+1)-1},W.readEG=function(){var P=this.readUEG();return 1&P?1+P>>>1:-1*(P>>>1)},W.readBoolean=function(){return this.readBits(1)===1},W.readUByte=function(){return this.readBits(8)},W.readUShort=function(){return this.readBits(16)},W.readUInt=function(){return this.readBits(32)},W.skipScalingList=function(P){for(var R=8,d=8,f,w=0;w<P;w++)d!==0&&(f=this.readEG(),d=(R+f+256)%256),R=d===0?R:d},W.readSPS=function(){var P=0,R=0,d=0,f=0,w,p,g,b=this.readUByte.bind(this),o=this.readBits.bind(this),i=this.readUEG.bind(this),s=this.readBoolean.bind(this),l=this.skipBits.bind(this),C=this.skipEG.bind(this),m=this.skipUEG.bind(this),v=this.skipScalingList.bind(this);b();var k=b();if(o(5),l(3),b(),m(),k===100||k===110||k===122||k===244||k===44||k===83||k===86||k===118||k===128){var L=i();if(L===3&&l(1),m(),m(),l(1),s())for(p=L!==3?8:12,g=0;g<p;g++)s()&&(g<6?v(16):v(64))}m();var E=i();if(E===0)i();else if(E===1)for(l(1),C(),C(),w=i(),g=0;g<w;g++)C();m(),l(1);var y=i(),c=i(),u=o(1);u===0&&l(1),l(1),s()&&(P=i(),R=i(),d=i(),f=i());var A=[1,1];if(s()&&s()){var S=b();switch(S){case 1:A=[1,1];break;case 2:A=[12,11];break;case 3:A=[10,11];break;case 4:A=[16,11];break;case 5:A=[40,33];break;case 6:A=[24,11];break;case 7:A=[20,11];break;case 8:A=[32,11];break;case 9:A=[80,33];break;case 10:A=[18,11];break;case 11:A=[15,11];break;case 12:A=[64,33];break;case 13:A=[160,99];break;case 14:A=[4,3];break;case 15:A=[3,2];break;case 16:A=[2,1];break;case 255:{A=[b()<<8|b(),b()<<8|b()];break}}}return{width:Math.ceil((y+1)*16-P*2-R*2),height:(2-u)*(c+1)*16-(u?2:4)*(d+f),pixelRatio:A}},W.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},M}();$.default=I},"./src/demux/id3.ts":function(ie,$,O){"use strict";O.r($),O.d($,"isHeader",function(){return V}),O.d($,"isFooter",function(){return I}),O.d($,"getID3Data",function(){return M}),O.d($,"canParse",function(){return N}),O.d($,"getTimeStamp",function(){return P}),O.d($,"isTimeStampFrame",function(){return R}),O.d($,"getID3Frames",function(){return f}),O.d($,"decodeFrame",function(){return w}),O.d($,"utf8ArrayToStr",function(){return i}),O.d($,"testables",function(){return s});var V=function(v,k){return k+10<=v.length&&(v[k]===73&&v[k+1]===68&&v[k+2]===51&&(v[k+3]<255&&v[k+4]<255&&(v[k+6]<128&&v[k+7]<128&&v[k+8]<128&&v[k+9]<128)))},I=function(v,k){return k+10<=v.length&&(v[k]===51&&v[k+1]===68&&v[k+2]===73&&(v[k+3]<255&&v[k+4]<255&&(v[k+6]<128&&v[k+7]<128&&v[k+8]<128&&v[k+9]<128)))},M=function(v,k){for(var L=k,E=0;V(v,k);){E+=10;var y=W(v,k+6);E+=y,I(v,k+10)&&(E+=10),k+=E}return E>0?v.subarray(L,L+E):void 0},W=function(v,k){var L=0;return L=(v[k]&127)<<21,L|=(v[k+1]&127)<<14,L|=(v[k+2]&127)<<7,L|=v[k+3]&127,L},N=function(v,k){return V(v,k)&&W(v,k+6)+10<=v.length-k},P=function(v){for(var k=f(v),L=0;L<k.length;L++){var E=k[L];if(R(E))return o(E)}return},R=function(v){return v&&v.key==="PRIV"&&v.info==="com.apple.streaming.transportStreamTimestamp"},d=function(v){var k=String.fromCharCode(v[0],v[1],v[2],v[3]),L=W(v,4),E=10;return{type:k,size:L,data:v.subarray(E,E+L)}},f=function(v){for(var k=0,L=[];V(v,k);){var E=W(v,k+6);k+=10;for(var y=k+E;k+8<y;){var c=d(v.subarray(k)),u=w(c);u&&L.push(u),k+=c.size+10}I(v,k)&&(k+=10)}return L},w=function(v){return v.type==="PRIV"?p(v):v.type[0]==="W"?b(v):g(v)},p=function(v){if(v.size<2)return;var k=i(v.data,!0),L=new Uint8Array(v.data.subarray(k.length+1));return{key:v.type,info:k,data:L.buffer}},g=function(v){if(v.size<2)return;if(v.type==="TXXX"){var k=1,L=i(v.data.subarray(k),!0);k+=L.length+1;var E=i(v.data.subarray(k));return{key:v.type,info:L,data:E}}var y=i(v.data.subarray(1));return{key:v.type,data:y}},b=function(v){if(v.type==="WXXX"){if(v.size<2)return;var k=1,L=i(v.data.subarray(k),!0);k+=L.length+1;var E=i(v.data.subarray(k));return{key:v.type,info:L,data:E}}var y=i(v.data);return{key:v.type,data:y}},o=function(v){if(v.data.byteLength===8){var k=new Uint8Array(v.data),L=k[3]&1,E=(k[4]<<23)+(k[5]<<15)+(k[6]<<7)+k[7];return E/=45,L&&(E+=4772185884e-2),Math.round(E)}return},i=function(v,k){k===void 0&&(k=!1);var L=C();if(L){var E=L.decode(v);if(k){var y=E.indexOf("\0");return y!==-1?E.substring(0,y):E}return E.replace(/\0/g,"")}for(var c=v.length,u,A,S,T="",_=0;_<c;){if(u=v[_++],u===0&&k)return T;if(u===0||u===3)continue;switch(u>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:T+=String.fromCharCode(u);break;case 12:case 13:A=v[_++],T+=String.fromCharCode((u&31)<<6|A&63);break;case 14:A=v[_++],S=v[_++],T+=String.fromCharCode((u&15)<<12|(A&63)<<6|(S&63)<<0);break;default:}}return T},s={decodeTextFrame:g},l;function C(){return!l&&typeof self.TextDecoder!="undefined"&&(l=new self.TextDecoder("utf-8")),l}},"./src/demux/mp3demuxer.ts":function(ie,$,O){"use strict";O.r($);var V=O("./src/demux/base-audio-demuxer.ts"),I=O("./src/demux/id3.ts"),M=O("./src/utils/logger.ts"),W=O("./src/demux/mpegaudio.ts");function N(d,f){d.prototype=Object.create(f.prototype),d.prototype.constructor=d,P(d,f)}function P(d,f){return P=Object.setPrototypeOf||function(p,g){return p.__proto__=g,p},P(d,f)}var R=function(d){N(f,d);function f(){return d.apply(this,arguments)||this}var w=f.prototype;return w.resetInitSegment=function(g,b,o){d.prototype.resetInitSegment.call(this,g,b,o),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:g,duration:o,inputTimeScale:9e4,dropped:0}},f.probe=function(g){if(!g)return!1;for(var b=I.getID3Data(g,0)||[],o=b.length,i=g.length;o<i;o++)if(W.probe(g,o))return M.logger.log("MPEG Audio sync word found !"),!0;return!1},w.canParse=function(g,b){return W.canParse(g,b)},w.appendFrame=function(g,b,o){return this.initPTS===null?void 0:W.appendFrame(g,b,o,this.initPTS,this.frameIndex)},f}(V.default);R.minProbeByteLength=4,$.default=R},"./src/demux/mp4demuxer.ts":function(ie,$,O){"use strict";O.r($);var V=O("./src/utils/mp4-tools.ts"),I=O("./src/demux/dummy-demuxed-track.ts"),M=function(){function W(P,R){this.remainderData=null,this.config=void 0,this.config=R}var N=W.prototype;return N.resetTimeStamp=function(){},N.resetInitSegment=function(){},N.resetContiguity=function(){},W.probe=function(R){return Object(V.findBox)({data:R,start:0,end:Math.min(R.length,16384)},["moof"]).length>0},N.demux=function(R){var d=R,f=Object(I.dummyTrack)();if(this.config.progressive){this.remainderData&&(d=Object(V.appendUint8Array)(this.remainderData,R));var w=Object(V.segmentValidRange)(d);this.remainderData=w.remainder,f.samples=w.valid||new Uint8Array}else f.samples=d;return{audioTrack:Object(I.dummyTrack)(),avcTrack:f,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},N.flush=function(){var R=Object(I.dummyTrack)();return R.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(I.dummyTrack)(),avcTrack:R,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},N.demuxSampleAes=function(R,d,f){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},N.destroy=function(){},W}();M.minProbeByteLength=1024,$.default=M},"./src/demux/mpegaudio.ts":function(ie,$,O){"use strict";O.r($),O.d($,"appendFrame",function(){return P}),O.d($,"parseHeader",function(){return R}),O.d($,"isHeaderPattern",function(){return d}),O.d($,"isHeader",function(){return f}),O.d($,"canParse",function(){return w}),O.d($,"probe",function(){return p});var V=null,I=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],M=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],W=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],N=[0,1,1,4];function P(g,b,o,i,s){if(o+24>b.length)return;var l=R(b,o);if(l&&o+l.frameLength<=b.length){var C=l.samplesPerFrame*9e4/l.sampleRate,m=i+s*C,v={unit:b.subarray(o,o+l.frameLength),pts:m,dts:m};return g.config=[],g.channelCount=l.channelCount,g.samplerate=l.sampleRate,g.samples.push(v),{sample:v,length:l.frameLength,missing:0}}}function R(g,b){var o=g[b+1]>>3&3,i=g[b+1]>>1&3,s=g[b+2]>>4&15,l=g[b+2]>>2&3;if(o!==1&&s!==0&&s!==15&&l!==3){var C=g[b+2]>>1&1,m=g[b+3]>>6,v=o===3?3-i:i===3?3:4,k=I[v*14+s-1]*1e3,L=o===3?0:o===2?1:2,E=M[L*3+l],y=m===3?1:2,c=W[o][i],u=N[i],A=c*8*u,S=Math.floor(c*k/E+C)*u;if(V===null){var T=navigator.userAgent||"",_=T.match(/Chrome\/(\d+)/i);V=_?parseInt(_[1]):0}var j=!!V&&V<=87;return j&&i===2&&k>=224e3&&m===0&&(g[b+3]=g[b+3]|128),{sampleRate:E,channelCount:y,frameLength:S,samplesPerFrame:A}}}function d(g,b){return g[b]===255&&(g[b+1]&224)===224&&(g[b+1]&6)!==0}function f(g,b){return b+1<g.length&&d(g,b)}function w(g,b){var o=4;return d(g,b)&&o<=g.length-b}function p(g,b){if(b+1<g.length&&d(g,b)){var o=4,i=R(g,b),s=o;i!=null&&i.frameLength&&(s=i.frameLength);var l=b+s;return l===g.length||f(g,l)}return!1}},"./src/demux/sample-aes.ts":function(ie,$,O){"use strict";O.r($);var V=O("./src/crypt/decrypter.ts"),I=O("./src/demux/tsdemuxer.ts"),M=function(){function W(P,R,d){this.keyData=void 0,this.decrypter=void 0,this.keyData=d,this.decrypter=new V.default(P,R,{removePKCS7Padding:!1})}var N=W.prototype;return N.decryptBuffer=function(R,d){this.decrypter.decrypt(R,this.keyData.key.buffer,this.keyData.iv.buffer,d)},N.decryptAacSample=function(R,d,f,w){var p=R[d].unit,g=p.subarray(16,p.length-p.length%16),b=g.buffer.slice(g.byteOffset,g.byteOffset+g.length),o=this;this.decryptBuffer(b,function(i){var s=new Uint8Array(i);p.set(s,16),w||o.decryptAacSamples(R,d+1,f)})},N.decryptAacSamples=function(R,d,f){for(;;d++){if(d>=R.length){f();return}if(R[d].unit.length<32)continue;var w=this.decrypter.isSync();if(this.decryptAacSample(R,d,f,w),!w)return}},N.getAvcEncryptedData=function(R){for(var d=Math.floor((R.length-48)/160)*16+16,f=new Int8Array(d),w=0,p=32;p<=R.length-16;p+=160,w+=16)f.set(R.subarray(p,p+16),w);return f},N.getAvcDecryptedUnit=function(R,d){for(var f=new Uint8Array(d),w=0,p=32;p<=R.length-16;p+=160,w+=16)R.set(f.subarray(w,w+16),p);return R},N.decryptAvcSample=function(R,d,f,w,p,g){var b=Object(I.discardEPB)(p.data),o=this.getAvcEncryptedData(b),i=this;this.decryptBuffer(o.buffer,function(s){p.data=i.getAvcDecryptedUnit(b,s),g||i.decryptAvcSamples(R,d,f+1,w)})},N.decryptAvcSamples=function(R,d,f,w){if(R instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;d++,f=0){if(d>=R.length){w();return}for(var p=R[d].units;!(f>=p.length);f++){var g=p[f];if(g.data.length<=48||g.type!==1&&g.type!==5)continue;var b=this.decrypter.isSync();if(this.decryptAvcSample(R,d,f,w,g,b),!b)return}}},W}();$.default=M},"./src/demux/transmuxer-interface.ts":function(ie,$,O){"use strict";O.r($),O.d($,"default",function(){return p});var V=O("./node_modules/webworkify-webpack/index.js"),I=O.n(V),M=O("./src/events.ts"),W=O("./src/demux/transmuxer.ts"),N=O("./src/utils/logger.ts"),P=O("./src/errors.ts"),R=O("./src/utils/mediasource-helper.ts"),d=O("./node_modules/eventemitter3/index.js"),f=O.n(d),w=Object(R.getMediaSource)()||{isTypeSupported:function(){return!1}},p=function(){function g(o,i,s,l){var C=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=o,this.id=i,this.onTransmuxComplete=s,this.onFlush=l;var m=o.config,v=function(c,u){u=u||{},u.frag=C.frag,u.id=C.id,o.trigger(c,u)};this.observer=new d.EventEmitter,this.observer.on(M.Events.FRAG_DECRYPTED,v),this.observer.on(M.Events.ERROR,v);var k={mp4:w.isTypeSupported("video/mp4"),mpeg:w.isTypeSupported("audio/mpeg"),mp3:w.isTypeSupported('audio/mp4; codecs="mp3"')},L=navigator.vendor;if(m.enableWorker&&typeof Worker!="undefined"){N.logger.log("demuxing in webworker");var E;try{E=this.worker=V("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),E.addEventListener("message",this.onwmsg),E.onerror=function(y){o.trigger(M.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(y.message+" ("+y.filename+":"+y.lineno+")")})},E.postMessage({cmd:"init",typeSupported:k,vendor:L,id:i,config:JSON.stringify(m)})}catch(y){N.logger.warn("Error in worker:",y),N.logger.error("Error while initializing DemuxerWorker, fallback to inline"),E&&self.URL.revokeObjectURL(E.objectURL),this.transmuxer=new W.default(this.observer,k,m,L,i),this.worker=null}}else this.transmuxer=new W.default(this.observer,k,m,L,i)}var b=g.prototype;return b.destroy=function(){var i=this.worker;if(i)i.removeEventListener("message",this.onwmsg),i.terminate(),this.worker=null;else{var s=this.transmuxer;s&&(s.destroy(),this.transmuxer=null)}var l=this.observer;l&&l.removeAllListeners(),this.observer=null},b.push=function(i,s,l,C,m,v,k,L,E,y){var c=this;E.transmuxing.start=self.performance.now();var u=this.transmuxer,A=this.worker,S=v?v.start:m.start,T=m.decryptdata,_=this.frag,j=!(_&&m.cc===_.cc),z=!(_&&E.level===_.level),Z=_?E.sn-_.sn:-1,K=this.part?E.part-this.part.index:1,F=!z&&(Z===1||Z===0&&K===1),ee=self.performance.now();(z||Z||m.stats.parsing.start===0)&&(m.stats.parsing.start=ee),v&&(K||!F)&&(v.stats.parsing.start=ee);var se=new W.TransmuxState(j,F,L,z,S);if(!F||j){N.logger.log("[transmuxer-interface, "+m.type+"]: Starting new transmux session for sn: "+E.sn+" p: "+E.part+" level: "+E.level+" id: "+E.id+`
|
|
discontinuity: `+j+`
|
|
trackSwitch: `+z+`
|
|
contiguous: `+F+`
|
|
accurateTimeOffset: `+L+`
|
|
timeOffset: `+S);var he=new W.TransmuxConfig(l,C,s,k,y);this.configureTransmuxer(he)}if(this.frag=m,this.part=v,A)A.postMessage({cmd:"demux",data:i,decryptdata:T,chunkMeta:E,state:se},i instanceof ArrayBuffer?[i]:[]);else if(u){var Ce=u.push(i,T,E,se);Object(W.isPromise)(Ce)?Ce.then(function(Ue){c.handleTransmuxComplete(Ue)}):this.handleTransmuxComplete(Ce)}},b.flush=function(i){var s=this;i.transmuxing.start=self.performance.now();var l=this.transmuxer,C=this.worker;if(C)C.postMessage({cmd:"flush",chunkMeta:i});else if(l){var m=l.flush(i);Object(W.isPromise)(m)?m.then(function(v){s.handleFlushResult(v,i)}):this.handleFlushResult(m,i)}},b.handleFlushResult=function(i,s){var l=this;i.forEach(function(C){l.handleTransmuxComplete(C)}),this.onFlush(s)},b.onWorkerMessage=function(i){var s=i.data,l=this.hls;switch(s.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(s.data);break}case"flush":{this.onFlush(s.data);break}default:{s.data=s.data||{},s.data.frag=this.frag,s.data.id=this.id,l.trigger(s.event,s.data);break}}},b.configureTransmuxer=function(i){var s=this.worker,l=this.transmuxer;s?s.postMessage({cmd:"configure",config:i}):l&&l.configure(i)},b.handleTransmuxComplete=function(i){i.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(i)},g}()},"./src/demux/transmuxer-worker.ts":function(ie,$,O){"use strict";O.r($),O.d($,"default",function(){return P});var V=O("./src/demux/transmuxer.ts"),I=O("./src/events.ts"),M=O("./src/utils/logger.ts"),W=O("./node_modules/eventemitter3/index.js"),N=O.n(W);function P(p){var g=new W.EventEmitter,b=function(i,s){p.postMessage({event:i,data:s})};g.on(I.Events.FRAG_DECRYPTED,b),g.on(I.Events.ERROR,b),p.addEventListener("message",function(o){var i=o.data;switch(i.cmd){case"init":{var s=JSON.parse(i.config);p.transmuxer=new V.default(g,i.typeSupported,s,i.vendor,i.id),Object(M.enableLogs)(s.debug),b("init",null);break}case"configure":{p.transmuxer.configure(i.config);break}case"demux":{var l=p.transmuxer.push(i.data,i.decryptdata,i.chunkMeta,i.state);Object(V.isPromise)(l)?l.then(function(v){R(p,v)}):R(p,l);break}case"flush":{var C=i.chunkMeta,m=p.transmuxer.flush(C);Object(V.isPromise)(m)?m.then(function(v){f(p,v,C)}):f(p,m,C);break}default:break}})}function R(p,g){if(w(g.remuxResult))return;var b=[],o=g.remuxResult,i=o.audio,s=o.video;i&&d(b,i),s&&d(b,s),p.postMessage({event:"transmuxComplete",data:g},b)}function d(p,g){g.data1&&p.push(g.data1.buffer),g.data2&&p.push(g.data2.buffer)}function f(p,g,b){g.forEach(function(o){R(p,o)}),p.postMessage({event:"flush",data:b})}function w(p){return!p.audio&&!p.video&&!p.text&&!p.id3&&!p.initSegment}},"./src/demux/transmuxer.ts":function(ie,$,O){"use strict";O.r($),O.d($,"default",function(){return s}),O.d($,"isPromise",function(){return m}),O.d($,"TransmuxConfig",function(){return v}),O.d($,"TransmuxState",function(){return k});var V=O("./src/events.ts"),I=O("./src/errors.ts"),M=O("./src/crypt/decrypter.ts"),W=O("./src/demux/aacdemuxer.ts"),N=O("./src/demux/mp4demuxer.ts"),P=O("./src/demux/tsdemuxer.ts"),R=O("./src/demux/mp3demuxer.ts"),d=O("./src/remux/mp4-remuxer.ts"),f=O("./src/remux/passthrough-remuxer.ts"),w=O("./src/demux/chunk-cache.ts"),p=O("./src/utils/mp4-tools.ts"),g=O("./src/utils/logger.ts"),b;try{b=self.performance.now.bind(self.performance)}catch(L){g.logger.debug("Unable to use Performance API on this environment"),b=self.Date.now}var o=[{demux:P.default,remux:d.default},{demux:N.default,remux:f.default},{demux:W.default,remux:d.default},{demux:R.default,remux:d.default}],i=1024;o.forEach(function(L){var E=L.demux;i=Math.max(i,E.minProbeByteLength)});var s=function(){function L(y,c,u,A,S){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new w.default,this.observer=y,this.typeSupported=c,this.config=u,this.vendor=A,this.id=S}var E=L.prototype;return E.configure=function(c){this.transmuxConfig=c,this.decrypter&&this.decrypter.reset()},E.push=function(c,u,A,S){var T=this,_=A.transmuxing;_.executeStart=b();var j=new Uint8Array(c),z=this.cache,Z=this.config,K=this.currentTransmuxState,F=this.transmuxConfig;S&&(this.currentTransmuxState=S);var ee=l(j,u);if(ee&&ee.method==="AES-128"){var se=this.getDecrypter();if(Z.enableSoftwareAES){var he=se.softwareDecrypt(j,ee.key.buffer,ee.iv.buffer);if(!he)return _.executeEnd=b(),C(A);j=new Uint8Array(he)}else return this.decryptionPromise=se.webCryptoDecrypt(j,ee.key.buffer,ee.iv.buffer).then(function(be){var Ae=T.push(be,null,A);return T.decryptionPromise=null,Ae}),this.decryptionPromise}var Ce=S||K,Ue=Ce.contiguous,ke=Ce.discontinuity,Me=Ce.trackSwitch,ce=Ce.accurateTimeOffset,ve=Ce.timeOffset,le=F.audioCodec,ne=F.videoCodec,Le=F.defaultInitPts,xe=F.duration,Ie=F.initSegmentData;if((ke||Me)&&this.resetInitSegment(Ie,le,ne,xe),ke&&this.resetInitialTimestamp(Le),Ue||this.resetContiguity(),this.needsProbing(j,ke,Me)){if(z.dataLength){var Re=z.flush();j=Object(p.appendUint8Array)(Re,j)}this.configureTransmuxer(j,F)}var ae=this.transmux(j,ee,ve,ce,A),oe=this.currentTransmuxState;return oe.contiguous=!0,oe.discontinuity=!1,oe.trackSwitch=!1,_.executeEnd=b(),ae},E.flush=function(c){var u=this,A=c.transmuxing;A.executeStart=b();var S=this.decrypter,T=this.cache,_=this.currentTransmuxState,j=this.decryptionPromise;if(j)return j.then(function(){return u.flush(c)});var z=[],Z=_.timeOffset;if(S){var K=S.flush();K&&z.push(this.push(K,null,c))}var F=T.dataLength;T.reset();var ee=this.demuxer,se=this.remuxer;if(!ee||!se)return F>=i&&this.observer.emit(V.Events.ERROR,V.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),A.executeEnd=b(),[C(c)];var he=ee.flush(Z);return m(he)?he.then(function(Ce){return u.flushRemux(z,Ce,c),z}):(this.flushRemux(z,he,c),z)},E.flushRemux=function(c,u,A){var S=u.audioTrack,T=u.avcTrack,_=u.id3Track,j=u.textTrack,z=this.currentTransmuxState,Z=z.accurateTimeOffset,K=z.timeOffset;g.logger.log("[transmuxer.ts]: Flushed fragment "+A.sn+(A.part>-1?" p: "+A.part:"")+" of level "+A.level);var F=this.remuxer.remux(S,T,_,j,K,Z,!0,this.id);c.push({remuxResult:F,chunkMeta:A}),A.transmuxing.executeEnd=b()},E.resetInitialTimestamp=function(c){var u=this.demuxer,A=this.remuxer;if(!u||!A)return;u.resetTimeStamp(c),A.resetTimeStamp(c)},E.resetContiguity=function(){var c=this.demuxer,u=this.remuxer;if(!c||!u)return;c.resetContiguity(),u.resetNextTimestamp()},E.resetInitSegment=function(c,u,A,S){var T=this.demuxer,_=this.remuxer;if(!T||!_)return;T.resetInitSegment(u,A,S),_.resetInitSegment(c,u,A)},E.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},E.transmux=function(c,u,A,S,T){var _;return u&&u.method==="SAMPLE-AES"?_=this.transmuxSampleAes(c,u,A,S,T):_=this.transmuxUnencrypted(c,A,S,T),_},E.transmuxUnencrypted=function(c,u,A,S){var T=this.demuxer.demux(c,u,!1,!this.config.progressive),_=T.audioTrack,j=T.avcTrack,z=T.id3Track,Z=T.textTrack,K=this.remuxer.remux(_,j,z,Z,u,A,!1,this.id);return{remuxResult:K,chunkMeta:S}},E.transmuxSampleAes=function(c,u,A,S,T){var _=this;return this.demuxer.demuxSampleAes(c,u,A).then(function(j){var z=_.remuxer.remux(j.audioTrack,j.avcTrack,j.id3Track,j.textTrack,A,S,!1,_.id);return{remuxResult:z,chunkMeta:T}})},E.configureTransmuxer=function(c,u){for(var A=this.config,S=this.observer,T=this.typeSupported,_=this.vendor,j=u.audioCodec,z=u.defaultInitPts,Z=u.duration,K=u.initSegmentData,F=u.videoCodec,ee,se=0,he=o.length;se<he;se++)if(o[se].demux.probe(c)){ee=o[se];break}ee||(g.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),ee={demux:N.default,remux:f.default});var Ce=this.demuxer,Ue=this.remuxer,ke=ee.remux,Me=ee.demux;(!Ue||!(Ue instanceof ke))&&(this.remuxer=new ke(S,A,T,_)),(!Ce||!(Ce instanceof Me))&&(this.demuxer=new Me(S,A,T),this.probe=Me.probe),this.resetInitSegment(K,j,F,Z),this.resetInitialTimestamp(z)},E.needsProbing=function(c,u,A){return!this.demuxer||!this.remuxer||u||A},E.getDecrypter=function(){var c=this.decrypter;return c||(c=this.decrypter=new M.default(this.observer,this.config)),c},L}();function l(L,E){var y=null;return L.byteLength>0&&E!=null&&E.key!=null&&E.iv!==null&&E.method!=null&&(y=E),y}var C=function(E){return{remuxResult:{},chunkMeta:E}};function m(L){return"then"in L&&L.then instanceof Function}var v=function(E,y,c,u,A){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=E,this.videoCodec=y,this.initSegmentData=c,this.duration=u,this.defaultInitPts=A},k=function(E,y,c,u,A){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=E,this.contiguous=y,this.accurateTimeOffset=c,this.trackSwitch=u,this.timeOffset=A}},"./src/demux/tsdemuxer.ts":function(ie,$,O){"use strict";O.r($),O.d($,"discardEPB",function(){return C});var V=O("./src/demux/adts.ts"),I=O("./src/demux/mpegaudio.ts"),M=O("./src/demux/exp-golomb.ts"),W=O("./src/demux/id3.ts"),N=O("./src/demux/sample-aes.ts"),P=O("./src/events.ts"),R=O("./src/utils/mp4-tools.ts"),d=O("./src/utils/logger.ts"),f=O("./src/errors.ts"),w={video:1,audio:2,id3:3,text:4},p=function(){function m(k,L,E){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=k,this.config=L,this.typeSupported=E}m.probe=function(L){var E=m.syncOffset(L);return E<0?!1:(E&&d.logger.warn("MPEG2-TS detected but first sync word found @ offset "+E+", junk ahead ?"),!0)},m.syncOffset=function(L){for(var E=Math.min(1e3,L.length-3*188),y=0;y<E;){if(L[y]===71&&L[y+188]===71&&L[y+2*188]===71)return y;y++}return-1},m.createTrack=function(L,E){return{container:L==="video"||L==="audio"?"video/mp2t":void 0,type:L,id:w[L],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:L==="audio"?E:void 0}};var v=m.prototype;return v.resetInitSegment=function(L,E,y){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=m.createTrack("video",y),this._audioTrack=m.createTrack("audio",y),this._id3Track=m.createTrack("id3",y),this._txtTrack=m.createTrack("text",y),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=L,this.videoCodec=E,this._duration=y},v.resetTimeStamp=function(){},v.resetContiguity=function(){var L=this._audioTrack,E=this._avcTrack,y=this._id3Track;L&&(L.pesData=null),E&&(E.pesData=null),y&&(y.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},v.demux=function(L,E,y,c){y===void 0&&(y=!1),c===void 0&&(c=!1),y||(this.sampleAes=null);var u,A=this._avcTrack,S=this._audioTrack,T=this._id3Track,_=A.pid,j=A.pesData,z=S.pid,Z=T.pid,K=S.pesData,F=T.pesData,ee=!1,se=this.pmtParsed,he=this._pmtId,Ce=L.length;if(this.remainderData&&(L=Object(R.appendUint8Array)(this.remainderData,L),Ce=L.length,this.remainderData=null),Ce<188&&!c)return this.remainderData=L,{audioTrack:S,avcTrack:A,id3Track:T,textTrack:this._txtTrack};var Ue=Math.max(0,m.syncOffset(L));Ce-=(Ce+Ue)%188,Ce<L.byteLength&&!c&&(this.remainderData=new Uint8Array(L.buffer,Ce,L.buffer.byteLength-Ce));for(var ke=Ue;ke<Ce;ke+=188)if(L[ke]===71){var Me=!!(L[ke+1]&64),ce=((L[ke+1]&31)<<8)+L[ke+2],ve=(L[ke+3]&48)>>4,le=void 0;if(ve>1){if(le=ke+5+L[ke+4],le===ke+188)continue}else le=ke+4;switch(ce){case _:Me&&(j&&(u=i(j))&&this.parseAVCPES(u,!1),j={data:[],size:0}),j&&(j.data.push(L.subarray(le,ke+188)),j.size+=ke+188-le);break;case z:Me&&(K&&(u=i(K))&&(S.isAAC?this.parseAACPES(u):this.parseMPEGPES(u)),K={data:[],size:0}),K&&(K.data.push(L.subarray(le,ke+188)),K.size+=ke+188-le);break;case Z:Me&&(F&&(u=i(F))&&this.parseID3PES(u),F={data:[],size:0}),F&&(F.data.push(L.subarray(le,ke+188)),F.size+=ke+188-le);break;case 0:Me&&(le+=L[le]+1),he=this._pmtId=b(L,le);break;case he:{Me&&(le+=L[le]+1);var ne=o(L,le,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,y);_=ne.avc,_>0&&(A.pid=_),z=ne.audio,z>0&&(S.pid=z,S.isAAC=ne.isAAC),Z=ne.id3,Z>0&&(T.pid=Z),ee&&!se&&(d.logger.log("reparse from beginning"),ee=!1,ke=Ue-188),se=this.pmtParsed=!0;break}case 17:case 8191:break;default:ee=!0;break}}else this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:f.ErrorTypes.MEDIA_ERROR,details:f.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});A.pesData=j,S.pesData=K,T.pesData=F;var Le={audioTrack:S,avcTrack:A,id3Track:T,textTrack:this._txtTrack};return c&&this.extractRemainingSamples(Le),Le},v.flush=function(){var L=this.remainderData;this.remainderData=null;var E;return L?E=this.demux(L,-1,!1,!0):E={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(E),this.sampleAes?this.decrypt(E,this.sampleAes):E},v.extractRemainingSamples=function(L){var E=L.audioTrack,y=L.avcTrack,c=L.id3Track,u=y.pesData,A=E.pesData,S=c.pesData,T;u&&(T=i(u))?(this.parseAVCPES(T,!0),y.pesData=null):y.pesData=u,A&&(T=i(A))?(E.isAAC?this.parseAACPES(T):this.parseMPEGPES(T),E.pesData=null):(A!=null&&A.size&&d.logger.log("last AAC PES packet truncated,might overlap between fragments"),E.pesData=A),S&&(T=i(S))?(this.parseID3PES(T),c.pesData=null):c.pesData=S},v.demuxSampleAes=function(L,E,y){var c=this.demux(L,y,!0,!this.config.progressive),u=this.sampleAes=new N.default(this.observer,this.config,E);return this.decrypt(c,u)},v.decrypt=function(L,E){return new Promise(function(y){var c=L.audioTrack,u=L.avcTrack;c.samples&&c.isAAC?E.decryptAacSamples(c.samples,0,function(){u.samples?E.decryptAvcSamples(u.samples,0,0,function(){y(L)}):y(L)}):u.samples&&E.decryptAvcSamples(u.samples,0,0,function(){y(L)})})},v.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},v.parseAVCPES=function(L,E){var y=this,c=this._avcTrack,u=this.parseAVCNALu(L.data),A=!1,S=this.avcSample,T,_=!1;L.data=null,S&&u.length&&!c.audFound&&(s(S,c),S=this.avcSample=g(!1,L.pts,L.dts,"")),u.forEach(function(j){switch(j.type){case 1:{T=!0,S||(S=y.avcSample=g(!0,L.pts,L.dts,"")),A&&(S.debug+="NDR "),S.frame=!0;var z=j.data;if(_&&z.length>4){var Z=new M.default(z).readSliceType();(Z===2||Z===4||Z===7||Z===9)&&(S.key=!0)}break}case 5:T=!0,S||(S=y.avcSample=g(!0,L.pts,L.dts,"")),A&&(S.debug+="IDR "),S.key=!0,S.frame=!0;break;case 6:{T=!0,A&&S&&(S.debug+="SEI ");var K=new M.default(C(j.data));K.readUByte();for(var F=0,ee=0,se=!1,he=0;!se&&K.bytesAvailable>1;){F=0;do he=K.readUByte(),F+=he;while(he===255);ee=0;do he=K.readUByte(),ee+=he;while(he===255);if(F===4&&K.bytesAvailable!==0){se=!0;var Ce=K.readUByte();if(Ce===181){var Ue=K.readUShort();if(Ue===49){var ke=K.readUInt();if(ke===1195456820){var Me=K.readUByte();if(Me===3){for(var ce=K.readUByte(),ve=K.readUByte(),le=31&ce,ne=[ce,ve],Le=0;Le<le;Le++)ne.push(K.readUByte()),ne.push(K.readUByte()),ne.push(K.readUByte());l(y._txtTrack.samples,{type:3,pts:L.pts,bytes:ne})}}}}}else if(F===5&&K.bytesAvailable!==0){if(se=!0,ee>16){for(var xe=[],Ie=0;Ie<16;Ie++)xe.push(K.readUByte().toString(16)),(Ie===3||Ie===5||Ie===7||Ie===9)&&xe.push("-");for(var Re=ee-16,ae=new Uint8Array(Re),oe=0;oe<Re;oe++)ae[oe]=K.readUByte();l(y._txtTrack.samples,{pts:L.pts,payloadType:F,uuid:xe.join(""),userData:Object(W.utf8ArrayToStr)(ae),userDataBytes:ae})}}else if(ee<K.bytesAvailable)for(var be=0;be<ee;be++)K.readUByte()}break}case 7:if(T=!0,_=!0,A&&S&&(S.debug+="SPS "),!c.sps){var Ae=new M.default(j.data),Ne=Ae.readSPS();c.width=Ne.width,c.height=Ne.height,c.pixelRatio=Ne.pixelRatio,c.sps=[j.data],c.duration=y._duration;for(var _e=j.data.subarray(1,4),We="avc1.",Fe=0;Fe<3;Fe++){var et=_e[Fe].toString(16);et.length<2&&(et="0"+et),We+=et}c.codec=We}break;case 8:T=!0,A&&S&&(S.debug+="PPS "),c.pps||(c.pps=[j.data]);break;case 9:T=!1,c.audFound=!0,S&&s(S,c),S=y.avcSample=g(!1,L.pts,L.dts,A?"AUD ":"");break;case 12:T=!1;break;default:T=!1,S&&(S.debug+="unknown NAL "+j.type+" ");break}if(S&&T){var Je=S.units;Je.push(j)}}),E&&S&&(s(S,c),this.avcSample=null)},v.getLastNalUnit=function(){var L,E=this.avcSample,y;if(!E||E.units.length===0){var c=this._avcTrack.samples;E=c[c.length-1]}if((L=E)!==null&&L!==void 0&&L.units){var u=E.units;y=u[u.length-1]}return y},v.parseAVCNALu=function(L){var E=L.byteLength,y=this._avcTrack,c=y.naluState||0,u=c,A=[],S=0,T,_,j,z=-1,Z=0;for(c===-1&&(z=0,Z=L[0]&31,c=0,S=1);S<E;){if(T=L[S++],!c){c=T?0:1;continue}if(c===1){c=T?0:2;continue}if(!T)c=3;else if(T===1){if(z>=0){var K={data:L.subarray(z,S-c-1),type:Z};A.push(K)}else{var F=this.getLastNalUnit();if(F&&(u&&S<=4-u&&(F.state&&(F.data=F.data.subarray(0,F.data.byteLength-u))),_=S-c-1,_>0)){var ee=new Uint8Array(F.data.byteLength+_);ee.set(F.data,0),ee.set(L.subarray(0,_),F.data.byteLength),F.data=ee,F.state=0}}S<E?(j=L[S]&31,z=S,Z=j,c=0):c=-1}else c=0}if(z>=0&&c>=0){var se={data:L.subarray(z,E),type:Z,state:c};A.push(se)}if(A.length===0){var he=this.getLastNalUnit();if(he){var Ce=new Uint8Array(he.data.byteLength+L.byteLength);Ce.set(he.data,0),Ce.set(L,he.data.byteLength),he.data=Ce}}return y.naluState=c,A},v.parseAACPES=function(L){var E=0,y=this._audioTrack,c=this.aacOverFlow,u=L.data;if(c){this.aacOverFlow=null;var A=c.sample.unit.byteLength,S=Math.min(c.missing,A),T=A-S;c.sample.unit.set(u.subarray(0,S),T),y.samples.push(c.sample),E=c.missing}var _,j;for(_=E,j=u.length;_<j-1&&!V.isHeader(u,_);_++);if(_!==E){var z,Z;if(_<j-1?(z="AAC PES did not start with ADTS header,offset:"+_,Z=!1):(z="no ADTS header found in AAC PES",Z=!0),d.logger.warn("parsing error:"+z),this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:f.ErrorTypes.MEDIA_ERROR,details:f.ErrorDetails.FRAG_PARSING_ERROR,fatal:Z,reason:z}),Z)return}V.initTrackConfig(y,this.observer,u,_,this.audioCodec);var K;if(L.pts!==void 0)K=L.pts;else if(c){var F=V.getFrameDuration(y.samplerate);K=c.sample.pts+F}else{d.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var ee=0;_<j;)if(V.isHeader(u,_)){if(_+5<j){var se=V.appendFrame(y,u,_,K,ee);if(se)if(se.missing)this.aacOverFlow=se;else{_+=se.length,ee++;continue}}break}else _++},v.parseMPEGPES=function(L){var E=L.data,y=E.length,c=0,u=0,A=L.pts;if(A===void 0){d.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;u<y;)if(I.isHeader(E,u)){var S=I.appendFrame(this._audioTrack,E,u,A,c);if(S)u+=S.length,c++;else break}else u++},v.parseID3PES=function(L){if(L.pts===void 0){d.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(L)},m}();p.minProbeByteLength=188;function g(m,v,k,L){return{key:m,frame:!1,pts:v,dts:k,units:[],debug:L,length:0}}function b(m,v){return(m[v+10]&31)<<8|m[v+11]}function o(m,v,k,L){var E={audio:-1,avc:-1,id3:-1,isAAC:!0},y=(m[v+1]&15)<<8|m[v+2],c=v+3+y-4,u=(m[v+10]&15)<<8|m[v+11];for(v+=12+u;v<c;){var A=(m[v+1]&31)<<8|m[v+2];switch(m[v]){case 207:if(!L){d.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:E.audio===-1&&(E.audio=A);break;case 21:E.id3===-1&&(E.id3=A);break;case 219:if(!L){d.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:E.avc===-1&&(E.avc=A);break;case 3:case 4:k?E.audio===-1&&(E.audio=A,E.isAAC=!1):d.logger.log("MPEG audio found, not supported in this browser");break;case 36:d.logger.warn("Unsupported HEVC stream type found");break;default:break}v+=((m[v+3]&15)<<8|m[v+4])+5}return E}function i(m){var v=0,k,L,E,y,c,u=m.data;if(!m||m.size===0)return null;for(;u[0].length<19&&u.length>1;){var A=new Uint8Array(u[0].length+u[1].length);A.set(u[0]),A.set(u[1],u[0].length),u[0]=A,u.splice(1,1)}k=u[0];var S=(k[0]<<16)+(k[1]<<8)+k[2];if(S===1){if(L=(k[4]<<8)+k[5],L&&L>m.size-6)return null;var T=k[7];T&192&&(y=(k[9]&14)*536870912+(k[10]&255)*4194304+(k[11]&254)*16384+(k[12]&255)*128+(k[13]&254)/2,T&64?(c=(k[14]&14)*536870912+(k[15]&255)*4194304+(k[16]&254)*16384+(k[17]&255)*128+(k[18]&254)/2,y-c>60*9e4&&(d.logger.warn(Math.round((y-c)/9e4)+"s delta between PTS and DTS, align them"),y=c)):c=y),E=k[8];var _=E+9;if(m.size<=_)return null;m.size-=_;for(var j=new Uint8Array(m.size),z=0,Z=u.length;z<Z;z++){k=u[z];var K=k.byteLength;if(_)if(_>K){_-=K;continue}else k=k.subarray(_),K-=_,_=0;j.set(k,v),v+=K}return L&&(L-=E+3),{data:j,pts:y,dts:c,len:L}}return null}function s(m,v){if(m.units.length&&m.frame){if(m.pts===void 0){var k=v.samples,L=k.length;if(L){var E=k[L-1];m.pts=E.pts,m.dts=E.dts}else{v.dropped++;return}}v.samples.push(m)}m.debug.length&&d.logger.log(m.pts+"/"+m.dts+":"+m.debug)}function l(m,v){var k=m.length;if(k>0){if(v.pts>=m[k-1].pts)m.push(v);else for(var L=k-1;L>=0;L--)if(v.pts<m[L].pts){m.splice(L,0,v);break}}else m.push(v)}function C(m){for(var v=m.byteLength,k=[],L=1;L<v-2;)m[L]===0&&m[L+1]===0&&m[L+2]===3?(k.push(L+2),L+=2):L++;if(k.length===0)return m;var E=v-k.length,y=new Uint8Array(E),c=0;for(L=0;L<E;c++,L++)c===k[0]&&(c++,k.shift()),y[L]=m[c];return y}$.default=p},"./src/errors.ts":function(ie,$,O){"use strict";O.r($),O.d($,"ErrorTypes",function(){return V}),O.d($,"ErrorDetails",function(){return I});var V;(function(M){M.NETWORK_ERROR="networkError",M.MEDIA_ERROR="mediaError",M.KEY_SYSTEM_ERROR="keySystemError",M.MUX_ERROR="muxError",M.OTHER_ERROR="otherError"})(V||(V={}));var I;(function(M){M.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",M.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",M.KEY_SYSTEM_NO_SESSION="keySystemNoSession",M.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",M.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",M.MANIFEST_LOAD_ERROR="manifestLoadError",M.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",M.MANIFEST_PARSING_ERROR="manifestParsingError",M.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",M.LEVEL_EMPTY_ERROR="levelEmptyError",M.LEVEL_LOAD_ERROR="levelLoadError",M.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",M.LEVEL_SWITCH_ERROR="levelSwitchError",M.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",M.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",M.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",M.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",M.FRAG_LOAD_ERROR="fragLoadError",M.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",M.FRAG_DECRYPT_ERROR="fragDecryptError",M.FRAG_PARSING_ERROR="fragParsingError",M.REMUX_ALLOC_ERROR="remuxAllocError",M.KEY_LOAD_ERROR="keyLoadError",M.KEY_LOAD_TIMEOUT="keyLoadTimeOut",M.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",M.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",M.BUFFER_APPEND_ERROR="bufferAppendError",M.BUFFER_APPENDING_ERROR="bufferAppendingError",M.BUFFER_STALLED_ERROR="bufferStalledError",M.BUFFER_FULL_ERROR="bufferFullError",M.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",M.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",M.INTERNAL_EXCEPTION="internalException",M.INTERNAL_ABORTED="aborted",M.UNKNOWN="unknown"})(I||(I={}))},"./src/events.ts":function(ie,$,O){"use strict";O.r($),O.d($,"Events",function(){return V});var V;(function(I){I.MEDIA_ATTACHING="hlsMediaAttaching",I.MEDIA_ATTACHED="hlsMediaAttached",I.MEDIA_DETACHING="hlsMediaDetaching",I.MEDIA_DETACHED="hlsMediaDetached",I.BUFFER_RESET="hlsBufferReset",I.BUFFER_CODECS="hlsBufferCodecs",I.BUFFER_CREATED="hlsBufferCreated",I.BUFFER_APPENDING="hlsBufferAppending",I.BUFFER_APPENDED="hlsBufferAppended",I.BUFFER_EOS="hlsBufferEos",I.BUFFER_FLUSHING="hlsBufferFlushing",I.BUFFER_FLUSHED="hlsBufferFlushed",I.MANIFEST_LOADING="hlsManifestLoading",I.MANIFEST_LOADED="hlsManifestLoaded",I.MANIFEST_PARSED="hlsManifestParsed",I.LEVEL_SWITCHING="hlsLevelSwitching",I.LEVEL_SWITCHED="hlsLevelSwitched",I.LEVEL_LOADING="hlsLevelLoading",I.LEVEL_LOADED="hlsLevelLoaded",I.LEVEL_UPDATED="hlsLevelUpdated",I.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",I.LEVELS_UPDATED="hlsLevelsUpdated",I.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",I.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",I.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",I.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",I.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",I.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",I.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",I.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",I.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",I.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",I.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",I.CUES_PARSED="hlsCuesParsed",I.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",I.INIT_PTS_FOUND="hlsInitPtsFound",I.FRAG_LOADING="hlsFragLoading",I.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",I.FRAG_LOADED="hlsFragLoaded",I.FRAG_DECRYPTED="hlsFragDecrypted",I.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",I.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",I.FRAG_PARSING_METADATA="hlsFragParsingMetadata",I.FRAG_PARSED="hlsFragParsed",I.FRAG_BUFFERED="hlsFragBuffered",I.FRAG_CHANGED="hlsFragChanged",I.FPS_DROP="hlsFpsDrop",I.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",I.ERROR="hlsError",I.DESTROYING="hlsDestroying",I.KEY_LOADING="hlsKeyLoading",I.KEY_LOADED="hlsKeyLoaded",I.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",I.BACK_BUFFER_REACHED="hlsBackBufferReached"})(V||(V={}))},"./src/hls.ts":function(ie,$,O){"use strict";O.r($),O.d($,"default",function(){return m});var V=O("./node_modules/url-toolkit/src/url-toolkit.js"),I=O.n(V),M=O("./src/loader/playlist-loader.ts"),W=O("./src/loader/key-loader.ts"),N=O("./src/controller/id3-track-controller.ts"),P=O("./src/controller/latency-controller.ts"),R=O("./src/controller/level-controller.ts"),d=O("./src/controller/fragment-tracker.ts"),f=O("./src/controller/stream-controller.ts"),w=O("./src/is-supported.ts"),p=O("./src/utils/logger.ts"),g=O("./src/config.ts"),b=O("./node_modules/eventemitter3/index.js"),o=O.n(b),i=O("./src/events.ts"),s=O("./src/errors.ts");function l(v,k){for(var L=0;L<k.length;L++){var E=k[L];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(v,E.key,E)}}function C(v,k,L){return k&&l(v.prototype,k),L&&l(v,L),v}var m=function(){v.isSupported=function(){return Object(w.isSupported)()};function v(L){L===void 0&&(L={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new b.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var E=this.config=Object(g.mergeConfig)(v.DefaultConfig,L);this.userConfig=L,Object(p.enableLogs)(E.debug),this._autoLevelCapping=-1,E.progressive&&Object(g.enableStreamingMode)(E);var y=E.abrController,c=E.bufferController,u=E.capLevelController,A=E.fpsController,S=this.abrController=new y(this),T=this.bufferController=new c(this),_=this.capLevelController=new u(this),j=new A(this),z=new M.default(this),Z=new W.default(this),K=new N.default(this),F=this.levelController=new R.default(this),ee=new d.FragmentTracker(this),se=this.streamController=new f.default(this,ee);_.setStreamController(se),j.setStreamController(se);var he=[F,se];this.networkControllers=he;var Ce=[z,Z,S,T,_,j,K,ee];this.audioTrackController=this.createController(E.audioTrackController,null,he),this.createController(E.audioStreamController,ee,he),this.subtitleTrackController=this.createController(E.subtitleTrackController,null,he),this.createController(E.subtitleStreamController,ee,he),this.createController(E.timelineController,null,Ce),this.emeController=this.createController(E.emeController,null,Ce),this.cmcdController=this.createController(E.cmcdController,null,Ce),this.latencyController=this.createController(P.default,null,Ce),this.coreComponents=Ce}var k=v.prototype;return k.createController=function(E,y,c){if(E){var u=y?new E(this,y):new E(this);return c&&c.push(u),u}return null},k.on=function(E,y,c){c===void 0&&(c=this),this._emitter.on(E,y,c)},k.once=function(E,y,c){c===void 0&&(c=this),this._emitter.once(E,y,c)},k.removeAllListeners=function(E){this._emitter.removeAllListeners(E)},k.off=function(E,y,c,u){c===void 0&&(c=this),this._emitter.off(E,y,c,u)},k.listeners=function(E){return this._emitter.listeners(E)},k.emit=function(E,y,c){return this._emitter.emit(E,y,c)},k.trigger=function(E,y){if(this.config.debug)return this.emit(E,E,y);try{return this.emit(E,E,y)}catch(c){p.logger.error("An internal error happened while handling event "+E+'. Error message: "'+c.message+'". Here is a stacktrace:',c),this.trigger(i.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:E,error:c})}return!1},k.listenerCount=function(E){return this._emitter.listenerCount(E)},k.destroy=function(){p.logger.log("destroy"),this.trigger(i.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(E){return E.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(E){return E.destroy()}),this.coreComponents.length=0},k.attachMedia=function(E){p.logger.log("attachMedia"),this._media=E,this.trigger(i.Events.MEDIA_ATTACHING,{media:E})},k.detachMedia=function(){p.logger.log("detachMedia"),this.trigger(i.Events.MEDIA_DETACHING,void 0),this._media=null},k.loadSource=function(E){this.stopLoad();var y=this.media,c=this.url,u=this.url=V.buildAbsoluteURL(self.location.href,E,{alwaysNormalize:!0});p.logger.log("loadSource:"+u),y&&c&&c!==u&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(y)),this.trigger(i.Events.MANIFEST_LOADING,{url:E})},k.startLoad=function(E){E===void 0&&(E=-1),p.logger.log("startLoad("+E+")"),this.networkControllers.forEach(function(y){y.startLoad(E)})},k.stopLoad=function(){p.logger.log("stopLoad"),this.networkControllers.forEach(function(E){E.stopLoad()})},k.swapAudioCodec=function(){p.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},k.recoverMediaError=function(){p.logger.log("recoverMediaError");var E=this._media;this.detachMedia(),E&&this.attachMedia(E)},k.removeLevel=function(E,y){y===void 0&&(y=0),this.levelController.removeLevel(E,y)},C(v,[{key:"levels",get:function(){var E=this.levelController.levels;return E||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(E){p.logger.log("set currentLevel:"+E),this.loadLevel=E,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(E){p.logger.log("set nextLevel:"+E),this.levelController.manualLevel=E,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(E){p.logger.log("set loadLevel:"+E),this.levelController.manualLevel=E}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(E){this.levelController.nextLoadLevel=E}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(E){p.logger.log("set firstLevel:"+E),this.levelController.firstLevel=E}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(E){p.logger.log("set startLevel:"+E),E!==-1&&(E=Math.max(E,this.minAutoLevel)),this.levelController.startLevel=E}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(E){var y=!!E;y!==this.config.capLevelToPlayerSize&&(y?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=y)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(E){this._autoLevelCapping!==E&&(p.logger.log("set autoLevelCapping:"+E),this._autoLevelCapping=E)}},{key:"bandwidthEstimate",get:function(){var E=this.abrController.bwEstimator;return E?E.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var E=this.levels,y=this.config.minAutoBitrate;if(!E)return 0;for(var c=E.length,u=0;u<c;u++)if(E[u].maxBitrate>y)return u;return 0}},{key:"maxAutoLevel",get:function(){var E=this.levels,y=this.autoLevelCapping,c;return y===-1&&E&&E.length?c=E.length-1:c=y,c}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(E){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,E)}},{key:"audioTracks",get:function(){var E=this.audioTrackController;return E?E.audioTracks:[]}},{key:"audioTrack",get:function(){var E=this.audioTrackController;return E?E.audioTrack:-1},set:function(E){var y=this.audioTrackController;y&&(y.audioTrack=E)}},{key:"subtitleTracks",get:function(){var E=this.subtitleTrackController;return E?E.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var E=this.subtitleTrackController;return E?E.subtitleTrack:-1},set:function(E){var y=this.subtitleTrackController;y&&(y.subtitleTrack=E)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var E=this.subtitleTrackController;return E?E.subtitleDisplay:!1},set:function(E){var y=this.subtitleTrackController;y&&(y.subtitleDisplay=E)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(E){this.config.lowLatencyMode=E}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return i.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return v.defaultConfig?v.defaultConfig:g.hlsDefaultConfig},set:function(E){v.defaultConfig=E}}]),v}();m.defaultConfig=void 0},"./src/is-supported.ts":function(ie,$,O){"use strict";O.r($),O.d($,"isSupported",function(){return M}),O.d($,"changeTypeSupported",function(){return W});var V=O("./src/utils/mediasource-helper.ts");function I(){return self.SourceBuffer||self.WebKitSourceBuffer}function M(){var N=Object(V.getMediaSource)();if(!N)return!1;var P=I(),R=N&&typeof N.isTypeSupported=="function"&&N.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),d=!P||P.prototype&&typeof P.prototype.appendBuffer=="function"&&typeof P.prototype.remove=="function";return!!R&&!!d}function W(){var N,P=I();return typeof(P==null||((N=P.prototype)===null||N===void 0)?void 0:N.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ie,$,O){"use strict";O.r($),O.d($,"default",function(){return p}),O.d($,"LoadError",function(){return b});var V=O("./src/polyfills/number.ts"),I=O("./src/errors.ts");function M(o,i){o.prototype=Object.create(i.prototype),o.prototype.constructor=o,d(o,i)}function W(o){var i=typeof Map=="function"?new Map:void 0;return W=function(l){if(l===null||!R(l))return l;if(typeof l!="function")throw new TypeError("Super expression must either be null or a function");if(typeof i!="undefined"){if(i.has(l))return i.get(l);i.set(l,C)}function C(){return N(l,arguments,f(this).constructor)}return C.prototype=Object.create(l.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),d(C,l)},W(o)}function N(o,i,s){return P()?N=Reflect.construct:N=function(C,m,v){var k=[null];k.push.apply(k,m);var L=Function.bind.apply(C,k),E=new L;return v&&d(E,v.prototype),E},N.apply(null,arguments)}function P(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(o){return!1}}function R(o){return Function.toString.call(o).indexOf("[native code]")!==-1}function d(o,i){return d=Object.setPrototypeOf||function(l,C){return l.__proto__=C,l},d(o,i)}function f(o){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},f(o)}var w=Math.pow(2,17),p=function(){function o(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var i=o.prototype;return i.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},i.abort=function(){this.loader&&this.loader.abort()},i.load=function(l,C){var m=this,v=l.url;if(!v)return Promise.reject(new b({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,networkDetails:null},"Fragment does not have a "+(v?"part list":"url")));this.abort();var k=this.config,L=k.fLoader,E=k.loader;return new Promise(function(y,c){m.loader&&m.loader.destroy();var u=m.loader=l.loader=L?new L(k):new E(k),A=g(l),S={timeout:k.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:k.fragLoadingMaxRetryTimeout,highWaterMark:w};l.stats=u.stats,u.load(A,S,{onSuccess:function(_,j,z,Z){m.resetLoader(l,u),y({frag:l,part:null,payload:_.data,networkDetails:Z})},onError:function(_,j,z){m.resetLoader(l,u),c(new b({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,response:_,networkDetails:z}))},onAbort:function(_,j,z){m.resetLoader(l,u),c(new b({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,networkDetails:z}))},onTimeout:function(_,j,z){m.resetLoader(l,u),c(new b({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,networkDetails:z}))},onProgress:function(_,j,z,Z){C&&C({frag:l,part:null,payload:z,networkDetails:Z})}})})},i.loadPart=function(l,C,m){var v=this;this.abort();var k=this.config,L=k.fLoader,E=k.loader;return new Promise(function(y,c){v.loader&&v.loader.destroy();var u=v.loader=l.loader=L?new L(k):new E(k),A=g(l,C),S={timeout:k.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:k.fragLoadingMaxRetryTimeout,highWaterMark:w};C.stats=u.stats,u.load(A,S,{onSuccess:function(_,j,z,Z){v.resetLoader(l,u),v.updateStatsFromPart(l,C);var K={frag:l,part:C,payload:_.data,networkDetails:Z};m(K),y(K)},onError:function(_,j,z){v.resetLoader(l,u),c(new b({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,part:C,response:_,networkDetails:z}))},onAbort:function(_,j,z){l.stats.aborted=C.stats.aborted,v.resetLoader(l,u),c(new b({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,part:C,networkDetails:z}))},onTimeout:function(_,j,z){v.resetLoader(l,u),c(new b({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,part:C,networkDetails:z}))}})})},i.updateStatsFromPart=function(l,C){var m=l.stats,v=C.stats,k=v.total;if(m.loaded+=v.loaded,k){var L=Math.round(l.duration/C.duration),E=Math.min(Math.round(m.loaded/k),L),y=L-E,c=y*Math.round(m.loaded/E);m.total=m.loaded+c}else m.total=Math.max(m.loaded,m.total);var u=m.loading,A=v.loading;u.start?u.first+=A.first-A.start:(u.start=A.start,u.first=A.first),u.end=A.end},i.resetLoader=function(l,C){l.loader=null,this.loader===C&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),C.destroy()},o}();function g(o,i){i===void 0&&(i=null);var s=i||o,l={frag:o,part:i,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},C=s.byteRangeStartOffset,m=s.byteRangeEndOffset;return Object(V.isFiniteNumber)(C)&&Object(V.isFiniteNumber)(m)&&(l.rangeStart=C,l.rangeEnd=m),l}var b=function(o){M(i,o);function i(s){for(var l,C=arguments.length,m=new Array(C>1?C-1:0),v=1;v<C;v++)m[v-1]=arguments[v];return l=o.call.apply(o,[this].concat(m))||this,l.data=void 0,l.data=s,l}return i}(W(Error))},"./src/loader/fragment.ts":function(ie,$,O){"use strict";O.r($),O.d($,"ElementaryStreamTypes",function(){return p}),O.d($,"BaseSegment",function(){return g}),O.d($,"Fragment",function(){return b}),O.d($,"Part",function(){return o});var V=O("./src/polyfills/number.ts"),I=O("./node_modules/url-toolkit/src/url-toolkit.js"),M=O.n(I),W=O("./src/utils/logger.ts"),N=O("./src/loader/level-key.ts"),P=O("./src/loader/load-stats.ts");function R(i,s){i.prototype=Object.create(s.prototype),i.prototype.constructor=i,d(i,s)}function d(i,s){return d=Object.setPrototypeOf||function(C,m){return C.__proto__=m,C},d(i,s)}function f(i,s){for(var l=0;l<s.length;l++){var C=s[l];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(i,C.key,C)}}function w(i,s,l){return s&&f(i.prototype,s),l&&f(i,l),i}var p;(function(i){i.AUDIO="audio",i.VIDEO="video",i.AUDIOVIDEO="audiovideo"})(p||(p={}));var g=function(){function i(l){var C;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(C={},C[p.AUDIO]=null,C[p.VIDEO]=null,C[p.AUDIOVIDEO]=null,C),this.baseurl=l}var s=i.prototype;return s.setByteRange=function(C,m){var v=C.split("@",2),k=[];v.length===1?k[0]=m?m.byteRangeEndOffset:0:k[0]=parseInt(v[1]),k[1]=parseInt(v[0])+k[0],this._byteRange=k},w(i,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(I.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(C){this._url=C}}]),i}(),b=function(i){R(s,i);function s(C,m){var v;return v=i.call(this,m)||this,v._decryptdata=null,v.rawProgramDateTime=null,v.programDateTime=null,v.tagList=[],v.duration=0,v.sn=0,v.levelkey=void 0,v.type=void 0,v.loader=null,v.level=-1,v.cc=0,v.startPTS=void 0,v.endPTS=void 0,v.appendedPTS=void 0,v.startDTS=void 0,v.endDTS=void 0,v.start=0,v.deltaPTS=void 0,v.maxStartPTS=void 0,v.minEndPTS=void 0,v.stats=new P.LoadStats,v.urlId=0,v.data=void 0,v.bitrateTest=!1,v.title=null,v.initSegment=null,v.type=C,v}var l=s.prototype;return l.createInitializationVector=function(m){for(var v=new Uint8Array(16),k=12;k<16;k++)v[k]=m>>8*(15-k)&255;return v},l.setDecryptDataFromLevelKey=function(m,v){var k=m;return(m==null?void 0:m.method)==="AES-128"&&m.uri&&!m.iv&&(k=N.LevelKey.fromURI(m.uri),k.method=m.method,k.iv=this.createInitializationVector(v),k.keyFormat="identity"),k},l.setElementaryStreamInfo=function(m,v,k,L,E,y){y===void 0&&(y=!1);var c=this.elementaryStreams,u=c[m];if(!u){c[m]={startPTS:v,endPTS:k,startDTS:L,endDTS:E,partial:y};return}u.startPTS=Math.min(u.startPTS,v),u.endPTS=Math.max(u.endPTS,k),u.startDTS=Math.min(u.startDTS,L),u.endDTS=Math.max(u.endDTS,E)},l.clearElementaryStreamInfo=function(){var m=this.elementaryStreams;m[p.AUDIO]=null,m[p.VIDEO]=null,m[p.AUDIOVIDEO]=null},w(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var m=this.sn;typeof m!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&W.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),m=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,m)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(V.isFiniteNumber)(this.programDateTime))return null;var m=Object(V.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+m*1e3}},{key:"encrypted",get:function(){var m;return!!((m=this.decryptdata)!==null&&m!==void 0&&m.keyFormat&&this.decryptdata.uri)}}]),s}(g),o=function(i){R(s,i);function s(l,C,m,v,k){var L;L=i.call(this,m)||this,L.fragOffset=0,L.duration=0,L.gap=!1,L.independent=!1,L.relurl=void 0,L.fragment=void 0,L.index=void 0,L.stats=new P.LoadStats,L.duration=l.decimalFloatingPoint("DURATION"),L.gap=l.bool("GAP"),L.independent=l.bool("INDEPENDENT"),L.relurl=l.enumeratedString("URI"),L.fragment=C,L.index=v;var E=l.enumeratedString("BYTERANGE");return E&&L.setByteRange(E,k),k&&(L.fragOffset=k.fragOffset+k.duration),L}return w(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var C=this.elementaryStreams;return!!(C.audio||C.video||C.audiovideo)}}]),s}(g)},"./src/loader/key-loader.ts":function(ie,$,O){"use strict";O.r($),O.d($,"default",function(){return W});var V=O("./src/events.ts"),I=O("./src/errors.ts"),M=O("./src/utils/logger.ts"),W=function(){function N(R){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=R,this._registerListeners()}var P=N.prototype;return P._registerListeners=function(){this.hls.on(V.Events.KEY_LOADING,this.onKeyLoading,this)},P._unregisterListeners=function(){this.hls.off(V.Events.KEY_LOADING,this.onKeyLoading)},P.destroy=function(){this._unregisterListeners();for(var d in this.loaders){var f=this.loaders[d];f&&f.destroy()}this.loaders={}},P.onKeyLoading=function(d,f){var w=f.frag,p=w.type,g=this.loaders[p];if(!w.decryptdata){M.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var b=w.decryptdata.uri;if(b!==this.decrypturl||this.decryptkey===null){var o=this.hls.config;if(g&&(M.logger.warn("abort previous key loader for type:"+p),g.abort()),!b){M.logger.warn("key uri is falsy");return}var i=o.loader,s=w.loader=this.loaders[p]=new i(o);this.decrypturl=b,this.decryptkey=null;var l={url:b,frag:w,responseType:"arraybuffer"},C={timeout:o.fragLoadingTimeOut,maxRetry:0,retryDelay:o.fragLoadingRetryDelay,maxRetryDelay:o.fragLoadingMaxRetryTimeout,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(l,C,m)}else this.decryptkey&&(w.decryptdata.key=this.decryptkey,this.hls.trigger(V.Events.KEY_LOADED,{frag:w}))},P.loadsuccess=function(d,f,w){var p=w.frag;if(!p.decryptdata){M.logger.error("after key load, decryptdata unset");return}this.decryptkey=p.decryptdata.key=new Uint8Array(d.data),p.loader=null,delete this.loaders[p.type],this.hls.trigger(V.Events.KEY_LOADED,{frag:p})},P.loaderror=function(d,f){var w=f.frag,p=w.loader;p&&p.abort(),delete this.loaders[w.type],this.hls.trigger(V.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:w,response:d})},P.loadtimeout=function(d,f){var w=f.frag,p=w.loader;p&&p.abort(),delete this.loaders[w.type],this.hls.trigger(V.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:w})},N}()},"./src/loader/level-details.ts":function(ie,$,O){"use strict";O.r($),O.d($,"LevelDetails",function(){return N});var V=O("./src/polyfills/number.ts");function I(P,R){for(var d=0;d<R.length;d++){var f=R[d];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(P,f.key,f)}}function M(P,R,d){return R&&I(P.prototype,R),d&&I(P,d),P}var W=10,N=function(){function P(d){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=d}var R=P.prototype;return R.reloaded=function(f){if(!f){this.advanced=!0,this.updated=!0;return}var w=this.lastPartSn-f.lastPartSn,p=this.lastPartIndex-f.lastPartIndex;this.updated=this.endSN!==f.endSN||!!p||!!w,this.advanced=this.endSN>f.endSN||w>0||w===0&&p>0,this.updated||this.advanced?this.misses=Math.floor(f.misses*.6):this.misses=f.misses+1,this.availabilityDelay=f.availabilityDelay},M(P,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(V.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||W}},{key:"drift",get:function(){var f=this.driftEndTime-this.driftStartTime;if(f>0){var w=this.driftEnd-this.driftStart;return w*1e3/f}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var f;return(f=this.partList)!==null&&f!==void 0&&f.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var f;return(f=this.fragments)!==null&&f!==void 0&&f.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var f;return(f=this.partList)!==null&&f!==void 0&&f.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var f;return(f=this.partList)!==null&&f!==void 0&&f.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),P}()},"./src/loader/level-key.ts":function(ie,$,O){"use strict";O.r($),O.d($,"LevelKey",function(){return N});var V=O("./node_modules/url-toolkit/src/url-toolkit.js"),I=O.n(V);function M(P,R){for(var d=0;d<R.length;d++){var f=R[d];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(P,f.key,f)}}function W(P,R,d){return R&&M(P.prototype,R),d&&M(P,d),P}var N=function(){P.fromURL=function(d,f){return new P(d,f)},P.fromURI=function(d){return new P(d)};function P(R,d){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,d?this._uri=Object(V.buildAbsoluteURL)(R,d,{alwaysNormalize:!0}):this._uri=R}return W(P,[{key:"uri",get:function(){return this._uri}}]),P}()},"./src/loader/load-stats.ts":function(ie,$,O){"use strict";O.r($),O.d($,"LoadStats",function(){return V});var V=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(ie,$,O){"use strict";O.r($),O.d($,"default",function(){return s});var V=O("./src/polyfills/number.ts"),I=O("./node_modules/url-toolkit/src/url-toolkit.js"),M=O.n(I),W=O("./src/loader/fragment.ts"),N=O("./src/loader/level-details.ts"),P=O("./src/loader/level-key.ts"),R=O("./src/utils/attr-list.ts"),d=O("./src/utils/logger.ts"),f=O("./src/utils/codecs.ts"),w=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,p=/#EXT-X-MEDIA:(.*)/g,g=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),b=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),o=/\.(mp4|m4s|m4v|m4a)$/i;function i(k){var L,E;return o.test((L=(E=I.parseURL(k))===null||E===void 0?void 0:E.path)!=null?L:"")}var s=function(){function k(){}return k.findGroup=function(E,y){for(var c=0;c<E.length;c++){var u=E[c];if(u.id===y)return u}},k.convertAVC1ToAVCOTI=function(E){var y=E.split(".");if(y.length>2){var c=y.shift()+".";return c+=parseInt(y.shift()).toString(16),c+=("000"+parseInt(y.shift()).toString(16)).substr(-4),c}return E},k.resolve=function(E,y){return I.buildAbsoluteURL(y,E,{alwaysNormalize:!0})},k.parseMasterPlaylist=function(E,y){var c=[],u={},A=!1;w.lastIndex=0;for(var S;(S=w.exec(E))!=null;)if(S[1]){var T=new R.AttrList(S[1]),_={attrs:T,bitrate:T.decimalInteger("AVERAGE-BANDWIDTH")||T.decimalInteger("BANDWIDTH"),name:T.NAME,url:k.resolve(S[2],y)},j=T.decimalResolution("RESOLUTION");j&&(_.width=j.width,_.height=j.height),l((T.CODECS||"").split(/[ ,]+/).filter(function(Z){return Z}),_),_.videoCodec&&_.videoCodec.indexOf("avc1")!==-1&&(_.videoCodec=k.convertAVC1ToAVCOTI(_.videoCodec)),c.push(_)}else if(S[3]){var z=new R.AttrList(S[3]);z["DATA-ID"]&&(A=!0,u[z["DATA-ID"]]=z)}return{levels:c,sessionData:A?u:null}},k.parseMasterPlaylistMedia=function(E,y,c,u){u===void 0&&(u=[]);var A,S=[],T=0;for(p.lastIndex=0;(A=p.exec(E))!==null;){var _=new R.AttrList(A[1]);if(_.TYPE===c){var j={attrs:_,bitrate:0,id:T++,groupId:_["GROUP-ID"],instreamId:_["INSTREAM-ID"],name:_.NAME||_.LANGUAGE||"",type:c,default:_.bool("DEFAULT"),autoselect:_.bool("AUTOSELECT"),forced:_.bool("FORCED"),lang:_.LANGUAGE,url:_.URI?k.resolve(_.URI,y):""};if(u.length){var z=k.findGroup(u,j.groupId)||u[0];C(j,z,"audioCodec"),C(j,z,"textCodec")}S.push(j)}}return S},k.parseLevelPlaylist=function(E,y,c,u,A){var S=new N.LevelDetails(y),T=S.fragments,_=null,j=0,z=0,Z=0,K=0,F=null,ee=new W.Fragment(u,y),se,he,Ce,Ue=-1,ke=!1;for(g.lastIndex=0,S.m3u8=E;(se=g.exec(E))!==null;){ke&&(ke=!1,ee=new W.Fragment(u,y),ee.start=Z,ee.sn=j,ee.cc=K,ee.level=c,_&&(ee.initSegment=_,ee.rawProgramDateTime=_.rawProgramDateTime));var Me=se[1];if(Me){ee.duration=parseFloat(Me);var ce=(" "+se[2]).slice(1);ee.title=ce||null,ee.tagList.push(ce?["INF",Me,ce]:["INF",Me])}else if(se[3])Object(V.isFiniteNumber)(ee.duration)&&(ee.start=Z,Ce&&(ee.levelkey=Ce),ee.sn=j,ee.level=c,ee.cc=K,ee.urlId=A,T.push(ee),ee.relurl=(" "+se[3]).slice(1),v(ee,F),F=ee,Z+=ee.duration,j++,z=0,ke=!0);else if(se[4]){var ve=(" "+se[4]).slice(1);F?ee.setByteRange(ve,F):ee.setByteRange(ve)}else if(se[5])ee.rawProgramDateTime=(" "+se[5]).slice(1),ee.tagList.push(["PROGRAM-DATE-TIME",ee.rawProgramDateTime]),Ue===-1&&(Ue=T.length);else{if(se=se[0].match(b),!se){d.logger.warn("No matches on slow regex match for level playlist!");continue}for(he=1;he<se.length&&!(typeof se[he]!="undefined");he++);var le=(" "+se[he]).slice(1),ne=(" "+se[he+1]).slice(1),Le=se[he+2]?(" "+se[he+2]).slice(1):"";switch(le){case"PLAYLIST-TYPE":S.type=ne.toUpperCase();break;case"MEDIA-SEQUENCE":j=S.startSN=parseInt(ne);break;case"SKIP":{var xe=new R.AttrList(ne),Ie=xe.decimalInteger("SKIPPED-SEGMENTS");if(Object(V.isFiniteNumber)(Ie)){S.skippedSegments=Ie;for(var Re=Ie;Re--;)T.unshift(null);j+=Ie}var ae=xe.enumeratedString("RECENTLY-REMOVED-DATERANGES");ae&&(S.recentlyRemovedDateranges=ae.split(" "));break}case"TARGETDURATION":S.targetduration=parseFloat(ne);break;case"VERSION":S.version=parseInt(ne);break;case"EXTM3U":break;case"ENDLIST":S.live=!1;break;case"#":(ne||Le)&&ee.tagList.push(Le?[ne,Le]:[ne]);break;case"DIS":K++;case"GAP":ee.tagList.push([le]);break;case"BITRATE":ee.tagList.push([le,ne]);break;case"DISCONTINUITY-SEQ":K=parseInt(ne);break;case"KEY":{var oe,be=new R.AttrList(ne),Ae=be.enumeratedString("METHOD"),Ne=be.URI,_e=be.hexadecimalInteger("IV"),We=be.enumeratedString("KEYFORMATVERSIONS"),Fe=be.enumeratedString("KEYID"),et=(oe=be.enumeratedString("KEYFORMAT"))!=null?oe:"identity",Je=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Je.indexOf(et)>-1){d.logger.warn("Keyformat "+et+" is not supported from the manifest");continue}else if(et!=="identity")continue;Ae&&(Ce=P.LevelKey.fromURL(y,Ne),Ne&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Ae)>=0&&(Ce.method=Ae,Ce.keyFormat=et,Fe&&(Ce.keyID=Fe),We&&(Ce.keyFormatVersions=We),Ce.iv=_e));break}case"START":{var Qe=new R.AttrList(ne),Ye=Qe.decimalFloatingPoint("TIME-OFFSET");Object(V.isFiniteNumber)(Ye)&&(S.startTimeOffset=Ye);break}case"MAP":{var dt=new R.AttrList(ne);ee.relurl=dt.URI,dt.BYTERANGE&&ee.setByteRange(dt.BYTERANGE),ee.level=c,ee.sn="initSegment",Ce&&(ee.levelkey=Ce),ee.initSegment=null,_=ee,ke=!0;break}case"SERVER-CONTROL":{var $e=new R.AttrList(ne);S.canBlockReload=$e.bool("CAN-BLOCK-RELOAD"),S.canSkipUntil=$e.optionalFloat("CAN-SKIP-UNTIL",0),S.canSkipDateRanges=S.canSkipUntil>0&&$e.bool("CAN-SKIP-DATERANGES"),S.partHoldBack=$e.optionalFloat("PART-HOLD-BACK",0),S.holdBack=$e.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var tt=new R.AttrList(ne);S.partTarget=tt.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Oe=S.partList;Oe||(Oe=S.partList=[]);var Ze=z>0?Oe[Oe.length-1]:void 0,at=z++,Be=new W.Part(new R.AttrList(ne),ee,y,at,Ze);Oe.push(Be),ee.duration+=Be.duration;break}case"PRELOAD-HINT":{var Ke=new R.AttrList(ne);S.preloadHint=Ke;break}case"RENDITION-REPORT":{var Ee=new R.AttrList(ne);S.renditionReports=S.renditionReports||[],S.renditionReports.push(Ee);break}default:d.logger.warn("line parsed but not handled: "+se);break}}}F&&!F.relurl?(T.pop(),Z-=F.duration,S.partList&&(S.fragmentHint=F)):S.partList&&(v(ee,F),ee.cc=K,S.fragmentHint=ee);var me=T.length,ye=T[0],te=T[me-1];if(Z+=S.skippedSegments*S.targetduration,Z>0&&me&&te){S.averagetargetduration=Z/me;var re=te.sn;S.endSN=re!=="initSegment"?re:0,ye&&(S.startCC=ye.cc,ye.initSegment||S.fragments.every(function(ue){return ue.relurl&&i(ue.relurl)})&&(d.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),ee=new W.Fragment(u,y),ee.relurl=te.relurl,ee.level=c,ee.sn="initSegment",ye.initSegment=ee,S.needSidxRanges=!0))}else S.endSN=0,S.startCC=0;return S.fragmentHint&&(Z+=S.fragmentHint.duration),S.totalduration=Z,S.endCC=K,Ue>0&&m(T,Ue),S},k}();function l(k,L){["video","audio","text"].forEach(function(E){var y=k.filter(function(u){return Object(f.isCodecType)(u,E)});if(y.length){var c=y.filter(function(u){return u.lastIndexOf("avc1",0)===0||u.lastIndexOf("mp4a",0)===0});L[E+"Codec"]=c.length>0?c[0]:y[0],k=k.filter(function(u){return y.indexOf(u)===-1})}}),L.unknownCodecs=k}function C(k,L,E){var y=L[E];y&&(k[E]=y)}function m(k,L){for(var E=k[L],y=L;y--;){var c=k[y];if(!c)return;c.programDateTime=E.programDateTime-c.duration*1e3,E=c}}function v(k,L){k.rawProgramDateTime?k.programDateTime=Date.parse(k.rawProgramDateTime):L!=null&&L.programDateTime&&(k.programDateTime=L.endProgramDateTime),Object(V.isFiniteNumber)(k.programDateTime)||(k.programDateTime=null,k.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ie,$,O){"use strict";O.r($);var V=O("./src/polyfills/number.ts"),I=O("./src/events.ts"),M=O("./src/errors.ts"),W=O("./src/utils/logger.ts"),N=O("./src/utils/mp4-tools.ts"),P=O("./src/loader/m3u8-parser.ts"),R=O("./src/types/loader.ts"),d=O("./src/utils/attr-list.ts");function f(g){var b=g.type;switch(b){case R.PlaylistContextType.AUDIO_TRACK:return R.PlaylistLevelType.AUDIO;case R.PlaylistContextType.SUBTITLE_TRACK:return R.PlaylistLevelType.SUBTITLE;default:return R.PlaylistLevelType.MAIN}}function w(g,b){var o=g.url;return(o===void 0||o.indexOf("data:")===0)&&(o=b.url),o}var p=function(){function g(o){this.hls=void 0,this.loaders=Object.create(null),this.hls=o,this.registerListeners()}var b=g.prototype;return b.registerListeners=function(){var i=this.hls;i.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.on(I.Events.LEVEL_LOADING,this.onLevelLoading,this),i.on(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),i.on(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},b.unregisterListeners=function(){var i=this.hls;i.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.off(I.Events.LEVEL_LOADING,this.onLevelLoading,this),i.off(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),i.off(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},b.createInternalLoader=function(i){var s=this.hls.config,l=s.pLoader,C=s.loader,m=l||C,v=new m(s);return i.loader=v,this.loaders[i.type]=v,v},b.getInternalLoader=function(i){return this.loaders[i.type]},b.resetInternalLoader=function(i){this.loaders[i]&&delete this.loaders[i]},b.destroyInternalLoaders=function(){for(var i in this.loaders){var s=this.loaders[i];s&&s.destroy(),this.resetInternalLoader(i)}},b.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},b.onManifestLoading=function(i,s){var l=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:R.PlaylistContextType.MANIFEST,url:l,deliveryDirectives:null})},b.onLevelLoading=function(i,s){var l=s.id,C=s.level,m=s.url,v=s.deliveryDirectives;this.load({id:l,groupId:null,level:C,responseType:"text",type:R.PlaylistContextType.LEVEL,url:m,deliveryDirectives:v})},b.onAudioTrackLoading=function(i,s){var l=s.id,C=s.groupId,m=s.url,v=s.deliveryDirectives;this.load({id:l,groupId:C,level:null,responseType:"text",type:R.PlaylistContextType.AUDIO_TRACK,url:m,deliveryDirectives:v})},b.onSubtitleTrackLoading=function(i,s){var l=s.id,C=s.groupId,m=s.url,v=s.deliveryDirectives;this.load({id:l,groupId:C,level:null,responseType:"text",type:R.PlaylistContextType.SUBTITLE_TRACK,url:m,deliveryDirectives:v})},b.load=function(i){var s,l=this.hls.config,C=this.getInternalLoader(i);if(C){var m=C.context;if(m&&m.url===i.url){W.logger.trace("[playlist-loader]: playlist request ongoing");return}W.logger.log("[playlist-loader]: aborting previous loader for type: "+i.type),C.abort()}var v,k,L,E;switch(i.type){case R.PlaylistContextType.MANIFEST:v=l.manifestLoadingMaxRetry,k=l.manifestLoadingTimeOut,L=l.manifestLoadingRetryDelay,E=l.manifestLoadingMaxRetryTimeout;break;case R.PlaylistContextType.LEVEL:case R.PlaylistContextType.AUDIO_TRACK:case R.PlaylistContextType.SUBTITLE_TRACK:v=0,k=l.levelLoadingTimeOut;break;default:v=l.levelLoadingMaxRetry,k=l.levelLoadingTimeOut,L=l.levelLoadingRetryDelay,E=l.levelLoadingMaxRetryTimeout;break}if(C=this.createInternalLoader(i),(s=i.deliveryDirectives)!==null&&s!==void 0&&s.part){var y;if(i.type===R.PlaylistContextType.LEVEL&&i.level!==null?y=this.hls.levels[i.level].details:i.type===R.PlaylistContextType.AUDIO_TRACK&&i.id!==null?y=this.hls.audioTracks[i.id].details:i.type===R.PlaylistContextType.SUBTITLE_TRACK&&i.id!==null&&(y=this.hls.subtitleTracks[i.id].details),y){var c=y.partTarget,u=y.targetduration;c&&u&&(k=Math.min(Math.max(c*3,u*.8)*1e3,k))}}var A={timeout:k,maxRetry:v,retryDelay:L,maxRetryDelay:E,highWaterMark:0},S={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};C.load(i,A,S)},b.loadsuccess=function(i,s,l,C){if(C===void 0&&(C=null),l.isSidxRequest){this.handleSidxRequest(i,l),this.handlePlaylistLoaded(i,s,l,C);return}this.resetInternalLoader(l.type);var m=i.data;if(m.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(i,l,"no EXTM3U delimiter",C);return}s.parsing.start=performance.now(),m.indexOf("#EXTINF:")>0||m.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(i,s,l,C):this.handleMasterPlaylist(i,s,l,C)},b.loaderror=function(i,s,l){l===void 0&&(l=null),this.handleNetworkError(s,l,!1,i)},b.loadtimeout=function(i,s,l){l===void 0&&(l=null),this.handleNetworkError(s,l,!0)},b.handleMasterPlaylist=function(i,s,l,C){var m=this.hls,v=i.data,k=w(i,l),L=P.default.parseMasterPlaylist(v,k),E=L.levels,y=L.sessionData;if(!E.length){this.handleManifestParsingError(i,l,"no level found in manifest",C);return}var c=E.map(function(j){return{id:j.attrs.AUDIO,audioCodec:j.audioCodec}}),u=E.map(function(j){return{id:j.attrs.SUBTITLES,textCodec:j.textCodec}}),A=P.default.parseMasterPlaylistMedia(v,k,"AUDIO",c),S=P.default.parseMasterPlaylistMedia(v,k,"SUBTITLES",u),T=P.default.parseMasterPlaylistMedia(v,k,"CLOSED-CAPTIONS");if(A.length){var _=A.some(function(j){return!j.url});!_&&E[0].audioCodec&&!E[0].attrs.AUDIO&&(W.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),A.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new d.AttrList({}),bitrate:0,url:""}))}m.trigger(I.Events.MANIFEST_LOADED,{levels:E,audioTracks:A,subtitles:S,captions:T,url:k,stats:s,networkDetails:C,sessionData:y})},b.handleTrackOrLevelPlaylist=function(i,s,l,C){var m=this.hls,v=l.id,k=l.level,L=l.type,E=w(i,l),y=Object(V.isFiniteNumber)(v)?v:0,c=Object(V.isFiniteNumber)(k)?k:y,u=f(l),A=P.default.parseLevelPlaylist(i.data,E,c,u,y);if(!A.fragments.length){m.trigger(I.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:E,reason:"no fragments found in level",level:typeof l.level=="number"?l.level:void 0});return}if(L===R.PlaylistContextType.MANIFEST){var S={attrs:new d.AttrList({}),bitrate:0,details:A,name:"",url:E};m.trigger(I.Events.MANIFEST_LOADED,{levels:[S],audioTracks:[],url:E,stats:s,networkDetails:C,sessionData:null})}if(s.parsing.end=performance.now(),A.needSidxRanges){var T,_=(T=A.fragments[0].initSegment)===null||T===void 0?void 0:T.url;this.load({url:_,isSidxRequest:!0,type:L,level:k,levelDetails:A,id:v,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}l.levelDetails=A,this.handlePlaylistLoaded(i,s,l,C)},b.handleSidxRequest=function(i,s){var l=Object(N.parseSegmentIndex)(new Uint8Array(i.data));if(!l)return;var C=l.references,m=s.levelDetails;C.forEach(function(v,k){var L=v.info,E=m.fragments[k];E.byteRange.length===0&&E.setByteRange(String(1+L.end-L.start)+"@"+String(L.start)),E.initSegment&&E.initSegment.setByteRange(String(l.moovEndOffset)+"@0")})},b.handleManifestParsingError=function(i,s,l,C){this.hls.trigger(I.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===R.PlaylistContextType.MANIFEST,url:i.url,reason:l,response:i,context:s,networkDetails:C})},b.handleNetworkError=function(i,s,l,C){l===void 0&&(l=!1),W.logger.warn("[playlist-loader]: A network "+(l?"timeout":"error")+" occurred while loading "+i.type+" level: "+i.level+" id: "+i.id+' group-id: "'+i.groupId+'"');var m=M.ErrorDetails.UNKNOWN,v=!1,k=this.getInternalLoader(i);switch(i.type){case R.PlaylistContextType.MANIFEST:m=l?M.ErrorDetails.MANIFEST_LOAD_TIMEOUT:M.ErrorDetails.MANIFEST_LOAD_ERROR,v=!0;break;case R.PlaylistContextType.LEVEL:m=l?M.ErrorDetails.LEVEL_LOAD_TIMEOUT:M.ErrorDetails.LEVEL_LOAD_ERROR,v=!1;break;case R.PlaylistContextType.AUDIO_TRACK:m=l?M.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:M.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,v=!1;break;case R.PlaylistContextType.SUBTITLE_TRACK:m=l?M.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:M.ErrorDetails.SUBTITLE_LOAD_ERROR,v=!1;break}k&&this.resetInternalLoader(i.type);var L={type:M.ErrorTypes.NETWORK_ERROR,details:m,fatal:v,url:i.url,loader:k,context:i,networkDetails:s};C&&(L.response=C),this.hls.trigger(I.Events.ERROR,L)},b.handlePlaylistLoaded=function(i,s,l,C){var m=l.type,v=l.level,k=l.id,L=l.groupId,E=l.loader,y=l.levelDetails,c=l.deliveryDirectives;if(!(y!=null&&y.targetduration)){this.handleManifestParsingError(i,l,"invalid target duration",C);return}if(!E)return;y.live&&(E.getCacheAge&&(y.ageHeader=E.getCacheAge()||0),(!E.getCacheAge||isNaN(y.ageHeader))&&(y.ageHeader=0));switch(m){case R.PlaylistContextType.MANIFEST:case R.PlaylistContextType.LEVEL:this.hls.trigger(I.Events.LEVEL_LOADED,{details:y,level:v||0,id:k||0,stats:s,networkDetails:C,deliveryDirectives:c});break;case R.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(I.Events.AUDIO_TRACK_LOADED,{details:y,id:k||0,groupId:L||"",stats:s,networkDetails:C,deliveryDirectives:c});break;case R.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(I.Events.SUBTITLE_TRACK_LOADED,{details:y,id:k||0,groupId:L||"",stats:s,networkDetails:C,deliveryDirectives:c});break}},g}();$.default=p},"./src/polyfills/number.ts":function(ie,$,O){"use strict";O.r($),O.d($,"isFiniteNumber",function(){return V}),O.d($,"MAX_SAFE_INTEGER",function(){return I});var V=Number.isFinite||function(M){return typeof M=="number"&&isFinite(M)},I=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ie,$,O){"use strict";O.r($);var V=function(){function I(){}return I.getSilentFrame=function(W,N){switch(W){case"mp4a.40.2":if(N===1)return new Uint8Array([0,200,0,128,35,128]);if(N===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(N===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(N===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(N===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(N===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(N===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(N===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(N===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},I}();$.default=V},"./src/remux/mp4-generator.ts":function(ie,$,O){"use strict";O.r($);var V=Math.pow(2,32)-1,I=function(){function M(){}return M.init=function(){M.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var N;for(N in M.types)M.types.hasOwnProperty(N)&&(M.types[N]=[N.charCodeAt(0),N.charCodeAt(1),N.charCodeAt(2),N.charCodeAt(3)]);var P=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),R=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);M.HDLR_TYPES={video:P,audio:R};var d=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),f=new Uint8Array([0,0,0,0,0,0,0,0]);M.STTS=M.STSC=M.STCO=f,M.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),M.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),M.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),M.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var w=new Uint8Array([105,115,111,109]),p=new Uint8Array([97,118,99,49]),g=new Uint8Array([0,0,0,1]);M.FTYP=M.box(M.types.ftyp,w,g,w,p),M.DINF=M.box(M.types.dinf,M.box(M.types.dref,d))},M.box=function(N){for(var P=8,R=arguments.length,d=new Array(R>1?R-1:0),f=1;f<R;f++)d[f-1]=arguments[f];for(var w=d.length,p=w;w--;)P+=d[w].byteLength;var g=new Uint8Array(P);for(g[0]=P>>24&255,g[1]=P>>16&255,g[2]=P>>8&255,g[3]=P&255,g.set(N,4),w=0,P=8;w<p;w++)g.set(d[w],P),P+=d[w].byteLength;return g},M.hdlr=function(N){return M.box(M.types.hdlr,M.HDLR_TYPES[N])},M.mdat=function(N){return M.box(M.types.mdat,N)},M.mdhd=function(N,P){P*=N;var R=Math.floor(P/(V+1)),d=Math.floor(P%(V+1));return M.box(M.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,N>>24&255,N>>16&255,N>>8&255,N&255,R>>24,R>>16&255,R>>8&255,R&255,d>>24,d>>16&255,d>>8&255,d&255,85,196,0,0]))},M.mdia=function(N){return M.box(M.types.mdia,M.mdhd(N.timescale,N.duration),M.hdlr(N.type),M.minf(N))},M.mfhd=function(N){return M.box(M.types.mfhd,new Uint8Array([0,0,0,0,N>>24,N>>16&255,N>>8&255,N&255]))},M.minf=function(N){return N.type==="audio"?M.box(M.types.minf,M.box(M.types.smhd,M.SMHD),M.DINF,M.stbl(N)):M.box(M.types.minf,M.box(M.types.vmhd,M.VMHD),M.DINF,M.stbl(N))},M.moof=function(N,P,R){return M.box(M.types.moof,M.mfhd(N),M.traf(R,P))},M.moov=function(N){for(var P=N.length,R=[];P--;)R[P]=M.trak(N[P]);return M.box.apply(null,[M.types.moov,M.mvhd(N[0].timescale,N[0].duration)].concat(R).concat(M.mvex(N)))},M.mvex=function(N){for(var P=N.length,R=[];P--;)R[P]=M.trex(N[P]);return M.box.apply(null,[M.types.mvex].concat(R))},M.mvhd=function(N,P){P*=N;var R=Math.floor(P/(V+1)),d=Math.floor(P%(V+1)),f=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,N>>24&255,N>>16&255,N>>8&255,N&255,R>>24,R>>16&255,R>>8&255,R&255,d>>24,d>>16&255,d>>8&255,d&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return M.box(M.types.mvhd,f)},M.sdtp=function(N){var P=N.samples||[],R=new Uint8Array(4+P.length),d,f;for(d=0;d<P.length;d++)f=P[d].flags,R[d+4]=f.dependsOn<<4|f.isDependedOn<<2|f.hasRedundancy;return M.box(M.types.sdtp,R)},M.stbl=function(N){return M.box(M.types.stbl,M.stsd(N),M.box(M.types.stts,M.STTS),M.box(M.types.stsc,M.STSC),M.box(M.types.stsz,M.STSZ),M.box(M.types.stco,M.STCO))},M.avc1=function(N){var P=[],R=[],d,f,w;for(d=0;d<N.sps.length;d++)f=N.sps[d],w=f.byteLength,P.push(w>>>8&255),P.push(w&255),P=P.concat(Array.prototype.slice.call(f));for(d=0;d<N.pps.length;d++)f=N.pps[d],w=f.byteLength,R.push(w>>>8&255),R.push(w&255),R=R.concat(Array.prototype.slice.call(f));var p=M.box(M.types.avcC,new Uint8Array([1,P[3],P[4],P[5],252|3,224|N.sps.length].concat(P).concat([N.pps.length]).concat(R))),g=N.width,b=N.height,o=N.pixelRatio[0],i=N.pixelRatio[1];return M.box(M.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,g>>8&255,g&255,b>>8&255,b&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),p,M.box(M.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),M.box(M.types.pasp,new Uint8Array([o>>24,o>>16&255,o>>8&255,o&255,i>>24,i>>16&255,i>>8&255,i&255])))},M.esds=function(N){var P=N.config.length;return new Uint8Array([0,0,0,0,3,23+P,0,1,0,4,15+P,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([P]).concat(N.config).concat([6,1,2]))},M.mp4a=function(N){var P=N.samplerate;return M.box(M.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,N.channelCount,0,16,0,0,0,0,P>>8&255,P&255,0,0]),M.box(M.types.esds,M.esds(N)))},M.mp3=function(N){var P=N.samplerate;return M.box(M.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,N.channelCount,0,16,0,0,0,0,P>>8&255,P&255,0,0]))},M.stsd=function(N){return N.type==="audio"?!N.isAAC&&N.codec==="mp3"?M.box(M.types.stsd,M.STSD,M.mp3(N)):M.box(M.types.stsd,M.STSD,M.mp4a(N)):M.box(M.types.stsd,M.STSD,M.avc1(N))},M.tkhd=function(N){var P=N.id,R=N.duration*N.timescale,d=N.width,f=N.height,w=Math.floor(R/(V+1)),p=Math.floor(R%(V+1));return M.box(M.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,P>>24&255,P>>16&255,P>>8&255,P&255,0,0,0,0,w>>24,w>>16&255,w>>8&255,w&255,p>>24,p>>16&255,p>>8&255,p&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,d>>8&255,d&255,0,0,f>>8&255,f&255,0,0]))},M.traf=function(N,P){var R=M.sdtp(N),d=N.id,f=Math.floor(P/(V+1)),w=Math.floor(P%(V+1));return M.box(M.types.traf,M.box(M.types.tfhd,new Uint8Array([0,0,0,0,d>>24,d>>16&255,d>>8&255,d&255])),M.box(M.types.tfdt,new Uint8Array([1,0,0,0,f>>24,f>>16&255,f>>8&255,f&255,w>>24,w>>16&255,w>>8&255,w&255])),M.trun(N,R.length+16+20+8+16+8+8),R)},M.trak=function(N){return N.duration=N.duration||4294967295,M.box(M.types.trak,M.tkhd(N),M.mdia(N))},M.trex=function(N){var P=N.id;return M.box(M.types.trex,new Uint8Array([0,0,0,0,P>>24,P>>16&255,P>>8&255,P&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},M.trun=function(N,P){var R=N.samples||[],d=R.length,f=12+16*d,w=new Uint8Array(f),p,g,b,o,i,s;for(P+=8+f,w.set([0,0,15,1,d>>>24&255,d>>>16&255,d>>>8&255,d&255,P>>>24&255,P>>>16&255,P>>>8&255,P&255],0),p=0;p<d;p++)g=R[p],b=g.duration,o=g.size,i=g.flags,s=g.cts,w.set([b>>>24&255,b>>>16&255,b>>>8&255,b&255,o>>>24&255,o>>>16&255,o>>>8&255,o&255,i.isLeading<<2|i.dependsOn,i.isDependedOn<<6|i.hasRedundancy<<4|i.paddingValue<<1|i.isNonSync,i.degradPrio&240<<8,i.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*p);return M.box(M.types.trun,w)},M.initSegment=function(N){M.types||M.init();var P=M.moov(N),R=new Uint8Array(M.FTYP.byteLength+P.byteLength);return R.set(M.FTYP),R.set(P,M.FTYP.byteLength),R},M}();I.types=void 0,I.HDLR_TYPES=void 0,I.STTS=void 0,I.STSC=void 0,I.STCO=void 0,I.STSZ=void 0,I.VMHD=void 0,I.SMHD=void 0,I.STSD=void 0,I.FTYP=void 0,I.DINF=void 0,$.default=I},"./src/remux/mp4-remuxer.ts":function(ie,$,O){"use strict";O.r($),O.d($,"default",function(){return s}),O.d($,"normalizePts",function(){return l});var V=O("./src/polyfills/number.ts"),I=O("./src/remux/aac-helper.ts"),M=O("./src/remux/mp4-generator.ts"),W=O("./src/events.ts"),N=O("./src/errors.ts"),P=O("./src/utils/logger.ts"),R=O("./src/types/loader.ts"),d=O("./src/utils/timescale-conversion.ts");function f(){return f=Object.assign||function(k){for(var L=1;L<arguments.length;L++){var E=arguments[L];for(var y in E)Object.prototype.hasOwnProperty.call(E,y)&&(k[y]=E[y])}return k},f.apply(this,arguments)}var w=10*1e3,p=1024,g=1152,b=null,o=null,i=!1,s=function(){function k(E,y,c,u){if(u===void 0&&(u=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=E,this.config=y,this.typeSupported=c,this.ISGenerated=!1,b===null){var A=navigator.userAgent||"",S=A.match(/Chrome\/(\d+)/i);b=S?parseInt(S[1]):0}if(o===null){var T=navigator.userAgent.match(/Safari\/(\d+)/i);o=T?parseInt(T[1]):0}i=!!b&&b<75||!!o&&o<600}var L=k.prototype;return L.destroy=function(){},L.resetTimeStamp=function(y){P.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=y},L.resetNextTimestamp=function(){P.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},L.resetInitSegment=function(){P.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},L.getVideoStartPts=function(y){var c=!1,u=y.reduce(function(A,S){var T=S.pts-A;return T<-4294967296?(c=!0,l(A,S.pts)):T>0?A:S.pts},y[0].pts);return c&&P.logger.debug("PTS rollover detected"),u},L.remux=function(y,c,u,A,S,T,_,j){var z,Z,K,F,ee,se,he=S,Ce=S,Ue=y.pid>-1,ke=c.pid>-1,Me=c.samples.length,ce=y.samples.length>0,ve=Me>1,le=(!Ue||ce)&&(!ke||ve)||this.ISGenerated||_;if(le){this.ISGenerated||(K=this.generateIS(y,c,S));var ne=this.isVideoContiguous,Le=-1;if(ve&&(Le=C(c.samples),!ne&&this.config.forceKeyFrameOnDiscontinuity))if(se=!0,Le>0){P.logger.warn("[mp4-remuxer]: Dropped "+Le+" out of "+Me+" video samples due to a missing keyframe");var xe=this.getVideoStartPts(c.samples);c.samples=c.samples.slice(Le),c.dropped+=Le,Ce+=(c.samples[0].pts-xe)/(c.timescale||9e4)}else Le===-1&&(P.logger.warn("[mp4-remuxer]: No keyframe found out of "+Me+" video samples"),se=!1);if(this.ISGenerated){if(ce&&ve){var Ie=this.getVideoStartPts(c.samples),Re=l(y.samples[0].pts,Ie)-Ie,ae=Re/c.inputTimeScale;he+=Math.max(0,ae),Ce+=Math.max(0,-ae)}if(ce){if(y.samplerate||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),K=this.generateIS(y,c,S)),Z=this.remuxAudio(y,he,this.isAudioContiguous,T,ke||ve||j===R.PlaylistLevelType.AUDIO?Ce:void 0),ve){var oe=Z?Z.endPTS-Z.startPTS:0;c.inputTimeScale||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),K=this.generateIS(y,c,S)),z=this.remuxVideo(c,Ce,ne,oe)}}else ve&&(z=this.remuxVideo(c,Ce,ne,0));z&&(z.firstKeyFrame=Le,z.independent=Le!==-1)}}return this.ISGenerated&&(u.samples.length&&(ee=this.remuxID3(u,S)),A.samples.length&&(F=this.remuxText(A,S))),{audio:Z,video:z,initSegment:K,independent:se,text:F,id3:ee}},L.generateIS=function(y,c,u){var A=y.samples,S=c.samples,T=this.typeSupported,_={},j=!Object(V.isFiniteNumber)(this._initPTS),z="audio/mp4",Z,K,F;if(j&&(Z=K=Infinity),y.config&&A.length&&(y.timescale=y.samplerate,y.isAAC||(T.mpeg?(z="audio/mpeg",y.codec=""):T.mp3&&(y.codec="mp3")),_.audio={id:"audio",container:z,codec:y.codec,initSegment:!y.isAAC&&T.mpeg?new Uint8Array(0):M.default.initSegment([y]),metadata:{channelCount:y.channelCount}},j&&(F=y.inputTimeScale,Z=K=A[0].pts-Math.round(F*u))),c.sps&&c.pps&&S.length&&(c.timescale=c.inputTimeScale,_.video={id:"main",container:"video/mp4",codec:c.codec,initSegment:M.default.initSegment([c]),metadata:{width:c.width,height:c.height}},j)){F=c.inputTimeScale;var ee=this.getVideoStartPts(S),se=Math.round(F*u);K=Math.min(K,l(S[0].dts,ee)-se),Z=Math.min(Z,ee-se)}if(Object.keys(_).length)return this.ISGenerated=!0,j&&(this._initPTS=Z,this._initDTS=K),{tracks:_,initPTS:Z,timescale:F}},L.remuxVideo=function(y,c,u,A){var S=y.inputTimeScale,T=y.samples,_=[],j=T.length,z=this._initPTS,Z=this.nextAvcDts,K=8,F,ee,se,he=Number.POSITIVE_INFINITY,Ce=Number.NEGATIVE_INFINITY,Ue=0,ke=!1;if(!u||Z===null){var Me=c*S,ce=T[0].pts-l(T[0].dts,T[0].pts);Z=Me-ce}for(var ve=0;ve<j;ve++){var le=T[ve];if(le.pts=l(le.pts-z,Z),le.dts=l(le.dts-z,Z),le.dts>le.pts){var ne=9e4*.2;Ue=Math.max(Math.min(Ue,le.pts-le.dts),-1*ne)}le.dts<T[ve>0?ve-1:ve].dts&&(ke=!0)}ke&&T.sort(function(At,wt){var ft=At.dts-wt.dts,Kt=At.pts-wt.pts;return ft||Kt}),ee=T[0].dts,se=T[T.length-1].dts;var Le=Math.round((se-ee)/(j-1));if(Ue<0){if(Ue<Le*-2){P.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(d.toMsFromMpegTsClock)(-Le,!0)+" ms");for(var xe=Ue,Ie=0;Ie<j;Ie++)T[Ie].dts=xe=Math.max(xe,T[Ie].pts-Le),T[Ie].pts=Math.max(xe,T[Ie].pts)}else{P.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(d.toMsFromMpegTsClock)(Ue,!0)+" ms to overcome this issue");for(var Re=0;Re<j;Re++)T[Re].dts=T[Re].dts+Ue}ee=T[0].dts}if(u){var ae=ee-Z,oe=ae>Le,be=ae<-1;if(oe||be){oe?P.logger.warn("AVC: "+Object(d.toMsFromMpegTsClock)(ae,!0)+" ms ("+ae+"dts) hole between fragments detected, filling it"):P.logger.warn("AVC: "+Object(d.toMsFromMpegTsClock)(-ae,!0)+" ms ("+ae+"dts) overlapping between fragments detected"),ee=Z;var Ae=T[0].pts-ae;T[0].dts=ee,T[0].pts=Ae,P.logger.log("Video: First PTS/DTS adjusted: "+Object(d.toMsFromMpegTsClock)(Ae,!0)+"/"+Object(d.toMsFromMpegTsClock)(ee,!0)+", delta: "+Object(d.toMsFromMpegTsClock)(ae,!0)+" ms")}}i&&(ee=Math.max(0,ee));for(var Ne=0,_e=0,We=0;We<j;We++){for(var Fe=T[We],et=Fe.units,Je=et.length,Qe=0,Ye=0;Ye<Je;Ye++)Qe+=et[Ye].data.length;_e+=Qe,Ne+=Je,Fe.length=Qe,Fe.dts=Math.max(Fe.dts,ee),Fe.pts=Math.max(Fe.pts,Fe.dts,0),he=Math.min(Fe.pts,he),Ce=Math.max(Fe.pts,Ce)}se=T[j-1].dts;var dt=_e+4*Ne+8,$e;try{$e=new Uint8Array(dt)}catch(At){this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:N.ErrorTypes.MUX_ERROR,details:N.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:dt,reason:"fail allocating video mdat "+dt});return}var tt=new DataView($e.buffer);tt.setUint32(0,dt),$e.set(M.default.types.mdat,4);for(var Oe=0;Oe<j;Oe++){for(var Ze=T[Oe],at=Ze.units,Be=0,Ke=0,Ee=at.length;Ke<Ee;Ke++){var me=at[Ke],ye=me.data,te=me.data.byteLength;tt.setUint32(K,te),K+=4,$e.set(ye,K),K+=te,Be+=4+te}if(Oe<j-1)F=T[Oe+1].dts-Ze.dts;else{var re=this.config,ue=Ze.dts-T[Oe>0?Oe-1:Oe].dts;if(re.stretchShortVideoTrack&&this.nextAudioPts!==null){var fe=Math.floor(re.maxBufferHole*S),Pe=(A?he+A*S:this.nextAudioPts)-Ze.pts;Pe>fe?(F=Pe-ue,F<0&&(F=ue),P.logger.log("[mp4-remuxer]: It is approximately "+Pe/90+" ms to the next segment; using duration "+F/90+" ms for the last video frame.")):F=ue}else F=ue}var Se=Math.round(Ze.pts-Ze.dts);_.push(new m(Ze.key,F,Be,Se))}if(_.length&&b&&b<70){var ze=_[0].flags;ze.dependsOn=2,ze.isNonSync=0}console.assert(F!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=Z=se+F,this.isVideoContiguous=!0;var ot=M.default.moof(y.sequenceNumber++,ee,f({},y,{samples:_})),ct="video",ht={data1:ot,data2:$e,startPTS:he/S,endPTS:(Ce+F)/S,startDTS:ee/S,endDTS:Z/S,type:ct,hasAudio:!1,hasVideo:!0,nb:_.length,dropped:y.dropped};return y.samples=[],y.dropped=0,console.assert($e.length,"MDAT length must not be zero"),ht},L.remuxAudio=function(y,c,u,A,S){var T=y.inputTimeScale,_=y.samplerate?y.samplerate:T,j=T/_,z=y.isAAC?p:g,Z=z*j,K=this._initPTS,F=!y.isAAC&&this.typeSupported.mpeg,ee=[],se=y.samples,he=F?0:8,Ce=this.nextAudioPts||-1,Ue=c*T;if(this.isAudioContiguous=u=u||se.length&&Ce>0&&(A&&Math.abs(Ue-Ce)<9e3||Math.abs(l(se[0].pts-K,Ue)-Ce)<20*Z),se.forEach(function(ye){ye.pts=l(ye.pts-K,Ue)}),!u||Ce<0){if(se=se.filter(function(ye){return ye.pts>=0}),!se.length)return;S===0?Ce=0:A?Ce=Math.max(0,Ue):Ce=se[0].pts}if(y.isAAC)for(var ke=S!==void 0,Me=this.config.maxAudioFramesDrift,ce=0,ve=Ce;ce<se.length;ce++){var le=se[ce],ne=le.pts,Le=ne-ve,xe=Math.abs(1e3*Le/T);if(Le<=-Me*Z&&ke)ce===0&&(P.logger.warn("Audio frame @ "+(ne/T).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Le/T)+" ms."),this.nextAudioPts=Ce=ve=ne);else if(Le>=Me*Z&&xe<w&&ke){var Ie=Math.round(Le/Z);ve=ne-Ie*Z,ve<0&&(Ie--,ve+=Z),ce===0&&(this.nextAudioPts=Ce=ve),P.logger.warn("[mp4-remuxer]: Injecting "+Ie+" audio frame @ "+(ve/T).toFixed(3)+"s due to "+Math.round(1e3*Le/T)+" ms gap.");for(var Re=0;Re<Ie;Re++){var ae=Math.max(ve,0),oe=I.default.getSilentFrame(y.manifestCodec||y.codec,y.channelCount);oe||(P.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),oe=le.unit.subarray()),se.splice(ce,0,{unit:oe,pts:ae}),ve+=Z,ce++}}le.pts=ve,ve+=Z}for(var be=null,Ae=null,Ne,_e=0,We=se.length;We--;)_e+=se[We].unit.byteLength;for(var Fe=0,et=se.length;Fe<et;Fe++){var Je=se[Fe],Qe=Je.unit,Ye=Je.pts;if(Ae!==null){var dt=ee[Fe-1];dt.duration=Math.round((Ye-Ae)/j)}else if(u&&y.isAAC&&(Ye=Ce),be=Ye,_e>0){_e+=he;try{Ne=new Uint8Array(_e)}catch(ye){this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:N.ErrorTypes.MUX_ERROR,details:N.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:_e,reason:"fail allocating audio mdat "+_e});return}if(!F){var $e=new DataView(Ne.buffer);$e.setUint32(0,_e),Ne.set(M.default.types.mdat,4)}}else return;Ne.set(Qe,he);var tt=Qe.byteLength;he+=tt,ee.push(new m(!0,z,tt,0)),Ae=Ye}var Oe=ee.length;if(!Oe)return;var Ze=ee[ee.length-1];this.nextAudioPts=Ce=Ae+j*Ze.duration;var at=F?new Uint8Array(0):M.default.moof(y.sequenceNumber++,be/j,f({},y,{samples:ee}));y.samples=[];var Be=be/T,Ke=Ce/T,Ee="audio",me={data1:at,data2:Ne,startPTS:Be,endPTS:Ke,startDTS:Be,endDTS:Ke,type:Ee,hasAudio:!0,hasVideo:!1,nb:Oe};return this.isAudioContiguous=!0,console.assert(Ne.length,"MDAT length must not be zero"),me},L.remuxEmptyAudio=function(y,c,u,A){var S=y.inputTimeScale,T=y.samplerate?y.samplerate:S,_=S/T,j=this.nextAudioPts,z=(j!==null?j:A.startDTS*S)+this._initDTS,Z=A.endDTS*S+this._initDTS,K=_*p,F=Math.ceil((Z-z)/K),ee=I.default.getSilentFrame(y.manifestCodec||y.codec,y.channelCount);if(P.logger.warn("[mp4-remuxer]: remux empty Audio"),!ee){P.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var se=[],he=0;he<F;he++){var Ce=z+he*K;se.push({unit:ee,pts:Ce,dts:Ce})}return y.samples=se,this.remuxAudio(y,c,u,!1)},L.remuxID3=function(y,c){var u=y.samples.length;if(!u)return;for(var A=y.inputTimeScale,S=this._initPTS,T=this._initDTS,_=0;_<u;_++){var j=y.samples[_];j.pts=l(j.pts-S,c*A)/A,j.dts=l(j.dts-T,c*A)/A}var z=y.samples;return y.samples=[],{samples:z}},L.remuxText=function(y,c){var u=y.samples.length;if(!u)return;for(var A=y.inputTimeScale,S=this._initPTS,T=0;T<u;T++){var _=y.samples[T];_.pts=l(_.pts-S,c*A)/A}y.samples.sort(function(z,Z){return z.pts-Z.pts});var j=y.samples;return y.samples=[],{samples:j}},k}();function l(k,L){var E;if(L===null)return k;for(L<k?E=-8589934592:E=8589934592;Math.abs(k-L)>4294967296;)k+=E;return k}function C(k){for(var L=0;L<k.length;L++)if(k[L].key)return L;return-1}var m=function(L,E,y,c){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=E,this.size=y,this.cts=c,this.flags=new v(L)},v=function(L){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=L?2:1,this.isNonSync=L?0:1}},"./src/remux/passthrough-remuxer.ts":function(ie,$,O){"use strict";O.r($);var V=O("./src/polyfills/number.ts"),I=O("./src/utils/mp4-tools.ts"),M=O("./src/loader/fragment.ts"),W=O("./src/utils/logger.ts"),N=function(){function d(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var f=d.prototype;return f.destroy=function(){},f.resetTimeStamp=function(p){this.initPTS=p,this.lastEndDTS=null},f.resetNextTimestamp=function(){this.lastEndDTS=null},f.resetInitSegment=function(p,g,b){this.audioCodec=g,this.videoCodec=b,this.generateInitSegment(p),this.emitInitSegment=!0},f.generateInitSegment=function(p){var g=this.audioCodec,b=this.videoCodec;if(!p||!p.byteLength){this.initTracks=void 0,this.initData=void 0;return}var o=this.initData=Object(I.parseInitSegment)(p);g||(g=R(o.audio,M.ElementaryStreamTypes.AUDIO)),b||(b=R(o.video,M.ElementaryStreamTypes.VIDEO));var i={};o.audio&&o.video?i.audiovideo={container:"video/mp4",codec:g+","+b,initSegment:p,id:"main"}:o.audio?i.audio={container:"audio/mp4",codec:g,initSegment:p,id:"audio"}:o.video?i.video={container:"video/mp4",codec:b,initSegment:p,id:"main"}:W.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=i},f.remux=function(p,g,b,o,i){var s=this.initPTS,l=this.lastEndDTS,C={audio:void 0,video:void 0,text:o,id3:b,initSegment:void 0};Object(V.isFiniteNumber)(l)||(l=this.lastEndDTS=i||0);var m=g.samples;if(!m||!m.length)return C;var v={initPTS:void 0,timescale:1},k=this.initData;if((!k||!k.length)&&(this.generateInitSegment(m),k=this.initData),!k||!k.length)return W.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),C;this.emitInitSegment&&(v.tracks=this.initTracks,this.emitInitSegment=!1),Object(V.isFiniteNumber)(s)||(this.initPTS=v.initPTS=s=P(k,m,l));var L=Object(I.getDuration)(m,k),E=l,y=L+E;Object(I.offsetStartDTS)(k,m,s),L>0?this.lastEndDTS=y:(W.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var c=!!k.audio,u=!!k.video,A="";c&&(A+="audio"),u&&(A+="video");var S={data1:m,startPTS:E,startDTS:E,endPTS:y,endDTS:y,type:A,hasAudio:c,hasVideo:u,nb:1,dropped:0};return C.audio=S.type==="audio"?S:void 0,C.video=S.type!=="audio"?S:void 0,C.text=o,C.id3=b,C.initSegment=v,C},d}(),P=function(f,w,p){return Object(I.getStartDTS)(f,w)-p};function R(d,f){var w=d==null?void 0:d.codec;return w&&w.length>4?w:w==="hvc1"?"hvc1.1.c.L120.90":w==="av01"?"av01.0.04M.08":w==="avc1"||f===M.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}$.default=N},"./src/task-loop.ts":function(ie,$,O){"use strict";O.r($),O.d($,"default",function(){return V});var V=function(){function I(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var M=I.prototype;return M.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},M.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},M.onHandlerDestroyed=function(){},M.hasInterval=function(){return!!this._tickInterval},M.hasNextTick=function(){return!!this._tickTimer},M.setInterval=function(N){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,N),!0)},M.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},M.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},M.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},M.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},M.doTick=function(){},I}()},"./src/types/cmcd.ts":function(ie,$,O){"use strict";O.r($),O.d($,"CMCDVersion",function(){return V}),O.d($,"CMCDObjectType",function(){return I}),O.d($,"CMCDStreamingFormat",function(){return M}),O.d($,"CMCDStreamType",function(){return W});var V=1,I;(function(N){N.MANIFEST="m",N.AUDIO="a",N.VIDEO="v",N.MUXED="av",N.INIT="i",N.CAPTION="c",N.TIMED_TEXT="tt",N.KEY="k",N.OTHER="o"})(I||(I={}));var M;(function(N){N.DASH="d",N.HLS="h",N.SMOOTH="s",N.OTHER="o"})(M||(M={}));var W;(function(N){N.VOD="v",N.LIVE="l"})(W||(W={}))},"./src/types/level.ts":function(ie,$,O){"use strict";O.r($),O.d($,"HlsSkip",function(){return M}),O.d($,"getSkipValue",function(){return W}),O.d($,"HlsUrlParameters",function(){return N}),O.d($,"Level",function(){return P});function V(R,d){for(var f=0;f<d.length;f++){var w=d[f];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(R,w.key,w)}}function I(R,d,f){return d&&V(R.prototype,d),f&&V(R,f),R}var M;(function(R){R.No="",R.Yes="YES",R.v2="v2"})(M||(M={}));function W(R,d){var f=R.canSkipUntil,w=R.canSkipDateRanges,p=R.endSN,g=d!==void 0?d-p:0;return f&&g<f?w?M.v2:M.Yes:M.No}var N=function(){function R(f,w,p){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=f,this.part=w,this.skip=p}var d=R.prototype;return d.addDirectives=function(w){var p=new self.URL(w);return this.msn!==void 0&&p.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&p.searchParams.set("_HLS_part",this.part.toString()),this.skip&&p.searchParams.set("_HLS_skip",this.skip),p.toString()},R}(),P=function(){function R(d){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[d.url],this.attrs=d.attrs,this.bitrate=d.bitrate,d.details&&(this.details=d.details),this.id=d.id||0,this.name=d.name,this.width=d.width||0,this.height=d.height||0,this.audioCodec=d.audioCodec,this.videoCodec=d.videoCodec,this.unknownCodecs=d.unknownCodecs,this.codecSet=[d.videoCodec,d.audioCodec].filter(function(f){return f}).join(",").replace(/\.[^.,]+/g,"")}return I(R,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(f){var w=f%this.url.length;this._urlId!==w&&(this.details=void 0,this._urlId=w)}}]),R}()},"./src/types/loader.ts":function(ie,$,O){"use strict";O.r($),O.d($,"PlaylistContextType",function(){return V}),O.d($,"PlaylistLevelType",function(){return I});var V;(function(M){M.MANIFEST="manifest",M.LEVEL="level",M.AUDIO_TRACK="audioTrack",M.SUBTITLE_TRACK="subtitleTrack"})(V||(V={}));var I;(function(M){M.MAIN="main",M.AUDIO="audio",M.SUBTITLE="subtitle"})(I||(I={}))},"./src/types/transmuxer.ts":function(ie,$,O){"use strict";O.r($),O.d($,"ChunkMetadata",function(){return V});var V=function(W,N,P,R,d,f){R===void 0&&(R=0),d===void 0&&(d=-1),f===void 0&&(f=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=I(),this.buffering={audio:I(),video:I(),audiovideo:I()},this.level=W,this.sn=N,this.id=P,this.size=R,this.part=d,this.partial=f};function I(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ie,$,O){"use strict";O.r($),O.d($,"AttrList",function(){return M});var V=/^(\d+)x(\d+)$/,I=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,M=function(){function W(P){typeof P=="string"&&(P=W.parseAttrList(P));for(var R in P)P.hasOwnProperty(R)&&(this[R]=P[R])}var N=W.prototype;return N.decimalInteger=function(R){var d=parseInt(this[R],10);return d>Number.MAX_SAFE_INTEGER?Infinity:d},N.hexadecimalInteger=function(R){if(this[R]){var d=(this[R]||"0x").slice(2);d=(d.length&1?"0":"")+d;for(var f=new Uint8Array(d.length/2),w=0;w<d.length/2;w++)f[w]=parseInt(d.slice(w*2,w*2+2),16);return f}else return null},N.hexadecimalIntegerAsNumber=function(R){var d=parseInt(this[R],16);return d>Number.MAX_SAFE_INTEGER?Infinity:d},N.decimalFloatingPoint=function(R){return parseFloat(this[R])},N.optionalFloat=function(R,d){var f=this[R];return f?parseFloat(f):d},N.enumeratedString=function(R){return this[R]},N.bool=function(R){return this[R]==="YES"},N.decimalResolution=function(R){var d=V.exec(this[R]);return d===null?void 0:{width:parseInt(d[1],10),height:parseInt(d[2],10)}},W.parseAttrList=function(R){var d,f={},w='"';for(I.lastIndex=0;(d=I.exec(R))!==null;){var p=d[2];p.indexOf(w)===0&&p.lastIndexOf(w)===p.length-1&&(p=p.slice(1,-1)),f[d[1]]=p}return f},W}()},"./src/utils/binary-search.ts":function(ie,$,O){"use strict";O.r($);var V={search:function(M,W){for(var N=0,P=M.length-1,R=null,d=null;N<=P;){R=(N+P)/2|0,d=M[R];var f=W(d);if(f>0)N=R+1;else if(f<0)P=R-1;else return d}return null}};$.default=V},"./src/utils/buffer-helper.ts":function(ie,$,O){"use strict";O.r($),O.d($,"BufferHelper",function(){return M});var V=O("./src/utils/logger.ts"),I={length:0,start:function(){return 0},end:function(){return 0}},M=function(){function W(){}return W.isBuffered=function(P,R){try{if(P){for(var d=W.getBuffered(P),f=0;f<d.length;f++)if(R>=d.start(f)&&R<=d.end(f))return!0}}catch(w){}return!1},W.bufferInfo=function(P,R,d){try{if(P){var f=W.getBuffered(P),w=[],p;for(p=0;p<f.length;p++)w.push({start:f.start(p),end:f.end(p)});return this.bufferedInfo(w,R,d)}}catch(g){}return{len:0,start:R,end:R,nextStart:void 0}},W.bufferedInfo=function(P,R,d){R=Math.max(0,R),P.sort(function(v,k){var L=v.start-k.start;return L||k.end-v.end});var f=[];if(d)for(var w=0;w<P.length;w++){var p=f.length;if(p){var g=f[p-1].end;P[w].start-g<d?P[w].end>g&&(f[p-1].end=P[w].end):f.push(P[w])}else f.push(P[w])}else f=P;for(var b=0,o,i=R,s=R,l=0;l<f.length;l++){var C=f[l].start,m=f[l].end;if(R+d>=C&&R<m)i=C,s=m,b=s-R;else if(R+d<C){o=C;break}}return{len:b,start:i||0,end:s||0,nextStart:o}},W.getBuffered=function(P){try{return P.buffered}catch(R){return V.logger.log("failed to get media.buffered",R),I}},W}()},"./src/utils/cea-608-parser.ts":function(ie,$,O){"use strict";O.r($),O.d($,"Row",function(){return s}),O.d($,"CaptionScreen",function(){return l});var V=O("./src/utils/logger.ts"),I={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},M=function(y){var c=y;return I.hasOwnProperty(y)&&(c=I[y]),String.fromCharCode(c)},W=15,N=100,P={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},R={17:2,18:4,21:6,22:8,23:10,19:13,20:15},d={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},f={25:2,26:4,29:6,30:8,31:10,27:13,28:15},w=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],p;(function(E){E[E.ERROR=0]="ERROR",E[E.TEXT=1]="TEXT",E[E.WARNING=2]="WARNING",E[E.INFO=2]="INFO",E[E.DEBUG=3]="DEBUG",E[E.DATA=3]="DATA"})(p||(p={}));var g=function(){function E(){this.time=null,this.verboseLevel=p.ERROR}var y=E.prototype;return y.log=function(u,A){this.verboseLevel>=u&&V.logger.log(this.time+" ["+u+"] "+A)},E}(),b=function(y){for(var c=[],u=0;u<y.length;u++)c.push(y[u].toString(16));return c},o=function(){function E(c,u,A,S,T){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=c||"white",this.underline=u||!1,this.italics=A||!1,this.background=S||"black",this.flash=T||!1}var y=E.prototype;return y.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},y.setStyles=function(u){for(var A=["foreground","underline","italics","background","flash"],S=0;S<A.length;S++){var T=A[S];u.hasOwnProperty(T)&&(this[T]=u[T])}},y.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},y.equals=function(u){return this.foreground===u.foreground&&this.underline===u.underline&&this.italics===u.italics&&this.background===u.background&&this.flash===u.flash},y.copy=function(u){this.foreground=u.foreground,this.underline=u.underline,this.italics=u.italics,this.background=u.background,this.flash=u.flash},y.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},E}(),i=function(){function E(c,u,A,S,T,_){this.uchar=void 0,this.penState=void 0,this.uchar=c||" ",this.penState=new o(u,A,S,T,_)}var y=E.prototype;return y.reset=function(){this.uchar=" ",this.penState.reset()},y.setChar=function(u,A){this.uchar=u,this.penState.copy(A)},y.setPenState=function(u){this.penState.copy(u)},y.equals=function(u){return this.uchar===u.uchar&&this.penState.equals(u.penState)},y.copy=function(u){this.uchar=u.uchar,this.penState.copy(u.penState)},y.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},E}(),s=function(){function E(c){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var u=0;u<N;u++)this.chars.push(new i);this.logger=c,this.pos=0,this.currPenState=new o}var y=E.prototype;return y.equals=function(u){for(var A=!0,S=0;S<N;S++)if(!this.chars[S].equals(u.chars[S])){A=!1;break}return A},y.copy=function(u){for(var A=0;A<N;A++)this.chars[A].copy(u.chars[A])},y.isEmpty=function(){for(var u=!0,A=0;A<N;A++)if(!this.chars[A].isEmpty()){u=!1;break}return u},y.setCursor=function(u){this.pos!==u&&(this.pos=u),this.pos<0?(this.logger.log(p.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>N&&(this.logger.log(p.DEBUG,"Too large cursor position "+this.pos),this.pos=N)},y.moveCursor=function(u){var A=this.pos+u;if(u>1)for(var S=this.pos+1;S<A+1;S++)this.chars[S].setPenState(this.currPenState);this.setCursor(A)},y.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},y.insertChar=function(u){u>=144&&this.backSpace();var A=M(u);if(this.pos>=N){this.logger.log(p.ERROR,"Cannot insert "+u.toString(16)+" ("+A+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(A,this.currPenState),this.moveCursor(1)},y.clearFromPos=function(u){var A;for(A=u;A<N;A++)this.chars[A].reset()},y.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},y.clearToEndOfRow=function(){this.clearFromPos(this.pos)},y.getTextString=function(){for(var u=[],A=!0,S=0;S<N;S++){var T=this.chars[S].uchar;T!==" "&&(A=!1),u.push(T)}return A?"":u.join("")},y.setPenStyles=function(u){this.currPenState.setStyles(u);var A=this.chars[this.pos];A.setPenState(this.currPenState)},E}(),l=function(){function E(c){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var u=0;u<W;u++)this.rows.push(new s(c));this.logger=c,this.currRow=W-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var y=E.prototype;return y.reset=function(){for(var u=0;u<W;u++)this.rows[u].clear();this.currRow=W-1},y.equals=function(u){for(var A=!0,S=0;S<W;S++)if(!this.rows[S].equals(u.rows[S])){A=!1;break}return A},y.copy=function(u){for(var A=0;A<W;A++)this.rows[A].copy(u.rows[A])},y.isEmpty=function(){for(var u=!0,A=0;A<W;A++)if(!this.rows[A].isEmpty()){u=!1;break}return u},y.backSpace=function(){var u=this.rows[this.currRow];u.backSpace()},y.clearToEndOfRow=function(){var u=this.rows[this.currRow];u.clearToEndOfRow()},y.insertChar=function(u){var A=this.rows[this.currRow];A.insertChar(u)},y.setPen=function(u){var A=this.rows[this.currRow];A.setPenStyles(u)},y.moveCursor=function(u){var A=this.rows[this.currRow];A.moveCursor(u)},y.setCursor=function(u){this.logger.log(p.INFO,"setCursor: "+u);var A=this.rows[this.currRow];A.setCursor(u)},y.setPAC=function(u){this.logger.log(p.INFO,"pacData = "+JSON.stringify(u));var A=u.row-1;if(this.nrRollUpRows&&A<this.nrRollUpRows-1&&(A=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==A){for(var S=0;S<W;S++)this.rows[S].clear();var T=this.currRow+1-this.nrRollUpRows,_=this.lastOutputScreen;if(_){var j=_.rows[T].cueStartTime,z=this.logger.time;if(j&&z!==null&&j<z)for(var Z=0;Z<this.nrRollUpRows;Z++)this.rows[A-this.nrRollUpRows+Z+1].copy(_.rows[T+Z])}}this.currRow=A;var K=this.rows[this.currRow];if(u.indent!==null){var F=u.indent,ee=Math.max(F-1,0);K.setCursor(u.indent),u.color=K.chars[ee].penState.foreground}var se={foreground:u.color,underline:u.underline,italics:u.italics,background:"black",flash:!1};this.setPen(se)},y.setBkgData=function(u){this.logger.log(p.INFO,"bkgData = "+JSON.stringify(u)),this.backSpace(),this.setPen(u),this.insertChar(32)},y.setRollUpRows=function(u){this.nrRollUpRows=u},y.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(p.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(p.TEXT,this.getDisplayText());var u=this.currRow+1-this.nrRollUpRows,A=this.rows.splice(u,1)[0];A.clear(),this.rows.splice(this.currRow,0,A),this.logger.log(p.INFO,"Rolling up")},y.getDisplayText=function(u){u=u||!1;for(var A=[],S="",T=-1,_=0;_<W;_++){var j=this.rows[_].getTextString();j&&(T=_+1,u?A.push("Row "+T+": '"+j+"'"):A.push(j.trim()))}return A.length>0&&(u?S="["+A.join(" | ")+"]":S=A.join(`
|
|
`)),S},y.getTextAndFormat=function(){return this.rows},E}(),C=function(){function E(c,u,A){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=c,this.outputFilter=u,this.mode=null,this.verbose=0,this.displayedMemory=new l(A),this.nonDisplayedMemory=new l(A),this.lastOutputScreen=new l(A),this.currRollUpRow=this.displayedMemory.rows[W-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=A}var y=E.prototype;return y.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[W-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},y.getHandler=function(){return this.outputFilter},y.setHandler=function(u){this.outputFilter=u},y.setPAC=function(u){this.writeScreen.setPAC(u)},y.setBkgData=function(u){this.writeScreen.setBkgData(u)},y.setMode=function(u){if(u===this.mode)return;this.mode=u,this.logger.log(p.INFO,"MODE="+u),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=u},y.insertChars=function(u){for(var A=0;A<u.length;A++)this.writeScreen.insertChar(u[A]);var S=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(p.INFO,S+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(p.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},y.ccRCL=function(){this.logger.log(p.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},y.ccBS=function(){if(this.logger.log(p.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},y.ccAOF=function(){},y.ccAON=function(){},y.ccDER=function(){this.logger.log(p.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},y.ccRU=function(u){this.logger.log(p.INFO,"RU("+u+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(u)},y.ccFON=function(){this.logger.log(p.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},y.ccRDC=function(){this.logger.log(p.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},y.ccTR=function(){this.logger.log(p.INFO,"TR"),this.setMode("MODE_TEXT")},y.ccRTD=function(){this.logger.log(p.INFO,"RTD"),this.setMode("MODE_TEXT")},y.ccEDM=function(){this.logger.log(p.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},y.ccCR=function(){this.logger.log(p.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},y.ccENM=function(){this.logger.log(p.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},y.ccEOC=function(){if(this.logger.log(p.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var u=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=u,this.writeScreen=this.nonDisplayedMemory,this.logger.log(p.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},y.ccTO=function(u){this.logger.log(p.INFO,"TO("+u+") - Tab Offset"),this.writeScreen.moveCursor(u)},y.ccMIDROW=function(u){var A={flash:!1};if(A.underline=u%2===1,A.italics=u>=46,A.italics)A.foreground="white";else{var S=Math.floor(u/2)-16,T=["white","green","blue","cyan","red","yellow","magenta"];A.foreground=T[S]}this.logger.log(p.INFO,"MIDROW: "+JSON.stringify(A)),this.writeScreen.setPen(A)},y.outputDataUpdate=function(u){u===void 0&&(u=!1);var A=this.logger.time;if(A===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=A:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,A,this.lastOutputScreen),u&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:A),this.lastOutputScreen.copy(this.displayedMemory))},y.cueSplitAtTime=function(u){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,u,this.displayedMemory),this.cueStartTime=u))},E}(),m=function(){function E(c,u,A){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var S=new g;this.channels=[null,new C(c,u,S),new C(c+1,A,S)],this.cmdHistory=L(),this.logger=S}var y=E.prototype;return y.getHandler=function(u){return this.channels[u].getHandler()},y.setHandler=function(u,A){this.channels[u].setHandler(A)},y.addData=function(u,A){var S,T,_,j=!1;this.logger.time=u;for(var z=0;z<A.length;z+=2){if(T=A[z]&127,_=A[z+1]&127,T===0&&_===0)continue;if(this.logger.log(p.DATA,"["+b([A[z],A[z+1]])+"] -> ("+b([T,_])+")"),S=this.parseCmd(T,_),S||(S=this.parseMidrow(T,_)),S||(S=this.parsePAC(T,_)),S||(S=this.parseBackgroundAttributes(T,_)),!S&&(j=this.parseChars(T,_),j)){var Z=this.currentChannel;if(Z&&Z>0){var K=this.channels[Z];K.insertChars(j)}else this.logger.log(p.WARNING,"No channel found yet. TEXT-MODE?")}!S&&!j&&this.logger.log(p.WARNING,"Couldn't parse cleaned data "+b([T,_])+" orig: "+b([A[z],A[z+1]]))}},y.parseCmd=function(u,A){var S=this.cmdHistory,T=(u===20||u===28||u===21||u===29)&&A>=32&&A<=47,_=(u===23||u===31)&&A>=33&&A<=35;if(!(T||_))return!1;if(k(u,A,S))return v(null,null,S),this.logger.log(p.DEBUG,"Repeated command ("+b([u,A])+") is dropped"),!0;var j=u===20||u===21||u===23?1:2,z=this.channels[j];return u===20||u===21||u===28||u===29?A===32?z.ccRCL():A===33?z.ccBS():A===34?z.ccAOF():A===35?z.ccAON():A===36?z.ccDER():A===37?z.ccRU(2):A===38?z.ccRU(3):A===39?z.ccRU(4):A===40?z.ccFON():A===41?z.ccRDC():A===42?z.ccTR():A===43?z.ccRTD():A===44?z.ccEDM():A===45?z.ccCR():A===46?z.ccENM():A===47&&z.ccEOC():z.ccTO(A-32),v(u,A,S),this.currentChannel=j,!0},y.parseMidrow=function(u,A){var S=0;if((u===17||u===25)&&A>=32&&A<=47){if(u===17?S=1:S=2,S!==this.currentChannel)return this.logger.log(p.ERROR,"Mismatch channel in midrow parsing"),!1;var T=this.channels[S];return T?(T.ccMIDROW(A),this.logger.log(p.DEBUG,"MIDROW ("+b([u,A])+")"),!0):!1}return!1},y.parsePAC=function(u,A){var S,T=this.cmdHistory,_=(u>=17&&u<=23||u>=25&&u<=31)&&A>=64&&A<=127,j=(u===16||u===24)&&A>=64&&A<=95;if(!(_||j))return!1;if(k(u,A,T))return v(null,null,T),!0;var z=u<=23?1:2;A>=64&&A<=95?S=z===1?P[u]:d[u]:S=z===1?R[u]:f[u];var Z=this.channels[z];return Z?(Z.setPAC(this.interpretPAC(S,A)),v(u,A,T),this.currentChannel=z,!0):!1},y.interpretPAC=function(u,A){var S,T={color:null,italics:!1,indent:null,underline:!1,row:u};return A>95?S=A-96:S=A-64,T.underline=(S&1)===1,S<=13?T.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(S/2)]:S<=15?(T.italics=!0,T.color="white"):T.indent=Math.floor((S-16)/2)*4,T},y.parseChars=function(u,A){var S,T=null,_=null;if(u>=25?(S=2,_=u-8):(S=1,_=u),_>=17&&_<=19){var j;_===17?j=A+80:_===18?j=A+112:j=A+144,this.logger.log(p.INFO,"Special char '"+M(j)+"' in channel "+S),T=[j]}else u>=32&&u<=127&&(T=A===0?[u]:[u,A]);if(T){var z=b(T);this.logger.log(p.DEBUG,"Char codes = "+z.join(",")),v(u,A,this.cmdHistory)}return T},y.parseBackgroundAttributes=function(u,A){var S=(u===16||u===24)&&A>=32&&A<=47,T=(u===23||u===31)&&A>=45&&A<=47;if(!(S||T))return!1;var _,j={};u===16||u===24?(_=Math.floor((A-32)/2),j.background=w[_],A%2===1&&(j.background=j.background+"_semi")):A===45?j.background="transparent":(j.foreground="black",A===47&&(j.underline=!0));var z=u<=23?1:2,Z=this.channels[z];return Z.setBkgData(j),v(u,A,this.cmdHistory),!0},y.reset=function(){for(var u=0;u<Object.keys(this.channels).length;u++){var A=this.channels[u];A&&A.reset()}this.cmdHistory=L()},y.cueSplitAtTime=function(u){for(var A=0;A<this.channels.length;A++){var S=this.channels[A];S&&S.cueSplitAtTime(u)}},E}();function v(E,y,c){c.a=E,c.b=y}function k(E,y,c){return c.a===E&&c.b===y}function L(){return{a:null,b:null}}$.default=m},"./src/utils/codecs.ts":function(ie,$,O){"use strict";O.r($),O.d($,"isCodecType",function(){return I}),O.d($,"isCodecSupportedInMp4",function(){return M});var V={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function I(W,N){var P=V[N];return!!P&&P[W.slice(0,4)]===!0}function M(W,N){return MediaSource.isTypeSupported((N||"video")+'/mp4;codecs="'+W+'"')}},"./src/utils/cues.ts":function(ie,$,O){"use strict";O.r($);var V=O("./src/utils/vttparser.ts"),I=O("./src/utils/webvtt-parser.ts"),M=O("./src/utils/texttrack-utils.ts"),W=/\s/,N={newCue:function(R,d,f,w){for(var p=[],g,b,o,i,s,l=self.VTTCue||self.TextTrackCue,C=0;C<w.rows.length;C++)if(g=w.rows[C],o=!0,i=0,s="",!g.isEmpty()){for(var m=0;m<g.chars.length;m++)W.test(g.chars[m].uchar)&&o?i++:(s+=g.chars[m].uchar,o=!1);g.cueStartTime=d,d===f&&(f+=1e-4),i>=16?i--:i++;var v=Object(V.fixLineBreaks)(s.trim()),k=Object(I.generateCueId)(d,f,v);(!R||!R.cues||!R.cues.getCueById(k))&&(b=new l(d,f,v),b.id=k,b.line=C+1,b.align="left",b.position=10+Math.min(80,Math.floor(i*8/32)*10),p.push(b))}return R&&p.length&&(p.sort(function(L,E){return L.line==="auto"||E.line==="auto"?0:L.line>8&&E.line>8?E.line-L.line:L.line-E.line}),p.forEach(function(L){return Object(M.addCueToTrack)(R,L)})),p}};$.default=N},"./src/utils/discontinuities.ts":function(ie,$,O){"use strict";O.r($),O.d($,"findFirstFragWithCC",function(){return W}),O.d($,"shouldAlignOnDiscontinuities",function(){return N}),O.d($,"findDiscontinuousReferenceFrag",function(){return P}),O.d($,"adjustSlidingStart",function(){return d}),O.d($,"alignStream",function(){return f}),O.d($,"alignPDT",function(){return p}),O.d($,"alignFragmentByPDTDelta",function(){return g}),O.d($,"alignMediaPlaylistByPDT",function(){return b});var V=O("./src/polyfills/number.ts"),I=O("./src/utils/logger.ts"),M=O("./src/controller/level-helper.ts");function W(o,i){for(var s=null,l=0,C=o.length;l<C;l++){var m=o[l];if(m&&m.cc===i){s=m;break}}return s}function N(o,i,s){return!!(i.details&&(s.endCC>s.startCC||o&&o.cc<s.startCC))}function P(o,i){var s=o.fragments,l=i.fragments;if(!l.length||!s.length){I.logger.log("No fragments to align");return}var C=W(s,l[0].cc);if(!C||C&&!C.startPTS){I.logger.log("No frag in previous level to align on");return}return C}function R(o,i){if(o){var s=o.start+i;o.start=o.startPTS=s,o.endPTS=s+o.duration}}function d(o,i){for(var s=i.fragments,l=0,C=s.length;l<C;l++)R(s[l],o);i.fragmentHint&&R(i.fragmentHint,o),i.alignedSliding=!0}function f(o,i,s){if(!i)return;w(o,s,i),!s.alignedSliding&&i.details&&p(s,i.details),!s.alignedSliding&&i.details&&!s.skippedSegments&&Object(M.adjustSliding)(i.details,s)}function w(o,i,s){if(N(o,s,i)){var l=P(s.details,i);l&&Object(V.isFiniteNumber)(l.start)&&(I.logger.log("Adjusting PTS using last level due to CC increase within current level "+i.url),d(l.start,i))}}function p(o,i){if(!i.fragments.length||!o.hasProgramDateTime||!i.hasProgramDateTime)return;var s=i.fragments[0].programDateTime,l=o.fragments[0].programDateTime,C=(l-s)/1e3+i.fragments[0].start;C&&Object(V.isFiniteNumber)(C)&&(I.logger.log("Adjusting PTS using programDateTime delta "+(l-s)+"ms, sliding:"+C.toFixed(3)+" "+o.url+" "),d(C,o))}function g(o,i){var s=o.programDateTime;if(!s)return;var l=(s-i)/1e3;o.start=o.startPTS=l,o.endPTS=l+o.duration}function b(o,i){if(!i.fragments.length||!o.hasProgramDateTime||!i.hasProgramDateTime)return;var s=i.fragments[0].programDateTime,l=i.fragments[0].start,C=s-l*1e3;o.fragments.forEach(function(m){g(m,C)}),o.fragmentHint&&g(o.fragmentHint,C),o.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ie,$,O){"use strict";O.r($);var V=O("./src/utils/ewma.ts"),I=function(){function M(N,P,R){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=R,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new V.default(N),this.fast_=new V.default(P)}var W=M.prototype;return W.update=function(P,R){var d=this.slow_,f=this.fast_;this.slow_.halfLife!==P&&(this.slow_=new V.default(P,d.getEstimate(),d.getTotalWeight())),this.fast_.halfLife!==R&&(this.fast_=new V.default(R,f.getEstimate(),f.getTotalWeight()))},W.sample=function(P,R){P=Math.max(P,this.minDelayMs_);var d=8*R,f=P/1e3,w=d/f;this.fast_.sample(f,w),this.slow_.sample(f,w)},W.canEstimate=function(){var P=this.fast_;return P&&P.getTotalWeight()>=this.minWeight_},W.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},W.destroy=function(){},M}();$.default=I},"./src/utils/ewma.ts":function(ie,$,O){"use strict";O.r($);var V=function(){function I(W,N,P){N===void 0&&(N=0),P===void 0&&(P=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=W,this.alpha_=W?Math.exp(Math.log(.5)/W):0,this.estimate_=N,this.totalWeight_=P}var M=I.prototype;return M.sample=function(N,P){var R=Math.pow(this.alpha_,N);this.estimate_=P*(1-R)+R*this.estimate_,this.totalWeight_+=N},M.getTotalWeight=function(){return this.totalWeight_},M.getEstimate=function(){if(this.alpha_){var N=1-Math.pow(this.alpha_,this.totalWeight_);if(N)return this.estimate_/N}return this.estimate_},I}();$.default=V},"./src/utils/fetch-loader.ts":function(ie,$,O){"use strict";O.r($),O.d($,"fetchSupported",function(){return g});var V=O("./src/polyfills/number.ts"),I=O("./src/loader/load-stats.ts"),M=O("./src/demux/chunk-cache.ts");function W(l,C){l.prototype=Object.create(C.prototype),l.prototype.constructor=l,f(l,C)}function N(l){var C=typeof Map=="function"?new Map:void 0;return N=function(v){if(v===null||!d(v))return v;if(typeof v!="function")throw new TypeError("Super expression must either be null or a function");if(typeof C!="undefined"){if(C.has(v))return C.get(v);C.set(v,k)}function k(){return P(v,arguments,w(this).constructor)}return k.prototype=Object.create(v.prototype,{constructor:{value:k,enumerable:!1,writable:!0,configurable:!0}}),f(k,v)},N(l)}function P(l,C,m){return R()?P=Reflect.construct:P=function(k,L,E){var y=[null];y.push.apply(y,L);var c=Function.bind.apply(k,y),u=new c;return E&&f(u,E.prototype),u},P.apply(null,arguments)}function R(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(l){return!1}}function d(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function f(l,C){return f=Object.setPrototypeOf||function(v,k){return v.__proto__=k,v},f(l,C)}function w(l){return w=Object.setPrototypeOf?Object.getPrototypeOf:function(m){return m.__proto__||Object.getPrototypeOf(m)},w(l)}function p(){return p=Object.assign||function(l){for(var C=1;C<arguments.length;C++){var m=arguments[C];for(var v in m)Object.prototype.hasOwnProperty.call(m,v)&&(l[v]=m[v])}return l},p.apply(this,arguments)}function g(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(l){}return!1}var b=function(){function l(m){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=m.fetchSetup||i,this.controller=new self.AbortController,this.stats=new I.LoadStats}var C=l.prototype;return C.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},C.abortInternal=function(){var v=this.response;(!v||!v.ok)&&(this.stats.aborted=!0,this.controller.abort())},C.abort=function(){var v;this.abortInternal(),(v=this.callbacks)!==null&&v!==void 0&&v.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},C.load=function(v,k,L){var E=this,y=this.stats;if(y.loading.start)throw new Error("Loader can only be used once.");y.loading.start=self.performance.now();var c=o(v,this.controller.signal),u=L.onProgress,A=v.responseType==="arraybuffer",S=A?"byteLength":"length";this.context=v,this.config=k,this.callbacks=L,this.request=this.fetchSetup(v,c),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){E.abortInternal(),L.onTimeout(y,v,E.response)},k.timeout),self.fetch(this.request).then(function(T){if(E.response=E.loader=T,!T.ok){var _=T.status,j=T.statusText;throw new s(j||"fetch, bad network response",_,T)}return y.loading.first=Math.max(self.performance.now(),y.loading.start),y.total=parseInt(T.headers.get("Content-Length")||"0"),u&&Object(V.isFiniteNumber)(k.highWaterMark)?E.loadProgressively(T,y,v,k.highWaterMark,u):A?T.arrayBuffer():T.text()}).then(function(T){var _=E.response;self.clearTimeout(E.requestTimeout),y.loading.end=Math.max(self.performance.now(),y.loading.first),y.loaded=y.total=T[S];var j={url:_.url,data:T};u&&!Object(V.isFiniteNumber)(k.highWaterMark)&&u(y,v,T,_),L.onSuccess(j,y,v,_)}).catch(function(T){if(self.clearTimeout(E.requestTimeout),y.aborted)return;var _=T.code||0;L.onError({code:_,text:T.message},v,T.details)})},C.getCacheAge=function(){var v=null;if(this.response){var k=this.response.headers.get("age");v=k?parseFloat(k):null}return v},C.loadProgressively=function(v,k,L,E,y){E===void 0&&(E=0);var c=new M.default,u=v.body.getReader(),A=function S(){return u.read().then(function(T){if(T.done)return c.dataLength&&y(k,L,c.flush(),v),Promise.resolve(new ArrayBuffer(0));var _=T.value,j=_.length;return k.loaded+=j,j<E||c.dataLength?(c.push(_),c.dataLength>=E&&y(k,L,c.flush(),v)):y(k,L,_,v),S()}).catch(function(){return Promise.reject()})};return A()},l}();function o(l,C){var m={method:"GET",mode:"cors",credentials:"same-origin",signal:C,headers:new self.Headers(p({},l.headers))};return l.rangeEnd&&m.headers.set("Range","bytes="+l.rangeStart+"-"+String(l.rangeEnd-1)),m}function i(l,C){return new self.Request(l.url,C)}var s=function(l){W(C,l);function C(m,v,k){var L;return L=l.call(this,m)||this,L.code=void 0,L.details=void 0,L.code=v,L.details=k,L}return C}(N(Error));$.default=b},"./src/utils/imsc1-ttml-parser.ts":function(ie,$,O){"use strict";O.r($),O.d($,"IMSC1_CODEC",function(){return d}),O.d($,"parseIMSC1",function(){return g});var V=O("./src/utils/mp4-tools.ts"),I=O("./src/utils/vttparser.ts"),M=O("./src/utils/vttcue.ts"),W=O("./src/demux/id3.ts"),N=O("./src/utils/timescale-conversion.ts"),P=O("./src/utils/webvtt-parser.ts");function R(){return R=Object.assign||function(E){for(var y=1;y<arguments.length;y++){var c=arguments[y];for(var u in c)Object.prototype.hasOwnProperty.call(c,u)&&(E[u]=c[u])}return E},R.apply(this,arguments)}var d="stpp.ttml.im1t",f=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,w=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,p={left:"start",center:"center",right:"end",start:"start",end:"end"};function g(E,y,c,u,A){var S=Object(V.findBox)(new Uint8Array(E),["mdat"]);if(S.length===0){A(new Error("Could not parse IMSC1 mdat"));return}var T=S[0],_=Object(W.utf8ArrayToStr)(new Uint8Array(E,T.start,T.end-T.start)),j=Object(N.toTimescaleFromScale)(y,1,c);try{u(b(_,j))}catch(z){A(z)}}function b(E,y){var c=new DOMParser,u=c.parseFromString(E,"text/xml"),A=u.getElementsByTagName("tt")[0];if(!A)throw new Error("Invalid ttml");var S={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},T=Object.keys(S).reduce(function(K,F){return K[F]=A.getAttribute("ttp:"+F)||S[F],K},{}),_=A.getAttribute("xml:space")!=="preserve",j=i(o(A,"styling","style")),z=i(o(A,"layout","region")),Z=o(A,"body","[begin]");return[].map.call(Z,function(K){var F=s(K,_);if(!F||!K.hasAttribute("begin"))return null;var ee=v(K.getAttribute("begin"),T),se=v(K.getAttribute("dur"),T),he=v(K.getAttribute("end"),T);if(ee===null)throw m(K);if(he===null){if(se===null)throw m(K);he=ee+se}var Ce=new M.default(ee-y,he-y,F);Ce.id=Object(P.generateCueId)(Ce.startTime,Ce.endTime,Ce.text);var Ue=z[K.getAttribute("region")],ke=j[K.getAttribute("style")];Ce.position=10,Ce.size=80;var Me=l(Ue,ke),ce=Me.textAlign;if(ce){var ve=p[ce];ve&&(Ce.lineAlign=ve),Ce.align=ce}return R(Ce,Me),Ce}).filter(function(K){return K!==null})}function o(E,y,c){var u=E.getElementsByTagName(y)[0];return u?[].slice.call(u.querySelectorAll(c)):[]}function i(E){return E.reduce(function(y,c){var u=c.getAttribute("xml:id");return u&&(y[u]=c),y},{})}function s(E,y){return[].slice.call(E.childNodes).reduce(function(c,u,A){var S;return u.nodeName==="br"&&A?c+`
|
|
`:(S=u.childNodes)!==null&&S!==void 0&&S.length?s(u,y):y?c+u.textContent.trim().replace(/\s+/g," "):c+u.textContent},"")}function l(E,y){var c="http://www.w3.org/ns/ttml#styling",u=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return u.reduce(function(A,S){var T=C(y,c,S)||C(E,c,S);return T&&(A[S]=T),A},{})}function C(E,y,c){return E.hasAttributeNS(y,c)?E.getAttributeNS(y,c):null}function m(E){return new Error("Could not parse ttml timestamp "+E)}function v(E,y){if(!E)return null;var c=Object(I.parseTimeStamp)(E);return c===null&&(f.test(E)?c=k(E,y):w.test(E)&&(c=L(E,y))),c}function k(E,y){var c=f.exec(E),u=(c[4]|0)+(c[5]|0)/y.subFrameRate;return(c[1]|0)*3600+(c[2]|0)*60+(c[3]|0)+u/y.frameRate}function L(E,y){var c=w.exec(E),u=Number(c[1]),A=c[2];switch(A){case"h":return u*3600;case"m":return u*60;case"ms":return u*1e3;case"f":return u/y.frameRate;case"t":return u/y.tickRate}return u}},"./src/utils/logger.ts":function(ie,$,O){"use strict";O.r($),O.d($,"enableLogs",function(){return P}),O.d($,"logger",function(){return R});var V=function(){},I={trace:V,debug:V,log:V,warn:V,info:V,error:V},M=I;function W(d){var f=self.console[d];return f?f.bind(self.console,"["+d+"] >"):V}function N(d){for(var f=arguments.length,w=new Array(f>1?f-1:0),p=1;p<f;p++)w[p-1]=arguments[p];w.forEach(function(g){M[g]=d[g]?d[g].bind(d):W(g)})}function P(d){if(self.console&&d===!0||typeof d=="object"){N(d,"debug","log","info","warn","error");try{M.log()}catch(f){M=I}}else M=I}var R=M},"./src/utils/mediakeys-helper.ts":function(ie,$,O){"use strict";O.r($),O.d($,"KeySystems",function(){return V}),O.d($,"requestMediaKeySystemAccess",function(){return I});var V;(function(M){M.WIDEVINE="com.widevine.alpha",M.PLAYREADY="com.microsoft.playready"})(V||(V={}));var I=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ie,$,O){"use strict";O.r($),O.d($,"getMediaSource",function(){return V});function V(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ie,$,O){"use strict";O.r($),O.d($,"bin2str",function(){return N}),O.d($,"readUint16",function(){return P}),O.d($,"readUint32",function(){return R}),O.d($,"writeUint32",function(){return d}),O.d($,"findBox",function(){return f}),O.d($,"parseSegmentIndex",function(){return w}),O.d($,"parseInitSegment",function(){return p}),O.d($,"getStartDTS",function(){return g}),O.d($,"getDuration",function(){return b}),O.d($,"computeRawDurationFromSamples",function(){return o}),O.d($,"offsetStartDTS",function(){return i}),O.d($,"segmentValidRange",function(){return s}),O.d($,"appendUint8Array",function(){return l});var V=O("./src/utils/typed-array.ts"),I=O("./src/loader/fragment.ts"),M=Math.pow(2,32)-1,W=[].push;function N(C){return String.fromCharCode.apply(null,C)}function P(C,m){"data"in C&&(m+=C.start,C=C.data);var v=C[m]<<8|C[m+1];return v<0?65536+v:v}function R(C,m){"data"in C&&(m+=C.start,C=C.data);var v=C[m]<<24|C[m+1]<<16|C[m+2]<<8|C[m+3];return v<0?4294967296+v:v}function d(C,m,v){"data"in C&&(m+=C.start,C=C.data),C[m]=v>>24,C[m+1]=v>>16&255,C[m+2]=v>>8&255,C[m+3]=v&255}function f(C,m){var v=[];if(!m.length)return v;var k,L,E;"data"in C?(k=C.data,L=C.start,E=C.end):(k=C,L=0,E=k.byteLength);for(var y=L;y<E;){var c=R(k,y),u=N(k.subarray(y+4,y+8)),A=c>1?y+c:E;if(u===m[0])if(m.length===1)v.push({data:k,start:y+8,end:A});else{var S=f({data:k,start:y+8,end:A},m.slice(1));S.length&&W.apply(v,S)}y=A}return v}function w(C){var m=f(C,["moov"]),v=m[0],k=v?v.end:null,L=f(C,["sidx"]);if(!L||!L[0])return null;var E=[],y=L[0],c=y.data[0],u=c===0?8:16,A=R(y,u);u+=4;var S=0,T=0;c===0?u+=8:u+=16,u+=2;var _=y.end+T,j=P(y,u);u+=2;for(var z=0;z<j;z++){var Z=u,K=R(y,Z);Z+=4;var F=K&2147483647,ee=(K&2147483648)>>>31;if(ee===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var se=R(y,Z);Z+=4,E.push({referenceSize:F,subsegmentDuration:se,info:{duration:se/A,start:_,end:_+F-1}}),_+=F,Z+=4,u=Z}return{earliestPresentationTime:S,timescale:A,version:c,referencesCount:j,references:E,moovEndOffset:k}}function p(C){for(var m=[],v=f(C,["moov","trak"]),k=0;k<v.length;k++){var L=v[k],E=f(L,["tkhd"])[0];if(E){var y=E.data[E.start],c=y===0?12:20,u=R(E,c),A=f(L,["mdia","mdhd"])[0];if(A){y=A.data[A.start],c=y===0?12:20;var S=R(A,c),T=f(L,["mdia","hdlr"])[0];if(T){var _=N(T.data.subarray(T.start+8,T.start+12)),j={soun:I.ElementaryStreamTypes.AUDIO,vide:I.ElementaryStreamTypes.VIDEO}[_];if(j){var z=f(L,["mdia","minf","stbl","stsd"])[0],Z=void 0;z&&(Z=N(z.data.subarray(z.start+12,z.start+16))),m[u]={timescale:S,type:j},m[j]={timescale:S,id:u,codec:Z}}}}}}var K=f(C,["moov","mvex","trex"]);return K.forEach(function(F){var ee=R(F,4),se=m[ee];se&&(se.default={duration:R(F,12),flags:R(F,20)})}),m}function g(C,m){return f(m,["moof","traf"]).reduce(function(v,k){var L=f(k,["tfdt"])[0],E=L.data[L.start],y=f(k,["tfhd"]).reduce(function(c,u){var A=R(u,4),S=C[A];if(S){var T=R(L,4);E===1&&(T*=Math.pow(2,32),T+=R(L,8));var _=S.timescale||9e4,j=T/_;if(isFinite(j)&&(c===null||j<c))return j}return c},null);return y!==null&&isFinite(y)&&(v===null||y<v)?y:v},null)||0}function b(C,m){for(var v=0,k=0,L=0,E=f(C,["moof","traf"]),y=0;y<E.length;y++){var c=E[y],u=f(c,["tfhd"])[0],A=R(u,4),S=m[A];if(!S)continue;var T=S.default,_=R(u,0)|(T==null?void 0:T.flags),j=T==null?void 0:T.duration;_&8&&(_&2?j=R(u,12):j=R(u,8));for(var z=S.timescale||9e4,Z=f(c,["trun"]),K=0;K<Z.length;K++){if(j){var F=R(Z[K],4);v=j*F}else v=o(Z[K]);S.type===I.ElementaryStreamTypes.VIDEO?k+=v/z:S.type===I.ElementaryStreamTypes.AUDIO&&(L+=v/z)}}if(k===0&&L===0){var ee=w(C);if(ee!=null&&ee.references)return ee.references.reduce(function(se,he){return se+he.info.duration||0},0)}return k||L}function o(C){var m=R(C,0),v=8;m&1&&(v+=4),m&4&&(v+=4);for(var k=0,L=R(C,4),E=0;E<L;E++){if(m&256){var y=R(C,v);k+=y,v+=4}m&512&&(v+=4),m&1024&&(v+=4),m&2048&&(v+=4)}return k}function i(C,m,v){f(m,["moof","traf"]).forEach(function(k){f(k,["tfhd"]).forEach(function(L){var E=R(L,4),y=C[E];if(!y)return;var c=y.timescale||9e4;f(k,["tfdt"]).forEach(function(u){var A=u.data[u.start],S=R(u,4);if(A===0)d(u,4,S-v*c);else{S*=Math.pow(2,32),S+=R(u,8),S-=v*c,S=Math.max(S,0);var T=Math.floor(S/(M+1)),_=Math.floor(S%(M+1));d(u,4,T),d(u,8,_)}})})})}function s(C){var m={valid:null,remainder:null},v=f(C,["moof"]);if(v){if(v.length<2)return m.remainder=C,m}else return m;var k=v[v.length-1];return m.valid=Object(V.sliceUint8)(C,0,k.start-8),m.remainder=Object(V.sliceUint8)(C,k.start-8),m}function l(C,m){var v=new Uint8Array(C.length+m.length);return v.set(C),v.set(m,C.length),v}},"./src/utils/output-filter.ts":function(ie,$,O){"use strict";O.r($),O.d($,"default",function(){return V});var V=function(){function I(W,N){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=W,this.trackName=N}var M=I.prototype;return M.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},M.newCue=function(N,P,R){(this.startTime===null||this.startTime>N)&&(this.startTime=N),this.endTime=P,this.screen=R,this.timelineController.createCaptionsTrack(this.trackName)},M.reset=function(){this.cueRanges=[]},I}()},"./src/utils/texttrack-utils.ts":function(ie,$,O){"use strict";O.r($),O.d($,"sendAddTrackEvent",function(){return I}),O.d($,"addCueToTrack",function(){return M}),O.d($,"clearCurrentCues",function(){return W}),O.d($,"removeCuesInRange",function(){return N}),O.d($,"getCuesInRange",function(){return R});var V=O("./src/utils/logger.ts");function I(d,f){var w;try{w=new Event("addtrack")}catch(p){w=document.createEvent("Event"),w.initEvent("addtrack",!1,!1)}w.track=d,f.dispatchEvent(w)}function M(d,f){var w=d.mode;if(w==="disabled"&&(d.mode="hidden"),d.cues&&!d.cues.getCueById(f.id))try{if(d.addCue(f),!d.cues.getCueById(f.id))throw new Error("addCue is failed for: "+f)}catch(g){V.logger.debug("[texttrack-utils]: "+g);var p=new self.TextTrackCue(f.startTime,f.endTime,f.text);p.id=f.id,d.addCue(p)}w==="disabled"&&(d.mode=w)}function W(d){var f=d.mode;if(f==="disabled"&&(d.mode="hidden"),d.cues)for(var w=d.cues.length;w--;)d.removeCue(d.cues[w]);f==="disabled"&&(d.mode=f)}function N(d,f,w){var p=d.mode;if(p==="disabled"&&(d.mode="hidden"),d.cues&&d.cues.length>0)for(var g=R(d.cues,f,w),b=0;b<g.length;b++)d.removeCue(g[b]);p==="disabled"&&(d.mode=p)}function P(d,f){if(f<d[0].startTime)return 0;var w=d.length-1;if(f>d[w].endTime)return-1;for(var p=0,g=w;p<=g;){var b=Math.floor((g+p)/2);if(f<d[b].startTime)g=b-1;else if(f>d[b].startTime&&p<w)p=b+1;else return b}return d[p].startTime-f<f-d[g].startTime?p:g}function R(d,f,w){var p=[],g=P(d,f);if(g>-1)for(var b=g,o=d.length;b<o;b++){var i=d[b];if(i.startTime>=f&&i.endTime<=w)p.push(i);else if(i.startTime>w)return p}return p}},"./src/utils/time-ranges.ts":function(ie,$,O){"use strict";O.r($);var V={toString:function(M){for(var W="",N=M.length,P=0;P<N;P++)W+="["+M.start(P).toFixed(3)+","+M.end(P).toFixed(3)+"]";return W}};$.default=V},"./src/utils/timescale-conversion.ts":function(ie,$,O){"use strict";O.r($),O.d($,"toTimescaleFromBase",function(){return I}),O.d($,"toTimescaleFromScale",function(){return M}),O.d($,"toMsFromMpegTsClock",function(){return W}),O.d($,"toMpegTsClockFromTimescale",function(){return N});var V=9e4;function I(P,R,d,f){d===void 0&&(d=1),f===void 0&&(f=!1);var w=P*R*d;return f?Math.round(w):w}function M(P,R,d,f){return d===void 0&&(d=1),f===void 0&&(f=!1),I(P,R,1/d,f)}function W(P,R){return R===void 0&&(R=!1),I(P,1e3,1/V,R)}function N(P,R){return R===void 0&&(R=1),I(P,V,1/R)}},"./src/utils/typed-array.ts":function(ie,$,O){"use strict";O.r($),O.d($,"sliceUint8",function(){return V});function V(I,M,W){return Uint8Array.prototype.slice?I.slice(M,W):new Uint8Array(Array.prototype.slice.call(I,M,W))}},"./src/utils/vttcue.ts":function(ie,$,O){"use strict";O.r($),$.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var V=["","lr","rl"],I=["start","middle","end","left","right"];function M(d,f){if(typeof f!="string")return!1;if(!Array.isArray(d))return!1;var w=f.toLowerCase();return~d.indexOf(w)?w:!1}function W(d){return M(V,d)}function N(d){return M(I,d)}function P(d){for(var f=arguments.length,w=new Array(f>1?f-1:0),p=1;p<f;p++)w[p-1]=arguments[p];for(var g=1;g<arguments.length;g++){var b=arguments[g];for(var o in b)d[o]=b[o]}return d}function R(d,f,w){var p=this,g={enumerable:!0};p.hasBeenReset=!1;var b="",o=!1,i=d,s=f,l=w,C=null,m="",v=!0,k="auto",L="start",E=50,y="middle",c=50,u="middle";Object.defineProperty(p,"id",P({},g,{get:function(){return b},set:function(S){b=""+S}})),Object.defineProperty(p,"pauseOnExit",P({},g,{get:function(){return o},set:function(S){o=!!S}})),Object.defineProperty(p,"startTime",P({},g,{get:function(){return i},set:function(S){if(typeof S!="number")throw new TypeError("Start time must be set to a number.");i=S,this.hasBeenReset=!0}})),Object.defineProperty(p,"endTime",P({},g,{get:function(){return s},set:function(S){if(typeof S!="number")throw new TypeError("End time must be set to a number.");s=S,this.hasBeenReset=!0}})),Object.defineProperty(p,"text",P({},g,{get:function(){return l},set:function(S){l=""+S,this.hasBeenReset=!0}})),Object.defineProperty(p,"region",P({},g,{get:function(){return C},set:function(S){C=S,this.hasBeenReset=!0}})),Object.defineProperty(p,"vertical",P({},g,{get:function(){return m},set:function(S){var T=W(S);if(T===!1)throw new SyntaxError("An invalid or illegal string was specified.");m=T,this.hasBeenReset=!0}})),Object.defineProperty(p,"snapToLines",P({},g,{get:function(){return v},set:function(S){v=!!S,this.hasBeenReset=!0}})),Object.defineProperty(p,"line",P({},g,{get:function(){return k},set:function(S){if(typeof S!="number"&&S!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");k=S,this.hasBeenReset=!0}})),Object.defineProperty(p,"lineAlign",P({},g,{get:function(){return L},set:function(S){var T=N(S);if(!T)throw new SyntaxError("An invalid or illegal string was specified.");L=T,this.hasBeenReset=!0}})),Object.defineProperty(p,"position",P({},g,{get:function(){return E},set:function(S){if(S<0||S>100)throw new Error("Position must be between 0 and 100.");E=S,this.hasBeenReset=!0}})),Object.defineProperty(p,"positionAlign",P({},g,{get:function(){return y},set:function(S){var T=N(S);if(!T)throw new SyntaxError("An invalid or illegal string was specified.");y=T,this.hasBeenReset=!0}})),Object.defineProperty(p,"size",P({},g,{get:function(){return c},set:function(S){if(S<0||S>100)throw new Error("Size must be between 0 and 100.");c=S,this.hasBeenReset=!0}})),Object.defineProperty(p,"align",P({},g,{get:function(){return u},set:function(S){var T=N(S);if(!T)throw new SyntaxError("An invalid or illegal string was specified.");u=T,this.hasBeenReset=!0}})),p.displayState=void 0}return R.prototype.getCueAsHTML=function(){var d=self.WebVTT;return d.convertCueToDOMTree(self,this.text)},R}()},"./src/utils/vttparser.ts":function(ie,$,O){"use strict";O.r($),O.d($,"parseTimeStamp",function(){return M}),O.d($,"fixLineBreaks",function(){return f}),O.d($,"VTTParser",function(){return w});var V=O("./src/utils/vttcue.ts"),I=function(){function p(){}var g=p.prototype;return g.decode=function(o,i){if(!o)return"";if(typeof o!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(o))},p}();function M(p){function g(o,i,s,l){return(o|0)*3600+(i|0)*60+(s|0)+parseFloat(l||0)}var b=p.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return b?parseFloat(b[2])>59?g(b[2],b[3],0,b[4]):g(b[1],b[2],b[3],b[4]):null}var W=function(){function p(){this.values=Object.create(null)}var g=p.prototype;return g.set=function(o,i){!this.get(o)&&i!==""&&(this.values[o]=i)},g.get=function(o,i,s){return s?this.has(o)?this.values[o]:i[s]:this.has(o)?this.values[o]:i},g.has=function(o){return o in this.values},g.alt=function(o,i,s){for(var l=0;l<s.length;++l)if(i===s[l]){this.set(o,i);break}},g.integer=function(o,i){/^-?\d+$/.test(i)&&this.set(o,parseInt(i,10))},g.percent=function(o,i){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(i)){var s=parseFloat(i);if(s>=0&&s<=100)return this.set(o,s),!0}return!1},p}();function N(p,g,b,o){var i=o?p.split(o):[p];for(var s in i){if(typeof i[s]!="string")continue;var l=i[s].split(b);if(l.length!==2)continue;var C=l[0],m=l[1];g(C,m)}}var P=new V.default(0,0,""),R=P.align==="middle"?"middle":"center";function d(p,g,b){var o=p;function i(){var C=M(p);if(C===null)throw new Error("Malformed timestamp: "+o);return p=p.replace(/^[^\sa-zA-Z-]+/,""),C}function s(C,m){var v=new W;N(C,function(E,y){var c;switch(E){case"region":for(var u=b.length-1;u>=0;u--)if(b[u].id===y){v.set(E,b[u].region);break}break;case"vertical":v.alt(E,y,["rl","lr"]);break;case"line":c=y.split(","),v.integer(E,c[0]),v.percent(E,c[0])&&v.set("snapToLines",!1),v.alt(E,c[0],["auto"]),c.length===2&&v.alt("lineAlign",c[1],["start",R,"end"]);break;case"position":c=y.split(","),v.percent(E,c[0]),c.length===2&&v.alt("positionAlign",c[1],["start",R,"end","line-left","line-right","auto"]);break;case"size":v.percent(E,y);break;case"align":v.alt(E,y,["start",R,"end","left","right"]);break}},/:/,/\s/),m.region=v.get("region",null),m.vertical=v.get("vertical","");var k=v.get("line","auto");k==="auto"&&P.line===-1&&(k=-1),m.line=k,m.lineAlign=v.get("lineAlign","start"),m.snapToLines=v.get("snapToLines",!0),m.size=v.get("size",100),m.align=v.get("align",R);var L=v.get("position","auto");L==="auto"&&P.position===50&&(L=m.align==="start"||m.align==="left"?0:m.align==="end"||m.align==="right"?100:50),m.position=L}function l(){p=p.replace(/^\s+/,"")}if(l(),g.startTime=i(),l(),p.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+o);p=p.substr(3),l(),g.endTime=i(),l(),s(p,g)}function f(p){return p.replace(/<br(?: \/)?>/gi,`
|
|
`)}var w=function(){function p(){this.state="INITIAL",this.buffer="",this.decoder=new I,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var g=p.prototype;return g.parse=function(o){var i=this;o&&(i.buffer+=i.decoder.decode(o,{stream:!0}));function s(){var L=i.buffer,E=0;for(L=f(L);E<L.length&&L[E]!=="\r"&&L[E]!==`
|
|
`;)++E;var y=L.substr(0,E);return L[E]==="\r"&&++E,L[E]===`
|
|
`&&++E,i.buffer=L.substr(E),y}function l(L){N(L,function(E,y){},/:/)}try{var C="";if(i.state==="INITIAL"){if(!/\r\n|\n/.test(i.buffer))return this;C=s();var m=C.match(/^()?WEBVTT([ \t].*)?$/);if(!m||!m[0])throw new Error("Malformed WebVTT signature.");i.state="HEADER"}for(var v=!1;i.buffer;){if(!/\r\n|\n/.test(i.buffer))return this;v?v=!1:C=s();switch(i.state){case"HEADER":/:/.test(C)?l(C):C||(i.state="ID");continue;case"NOTE":C||(i.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(C)){i.state="NOTE";break}if(!C)continue;if(i.cue=new V.default(0,0,""),i.state="CUE",C.indexOf("-->")===-1){i.cue.id=C;continue}case"CUE":if(!i.cue){i.state="BADCUE";continue}try{d(C,i.cue,i.regionList)}catch(L){i.cue=null,i.state="BADCUE";continue}i.state="CUETEXT";continue;case"CUETEXT":{var k=C.indexOf("-->")!==-1;if(!C||k&&(v=!0)){i.oncue&&i.cue&&i.oncue(i.cue),i.cue=null,i.state="ID";continue}if(i.cue===null)continue;i.cue.text&&(i.cue.text+=`
|
|
`),i.cue.text+=C}continue;case"BADCUE":C||(i.state="ID")}}}catch(L){i.state==="CUETEXT"&&i.cue&&i.oncue&&i.oncue(i.cue),i.cue=null,i.state=i.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},g.flush=function(){var o=this;try{if((o.cue||o.state==="HEADER")&&(o.buffer+=`
|
|
|
|
`,o.parse()),o.state==="INITIAL"||o.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(i){o.onparsingerror&&o.onparsingerror(i)}return o.onflush&&o.onflush(),this},p}()},"./src/utils/webvtt-parser.ts":function(ie,$,O){"use strict";O.r($),O.d($,"generateCueId",function(){return w}),O.d($,"parseWebVTT",function(){return g});var V=O("./src/polyfills/number.ts"),I=O("./src/utils/vttparser.ts"),M=O("./src/demux/id3.ts"),W=O("./src/utils/timescale-conversion.ts"),N=O("./src/remux/mp4-remuxer.ts"),P=/\r\n|\n\r|\n|\r/g,R=function(o,i,s){return s===void 0&&(s=0),o.substr(s,i.length)===i},d=function(o){var i=parseInt(o.substr(-3)),s=parseInt(o.substr(-6,2)),l=parseInt(o.substr(-9,2)),C=o.length>9?parseInt(o.substr(0,o.indexOf(":"))):0;if(!Object(V.isFiniteNumber)(i)||!Object(V.isFiniteNumber)(s)||!Object(V.isFiniteNumber)(l)||!Object(V.isFiniteNumber)(C))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+o);return i+=1e3*s,i+=60*1e3*l,i+=60*60*1e3*C,i},f=function(o){for(var i=5381,s=o.length;s;)i=i*33^o.charCodeAt(--s);return(i>>>0).toString()};function w(b,o,i){return f(b.toString())+f(o.toString())+f(i)}var p=function(o,i,s){var l=o[i],C=o[l.prevCC];if(!C||!C.new&&l.new){o.ccOffset=o.presentationOffset=l.start,l.new=!1;return}for(;(m=C)!==null&&m!==void 0&&m.new;){var m;o.ccOffset+=l.start-C.start,l.new=!1,l=C,C=o[l.prevCC]}o.presentationOffset=s};function g(b,o,i,s,l,C,m,v){var k=new I.VTTParser,L=Object(M.utf8ArrayToStr)(new Uint8Array(b)).trim().replace(P,`
|
|
`).split(`
|
|
`),E=[],y=Object(W.toMpegTsClockFromTimescale)(o,i),c="00:00.000",u=0,A=0,S,T=!0,_=!1;k.oncue=function(j){var z=s[l],Z=s.ccOffset,K=(u-y)/9e4;if(z!=null&&z.new&&(A!==void 0?Z=s.ccOffset=z.start:p(s,l,K)),K&&(Z=K-s.presentationOffset),_){var F=j.endTime-j.startTime,ee=Object(N.normalizePts)((j.startTime+Z-A)*9e4,C*9e4)/9e4;j.startTime=ee,j.endTime=ee+F}var se=j.text.trim();j.text=decodeURIComponent(encodeURIComponent(se)),j.id||(j.id=w(j.startTime,j.endTime,se)),j.endTime>0&&E.push(j)},k.onparsingerror=function(j){S=j},k.onflush=function(){if(S){v(S);return}m(E)},L.forEach(function(j){if(T)if(R(j,"X-TIMESTAMP-MAP=")){T=!1,_=!0,j.substr(16).split(",").forEach(function(z){R(z,"LOCAL:")?c=z.substr(6):R(z,"MPEGTS:")&&(u=parseInt(z.substr(7)))});try{A=d(c)/1e3}catch(z){_=!1,S=z}return}else j===""&&(T=!1);k.parse(j+`
|
|
`)}),k.flush()}},"./src/utils/xhr-loader.ts":function(ie,$,O){"use strict";O.r($);var V=O("./src/utils/logger.ts"),I=O("./src/loader/load-stats.ts"),M=/^age:\s*[\d.]+\s*$/m,W=function(){function N(R){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=R?R.xhrSetup:null,this.stats=new I.LoadStats,this.retryDelay=0}var P=N.prototype;return P.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},P.abortInternal=function(){var d=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),d&&(d.onreadystatechange=null,d.onprogress=null,d.readyState!==4&&(this.stats.aborted=!0,d.abort()))},P.abort=function(){var d;this.abortInternal(),(d=this.callbacks)!==null&&d!==void 0&&d.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},P.load=function(d,f,w){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=d,this.config=f,this.callbacks=w,this.retryDelay=f.retryDelay,this.loadInternal()},P.loadInternal=function(){var d=this.config,f=this.context;if(!d)return;var w=this.loader=new self.XMLHttpRequest,p=this.stats;p.loading.first=0,p.loaded=0;var g=this.xhrSetup;try{if(g)try{g(w,f.url)}catch(i){w.open("GET",f.url,!0),g(w,f.url)}w.readyState||w.open("GET",f.url,!0);var b=this.context.headers;if(b)for(var o in b)w.setRequestHeader(o,b[o])}catch(i){this.callbacks.onError({code:w.status,text:i.message},f,w);return}f.rangeEnd&&w.setRequestHeader("Range","bytes="+f.rangeStart+"-"+(f.rangeEnd-1)),w.onreadystatechange=this.readystatechange.bind(this),w.onprogress=this.loadprogress.bind(this),w.responseType=f.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),d.timeout),w.send()},P.readystatechange=function(){var d=this.context,f=this.loader,w=this.stats;if(!d||!f)return;var p=f.readyState,g=this.config;if(w.aborted)return;if(p>=2)if(self.clearTimeout(this.requestTimeout),w.loading.first===0&&(w.loading.first=Math.max(self.performance.now(),w.loading.start)),p===4){f.onreadystatechange=null,f.onprogress=null;var b=f.status;if(b>=200&&b<300){w.loading.end=Math.max(self.performance.now(),w.loading.first);var o,i;if(d.responseType==="arraybuffer"?(o=f.response,i=o.byteLength):(o=f.responseText,i=o.length),w.loaded=w.total=i,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(w,d,o,f),!this.callbacks)return;var l={url:f.responseURL,data:o};this.callbacks.onSuccess(l,w,d,f)}else w.retry>=g.maxRetry||b>=400&&b<499?(V.logger.error(b+" while loading "+d.url),this.callbacks.onError({code:b,text:f.statusText},d,f)):(V.logger.warn(b+" while loading "+d.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,g.maxRetryDelay),w.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),g.timeout)},P.loadtimeout=function(){V.logger.warn("timeout while loading "+this.context.url);var d=this.callbacks;d&&(this.abortInternal(),d.onTimeout(this.stats,this.context,this.loader))},P.loadprogress=function(d){var f=this.stats;f.loaded=d.loaded,d.lengthComputable&&(f.total=d.total)},P.getCacheAge=function(){var d=null;if(this.loader&&M.test(this.loader.getAllResponseHeaders())){var f=this.loader.getResponseHeader("age");d=f?parseFloat(f):null}return d},N}();$.default=W}}).default})},vHTk:function(vt,Te,Q){vt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);
|