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.
371 lines
1012 KiB
371 lines
1012 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[143,5,7],{"+NIl":function(yt,Ee,Q){(function(ne){ne(Q("VrN/"))})(function(ne){"use strict";ne.defineMode("stex",function($,M){"use strict";function K(m,p){m.cmdState.push(p)}function I(m){return m.cmdState.length>0?m.cmdState[m.cmdState.length-1]:null}function D(m){var p=m.cmdState.pop();p&&p.closeBracket()}function j(m){for(var p=m.cmdState,b=p.length-1;b>=0;b--){var o=p[b];if(o.name=="DEFAULT")continue;return o}return{styleIdentifier:function(){return null}}}function N(m,p,b){return function(){this.name=m,this.bracketNo=0,this.style=p,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 _={};_.importmodule=N("importmodule","tag",["string","builtin"]),_.documentclass=N("documentclass","tag",["","atom"]),_.usepackage=N("usepackage","tag",["atom"]),_.begin=N("begin","tag",["atom"]),_.end=N("end","tag",["atom"]),_.label=N("label","tag",["atom"]),_.ref=N("ref","tag",["atom"]),_.eqref=N("eqref","tag",["atom"]),_.cite=N("cite","tag",["atom"]),_.bibitem=N("bibitem","tag",["atom"]),_.Bibitem=N("Bibitem","tag",["atom"]),_.RBibitem=N("RBibitem","tag",["atom"]),_.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function k(m,p){m.f=p}function d(m,p){var b;if(m.match(/^\\[a-zA-Z@]+/)){var o=m.current().slice(1);return b=_.hasOwnProperty(o)?_[o]:_.DEFAULT,b=new b,K(p,b),k(p,T),b.style}if(m.match(/^\\[$&%#{}_]/))return"tag";if(m.match(/^\\[,;!\/\\]/))return"tag";if(m.match("\\["))return k(p,function(s,l){return f(s,l,"\\]")}),"keyword";if(m.match("\\("))return k(p,function(s,l){return f(s,l,"\\)")}),"keyword";if(m.match("$$"))return k(p,function(s,l){return f(s,l,"$$")}),"keyword";if(m.match("$"))return k(p,function(s,l){return f(s,l,"$")}),"keyword";var i=m.next();if(i=="%")return m.skipToEnd(),"comment";if(i=="}"||i=="]"){if(b=I(p),b)b.closeBracket(i),k(p,T);else return"error";return"bracket"}else return i=="{"||i=="["?(b=_.DEFAULT,b=new b,K(p,b),"bracket"):/\d/.test(i)?(m.eatWhile(/[\w.%]/),"atom"):(m.eatWhile(/[\w\-_]/),b=j(p),b.name=="begin"&&(b.argument=m.current()),b.styleIdentifier())}function f(m,p,b){if(m.eatSpace())return null;if(b&&m.match(b))return k(p,d),"keyword";if(m.match(/^\\[a-zA-Z@]+/))return"tag";if(m.match(/^[a-zA-Z]+/))return"variable-2";if(m.match(/^\\[$&%#{}_]/))return"tag";if(m.match(/^\\[,;!\/]/))return"tag";if(m.match(/^[\^_&]/))return"tag";if(m.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(m.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var o=m.next();return o=="{"||o=="}"||o=="["||o=="]"||o=="("||o==")"?"bracket":o=="%"?(m.skipToEnd(),"comment"):"error"}function T(m,p){var b=m.peek(),o;return b=="{"||b=="["?(o=I(p),o.openBracket(b),m.eat(b),k(p,d),"bracket"):/[ \t\r]/.test(b)?(m.eat(b),null):(k(p,d),D(p),d(m,p))}return{startState:function(){var m=M.inMathMode?function(p,b){return f(p,b)}:d;return{cmdState:[],f:m}},copyState:function(m){return{cmdState:m.cmdState.slice(),f:m.f}},token:function(m,p){return p.f(m,p)},blankLine:function(m){m.f=d,m.cmdState.length=0},lineComment:"%"}}),ne.defineMIME("text/x-stex","stex"),ne.defineMIME("text/x-latex","stex")})},"+ua5":function(yt,Ee,Q){},"/cxE":function(yt,Ee,Q){"use strict";Q.d(Ee,"e",function(){return M}),Q.d(Ee,"f",function(){return K}),Q.d(Ee,"g",function(){return I}),Q.d(Ee,"d",function(){return j}),Q.d(Ee,"a",function(){return N}),Q.d(Ee,"b",function(){return _}),Q.d(Ee,"c",function(){return k});var ne=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(T){T(f)})},d.prototype.onUnexpectedError=function(f){this.unexpectedErrorHandler(f),this.emit(f)},d.prototype.onUnexpectedExternalError=function(f){this.unexpectedErrorHandler(f)},d}(),$=new ne;function M(d){j(d)||$.onUnexpectedError(d);return}function K(d){j(d)||$.onUnexpectedExternalError(d);return}function I(d){if(d instanceof Error){var f=d.name,T=d.message,m=d.stacktrace||d.stack;return{$isError:!0,name:f,message:T,stack:m}}return d}var D="Canceled";function j(d){return d instanceof Error&&d.name===D&&d.message===D}function N(){var d=new Error(D);return d.name=d.message,d}function _(d){return d?new Error("Illegal argument: "+d):new Error("Illegal argument")}function k(d){return d?new Error("Illegal state: "+d):new Error("Illegal state")}},"19Vz":function(yt,Ee,Q){(function(ne){ne(Q("VrN/"))})(function(ne){ne.defineOption("placeholder","",function(N,_,k){var d=k&&k!=ne.Init;if(_&&!d)N.on("blur",I),N.on("change",D),N.on("swapDoc",D),ne.on(N.getInputField(),"compositionupdate",N.state.placeholderCompose=function(){K(N)}),D(N);else if(!_&&d){N.off("blur",I),N.off("change",D),N.off("swapDoc",D),ne.off(N.getInputField(),"compositionupdate",N.state.placeholderCompose),$(N);var f=N.getWrapperElement();f.className=f.className.replace(" CodeMirror-empty","")}_&&!N.hasFocus()&&I(N)});function $(N){N.state.placeholder&&(N.state.placeholder.parentNode.removeChild(N.state.placeholder),N.state.placeholder=null)}function M(N){$(N);var _=N.state.placeholder=document.createElement("pre");_.style.cssText="height: 0; overflow: visible",_.style.direction=N.getOption("direction"),_.className="CodeMirror-placeholder CodeMirror-line-like";var k=N.getOption("placeholder");typeof k=="string"&&(k=document.createTextNode(k)),_.appendChild(k),N.display.lineSpace.insertBefore(_,N.display.lineSpace.firstChild)}function K(N){setTimeout(function(){var _=!1,k=N.getInputField();k.nodeName=="TEXTAREA"?_=!k.value:N.lineCount()==1&&(_=!/[^\u200b]/.test(k.querySelector(".CodeMirror-line").textContent)),_?M(N):$(N)},20)}function I(N){j(N)&&M(N)}function D(N){var _=N.getWrapperElement(),k=j(N);_.className=_.className.replace(" CodeMirror-empty","")+(k?" CodeMirror-empty":""),k?M(N):$(N)}function j(N){return N.lineCount()===1&&N.getLine(0)===""}})},"1eCo":function(yt,Ee,Q){(function(ne){ne(Q("VrN/"))})(function(ne){"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},M={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ne.defineMode("xml",function(K,I){var D=K.indentUnit,j={},N=I.htmlMode?$:M;for(var _ in N)j[_]=N[_];for(var _ in I)j[_]=I[_];var k,d;function f(u,L){function S(W){return L.tokenize=W,W(u,L)}var A=u.next();if(A=="<")return u.eat("!")?u.eat("[")?u.match("CDATA[")?S(p("atom","]]>")):null:u.match("--")?S(p("comment","-->")):u.match("DOCTYPE",!0,!0)?(u.eatWhile(/[\w\._\-]/),S(b(1))):null:u.eat("?")?(u.eatWhile(/[\w\._\-]/),L.tokenize=p("meta","?>"),"meta"):(k=u.eat("/")?"closeTag":"openTag",L.tokenize=T,"tag bracket");if(A=="&"){var P;return u.eat("#")?u.eat("x")?P=u.eatWhile(/[a-fA-F\d]/)&&u.eat(";"):P=u.eatWhile(/[\d]/)&&u.eat(";"):P=u.eatWhile(/[\w\.\-:]/)&&u.eat(";"),P?"atom":"error"}else return u.eatWhile(/[^&<]/),null}f.isInText=!0;function T(u,L){var S=u.next();if(S==">"||S=="/"&&u.eat(">"))return L.tokenize=f,k=S==">"?"endTag":"selfcloseTag","tag bracket";if(S=="=")return k="equals",null;if(S=="<"){L.tokenize=f,L.state=l,L.tagName=L.tagStart=null;var A=L.tokenize(u,L);return A?A+" tag error":"tag error"}else return/[\'\"]/.test(S)?(L.tokenize=m(S),L.stringStartCol=u.column(),L.tokenize(u,L)):(u.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function m(u){var L=function(S,A){for(;!S.eol();)if(S.next()==u){A.tokenize=T;break}return"string"};return L.isInAttribute=!0,L}function p(u,L){return function(S,A){for(;!S.eol();){if(S.match(L)){A.tokenize=f;break}S.next()}return u}}function b(u){return function(L,S){for(var A;(A=L.next())!=null;){if(A=="<")return S.tokenize=b(u+1),S.tokenize(L,S);if(A==">")if(u==1){S.tokenize=f;break}else return S.tokenize=b(u-1),S.tokenize(L,S)}return"meta"}}function o(u,L,S){this.prev=u.context,this.tagName=L,this.indent=u.indented,this.startOfLine=S,(j.doNotIndent.hasOwnProperty(L)||u.context&&u.context.noIndent)&&(this.noIndent=!0)}function i(u){u.context&&(u.context=u.context.prev)}function s(u,L){for(var S;;){if(!u.context)return;if(S=u.context.tagName,!j.contextGrabbers.hasOwnProperty(S)||!j.contextGrabbers[S].hasOwnProperty(L))return;i(u)}}function l(u,L,S){return u=="openTag"?(S.tagStart=L.column(),E):u=="closeTag"?g:l}function E(u,L,S){return u=="word"?(S.tagName=L.current(),d="tag",w):j.allowMissingTagName&&u=="endTag"?(d="tag bracket",w(u,L,S)):(d="error",E)}function g(u,L,S){if(u=="word"){var A=L.current();return S.context&&S.context.tagName!=A&&j.implicitlyClosed.hasOwnProperty(S.context.tagName)&&i(S),S.context&&S.context.tagName==A||j.matchClosing===!1?(d="tag",v):(d="tag error",O)}else return j.allowMissingTagName&&u=="endTag"?(d="tag bracket",v(u,L,S)):(d="error",O)}function v(u,L,S){return u!="endTag"?(d="error",v):(i(S),l)}function O(u,L,S){return d="error",v(u,L,S)}function w(u,L,S){if(u=="word")return d="attribute",C;if(u=="endTag"||u=="selfcloseTag"){var A=S.tagName,P=S.tagStart;return S.tagName=S.tagStart=null,u=="selfcloseTag"||j.autoSelfClosers.hasOwnProperty(A)?s(S,A):(s(S,A),S.context=new o(S,A,P==S.indented)),l}return d="error",w}function C(u,L,S){return u=="equals"?y:(j.allowMissing||(d="error"),w(u,L,S))}function y(u,L,S){return u=="string"?c:u=="word"&&j.allowUnquoted?(d="string",w):(d="error",w(u,L,S))}function c(u,L,S){return u=="string"?c:w(u,L,S)}return{startState:function(u){var L={tokenize:f,state:l,indented:u||0,tagName:null,tagStart:null,context:null};return u!=null&&(L.baseIndent=u),L},token:function(u,L){if(!L.tagName&&u.sol()&&(L.indented=u.indentation()),u.eatSpace())return null;k=null;var S=L.tokenize(u,L);return(S||k)&&S!="comment"&&(d=null,L.state=L.state(k||S,u,L),d&&(S=d=="error"?S+" error":d)),S},indent:function(u,L,S){var A=u.context;if(u.tokenize.isInAttribute)return u.tagStart==u.indented?u.stringStartCol+1:u.indented+D;if(A&&A.noIndent)return ne.Pass;if(u.tokenize!=T&&u.tokenize!=f)return S?S.match(/^(\s*)/)[0].length:0;if(u.tagName)return j.multilineTagIndentPastTag!==!1?u.tagStart+u.tagName.length+2:u.tagStart+D*(j.multilineTagIndentFactor||1);if(j.alignCDATA&&/<!\[CDATA\[/.test(L))return 0;var P=L&&/^<(\/)?([\w_:\.-]*)/.exec(L);if(P&&P[1])for(;A;)if(A.tagName==P[2]){A=A.prev;break}else if(j.implicitlyClosed.hasOwnProperty(A.tagName))A=A.prev;else break;else if(P)for(;A;){var W=j.contextGrabbers[A.tagName];if(W&&W.hasOwnProperty(P[2]))A=A.prev;else break}for(;A&&A.prev&&!A.startOfLine;)A=A.prev;return A?A.indent+D:u.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:j.htmlMode?"html":"xml",helperType:j.htmlMode?"html":"xml",skipAttribute:function(u){u.state==y&&(u.state=w)},xmlCurrentTag:function(u){return u.tagName?{name:u.tagName,close:u.type=="closeTag"}:null},xmlCurrentContext:function(u){for(var L=[],S=u.context;S;S=S.prev)S.tagName&&L.push(S.tagName);return L.reverse()}}}),ne.defineMIME("text/xml","xml"),ne.defineMIME("application/xml","xml"),ne.mimeModes.hasOwnProperty("text/html")||ne.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"24hK":function(yt,Ee,Q){"use strict";Q.d(Ee,"a",function(){return M});var ne=Q("JYp7"),$=function(){function K(I){this.element=I,this.next=K.Undefined,this.prev=K.Undefined}return K.Undefined=new K(void 0),K}(),M=function(){function K(){this._first=$.Undefined,this._last=$.Undefined,this._size=0}return Object.defineProperty(K.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),K.prototype.isEmpty=function(){return this._first===$.Undefined},K.prototype.clear=function(){this._first=$.Undefined,this._last=$.Undefined,this._size=0},K.prototype.unshift=function(I){return this._insert(I,!1)},K.prototype.push=function(I){return this._insert(I,!0)},K.prototype._insert=function(I,D){var j=this,N=new $(I);if(this._first===$.Undefined)this._first=N,this._last=N;else if(D){var _=this._last;this._last=N,N.prev=_,_.next=N}else{var k=this._first;this._first=N,N.next=k,k.prev=N}this._size+=1;var d=!1;return function(){d||(d=!0,j._remove(N))}},K.prototype.shift=function(){if(this._first===$.Undefined)return;var I=this._first.element;return this._remove(this._first),I},K.prototype.pop=function(){if(this._last===$.Undefined)return;var I=this._last.element;return this._remove(this._last),I},K.prototype._remove=function(I){if(I.prev!==$.Undefined&&I.next!==$.Undefined){var D=I.prev;D.next=I.next,I.next.prev=D}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},K.prototype.iterator=function(){var I,D=this._first;return{next:function(){return D===$.Undefined?ne.c:(I?I.value=D.element:I={done:!1,value:D.element},D=D.next,I)}}},K.prototype.toArray=function(){for(var I=[],D=this._first;D!==$.Undefined;D=D.next)I.push(D.element);return I},K}()},"55Ip":function(yt,Ee,Q){"use strict";Q.d(Ee,"a",function(){return s}),Q.d(Ee,"b",function(){return w});var ne=Q("Ty5D"),$=Q("dI71"),M=Q("q1tI"),K=Q.n(M),I=Q("YS25"),D=Q("17x9"),j=Q.n(D),N=Q("wx14"),_=Q("zLVn"),k=Q("9R94"),d=function(y){Object($.a)(c,y);function c(){for(var L,S=arguments.length,A=new Array(S),P=0;P<S;P++)A[P]=arguments[P];return L=y.call.apply(y,[this].concat(A))||this,L.history=Object(I.a)(L.props),L}var u=c.prototype;return u.render=function(){return K.a.createElement(ne.c,{history:this.history,children:this.props.children})},c}(K.a.Component),f=function(y){Object($.a)(c,y);function c(){for(var L,S=arguments.length,A=new Array(S),P=0;P<S;P++)A[P]=arguments[P];return L=y.call.apply(y,[this].concat(A))||this,L.history=Object(I.b)(L.props),L}var u=c.prototype;return u.render=function(){return K.a.createElement(ne.c,{history:this.history,children:this.props.children})},c}(K.a.Component),T=function(c,u){return typeof c=="function"?c(u):c},m=function(c,u){return typeof c=="string"?Object(I.c)(c,null,null,u):c},p=function(c){return c},b=K.a.forwardRef;typeof b=="undefined"&&(b=p);function o(y){return!!(y.metaKey||y.altKey||y.ctrlKey||y.shiftKey)}var i=b(function(y,c){var u=y.innerRef,L=y.navigate,S=y.onClick,A=Object(_.a)(y,["innerRef","navigate","onClick"]),P=A.target,W=Object(N.a)({},A,{onClick:function(Z){try{S&&S(Z)}catch(z){throw Z.preventDefault(),z}!Z.defaultPrevented&&Z.button===0&&(!P||P==="_self")&&!o(Z)&&(Z.preventDefault(),L())}});return p!==b?W.ref=c||u:W.ref=u,K.a.createElement("a",W)}),s=b(function(y,c){var u=y.component,L=u===void 0?i:u,S=y.replace,A=y.to,P=y.innerRef,W=Object(_.a)(y,["component","replace","to","innerRef"]);return K.a.createElement(ne.e.Consumer,null,function(V){V||Object(k.a)(!1);var Z=V.history,z=m(T(A,V.location),V.location),F=z?Z.createHref(z):"",te=Object(N.a)({},W,{href:F,navigate:function(){var fe=T(A,V.location),ye=S?Z.replace:Z.push;ye(fe)}});return p!==b?te.ref=c||P:te.innerRef=P,K.a.createElement(L,te)})});if(!1)var l,E;var g=function(c){return c},v=K.a.forwardRef;typeof v=="undefined"&&(v=g);function O(){for(var y=arguments.length,c=new Array(y),u=0;u<y;u++)c[u]=arguments[u];return c.filter(function(L){return L}).join(" ")}var w=v(function(y,c){var u=y["aria-current"],L=u===void 0?"page":u,S=y.activeClassName,A=S===void 0?"active":S,P=y.activeStyle,W=y.className,V=y.exact,Z=y.isActive,z=y.location,F=y.sensitive,te=y.strict,ie=y.style,fe=y.to,ye=y.innerRef,_e=Object(_.a)(y,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return K.a.createElement(ne.e.Consumer,null,function(Le){Le||Object(k.a)(!1);var Ae=z||Le.location,ke=m(T(fe,Ae),Ae),De=ke.pathname,ve=De&&De.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),ue=ve?Object(ne.f)(Ae.pathname,{path:ve,exact:V,sensitive:F,strict:te}):null,Me=!!(Z?Z(ue,Ae):ue),Qe=Me?O(W,A):W,He=Me?Object(N.a)({},ie,{},P):ie,rt=Object(N.a)({"aria-current":Me&&L||null,className:Qe,style:He,to:ke},_e);return g!==v?rt.ref=c||ye:rt.innerRef=ye,K.a.createElement(s,rt)})});if(!1)var C},"746U":function(yt,Ee,Q){"use strict";Q.d(Ee,"d",function(){return $}),Q.d(Ee,"j",function(){return M}),Q.d(Ee,"i",function(){return K}),Q.d(Ee,"h",function(){return I}),Q.d(Ee,"e",function(){return D}),Q.d(Ee,"k",function(){return j}),Q.d(Ee,"l",function(){return N}),Q.d(Ee,"a",function(){return _}),Q.d(Ee,"f",function(){return d}),Q.d(Ee,"g",function(){return f}),Q.d(Ee,"m",function(){return T}),Q.d(Ee,"c",function(){return b}),Q.d(Ee,"b",function(){return o}),Q.d(Ee,"n",function(){return i}),Q.d(Ee,"o",function(){return s});var ne={number:"number",string:"string",undefined:"undefined",object:"object",function:"function"};function $(l){return Array.isArray?Array.isArray(l):!!(l&&typeof l.length===ne.number&&l.constructor===Array)}function M(l){return typeof l===ne.string||l instanceof String}function K(l){return typeof l===ne.object&&l!==null&&!Array.isArray(l)&&!(l instanceof RegExp)&&!(l instanceof Date)}function I(l){return(typeof l===ne.number||l instanceof Number)&&!isNaN(l)}function D(l){return l===!0||l===!1}function j(l){return typeof l===ne.undefined}function N(l){return j(l)||l===null}function _(l,E){if(!l)throw new Error(E?"Unexpected type, expected '"+E+"'":"Unexpected type")}var k=Object.prototype.hasOwnProperty;function d(l){if(!K(l))return!1;for(var E in l)if(k.call(l,E))return!1;return!0}function f(l){return typeof l===ne.function}function T(l,E){for(var g=Math.min(l.length,E.length),v=0;v<g;v++)m(l[v],E[v])}function m(l,E){if(M(E)){if(typeof l!==E)throw new Error("argument does not match constraint: typeof "+E)}else if(f(E)){try{if(l instanceof E)return}catch(g){}if(!N(l)&&l.constructor===E)return;if(E.length===1&&E.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 p(l){for(var E=[],g=Object.getPrototypeOf(l);Object.prototype!==g;)E=E.concat(Object.getOwnPropertyNames(g)),g=Object.getPrototypeOf(g);return E}function b(l){for(var E=[],g=0,v=p(l);g<v.length;g++){var O=v[g];typeof l[O]=="function"&&E.push(O)}return E}function o(l,E){for(var g=function(y){return function(){var c=Array.prototype.slice.call(arguments,0);return E(y,c)}},v={},O=0,w=l;O<w.length;O++){var C=w[O];v[C]=g(C)}return v}function i(l){return l===null?void 0:l}function s(l){return typeof l=="undefined"?null:l}},"7Cbv":function(yt,Ee,Q){"use strict";var ne=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),$=new Uint8Array(16);function M(){if(!ne)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ne($)}var K=/^(?:[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(T){return typeof T=="string"&&K.test(T)}for(var D=I,j=[],N=0;N<256;++N)j.push((N+256).toString(16).substr(1));function _(T){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,p=(j[T[m+0]]+j[T[m+1]]+j[T[m+2]]+j[T[m+3]]+"-"+j[T[m+4]]+j[T[m+5]]+"-"+j[T[m+6]]+j[T[m+7]]+"-"+j[T[m+8]]+j[T[m+9]]+"-"+j[T[m+10]]+j[T[m+11]]+j[T[m+12]]+j[T[m+13]]+j[T[m+14]]+j[T[m+15]]).toLowerCase();if(!D(p))throw TypeError("Stringified UUID is invalid");return p}var k=_;function d(T,m,p){T=T||{};var b=T.random||(T.rng||M)();if(b[6]=b[6]&15|64,b[8]=b[8]&63|128,m){p=p||0;for(var o=0;o<16;++o)m[p+o]=b[o];return m}return k(b)}var f=Ee.a=d},"7ahc":function(yt,Ee,Q){"use strict";Q.d(Ee,"a",function(){return E});var ne=Q("k1fw"),$=Q("0Owb"),M=Q("+L6B"),K=Q("2/Rp"),I=Q("y8nQ"),D=Q("Vl3Y"),j=Q("tJVT"),N=Q("OaEy"),_=Q("2fM7"),k=Q("q1tI"),d=Q.n(k),f=Q("VrN/"),T=Q.n(f),m=Q("p77/"),p=Q.n(m),b=Q("c5Ni"),o=Q.n(b),i=_.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"]};Ee.b=function(g){var v=g.callback,O=g.onCancel,w=Object(k.useState)("python"),C=Object(j.a)(w,2),y=C[0],c=C[1];function u(S){c(l[S][1])}function L(S){v(S)}return d.a.createElement(D.a,Object($.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:L}),d.a.createElement(D.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},d.a.createElement(_.a,{onChange:u},Object.keys(l).map(function(S){return d.a.createElement(i,{key:S,value:S},l[S][0])}))),d.a.createElement(D.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},d.a.createElement(E,{mode:y})),d.a.createElement("div",{className:"flex-container flex-end"},d.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),d.a.createElement(K.a,{type:"ghost",onClick:O},"\u53D6\u6D88")))};function E(g){var v=g.value,O=g.onChange,w=g.mode,C=g.options,y=C===void 0?{}:C,c=Object(k.useRef)(),u=Object(k.useState)(),L=Object(j.a)(u,2),S=L[0],A=L[1];return Object(k.useEffect)(function(){if(S){function P(W){var V=W.getValue();O&&O(V)}return S.on("change",P),function(){S.off("change",P)}}},[S,O]),Object(k.useEffect)(function(){S&&S.setOption("mode",w)},[S,w]),Object(k.useEffect)(function(){S&&((v!==S.getValue()||v==="")&&setTimeout(function(){S.setValue(v||" ")},300))},[S,v]),Object(k.useEffect)(function(){if(c.current&&!S){var P=T.a.fromTextArea(c.current,Object(ne.a)({mode:w,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},y));A(P)}},[c.current,S]),d.a.createElement("div",{className:"my-codemirror-container"},d.a.createElement("textarea",{ref:c}))}},"8EBN":function(yt,Ee,Q){(function(ne){ne(Q("VrN/"))})(function(ne){"use strict";ne.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;$<ne.modeInfo.length;$++){var M=ne.modeInfo[$];M.mimes&&(M.mime=M.mimes[0])}ne.findModeByMIME=function(K){K=K.toLowerCase();for(var I=0;I<ne.modeInfo.length;I++){var D=ne.modeInfo[I];if(D.mime==K)return D;if(D.mimes){for(var j=0;j<D.mimes.length;j++)if(D.mimes[j]==K)return D}}if(/\+xml$/.test(K))return ne.findModeByMIME("application/xml");if(/\+json$/.test(K))return ne.findModeByMIME("application/json")},ne.findModeByExtension=function(K){K=K.toLowerCase();for(var I=0;I<ne.modeInfo.length;I++){var D=ne.modeInfo[I];if(D.ext){for(var j=0;j<D.ext.length;j++)if(D.ext[j]==K)return D}}},ne.findModeByFileName=function(K){for(var I=0;I<ne.modeInfo.length;I++){var D=ne.modeInfo[I];if(D.file&&D.file.test(K))return D}var j=K.lastIndexOf("."),N=j>-1&&K.substring(j+1,K.length);if(N)return ne.findModeByExtension(N)},ne.findModeByName=function(K){K=K.toLowerCase();for(var I=0;I<ne.modeInfo.length;I++){var D=ne.modeInfo[I];if(D.name.toLowerCase()==K)return D;if(D.alias){for(var j=0;j<D.alias.length;j++)if(D.alias[j].toLowerCase()==K)return D}}}})},"8HAY":function(yt,Ee,Q){"use strict";Q.d(Ee,"a",function(){return D}),Q.d(Ee,"b",function(){return j});var ne=Q("pmY6"),$=Q("MI8n"),M=function(){var N=function(_,k){return N=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,f){d.__proto__=f}||function(d,f){for(var T in f)f.hasOwnProperty(T)&&(d[T]=f[T])},N(_,k)};return function(_,k){N(_,k);function d(){this.constructor=_}_.prototype=k===null?Object.create(k):(d.prototype=k.prototype,new d)}}(),K=function(N,_,k,d){function f(T){return T instanceof k?T:new k(function(m){m(T)})}return new(k||(k=Promise))(function(T,m){function p(i){try{o(d.next(i))}catch(s){m(s)}}function b(i){try{o(d.throw(i))}catch(s){m(s)}}function o(i){i.done?T(i.value):f(i.value).then(p,b)}o((d=d.apply(N,_||[])).next())})},I=function(N,_){var k={label:0,sent:function(){if(T[0]&1)throw T[1];return T[1]},trys:[],ops:[]},d,f,T,m;return m={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function p(o){return function(i){return b([o,i])}}function b(o){if(d)throw new TypeError("Generator is already executing.");for(;k;)try{if(d=1,f&&(T=o[0]&2?f.return:o[0]?f.throw||((T=f.return)&&T.call(f),0):f.next)&&!(T=T.call(f,o[1])).done)return T;(f=0,T)&&(o=[o[0]&2,T.value]);switch(o[0]){case 0:case 1:T=o;break;case 4:return k.label++,{value:o[1],done:!1};case 5:k.label++,f=o[1],o=[0];continue;case 7:o=k.ops.pop(),k.trys.pop();continue;default:if(!(T=k.trys,T=T.length>0&&T[T.length-1])&&(o[0]===6||o[0]===2)){k=0;continue}if(o[0]===3&&(!T||o[1]>T[0]&&o[1]<T[3])){k.label=o[1];break}if(o[0]===6&&k.label<T[1]){k.label=T[1],T=o;break}if(T&&k.label<T[2]){k.label=T[2],k.ops.push(o);break}T[2]&&k.ops.pop(),k.trys.pop();continue}o=_.call(N,k)}catch(i){o=[6,i],f=0}finally{d=T=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}},D=function(N){M(_,N);function _(k,d,f,T,m){d===void 0&&(d=""),f===void 0&&(f=""),T===void 0&&(T=!0);var p=N.call(this)||this;return p._onDidChange=p._register(new $.a),p.onDidChange=p._onDidChange.event,p._enabled=!0,p._checked=!1,p._id=k,p._label=d,p._cssClass=f,p._enabled=T,p._actionCallback=m,p}return Object.defineProperty(_.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(_.prototype,"label",{get:function(){return this._label},set:function(k){this._setLabel(k)},enumerable:!0,configurable:!0}),_.prototype._setLabel=function(k){this._label!==k&&(this._label=k,this._onDidChange.fire({label:k}))},Object.defineProperty(_.prototype,"tooltip",{get:function(){return this._tooltip||""},set:function(k){this._setTooltip(k)},enumerable:!0,configurable:!0}),_.prototype._setTooltip=function(k){this._tooltip!==k&&(this._tooltip=k,this._onDidChange.fire({tooltip:k}))},Object.defineProperty(_.prototype,"class",{get:function(){return this._cssClass},set:function(k){this._setClass(k)},enumerable:!0,configurable:!0}),_.prototype._setClass=function(k){this._cssClass!==k&&(this._cssClass=k,this._onDidChange.fire({class:k}))},Object.defineProperty(_.prototype,"enabled",{get:function(){return this._enabled},set:function(k){this._setEnabled(k)},enumerable:!0,configurable:!0}),_.prototype._setEnabled=function(k){this._enabled!==k&&(this._enabled=k,this._onDidChange.fire({enabled:k}))},Object.defineProperty(_.prototype,"checked",{get:function(){return this._checked},set:function(k){this._setChecked(k)},enumerable:!0,configurable:!0}),_.prototype._setChecked=function(k){this._checked!==k&&(this._checked=k,this._onDidChange.fire({checked:k}))},_.prototype.run=function(k,d){return this._actionCallback?this._actionCallback(k):Promise.resolve(!0)},_}(ne.a),j=function(N){M(_,N);function _(){var k=N!==null&&N.apply(this,arguments)||this;return k._onDidBeforeRun=k._register(new $.a),k.onDidBeforeRun=k._onDidBeforeRun.event,k._onDidRun=k._register(new $.a),k.onDidRun=k._onDidRun.event,k}return _.prototype.run=function(k,d){return K(this,void 0,void 0,function(){var f,T;return I(this,function(m){switch(m.label){case 0:if(!k.enabled)return[2,Promise.resolve(null)];this._onDidBeforeRun.fire({action:k}),m.label=1;case 1:return m.trys.push([1,3,,4]),[4,this.runAction(k,d)];case 2:return f=m.sent(),this._onDidRun.fire({action:k,result:f}),[3,4];case 3:return T=m.sent(),this._onDidRun.fire({action:k,error:T}),[3,4];case 4:return[2]}})})},_.prototype.runAction=function(k,d){var f=d?k.run(d):k.run();return Promise.resolve(f)},_}(ne.a)},"8JLL":function(yt,Ee,Q){yt.exports={flex_box_center:"flex_box_center___15KPT",flex_space_between:"flex_space_between___1QiSE",flex_box_vertical_center:"flex_box_vertical_center___3bNXy",flex_box_center_end:"flex_box_center_end___1hLE4",flex_box_column:"flex_box_column___3CCm3",reply:"reply___eY1t0",replyList:"replyList___3g6Og",comment:"comment___LHpQl",content:"content___XWl90",commentItem:"commentItem___2Y_u_"}},"8hTe":function(yt,Ee,Q){yt.exports={button:"button___1wy9m"}},"9Bee":function(yt,Ee,Q){"use strict";var ne=Q("DYRE"),$=Q("zeV3"),M=Q("+L6B"),K=Q("2/Rp"),I=Q("k1fw"),D=Q("9og8"),j=Q("tJVT"),N=Q("WmNS"),_=Q.n(N),k=Q("q1tI"),d=Q.n(k),f=Q("vg9a"),T=Q("DlQD"),m=Q.n(T),p=Q("rUJ1");function b(H,h){var x=H.match(/^(\s+)(?:```)/);if(x===null)return h;var B=x[1];return h.split(`
|
|
`).map(function(X){var G=X.match(/^\s+/);if(G===null)return X;var me=Object(j.a)(G,1),We=me[0];return We.length>=B.length?X.slice(B.length):X}).join(`
|
|
`)}var o=[],i=["<ul>"],s=new m.a.Renderer,l=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function E(){o.length=0,i=["<ul>"]}var g={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function v(H,h,x,B){if(h>=H.length||H[h].level<=x)return h;var X=H[h];B.push("<li><a href='#"+X.anchor+"'>"+X.text+"</a>"),h++;var G=[];return h=v(H,h,X.level,G),G.length>0&&(B.push("<ul>"),G.forEach(function(me){B.push(me)}),B.push("</ul>")),B.push("</li>"),h=v(H,h,x,B),h}function O(){return v(o,0,0,i),i.push("</ul>"),i.join("")}var w={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 B=x[0],X=b(B,x[3]||""),G=x[2]?x[2].trim():x[2];if(["latex","katex","math"].indexOf(G)>=0){var me=c(),We=X;X=me,u[me]={type:"block",expression:We}}return{type:"code",raw:B,lang:G,text:X}}}},C=/(?:\${2})([^\n`]+?)(?:\${2})/gi,y=0,c=function(){return"__special_katext_id_".concat(y++,"__")},u={};function L(){return u}function S(){y=0,u={}}function A(H){return H=H.replace(C,function(h,x){var B=c();return u[B]={type:"inline",expression:x},B}),H}var P=s.listitem;s.listitem=function(H){return P(A(H))};var W=s.paragraph;s.paragraph=function(H){return W(A(H))};var V=s.tablecell;s.tablecell=function(H,h){return V(A(H),h)},s.code=function(H,h,x){var B=(h||"").match(/\S*/)[0];return B?["latex","katex","math"].indexOf(B)>=0?"<p class='editormd-tex'>".concat(H,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(h,'">').concat(x?H:Object(p.escape)(H,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(x?H:Object(p.escape)(H,!0))+"</code></pre>"},s.heading=function(H,h,x){var B=this.options.headerPrefix+x.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return o.push({anchor:B,level:h,text:H}),"<h"+h+' id="'+B+'">'+H+"</h"+h+">"},m.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),m.a.use({tokenizer:w,renderer:s});var Z=m.a,z=Q("SJMd"),F=Q("ulZh"),te=Q.n(F),ie=Q("m3rI"),fe=Q("Oy/b"),ye=Q("p5ED"),_e=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 Le=function(H,h){return(Le=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(x,B){x.__proto__=B}||function(x,B){for(var X in B)Object.prototype.hasOwnProperty.call(B,X)&&(x[X]=B[X])})(H,h)};function Ae(H,h){function x(){this.constructor=H}Le(H,h),H.prototype=h===null?Object.create(h):(x.prototype=h.prototype,new x)}function ke(H,h,x,B){return new(x||(x=Promise))(function(X,G){function me(gt){try{nt(B.next(gt))}catch(Ve){G(Ve)}}function We(gt){try{nt(B.throw(gt))}catch(Ve){G(Ve)}}function nt(gt){var Ve;gt.done?X(gt.value):(Ve=gt.value,Ve instanceof x?Ve:new x(function(Ot){Ot(Ve)})).then(me,We)}nt((B=B.apply(H,h||[])).next())})}function De(H,h){var x,B,X,G,me={label:0,sent:function(){if(1&X[0])throw X[1];return X[1]},trys:[],ops:[]};return G={next:We(0),throw:We(1),return:We(2)},typeof Symbol=="function"&&(G[Symbol.iterator]=function(){return this}),G;function We(nt){return function(gt){return function(Ve){if(x)throw new TypeError("Generator is already executing.");for(;me;)try{if(x=1,B&&(X=2&Ve[0]?B.return:Ve[0]?B.throw||((X=B.return)&&X.call(B),0):B.next)&&!(X=X.call(B,Ve[1])).done)return X;switch(B=0,X&&(Ve=[2&Ve[0],X.value]),Ve[0]){case 0:case 1:X=Ve;break;case 4:return me.label++,{value:Ve[1],done:!1};case 5:me.label++,B=Ve[1],Ve=[0];continue;case 7:Ve=me.ops.pop(),me.trys.pop();continue;default:if(!(X=me.trys,(X=X.length>0&&X[X.length-1])||Ve[0]!==6&&Ve[0]!==2)){me=0;continue}if(Ve[0]===3&&(!X||Ve[1]>X[0]&&Ve[1]<X[3])){me.label=Ve[1];break}if(Ve[0]===6&&me.label<X[1]){me.label=X[1],X=Ve;break}if(X&&me.label<X[2]){me.label=X[2],me.ops.push(Ve);break}X[2]&&me.ops.pop(),me.trys.pop();continue}Ve=h.call(H,me)}catch(Ot){Ve=[6,Ot],B=0}finally{x=X=0}if(5&Ve[0])throw Ve[1];return{value:Ve[0]?Ve[1]:void 0,done:!0}}([nt,gt])}}}function ve(){for(var H=0,h=0,x=arguments.length;h<x;h++)H+=arguments[h].length;var B=Array(H),X=0;for(h=0;h<x;h++)for(var G=arguments[h],me=0,We=G.length;me<We;me++,X++)B[X]=G[me];return B}var ue=function(){function H(){}return H.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},H.setAttributes=function(h,x){for(var B=0,X=x;B<X.length;B++){var G=X[B],me=G[0],We=G[1];h.setAttribute(me,We)}},H.createRect=function(h,x,B){var X=document.createElementNS("http://www.w3.org/2000/svg","rect");return X.setAttribute("width",h.toString()),X.setAttribute("height",x.toString()),B&&H.setAttributes(X,B),X},H.createLine=function(h,x,B,X,G){var me=document.createElementNS("http://www.w3.org/2000/svg","line");return me.setAttribute("x1",h.toString()),me.setAttribute("y1",x.toString()),me.setAttribute("x2",B.toString()),me.setAttribute("y2",X.toString()),G&&H.setAttributes(me,G),me},H.createPolygon=function(h,x){var B=document.createElementNS("http://www.w3.org/2000/svg","polygon");return B.setAttribute("points",h),x&&H.setAttributes(B,x),B},H.createCircle=function(h,x){var B=document.createElementNS("http://www.w3.org/2000/svg","circle");return B.setAttribute("cx",(h/2).toString()),B.setAttribute("cy",(h/2).toString()),B.setAttribute("r",h.toString()),x&&H.setAttributes(B,x),B},H.createEllipse=function(h,x,B){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()),B&&H.setAttributes(X,B),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,B,X,G,me,We){var nt=document.createElementNS("http://www.w3.org/2000/svg","marker");return H.setAttributes(nt,[["id",h],["orient",x],["markerWidth",B.toString()],["markerHeight",X.toString()],["refX",G.toString()],["refY",me.toString()]]),nt.appendChild(We),nt},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 B=document.createElementNS("http://www.w3.org/2000/svg","tspan");return B.textContent=h,x&&H.setAttributes(B,x),B},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 B=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return B.x=h,B.y=x,B},H.createPath=function(h,x){var B=document.createElementNS("http://www.w3.org/2000/svg","path");return B.setAttribute("d",h),x&&H.setAttributes(B,x),B},H}(),Me=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}(),Qe=function(){function H(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return H.prototype.rasterize=function(h,x,B){var X=this;return new Promise(function(G){var me=B!==void 0?B:document.createElement("canvas");h===null&&(X.markersOnly=!0,X.naturalSize=!1);var We=document.createElementNS("http://www.w3.org/2000/svg","svg");We.setAttribute("xmlns","http://www.w3.org/2000/svg"),We.setAttribute("width",x.width.baseVal.valueAsString),We.setAttribute("height",x.height.baseVal.valueAsString),We.setAttribute("viewBox","0 0 "+x.viewBox.baseVal.width.toString()+" "+x.viewBox.baseVal.height.toString()),We.innerHTML=x.innerHTML,X.naturalSize===!0?(We.width.baseVal.value=h.naturalWidth,We.height.baseVal.value=h.naturalHeight):X.width!==void 0&&X.height!==void 0&&(We.width.baseVal.value=X.width,We.height.baseVal.value=X.height),me.width=We.width.baseVal.value,me.height=We.height.baseVal.value;var nt=We.outerHTML,gt=me.getContext("2d");X.markersOnly!==!0&>.drawImage(h,0,0,me.width,me.height);var Ve=window.URL,Ot=new Image(me.width,me.height);Ot.setAttribute("crossOrigin","anonymous");var jt=new Blob([nt],{type:"image/svg+xml"}),or=Ve.createObjectURL(jt);Ot.onload=function(){gt.drawImage(Ot,0,0),Ve.revokeObjectURL(or);var Xr=me.toDataURL(X.imageType,X.imageQuality);G(Xr)},Ot.src=or})},H}(),He=function(){},rt=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 oe("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new oe("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new oe("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new de("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new de("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}(),oe=function(H,h){this.selector=H,this.style=h},de=function(H,h){this.localName=H,this.style=h},xe=function(){function H(h,x,B,X,G){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=h,this.displayMode=x,this.markerItems=B,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 B=document.createElement("div");B.className=this.toolbarBlockStyleClass.name,B.style.whiteSpace="nowrap",this.uiContainer.appendChild(B),this.addActionButton(B,'<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(B,'<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(B,'<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(B,'<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(B,'<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(B,'<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(B,'<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(B,'<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 me=document.createElement("div");me.className=""+x.toolbarButtonStyleClass.name,me.setAttribute("data-type-name",G.typeName),me.innerHTML=G.icon,me.addEventListener("click",function(){x.markerToolbarButtonClicked(me,G)}),x.buttons.push(me),x.markerButtons.push(me)}),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,B){var X=this,G=document.createElement("div");switch(G.className=""+this.toolbarButtonStyleClass.name,G.innerHTML=x,G.setAttribute("data-action",B),G.addEventListener("click",function(){X.actionToolbarButtonClicked(G,B)}),B){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 de("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 de("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new de("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new de("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 de("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var h=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new de("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 de("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new de("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new oe("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new oe("."+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(B){return B("marker",x)}),this.markerButtonOverflowBlock.style.display="none"},H.prototype.actionToolbarButtonClicked=function(h,x){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(B){return B("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(B){return B.getAttribute("data-type-name")===h});x&&this.setActiveButton(x)},H.prototype.setCurrentMarker=function(h){var x=this;this.currentMarker=h,this.buttons.filter(function(B){return/delete|notes/.test(B.getAttribute("data-action"))}).forEach(function(B){x.currentMarker===void 0?(B.style.fillOpacity="0.4",B.style.pointerEvents="none"):(B.style.fillOpacity="1",B.style.pointerEvents="all")})},H}(),Re=function(){function H(h,x,B,X){this.panels=[],this.panelButtons=[],this.markerjsContainer=h,this.displayMode=x,this.uiStyleSettings=B,this.styles=X,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return H.prototype.addStyles=function(){var h;this.toolboxStyleClass=this.styles.addClass(new de("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 de("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var x=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new de("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new de("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new de("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 de("toolbox-panel-row_colors",`
|
|
background-color: `+((h=this.uiStyleSettings.toolboxBackgroundColor)!==null&&h!==void 0?h:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new de("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 de("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new de("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new oe("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new oe("."+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,B,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+" "+((B=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&B!==void 0?B:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(G){var me;G.uiStyleSettings=X.uiStyleSettings;var We=document.createElement("div");We.className=X.toolboxButtonStyleClass.name+" "+((me=X.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&me!==void 0?me:X.toolboxButtonStyleColorsClass.name),We.innerHTML=G.icon,We.title=G.title,We.addEventListener("click",function(){X.panelButtonClick(G)}),X.panelButtons.push(We),X.buttonRow.appendChild(We)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},H.prototype.panelButtonClick=function(h){var x=this,B=-1;if(h!==this.activePanel){B=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,me){var We,nt;G.className=x.toolboxButtonStyleClass.name+" "+(me===B?""+((We=x.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&We!==void 0?We:x.toolboxActiveButtonStyleColorsClass.name):""+((nt=x.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&nt!==void 0?nt:x.toolboxButtonStyleColorsClass.name))})},H}(),Ie=function(H,h){this.title=H,this.icon=h},Ne=function(H){function h(x,B,X,G){var me=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 me.colors=[],me.addTransparent=!1,me.colorBoxes=[],me.colors=B,me.currentColor=X,me.setCurrentColor=me.setCurrentColor.bind(me),me.getColorBox=me.getColorBox.bind(me),me}return Ae(h,H),h.prototype.getUi=function(){var x=this,B=document.createElement("div");return B.style.overflow="hidden",B.style.whiteSpace="nowrap",this.colors.forEach(function(X){var G=x.getColorBox(X);B.appendChild(G),x.colorBoxes.push(G)}),B},h.prototype.getColorBox=function(x){var B=this,X=this.uiStyleSettings.toolbarHeight/4,G=this.uiStyleSettings.toolbarHeight-X,me=document.createElement("div");me.style.display="inline-block",me.style.boxSizing="content-box",me.style.width=G-2+"px",me.style.height=G-2+"px",me.style.padding="1px",me.style.marginRight="2px",me.style.marginBottom="2px",me.style.borderWidth="2px",me.style.borderStyle="solid",me.style.borderRadius=(G+2)/2+"px",me.style.borderColor=x===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",me.addEventListener("click",function(){B.setCurrentColor(x,me)});var We=document.createElement("div");return We.style.display="inline-block",We.style.width=G-2+"px",We.style.height=G-2+"px",We.style.backgroundColor=x,We.style.borderRadius=G/2+"px",x==="transparent"&&(We.style.fill=this.uiStyleSettings.toolboxAccentColor,We.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>`),me.appendChild(We),me},h.prototype.setCurrentColor=function(x,B){var X=this;this.currentColor=x,this.colorBoxes.forEach(function(G){G.style.borderColor=G===B?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(x)},h}(Ie),Ge=function(){function H(h,x,B){this._state="new",this._isSelected=!1,this._container=h,this._overlayContainer=x,this.globalSettings=B,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}(),ze=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}(),ut=function(){function H(){this.GRIP_SIZE=10,this.visual=ue.createGroup(),this.visual.appendChild(ue.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(ue.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}(),Ke=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}(),Be=function(H){function h(x,B,X){var G=H.call(this,x,B,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(ue.createTransform()),G.setupControlBox(),G}return Ae(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 B=ue.createTransform();this._visual.transform.baseVal.appendItem(B)},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,B){H.prototype.pointerDown.call(this,x,B),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(B),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(B)){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 me=this.container.transform.baseVal.getItem(0);me.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(me,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},h.prototype.pointerUp=function(x){var B=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",B==="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 B=this.unrotatePoint(x);this.state==="creating"?this.resize(x):this.state==="move"?(this.left=this.manipulationStartLeft+(B.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(B.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(B):this.state==="rotate"&&this.rotate(x)},h.prototype.resize=function(x){var B=this.manipulationStartLeft,X=this.manipulationStartWidth,G=this.manipulationStartTop,me=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:B=this.manipulationStartLeft+x.x-this.manipulationStartX,X=this.manipulationStartWidth+this.manipulationStartLeft-B;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,me=this.manipulationStartHeight+this.manipulationStartTop-G;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:me=this.manipulationStartHeight+x.y-this.manipulationStartY}X>=0?(this.left=B,this.width=X):(this.left=B+X,this.width=-X),me>=0?(this.top=G,this.height=me):(this.top=G+me,this.height=-me),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 B=Math.sign(x.x-this.centerX);this.rotationAngle=180*Math.atan((x.y-this.centerY)/(x.x-this.centerX))/Math.PI+90*B,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 B=this.container.getCTM(),X=ue.createPoint(x.x,x.y);return{x:(X=X.matrixTransform(B)).x,y:X.y}},h.prototype.unrotatePoint=function(x){if(this.rotationAngle===0)return x;var B=this.container.getCTM();B=B.inverse();var X=ue.createPoint(x.x,x.y);return{x:(X=X.matrixTransform(B)).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=ue.createGroup();var x=ue.createTransform();x.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(x),this.container.appendChild(this.controlBox),this.controlRect=ue.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=ue.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 ze,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 ut;return x.visual.transform.baseVal.appendItem(ue.createTransform()),this.controlBox.appendChild(x.visual),x},h.prototype.positionGrips=function(){var x=this.controlGrips.topLeft.GRIP_SIZE,B=-x/2,X=B,G=(this.width+this.CB_DISTANCE)/2-x/2,me=(this.height+this.CB_DISTANCE)/2-x/2,We=this.height+this.CB_DISTANCE-x/2,nt=this.width+this.CB_DISTANCE-x/2;this.positionGrip(this.controlGrips.topLeft.visual,B,X),this.positionGrip(this.controlGrips.topCenter.visual,G,X),this.positionGrip(this.controlGrips.topRight.visual,nt,X),this.positionGrip(this.controlGrips.centerLeft.visual,B,me),this.positionGrip(this.controlGrips.centerRight.visual,nt,me),this.positionGrip(this.controlGrips.bottomLeft.visual,B,We),this.positionGrip(this.controlGrips.bottomCenter.visual,G,We),this.positionGrip(this.controlGrips.bottomRight.visual,nt,We),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,G,X-3*this.CB_DISTANCE)},h.prototype.positionGrip=function(x,B,X){var G=x.transform.baseVal.getItem(0);G.setTranslate(B,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:Ke.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:Ke.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 B=x;this.left=B.left,this.top=B.top,this.width=B.width,this.height=B.height,this.rotationAngle=B.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(Ke.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,B.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(Ke.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,B.containerTransformMatrix))},h.prototype.scale=function(x,B){H.prototype.scale.call(this,x,B);var X=this.rotatePoint({x:this.left,y:this.top}),G=this.unrotatePoint({x:X.x*x,y:X.y*B});this.left=G.x,this.top=G.y,this.width=this.width*x,this.height=this.height*B,this.adjustControlBox()},h}(Ge),Xe=function(H){function h(x,B,X){var G=H.call(this,x,B,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 Ae(h,H),h.prototype.ownsTarget=function(x){return!(!H.prototype.ownsTarget.call(this,x)&&x!==this.visual)},h.prototype.createVisual=function(){this.visual=ue.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,B){H.prototype.pointerDown.call(this,x,B),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),ue.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&&ue.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(x),this.stateChanged()},h.prototype.setFillColor=function(x){this.fillColor=x,this.visual&&ue.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},h.prototype.setStrokeWidth=function(x){this.strokeWidth=x,this.visual&&ue.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},h.prototype.setStrokeDasharray=function(x){this.strokeDasharray=x,this.visual&&ue.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 B=x;this.fillColor=B.fillColor,this.strokeColor=B.strokeColor,this.strokeWidth=B.strokeWidth,this.strokeDasharray=B.strokeDasharray,this.opacity=B.opacity,this.createVisual(),H.prototype.restoreState.call(this,x),this.setSize()},h.prototype.scale=function(x,B){H.prototype.scale.call(this,x,B),this.setSize()},h.title="Rectangle marker",h}(Be),tt=function(H){function h(x,B,X,G){var me=H.call(this,x,G||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return me.widths=[],me.widthBoxes=[],me.widths=B,me.currentWidth=X,me.setCurrentWidth=me.setCurrentWidth.bind(me),me}return Ae(h,H),h.prototype.getUi=function(){var x=this,B=document.createElement("div");return B.style.display="flex",B.style.overflow="hidden",B.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)}),B.appendChild(G);var me=document.createElement("div");me.innerText=X.toString(),me.style.marginRight="5px",G.appendChild(me);var We=document.createElement("div");We.style.minHeight="20px",We.style.flexGrow="2",We.style.display="flex",We.style.alignItems="center";var nt=document.createElement("hr");nt.style.minWidth="20px",nt.style.border="0px",nt.style.borderTop=X+"px solid "+x.uiStyleSettings.toolboxColor,nt.style.flexGrow="2",We.appendChild(nt),G.appendChild(We),x.widthBoxes.push(G)}),B},h.prototype.setCurrentWidth=function(x,B){var X=this;this.currentWidth=x,this.widthBoxes.forEach(function(G){G.style.borderColor=G===B?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},h}(Ie),Ze=function(H){function h(x,B,X,G){var me=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 me.styles=[],me.styleBoxes=[],me.styles=B,me.currentStyle=X,me.setCurrentStyle=me.setCurrentStyle.bind(me),me}return Ae(h,H),h.prototype.getUi=function(){var x=this,B=document.createElement("div");return B.style.display="flex",B.style.overflow="hidden",B.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)}),B.appendChild(G);var me=document.createElement("div");me.style.minHeight="20px",me.style.flexGrow="2",me.style.overflow="hidden";var We=`<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>`;me.innerHTML=We,G.appendChild(me),x.styleBoxes.push(G)}),B},h.prototype.setCurrentStyle=function(x,B){var X=this;this.currentStyle=x,this.styleBoxes.forEach(function(G){G.style.borderColor=G===B?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},h}(Ie),it=function(H){function h(x,B,X){var G=H.call(this,x,B,X)||this;return G.strokeColor=X.defaultColor,G.strokeWidth=X.defaultStrokeWidth,G.strokeDasharray=X.defaultStrokeDasharray,G.strokePanel=new Ne("Line color",X.defaultColorSet,X.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.strokeWidthPanel=new tt("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new Ze("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G}return Ae(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}(Xe),we=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},Ye=function(H){function h(x,B,X){var G=H.call(this,x,B,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 Ae(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,B){H.prototype.pointerDown.call(this,x,B),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(B)?this.activeGrip=this.grip1:this.grip2.ownsTarget(B)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},h.prototype.pointerUp=function(x){var B=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",B==="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=ue.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 ut;return x.visual.transform.baseVal.appendItem(ue.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,B,X){var G=x.transform.baseVal.getItem(0);G.setTranslate(B,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 B=x;this.x1=B.x1,this.y1=B.y1,this.x2=B.x2,this.y2=B.y2},h.prototype.scale=function(x,B){H.prototype.scale.call(this,x,B),this.x1=this.x1*x,this.y1=this.y1*B,this.x2=this.x2*x,this.y2=this.y2*B,this.adjustVisual(),this.adjustControlBox()},h}(Ge),at=function(H){function h(x,B,X){var G=H.call(this,x,B,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 Ne("Line color",X.defaultColorSet,X.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.strokeWidthPanel=new tt("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new Ze("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G}return Ae(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=ue.createGroup(),this.selectorLine=ue.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=ue.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,B){H.prototype.pointerDown.call(this,x,B),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()),ue.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),ue.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),ue.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 B=x;this.strokeColor=B.strokeColor,this.strokeWidth=B.strokeWidth,this.strokeDasharray=B.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}(Ye),Oe=function(H){function h(x,B,X,G){var me=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 me.fonts=[],me.fontBoxes=[],me.fonts=B,me.currentFont=X,me.setCurrentFont=me.setCurrentFont.bind(me),me}return Ae(h,H),h.prototype.getUi=function(){var x=this,B=document.createElement("div");return B.style.overflow="hidden",B.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)}),B.appendChild(G);var me=document.createElement("div");me.style.display="flex",me.style.minHeight="20px",me.style.flexGrow="2",me.style.fontFamily=X,me.style.overflow="hidden";var We=document.createElement("div");We.style.whiteSpace="nowrap",We.style.overflow="hidden",We.style.textOverflow="ellipsis",We.innerHTML="The quick brown fox jumps over the lazy dog",me.appendChild(We),G.appendChild(me),x.fontBoxes.push(G)}),B},h.prototype.setCurrentFont=function(x,B){var X=this;this.currentFont=x,this.fontBoxes.forEach(function(G){G.style.borderColor=G===B?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},h}(Ie),je=function(H){function h(x,B,X){var G=H.call(this,x,B,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 Ne("Color",X.defaultColorSet,X.defaultColor),G.colorPanel.onColorChanged=G.setColor,G.fontFamilyPanel=new Oe("Font",X.defaultFontFamilies,X.defaultFontFamily),G.fontFamilyPanel.onFontChanged=G.setFont,G}return Ae(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 B=!1;return this.textElement.childNodes.forEach(function(X){X===x&&(B=!0)}),B},h.prototype.createVisual=function(){this.visual=ue.createGroup(),this.bgRectangle=ue.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=ue.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(ue.createTransform()),this.textElement.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},h.prototype.pointerDown=function(x,B){H.prototype.pointerDown.call(this,x,B),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(B){x.textElement.appendChild(ue.createTSpan(B.trim()===""?" ":B.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},h.prototype.getTextScale=function(){var x=this.textElement.getBBox(),B=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;B=Math.min(X,G)}return B},h.prototype.getTextPosition=function(x){var B=this.textElement.getBBox(),X=0,G=0;return B.width>0&&B.height>0&&(X=(this.width-B.width*x)/2,G=this.height/2-B.height*x/2),{x:X,y:G}},h.prototype.sizeText=function(){var x=this.textElement.getBBox(),B=this.getTextScale(),X=this.getTextPosition(B);X.y-=x.y*B,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+X.x+"px, "+X.y+"px) scale("+B+", "+B+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(X.x,X.y),this.textElement.transform.baseVal.getItem(1).setScale(B,B))},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&&(ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),ue.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},h.prototype.pointerUp=function(x){var B=this.state;B==="creating"&&(this._suppressMarkerCreateEvent=!0),H.prototype.pointerUp.call(this,x),this.setSize(),(B==="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(B){B.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var B=Number.parseFloat(x.textEditor.style.fontSize);x.textEditor.clientWidth>=Number.parseInt(x.textEditor.style.maxWidth)&&B>.9;)B-=.1,x.textEditor.style.fontSize=Math.max(B,.9)+"em"}),this.textEditor.addEventListener("keyup",function(B){B.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(B){if(B.clipboardData){var X=B.clipboardData.getData("text"),G=window.getSelection();if(!G.rangeCount)return!1;G.deleteFromDocument(),G.getRangeAt(0).insertNode(document.createTextNode(X)),B.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(),B=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};B.x-=G.x/2,B.y-=G.y/2,this.textEditor.style.top=B.y+"px",this.textEditor.style.left=B.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-B.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,B){H.prototype.dblClick.call(this,x,B),this.showTextEditor()},h.prototype.setColor=function(x){this.textElement&&ue.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&&ue.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 B=x;this.color=B.color,this.fontFamily=B.fontFamily,this.padding=B.padding,this.text=B.text,this.createVisual(),H.prototype.restoreState.call(this,x),this.setSize()},h.prototype.scale=function(x,B){H.prototype.scale.call(this,x,B),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}(Be),ge=function(H){function h(x,B,X){var G=H.call(this,x,B,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 Ne("Color",X.defaultColorSet,X.defaultColor),G.colorPanel.onColorChanged=G.setColor,G.lineWidthPanel=new tt("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),G.lineWidthPanel.onWidthChanged=G.setLineWidth,G}return Ae(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=ue.createGroup(),this.drawingImage=ue.createImage(),this.visual.appendChild(this.drawingImage);var x=ue.createTransform();this.visual.transform.baseVal.appendItem(x),this.addMarkerVisualToContainer(this.visual)},h.prototype.pointerDown=function(x,B){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,B)},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),ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),ue.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),B=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],X=B[0],G=B[1],me=B[2],We=B[3],nt=!1,gt=0;gt<this.canvasElement.height;gt++)for(var Ve=0;Ve<this.canvasElement.width;Ve++)x.data[gt*this.canvasElement.width*4+4*Ve+3]>0&&(nt=!0,gt<G&&(G=gt),Ve<X&&(X=Ve),gt>We&&(We=gt),Ve>me&&(me=Ve));if(nt){this.left=X/this.pixelRatio,this.top=G/this.pixelRatio,this.width=(me-X)/this.pixelRatio,this.height=(We-G)/this.pixelRatio;var Ot=document.createElement("canvas");Ot.width=me-X,Ot.height=We-G,Ot.getContext("2d").putImageData(this.canvasContext.getImageData(X,G,me-X,We-G),0,0),this.drawingImgUrl=Ot.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},h.prototype.setDrawingImage=function(){ue.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),ue.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,B){H.prototype.scale.call(this,x,B),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}(Be),he=function(H){function h(x,B,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=B,G.setCurrentType=G.setCurrentType.bind(G),G}return Ae(h,H),h.prototype.getUi=function(){var x=this,B=document.createElement("div");B.style.display="flex",B.style.overflow="hidden",B.style.flexGrow="2";for(var X=function(We){var nt="both";switch(We){case 0:nt="both";break;case 1:nt="start";break;case 2:nt="end";break;case 3:nt="none"}var gt=document.createElement("div");if(gt.style.display="flex",gt.style.flexGrow="2",gt.style.alignItems="center",gt.style.justifyContent="space-between",gt.style.padding="5px",gt.style.borderWidth="2px",gt.style.borderStyle="solid",gt.style.borderColor=nt===G.currentType?G.uiStyleSettings.toolboxAccentColor:"transparent",gt.addEventListener("click",function(){x.setCurrentType(nt,gt)}),B.appendChild(gt),nt==="both"||nt==="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",gt.appendChild(Ve)}var Ot=document.createElement("div");Ot.style.display="flex",Ot.style.alignItems="center",Ot.style.minHeight="20px",Ot.style.flexGrow="2";var jt=document.createElement("hr");if(jt.style.minWidth="20px",jt.style.border="0px",jt.style.borderTop="3px solid "+(G.uiStyleSettings!==void 0?G.uiStyleSettings.toolboxColor:"#eeeeee"),jt.style.flexGrow="2",Ot.appendChild(jt),gt.appendChild(Ot),nt==="both"||nt==="end"){var or=document.createElement("div");or.style.display="flex",or.style.alignItems="center",or.style.minHeight="20px",or.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>`,or.style.marginRight="5px",gt.appendChild(or)}G.typeBoxes.push(gt)},G=this,me=0;me<4;me++)X(me);return B},h.prototype.setCurrentType=function(x,B){var X=this;this.currentType=x,this.typeBoxes.forEach(function(G){G.style.borderColor=G===B?X.uiStyleSettings!==void 0?X.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},h}(Ie),ce=function(H){function h(x,B,X){var G=H.call(this,x,B,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 he("Arrow type","end"),G.arrowTypePanel.onArrowTypeChanged=G.setArrowType,G}return Ae(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,B){var X=this.arrowBaseWidth+2*this.strokeWidth,G=this.arrowBaseHeight+2*this.strokeWidth;return x-X/2+","+(B+G/2)+" "+x+","+(B-G/2)+" "+(x+X/2)+","+(B+G/2)},h.prototype.createTips=function(){this.arrow1=ue.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=ue.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.arrow2)},h.prototype.pointerDown=function(x,B){H.prototype.pointerDown.call(this,x,B),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",ue.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),ue.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),B=this.arrow1.transform.baseVal.getItem(0);B.setRotate(x,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(B,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 B=x;this.arrowType=B.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),re=function(H){function h(x,B,X){var G=H.call(this,x,B,X)||this;return G.fillColor=X.defaultFillColor,G.strokeWidth=0,G.fillPanel=new Ne("Color",X.defaultColorSet,X.defaultFillColor),G.fillPanel.onColorChanged=G.setFillColor,G}return Ae(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}(Xe),q=function(H){function h(x,B,X,G){var me=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 me.opacities=[],me.opacityBoxes=[],me.opacities=B,me.currentOpacity=X,me.setCurrentOpacity=me.setCurrentOpacity.bind(me),me}return Ae(h,H),h.prototype.getUi=function(){var x=this,B=document.createElement("div");return B.style.display="flex",B.style.overflow="hidden",B.style.flexGrow="2",B.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)}),B.appendChild(G);var me=document.createElement("div");me.innerText=100*X+"%",G.appendChild(me),x.opacityBoxes.push(G)}),B},h.prototype.setCurrentOpacity=function(x,B){var X=this;this.currentOpacity=x,this.opacityBoxes.forEach(function(G){G.style.borderColor=G===B?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},h}(Ie),ae=function(H){function h(x,B,X){var G=H.call(this,x,B,X)||this;return G.setOpacity=G.setOpacity.bind(G),G.fillColor=X.defaultHighlightColor,G.strokeWidth=0,G.opacity=X.defaultHighlightOpacity,G.fillPanel=new Ne("Color",X.defaultColorSet,G.fillColor),G.fillPanel.onColorChanged=G.setFillColor,G.opacityPanel=new q("Opacity",X.defaultOpacitySteps,G.opacity),G.opacityPanel.onOpacityChanged=G.setOpacity,G}return Ae(h,H),h.prototype.setOpacity=function(x){this.opacity=x,this.visual&&ue.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}(re),le='<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>',Te=function(H){function h(x,B,X){var G=H.call(this,x,B,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 Ne("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 Ne("Fill color",X.defaultColorSet,G.bgColor,le),G.bgColorPanel.onColorChanged=G.setBgColor,G.fontFamilyPanel=new Oe("Font",X.defaultFontFamilies,X.defaultFontFamily),G.fontFamilyPanel.onFontChanged=G.setFont,G.tipGrip=new ut,G.tipGrip.visual.transform.baseVal.appendItem(ue.createTransform()),G.controlBox.appendChild(G.tipGrip.visual),G}return Ae(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(){ue.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=ue.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},h.prototype.pointerDown=function(x,B){this.state==="new"&&H.prototype.pointerDown.call(this,x,B),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(B)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):H.prototype.pointerDown.call(this,x,B)},h.prototype.pointerUp=function(x){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,H.prototype.pointerUp.call(this,x);else{var B=this.state==="creating";H.prototype.pointerUp.call(this,x),this.setTipPoints(B),this.positionTip()}},h.prototype.manipulate=function(x){if(this.tipMoving){var B=this.unrotatePoint(x);this.tipPosition={x:B.x-this.manipulationStartLeft,y:B.y-this.manipulationStartTop},this.positionTip()}else H.prototype.manipulate.call(this,x)},h.prototype.setBgColor=function(x){this.bgRectangle&&this.tip&&(ue.setAttributes(this.bgRectangle,[["fill",x]]),ue.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 B=Math.min(this.height/2,15),X=this.height/5;x&&(this.tipPosition={x:B+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,B=Math.min(this.width/2,15),this.tipBase1Position={x:B,y:0},this.tipBase2Position={x:B+X,y:0}):(this.tipBase1Position={x:0,y:B},this.tipBase2Position={x:0,y:B+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,B=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-B-X,y:0},this.tipBase2Position={x:this.width-B,y:0}):(this.tipBase1Position={x:this.width,y:B},this.tipBase2Position={x:this.width,y:B+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,B=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-B-X,y:this.height},this.tipBase2Position={x:this.width-B,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-B-X},this.tipBase2Position={x:this.width,y:this.height-B}):G<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(X=this.width/5,B=Math.min(this.width/2,15),this.tipBase1Position={x:B,y:this.height},this.tipBase2Position={x:B+X,y:this.height}):(this.tipBase1Position={x:0,y:this.height-B},this.tipBase2Position={x:0,y:this.height-B-X})},h.prototype.resize=function(x){H.prototype.resize.call(this,x),this.positionTip()},h.prototype.positionTip=function(){ue.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 B=x;this.bgColor=B.bgColor,this.tipPosition=B.tipPosition,H.prototype.restoreState.call(this,x),this.createTip(),this.setTipPoints()},h.prototype.scale=function(x,B){H.prototype.scale.call(this,x,B),this.tipPosition={x:this.tipPosition.x*x,y:this.tipPosition.y*B},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}(je),be=function(H){function h(x,B,X){var G=H.call(this,x,B,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 Ne("Line color",ve(X.defaultColorSet,["transparent"]),X.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.fillPanel=new Ne("Fill color",ve(X.defaultColorSet,["transparent"]),G.fillColor,le),G.fillPanel.onColorChanged=G.setFillColor,G.strokeWidthPanel=new tt("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new Ze("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G.opacityPanel=new q("Opacity",X.defaultOpacitySteps,G.opacity),G.opacityPanel.onOpacityChanged=G.setOpacity,G}return Ae(h,H),h.prototype.ownsTarget=function(x){return!(!H.prototype.ownsTarget.call(this,x)&&x!==this.visual)},h.prototype.createVisual=function(){this.visual=ue.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,B){H.prototype.pointerDown.call(this,x,B),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),ue.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&&ue.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(x),this.stateChanged()},h.prototype.setFillColor=function(x){this.fillColor=x,this.visual&&ue.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(x),this.stateChanged()},h.prototype.setStrokeWidth=function(x){this.strokeWidth=x,this.visual&&ue.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},h.prototype.setStrokeDasharray=function(x){this.strokeDasharray=x,this.visual&&ue.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},h.prototype.setOpacity=function(x){this.opacity=x,this.visual&&ue.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 B=x;this.fillColor=B.fillColor,this.strokeColor=B.strokeColor,this.strokeWidth=B.strokeWidth,this.strokeDasharray=B.strokeDasharray,this.opacity=B.opacity,this.createVisual(),H.prototype.restoreState.call(this,x),this.setSize()},h.prototype.scale=function(x,B){H.prototype.scale.call(this,x,B),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}(Be),Fe=function(H){function h(x,B,X){return H.call(this,x,B,X)||this}return Ae(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=ue.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(ue.createTransform()),this.visual.appendChild(this.tip1),this.tip2=ue.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(ue.createTransform()),this.visual.appendChild(this.tip2)},h.prototype.pointerDown=function(x,B){H.prototype.pointerDown.call(this,x,B),this.state==="creating"&&this.createTips()},h.prototype.adjustVisual=function(){if(H.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(ue.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()]]),ue.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),B=this.tip1.transform.baseVal.getItem(0);B.setRotate(x,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(B,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),Je=function(H){function h(x,B,X){var G=H.call(this,x,B,X)||this;return G.strokePanel.colors=X.defaultColorSet,G.fillColor="transparent",G}return Ae(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}(be),pt=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}(),ct=function(H){function h(x,B,X){var G=H.call(this,x,B,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 Ne("Line color",X.defaultColorSet,X.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.strokeWidthPanel=new tt("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new Ze("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G}return Ae(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=ue.createGroup(),this.selectorCurve=ue.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=ue.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,B){H.prototype.pointerDown.call(this,x,B),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(B)&&(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()),ue.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),ue.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),ue.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},h.prototype.setupControlBox=function(){H.prototype.setupControlBox.call(this),this.curveControlLine1=ue.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=ue.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,B){this.curveX=this.curveX*x,this.curveY=this.curveY*B,H.prototype.scale.call(this,x,B)},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 B=x;this.strokeColor=B.strokeColor,this.strokeWidth=B.strokeWidth,this.strokeDasharray=B.strokeDasharray,this.curveX=B.curveX,this.curveY=B.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}(Ye),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,B,X){var G=H.call(this,x,!1)||this;return G.dataUrl=B,G.state=X,G}return Ae(h,H),h}(At),qe=function(H){function h(x,B,X){X===void 0&&(X=!1);var G=H.call(this,x,X)||this;return G.marker=B,G}return Ae(h,H),h}(At),Mt=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 B=this[h].indexOf(x);B>-1&&this[h].splice(B,1)},H}(),St=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 we,this._isOpen=!1,this.undoRedoManager=new pt,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 Mt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=H.instanceCounter++,this.styles=new rt(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[it,ge,ce,je,Je,be,ae,Te,Fe,re,at,ct]},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[it,ge,ce,je,be,ae,Te]},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"BASIC_MARKER_TYPES",{get:function(){return[it,ge,ce,je,ae]},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(B){if(typeof B=="string"){var X=x.ALL_MARKER_TYPES.find(function(G){return G.typeName===B});X!==void 0&&x._availableMarkerTypes.push(X)}else x._availableMarkerTypes.push(B)})},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(),Me.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},H.prototype.show=function(){var h=this;this.styles.styleSheetRoot===void 0&&He.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=He.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(x){return x(new At(h))})},H.prototype.render=function(){return ke(this,void 0,void 0,function(){var h;return De(this,function(x){switch(x.label){case 0:return this.setCurrentMarker(),(h=new Qe).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 B=!1;h||this.eventListeners.beforeclose.forEach(function(X){var G=new At(x,!0);X(G),G.defaultPrevented&&(B=!0)}),B||(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=[],B=0;B<arguments.length;B++)x[B]=arguments[B];(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,B=x<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/h;this.resize(x,B)},H.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},H.prototype.resize=function(h,x){this._isResizing=!0;var B=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(B,X),this._isResizing=!1},H.prototype.scaleMarkers=function(h,x){var B,X=this;this._currentMarker&&this._currentMarker instanceof je?this._currentMarker.scale(h,x):(B=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(G){G!==X._currentMarker&&G.scale(h,x)}),B!==void 0&&this.setCurrentMarker(B)},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=[],B=0;B<arguments.length;B++)x[B]=arguments[B];this.defs=ue.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 xe(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 Re(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 qe(h,h._currentMarker,!0);X(G),G.defaultPrevented&&(x=!0)}),!x){var B=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 qe(h,B))})}}},H.prototype.clear=function(){var h=this,x=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(me){var We=new qe(h,void 0,!0);me(We),We.defaultPrevented&&(x=!0)}),!x)){this.setCurrentMarker();for(var B=function(me){var We=X.markers[me];X.setCurrentMarker(X.markers[me]),X._currentMarker.dispose(),X.markerImage.removeChild(X._currentMarker.container),X.markers.splice(X.markers.indexOf(X._currentMarker),1),X.eventListeners.markerdelete.forEach(function(nt){return nt(new qe(h,We))})},X=this,G=this.markers.length-1;G>=0;G--)B(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(),B=this.undoRedoManager.getLastUndoStep();if(!B||B.width===x.width&&B.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(B){return B(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(B){return B(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 ke(this,void 0,void 0,function(){var h,x,B=this;return De(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(B,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(B){return x.markers.push(B.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(B){var X=x._availableMarkerTypes.find(function(me){return me.typeName===B.typeName});if(X!==void 0){var G=x.addNewMarker(X);G.restoreState(B),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(B){return B(new At(x))})},H.prototype.addNewMarker=function(h){var x=ue.createGroup();return this.markerImage.appendChild(x),new h(x,this.overlayContainer,this.settings)},H.prototype.createNewMarker=function(h){var x,B=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 qe(B,B._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 ge&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(ge):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(B){return B(new qe(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(B){return B(new qe(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(B){return B(new qe(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(B){return B(new qe(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(B){return B.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(B){return B.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 B=this.markerImage.getBoundingClientRect();return{x:(h-B.left)/this.zoomLevel,y:(x-B.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){Me.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 It=function(H,h){return(It=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(x,B){x.__proto__=B}||function(x,B){for(var X in B)Object.prototype.hasOwnProperty.call(B,X)&&(x[X]=B[X])})(H,h)};function kt(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}It(H,h),H.prototype=h===null?Object.create(h):(x.prototype=h.prototype,new x)}function Dt(H,h,x,B){return new(x||(x=Promise))(function(X,G){function me(gt){try{nt(B.next(gt))}catch(Ve){G(Ve)}}function We(gt){try{nt(B.throw(gt))}catch(Ve){G(Ve)}}function nt(gt){var Ve;gt.done?X(gt.value):(Ve=gt.value,Ve instanceof x?Ve:new x(function(Ot){Ot(Ve)})).then(me,We)}nt((B=B.apply(H,h||[])).next())})}function Ar(H,h){var x,B,X,G,me={label:0,sent:function(){if(1&X[0])throw X[1];return X[1]},trys:[],ops:[]};return G={next:We(0),throw:We(1),return:We(2)},typeof Symbol=="function"&&(G[Symbol.iterator]=function(){return this}),G;function We(nt){return function(gt){return function(Ve){if(x)throw new TypeError("Generator is already executing.");for(;me;)try{if(x=1,B&&(X=2&Ve[0]?B.return:Ve[0]?B.throw||((X=B.return)&&X.call(B),0):B.next)&&!(X=X.call(B,Ve[1])).done)return X;switch(B=0,X&&(Ve=[2&Ve[0],X.value]),Ve[0]){case 0:case 1:X=Ve;break;case 4:return me.label++,{value:Ve[1],done:!1};case 5:me.label++,B=Ve[1],Ve=[0];continue;case 7:Ve=me.ops.pop(),me.trys.pop();continue;default:if(!(X=me.trys,(X=X.length>0&&X[X.length-1])||Ve[0]!==6&&Ve[0]!==2)){me=0;continue}if(Ve[0]===3&&(!X||Ve[1]>X[0]&&Ve[1]<X[3])){me.label=Ve[1];break}if(Ve[0]===6&&me.label<X[1]){me.label=X[1],X=Ve;break}if(X&&me.label<X[2]){me.label=X[2],me.ops.push(Ve);break}X[2]&&me.ops.pop(),me.trys.pop();continue}Ve=h.call(H,me)}catch(Ot){Ve=[6,Ot],B=0}finally{x=X=0}if(5&Ve[0])throw Ve[1];return{value:Ve[0]?Ve[1]:void 0,done:!0}}([nt,gt])}}}var cr=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}(),Et=function(){function H(){}return H.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},H.setAttributes=function(h,x){for(var B=0,X=x;B<X.length;B++){var G=X[B],me=G[0],We=G[1];h.setAttribute(me,We)}},H.createRect=function(h,x,B){var X=document.createElementNS("http://www.w3.org/2000/svg","rect");return X.setAttribute("width",h.toString()),X.setAttribute("height",x.toString()),B&&H.setAttributes(X,B),X},H.createLine=function(h,x,B,X,G){var me=document.createElementNS("http://www.w3.org/2000/svg","line");return me.setAttribute("x1",h.toString()),me.setAttribute("y1",x.toString()),me.setAttribute("x2",B.toString()),me.setAttribute("y2",X.toString()),G&&H.setAttributes(me,G),me},H.createPolygon=function(h,x){var B=document.createElementNS("http://www.w3.org/2000/svg","polygon");return B.setAttribute("points",h),x&&H.setAttributes(B,x),B},H.createCircle=function(h,x){var B=document.createElementNS("http://www.w3.org/2000/svg","circle");return B.setAttribute("cx",(h/2).toString()),B.setAttribute("cy",(h/2).toString()),B.setAttribute("r",h.toString()),x&&H.setAttributes(B,x),B},H.createEllipse=function(h,x,B){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()),B&&H.setAttributes(X,B),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,B,X,G,me,We){var nt=document.createElementNS("http://www.w3.org/2000/svg","marker");return H.setAttributes(nt,[["id",h],["orient",x],["markerWidth",B.toString()],["markerHeight",X.toString()],["refX",G.toString()],["refY",me.toString()]]),nt.appendChild(We),nt},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 B=document.createElementNS("http://www.w3.org/2000/svg","tspan");return B.textContent=h,x&&H.setAttributes(B,x),B},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 B=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return B.x=h,B.y=x,B},H.createPath=function(h,x){var B=document.createElementNS("http://www.w3.org/2000/svg","path");return B.setAttribute("d",h),x&&H.setAttributes(B,x),B},H.createElement=function(h,x){var B=document.createElementNS("http://www.w3.org/2000/svg",h);return x&&H.setAttributes(B,x),B},H.getHollowRectanglePath=function(h,x,B,X,G,me,We,nt){return"M"+h+","+x+"V"+(x+X)+"H"+(h+B)+"V"+x+"H"+G+"V"+me+"H"+(G+We)+"V"+(me+nt)+"H"+G+"V"+x+"Z"},H}(),bt=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 ht("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new ht("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new ht("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new Ct("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new Ct("_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}(),ht=function(H,h){this.selector=H,this.style=h},Ct=function(H,h){this.localName=H,this.style=h},$t=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}(),rr=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}(),nr=function(H){function h(){var x=H!==null&&H.apply(this,arguments)||this;return x.buttons=[],x}return kt(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(B){return x.appendChild(B.getUI())}),x},h}(rr),dt=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}(),lt=function(H){function h(){var x=H!==null&&H.apply(this,arguments)||this;return x.elements=[],x}return kt(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(B){return x.appendChild(B)}),x},h}(rr),ir=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}(),Ht=function(){function H(){}return H.getIcon=function(h,x){if(h>0&&x>0){var B=new ir(h,x),X=B.ratio>=1?20:B.getHorizontalLength(20),G=B.ratio<1?20:B.getVerticalLength(20),me=document.createElementNS("http://www.w3.org/2000/svg","svg");me.setAttribute("xmlns","http://www.w3.org/2000/svg"),me.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(me);var We=Et.createDefs();me.appendChild(We);var nt=Et.createElement("clipPath",[["id","text-bg-clip"]]);We.appendChild(nt);var gt=Et.createPath(Et.getHollowRectanglePath((24-X)/2,(24-G)/2,X,G,(24-X)/2+2,(24-G)/2+2,X-4,G-4));me.appendChild(gt);var Ve=Et.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ve.appendChild(Et.createTSpan(h+":"+x)),me.appendChild(Ve);var Ot=Ve.getBBox();Et.setAttributes(Ve,[["x",((24-Ot.width)/2).toString()],["y",((24-Ot.height)/2-Ot.y).toString()]]);var jt=Et.createPath(Et.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Ot.width))/2,(24-Math.ceil(Ot.height))/2,Math.ceil(Ot.width),Math.ceil(Ot.height)));return nt.appendChild(jt),Et.setAttributes(gt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(me),me.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}(),Ut=function(H){function h(x,B,X){var G=H.call(this,x,B)||this;return G.isDropdownOpen=!1,G.onClick=G.dropdownButtonClicked,G.dropdownButtons=X,G}return kt(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(B){B.className=x.className,B.colorsClassName=x.colorsClassName,x.dropdownBlock.appendChild(B.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}(dt),Pt=function(){function H(h,x){this.GRIP_SIZE=10,this.color=h,this.fillColor=x,this.visual=Et.createGroup(),this.visual.appendChild(Et.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(Et.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(B){return Et.setAttributes(B,[["cx",h.toString()],["cy",x.toString()]])})},H}(),Gt=function(){function H(h,x,B,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=B,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&&Et.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=Et.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=Et.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var x=0;x<this.numberOfGridLines;x++)this.horizontalGridLines.push(Et.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(Et.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(B){return h.gridContainer.appendChild(B)}),this.verticalGridLines.forEach(function(B){return h.gridContainer.appendChild(B)}),this.cropRectElement=Et.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Pt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Pt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Pt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Pt(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),Et.setAttributes(this.cropRectElement,[["x",x.x.toString()],["y",x.y.toString()],["width",x.width.toString()],["height",x.height.toString()]]);var B=x.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(G,me){var We=x.y+B*(me+1);Et.setAttributes(G,[["x1",""+x.x],["y1",""+We],["x2",""+(x.x+x.width)],["y2",""+We]])});var X=x.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(G,me){var We=x.x+X*(me+1);Et.setAttributes(G,[["x1",""+We],["y1",""+x.y],["x2",""+We],["y2",""+(x.y+x.height)]])}),Et.setAttributes(this.cropShadeElement,[["d",Et.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 B=this.container.getBoundingClientRect();return{x:h-B.left+this.margin,y:x-B.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,B=h.y-this.previousPoint.y;this.zoomFactor!==1&&(x=-x/this.zoomFactor,B=-B/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+B),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),B=h.x-this.previousPoint.x,X=h.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:x.x+B<this.margin&&(B=this.margin-x.x),x.x+=B,x.width=this.cropRect.x+this.cropRect.width-x.x;break;case this.bottomRightGrip:case this.topRightGrip:x.width+B>this.canvasWidth*this.zoomFactor&&(B=this.canvasWidth*this.zoomFactor-x.width),x.width+=B}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(B),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,B=this.aspectRatio.getHorizontalLength(this.cropRect.height),X=this.aspectRatio.getVerticalLength(this.cropRect.width);B/this.canvasWidth<X/this.canvasHeight?this.cropRect.width=B: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,B,X,G,me){var We=B/h,nt=X/x;return{x:(G.x-me)*We+me,y:(G.y-me)*nt+me,width:G.width*We,height:G.height*nt}},H.prototype.scaleCanvas=function(h,x){var B=this.getRescaledRect(this.canvasWidth,this.canvasHeight,h,x,this.cropRect,this.margin);this.canvasWidth=h,this.canvasHeight=x,this.onCropChange&&this.onCropChange(B),this.setCropRectangle(B)},H}(),Er=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();Et.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,B=1;B<=this.width/5+10;B++){var X=B%5==0?this.height/3:this.height/6;x+="h4v"+-X+"h1v"+X}x+="v1H0Z",this.scaleShape=Et.createPath(x);var G=Et.createTransform();this.scaleShape.transform.baseVal.appendItem(G),h.appendChild(this.scaleShape),this.angleLabelElement=Et.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=Et.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var me=Et.createTSpan("");return me.innerHTML="°",this.angleLabelElement.appendChild(me),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,B,X,G,me,We){var nt=this;return new Promise(function(gt){var Ve=document.createElement("canvas");Ve.width=h.width.baseVal.value-2*X,Ve.height=h.height.baseVal.value-2*X;var Ot=1,jt=1;nt.naturalSize===!0?(Ot=x.naturalWidth/(h.width.baseVal.value-2*X)/me,jt=x.naturalHeight/(h.height.baseVal.value-2*X)/We,Ve.width=x.naturalWidth/me,Ve.height=x.naturalHeight/We):nt.width!==void 0&&nt.height!==void 0&&(Ot=nt.width/B.width,jt=nt.height/B.height,Ve.width*=Ot,Ve.height*=jt);var or=Ve.getContext("2d");or.translate(Ve.width/2,Ve.height/2),or.rotate(G*Math.PI/180),or.scale(me,We),or.translate(-Ve.width/2,-Ve.height/2),or.drawImage(x,0,0,Ve.width,Ve.height);var Xr=document.createElement("canvas");Xr.width=B.width*Ot,Xr.height=B.height*jt,Xr.getContext("2d").putImageData(or.getImageData((B.x-X)*Ot,(B.y-X)*jt,B.width*Ot,B.height*jt),0,0),gt(Xr.toDataURL(nt.imageType,nt.imageQuality))})},H}(),Ue=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 bt(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,B=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,B)}},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",Et.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();Et.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=Et.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=Et.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=Et.createGroup(),this.editingTargetRotationScaleContainer=Et.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var h=Et.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(h);var x=Et.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(x),this.editingTargetContainer=Et.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=Et.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Gt(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 $t,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 nr;x.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(x);var B=[];this.aspectRatios.forEach(function(jt){var or=new dt(Ht.getIcon(jt.horizontal,jt.vertical),jt.horizontal===0&&jt.vertical===0?"FREE":jt.horizontal+":"+jt.vertical);or.onClick=function(){return h.ratioButtonClicked(jt)},B.push(or)}),this.aspectRatioButton=new Ut(Ht.getIcon(0,0),"Aspect ratio",B),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 dt('<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 dt('<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),!cr.isLicensed){var me=new lt;this.topToolbar.addElementBlock(me);var We=document.createElement("div");We.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var nt=document.createElement("a");nt.style.color="currentColor",nt.href="https://markerjs.com/products/cropro",nt.target="_blank",nt.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>',We.appendChild(nt),me.addElement(We)}var gt=new nr;gt.minWidth=3*this.toolbarHeight+"px",gt.contentAlign="end",this.topToolbar.addButtonBlock(gt);var Ve=new dt('<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,gt.addButton(Ve),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ve.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Ot=new dt('<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");Ot.onClick=this.close,gt.addButton(Ot),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Ot.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},H.prototype.addBottomToolbar=function(){var h=this;this.bottomToolbar=new $t,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 nr;x.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(x);var B=new dt('<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");B.onClick=this.rotateLeftButtonClicked,x.addButton(B);var X=new dt('<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 lt;G.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(G),this.straightener=new Er("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(gt){h.rotateBy(gt),h.straightener.angle=h.rotationAngle},G.addElement(this.straightener.getUI());var me=new nr;me.minWidth=2*this.toolbarHeight+"px",me.contentAlign="end",this.bottomToolbar.addButtonBlock(me);var We=new dt('<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");We.onClick=this.flipHorizontallyButtonClicked,me.addButton(We);var nt=new dt('<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");nt.onClick=this.flipVerticallyButtonClicked,me.addButton(nt)},H.prototype.ratioButtonClicked=function(h){this.aspectRatio=h,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},H.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Ht.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 ir(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 B=this.cropImage.getBoundingClientRect();return{x:h-B.left,y:x-B.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 B=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/B.width,this.imageHeight/B.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 Dt(this,void 0,void 0,function(){var h,x;return Ar(this,function(B){switch(B.label){case 0:return[4,this.render()];case 1:return h=B.sent(),x=this.getState(),this.renderEventListeners.forEach(function(X){return X(h,x)}),this.close(!0),[2]}})})},H.prototype.render=function(){return Dt(this,void 0,void 0,function(){var h;return Ar(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(),Et.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 Ct("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 Ct("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Ct("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var h=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Ct("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 Ct("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Ct("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new ht("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new ht("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new Ct("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 Ct("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Ct("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 Ct("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 Ct("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},H.instanceCounter=0,H}(),ft=Q("8hTe"),Ft=Q.n(ft),Jt=/<pre[^>]*>/g;function qt(H){var h=document.createElement("div");return h.innerHTML=H,h.childNodes.length===0?"":h.childNodes[0].nodeValue}var ar=Ee.a=function(H){var h=H.value,x=h===void 0?"":h,B=H.edit,X=B===void 0?!1:B,G=H.className,me=H.showTextOnly,We=H.showLines,nt=H.replaces,gt=H.zoomImg,Ve=H.hasMask,Ot=H.style,jt=Ot===void 0?{}:Ot,or=H.stylesPrev,Xr=or===void 0?{}:or,Yr=String(x),br=Object(k.useRef)(),qr=Object(k.useRef)(),Gn=Object(k.useState)(""),Ir=Object(j.a)(Gn,2),$r=Ir[0],Gr=Ir[1],bn=Object(k.useState)("office"),nn=Object(j.a)(bn,2),mn=nn[0],dn=nn[1],hi=function(){var Vt=new Ue(qr.current);Vt.displayMode="popup",Vt.addRenderEventListener(function(){var Dr=Object(D.a)(_.a.mark(function Kt(mr){var Zt;return _.a.wrap(function(fr){for(;;)switch(fr.prev=fr.next){case 0:return br.current.style.display="none",fr.next=3,Object(_e.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:mr}});case 3:Zt=fr.sent,Zt!=null&&Zt.id&&nt(qr.current.getAttribute("src").replace(ie.a.API_SERVER,""),"/api/attachments/".concat(Zt==null?void 0:Zt.id,"?type=").concat(Zt.content_type));case 5:case"end":return fr.stop()}},Kt)}));return function(Kt){return Dr.apply(this,arguments)}}()),Vt.show()},zn=function(){var Vt=new St(qr.current);Vt.settings.displayMode="popup",Vt.addEventListener("render",function(){var Dr=Object(D.a)(_.a.mark(function Kt(mr){var Zt;return _.a.wrap(function(fr){for(;;)switch(fr.prev=fr.next){case 0:if(br.current.style.display="none",!qr.current){fr.next=6;break}return fr.next=4,Object(_e.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:mr.dataUrl}});case 4:Zt=fr.sent,Zt!=null&&Zt.id&&nt(qr.current.getAttribute("src").replace(ie.a.API_SERVER,""),"/api/attachments/".concat(Zt==null?void 0:Zt.id,"?type=").concat(Zt.content_type));case 6:case"end":return fr.stop()}},Kt)}));return function(Kt){return Dr.apply(this,arguments)}}()),Vt.show(),window.markerArea=Vt},an=Object(k.useMemo)(function(){try{var dr=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Vt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Dr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Yr=Yr.replace(dr,"("+ie.a.API_SERVER+"/api/attachments/").replace(Vt,'"'+ie.a.API_SERVER+"/api/attachments/").replace(Dr,'"'+ie.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,`
|
|
`),Yr=Yr.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
|
|
`)}catch(hn){}var Kt=Z(Yr),mr=L();if(Yr.match(/\[TOC\]/)&&(Kt=Kt.replace("<p>[TOC]</p>",O()),E()),Kt=Kt.replace(/(__special_katext_id_\d+__)/g,function(hn,fr){var Nr=mr[fr],Kn=Nr.type,Vn=Nr.expression;return Object(fe.renderToString)(qt(Vn)||"",{displayMode:Kn==="block",throwOnError:!1,output:"html"})}),Kt=Kt.replace(/▁/g,"\u2581\u2581\u2581"),S(),me){var Zt=document.createElement("div");return Zt.innerHTML=Kt,Zt.innerText}return setTimeout(function(){return On()},500),Kt},[Yr]),Jr=Object(k.useRef)();g.WebkitLineClamp=We,We&&(jt=Object(I.a)(Object(I.a)({},jt),g));function kn(dr){var Vt=dr.target;if(Vt.tagName.toUpperCase()==="IMG"){if(gt){var Dr=Vt.getAttribute("src");Gr(Dr),dn("image")}}else if(Vt.tagName.toUpperCase()==="A"){var Kt=Vt.getAttribute("href");if(Kt.indexOf("office")>-1)dr.preventDefault(),Gr(Kt),dn("office");else if(Kt.indexOf("application/pdf")>-1)dr.preventDefault(),Gr(Kt),dn("pdf");else if(Kt.indexOf("type=text")>-1)dr.preventDefault(),Gr(Kt),dn("html");else if(Kt.startsWith("#")){dr.preventDefault();var mr=document.getElementById(Kt.replace("#",""));mr&&mr.scrollIntoView(!0)}}}var On=function(){var Vt,Dr=(Vt=Jr.current)===null||Vt===void 0?void 0:Vt.querySelectorAll("video");Dr==null||Dr.forEach(function(Kt){if(Kt.oncontextmenu=function(){return!1},Kt.src.indexOf(".m3u8")>-1&&!Kt.canPlayType("application/vnd.apple.mpegurl")){if(te.a.isSupported()){var mr=new te.a;mr.loadSource(Kt.src),mr.attachMedia(Kt)}}})};Object(k.useEffect)(function(){if(Jr.current&&an&&(an.match(Jt)&&window.PR.prettyPrint()),Jr.current)return Jr.current.addEventListener("click",kn),function(){Jr.current.removeEventListener("click",kn),S(),E()}},[an,Jr.current,kn]);var ci=function(Vt){if(!X)return;Vt.target.nodeName==="IMG"?(br.current.style.display="flex",br.current.style.width=Vt.target.clientWidth+"px",br.current.style.height=Vt.target.clientHeight+"px",br.current.style.top=Vt.target.offsetTop+"px",br.current.style.left=Vt.target.offsetLeft+"px",qr.current.src=Vt.target.getAttribute("src")):br.current.style.display="none"};return d.a.createElement("div",{style:{position:"relative"}},d.a.createElement("div",{ref:Jr,style:Object(I.a)({},jt),className:"".concat(G||""," markdown-body ").concat(Ft.a.mdBody),onMouseOver:ci,dangerouslySetInnerHTML:{__html:an}}),d.a.createElement("div",{ref:br,className:Ft.a.button},d.a.createElement($.a,null,d.a.createElement(K.a,{onClick:function(){return hi()}},"\u88C1\u526A"),d.a.createElement(K.a,{onClick:function(){return zn()}},"\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(ye.a,{close:!0,data:$r,hasMask:Ve,type:$r!=null&&$r.length?mn:"",style:Object(I.a)({},Xr),onClose:function(){return Gr("")}}))}},"9VGf":function(yt,Ee,Q){"use strict";Q.d(Ee,"a",function(){return M});var ne=Q("q1tI"),$=Q.n(ne);function M(K,I){var D=Object(ne.useRef)();Object(ne.useEffect)(function(){D.current=K}),Object(ne.useEffect)(function(){function j(){D.current()}if(I!==null){var N=setInterval(j,I);return function(){return clearInterval(N)}}},[I])}},BU3w:function(yt,Ee,Q){"use strict";Q.d(Ee,"a",function(){return D});var ne=Q("MNnm"),$="rc-util-key";function M(j){if(j.attachTo)return j.attachTo;var N=document.querySelector("head");return N||document.body}function K(j){var N,_=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ne.a)())return null;var k=document.createElement("style");if((N=_.csp)===null||N===void 0?void 0:N.nonce){var d;k.nonce=(d=_.csp)===null||d===void 0?void 0:d.nonce}k.innerHTML=j;var f=M(_),T=f.firstChild;return _.prepend&&f.prepend?f.prepend(k):_.prepend&&T?f.insertBefore(k,T):f.appendChild(k),k}var I=new Map;function D(j,N){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},k=M(_);if(!I.has(k)){var d=K("",_),f=d.parentNode;I.set(k,f),f.removeChild(d)}var T=Array.from(I.get(k).children).find(function(i){return i.tagName==="STYLE"&&i[$]===N});if(T){var m,p;if(((m=_.csp)===null||m===void 0?void 0:m.nonce)&&T.nonce!==((p=_.csp)===null||p===void 0?void 0:p.nonce)){var b;T.nonce=(b=_.csp)===null||b===void 0?void 0:b.nonce}return T.innerHTML!==j&&(T.innerHTML=j),T}var o=K(j,_);return o[$]=N,o}},Bd2K:function(yt,Ee,Q){(function(ne){ne(Q("VrN/"),Q("osHv"))})(function(ne){ne.defineOption("autoCloseTags",!1,function(_,k,d){if(d!=ne.Init&&d&&_.removeKeyMap("autoCloseTags"),!k)return;var f={name:"autoCloseTags"};(typeof k!="object"||k.whenClosing!==!1)&&(f["'/'"]=function(T){return D(T)}),(typeof k!="object"||k.whenOpening!==!1)&&(f["'>'"]=function(T){return K(T)}),_.addKeyMap(f)});var $=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],M=["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 K(_){if(_.getOption("disableInput"))return ne.Pass;for(var k=_.listSelections(),d=[],f=_.getOption("autoCloseTags"),T=0;T<k.length;T++){if(!k[T].empty())return ne.Pass;var m=k[T].head,p=_.getTokenAt(m),b=ne.innerMode(_.getMode(),p.state),o=b.state,i=b.mode.xmlCurrentTag&&b.mode.xmlCurrentTag(o),s=i&&i.name;if(!s)return ne.Pass;var l=b.mode.configuration=="html",E=typeof f=="object"&&f.dontCloseTags||l&&$,g=typeof f=="object"&&f.indentTags||l&&M;p.end>m.ch&&(s=s.slice(0,s.length-p.end+m.ch));var v=s.toLowerCase();if(!s||p.type=="string"&&(p.end!=m.ch||!/[\"\']/.test(p.string.charAt(p.string.length-1))||p.string.length==1)||p.type=="tag"&&i.close||p.string.indexOf("/")==m.ch-p.start-1||E&&j(E,v)>-1||N(_,b.mode.xmlCurrentContext&&b.mode.xmlCurrentContext(o)||[],s,m,!0))return ne.Pass;var O=typeof f=="object"&&f.emptyTags;if(O&&j(O,s)>-1){d[T]={text:"/>",newPos:ne.Pos(m.line,m.ch+2)};continue}var w=g&&j(g,v)>-1;d[T]={indent:w,text:">"+(w?`
|
|
|
|
`:"")+"</"+s+">",newPos:w?ne.Pos(m.line+1,0):ne.Pos(m.line,m.ch+1)}}for(var C=typeof f=="object"&&f.dontIndentOnAutoClose,T=k.length-1;T>=0;T--){var y=d[T];_.replaceRange(y.text,k[T].head,k[T].anchor,"+insert");var c=_.listSelections().slice(0);c[T]={head:y.newPos,anchor:y.newPos},_.setSelections(c),!C&&y.indent&&(_.indentLine(y.newPos.line,null,!0),_.indentLine(y.newPos.line+1,null,!0))}}function I(_,k){for(var d=_.listSelections(),f=[],T=k?"/":"</",m=_.getOption("autoCloseTags"),p=typeof m=="object"&&m.dontIndentOnSlash,b=0;b<d.length;b++){if(!d[b].empty())return ne.Pass;var o=d[b].head,i=_.getTokenAt(o),s=ne.innerMode(_.getMode(),i.state),l=s.state;if(k&&(i.type=="string"||i.string.charAt(0)!="<"||i.start!=o.ch-1))return ne.Pass;var E,g=s.mode.name!="xml"&&_.getMode().name=="htmlmixed";if(g&&s.mode.name=="javascript")E=T+"script";else if(g&&s.mode.name=="css")E=T+"style";else{var v=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(l);if(!v||v.length&&N(_,v,v[v.length-1],o))return ne.Pass;E=T+v[v.length-1]}_.getLine(o.line).charAt(i.end)!=">"&&(E+=">"),f[b]=E}if(_.replaceSelections(f),d=_.listSelections(),!p)for(var b=0;b<d.length;b++)(b==d.length-1||d[b].head.line<d[b+1].head.line)&&_.indentLine(d[b].head.line)}function D(_){return _.getOption("disableInput")?ne.Pass:I(_,!0)}ne.commands.closeTag=function(_){return I(_)};function j(_,k){if(_.indexOf)return _.indexOf(k);for(var d=0,f=_.length;d<f;++d)if(_[d]==k)return d;return-1}function N(_,k,d,f,T){if(!ne.scanForClosingTag)return!1;var m=Math.min(_.lastLine()+1,f.line+500),p=ne.scanForClosingTag(_,f,null,m);if(!p||p.tag!=d)return!1;for(var b=T?1:0,o=k.length-1;o>=0&&k[o]==d;o--)++b;f=p.to;for(var o=1;o<b;o++){var i=ne.scanForClosingTag(_,f,null,m);if(!i||i.tag!=d)return!1;f=i.to}return!0}})},BjJ7:function(yt,Ee,Q){"use strict";Q.d(Ee,"d",function(){return $}),Q.d(Ee,"c",function(){return M}),Q.d(Ee,"e",function(){return K}),Q.d(Ee,"b",function(){return I}),Q.d(Ee,"a",function(){return j});var ne=Q("m3rI");function $(N){var _=!0;if(N.length>0){for(var k=0;k<N.length;k++)if(N[k].compile_success==0||!N[k].compile_success){_=!1;break}}else _=!1;return _}function M(N){for(var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",k=[],d=0;d<N.length;d++){var f=N[d],T=_?"".concat(_,"/").concat(f.name):"".concat(f.name);k.push({title:f.name,isLeaf:!(f.type==="tree"),key:T})}return k}function K(N,_,k){for(var d=0;d<N.length;d++){var f=N[d];if(f.key===_){f.children=k;break}f.children&&K(f.children,_,k)}return N}function I(N,_,k){var d;return function(){var f=this,T=arguments,m=function(){d=null,k||N.apply(f,T)},p=k&&!d;clearTimeout(d),d=setTimeout(m,_),p&&N.apply(f,T)}}var D=!0,j=ne.a.API_SERVER},"C+DQ":function(yt,Ee,Q){},"C/vA":function(yt,Ee,Q){"use strict";Q.d(Ee,"a",function(){return ne});function ne($){var M=this,K=!1,I;return function(){return K||(K=!0,I=$.apply(M,arguments)),I}}},"Cg/j":function(yt,Ee,Q){"use strict";Q.d(Ee,"b",function(){return ne}),Q.d(Ee,"a",function(){return $}),Q.d(Ee,"c",function(){return K}),Q.d(Ee,"d",function(){return I});var ne;(function(D){D.serviceIds=new Map,D.DI_TARGET="$di$target",D.DI_DEPENDENCIES="$di$dependencies";function j(N){return N[D.DI_DEPENDENCIES]||[]}D.getServiceDependencies=j})(ne||(ne={}));var $=K("instantiationService");function M(D,j,N,_){j[ne.DI_TARGET]===j?j[ne.DI_DEPENDENCIES].push({id:D,index:N,optional:_}):(j[ne.DI_DEPENDENCIES]=[{id:D,index:N,optional:_}],j[ne.DI_TARGET]=j)}function K(D){if(ne.serviceIds.has(D))return ne.serviceIds.get(D);var j=function(N,_,k){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");M(j,N,k,!1)};return j.toString=function(){return D},ne.serviceIds.set(D,j),j}function I(D){return function(j,N,_){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");M(D,j,_,!0)}}},DlQD:function(yt,Ee,Q){(function(ne,$){yt.exports=$()})(this,function(){"use strict";function ne(ge,he){for(var ce=0;ce<he.length;ce++){var re=he[ce];re.enumerable=re.enumerable||!1,re.configurable=!0,"value"in re&&(re.writable=!0),Object.defineProperty(ge,re.key,re)}}function $(ge,he,ce){return he&&ne(ge.prototype,he),ce&&ne(ge,ce),ge}function M(ge,he){if(!ge)return;if(typeof ge=="string")return K(ge,he);var ce=Object.prototype.toString.call(ge).slice(8,-1);if(ce==="Object"&&ge.constructor&&(ce=ge.constructor.name),ce==="Map"||ce==="Set")return Array.from(ge);if(ce==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ce))return K(ge,he)}function K(ge,he){(he==null||he>ge.length)&&(he=ge.length);for(var ce=0,re=new Array(he);ce<he;ce++)re[ce]=ge[ce];return re}function I(ge,he){var ce;if(typeof Symbol=="undefined"||ge[Symbol.iterator]==null){if(Array.isArray(ge)||(ce=M(ge))||he&&ge&&typeof ge.length=="number"){ce&&(ge=ce);var re=0;return function(){return re>=ge.length?{done:!0}:{done:!1,value:ge[re++]}}}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 ce=ge[Symbol.iterator](),ce.next.bind(ce)}function D(ge,he){return he={exports:{}},ge(he,he.exports),he.exports}var j=D(function(ge){function he(){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 ce(re){ge.exports.defaults=re}ge.exports={defaults:he(),getDefaults:he,changeDefaults:ce}}),N=j.defaults,_=j.getDefaults,k=j.changeDefaults,d=/[&<>"']/,f=/[&<>"']/g,T=/[<>"']|&(?!#?\w+;)/,m=/[<>"']|&(?!#?\w+;)/g,p={"&":"&","<":"<",">":">",'"':""","'":"'"},b=function(he){return p[he]};function o(ge,he){if(he){if(d.test(ge))return ge.replace(f,b)}else if(T.test(ge))return ge.replace(m,b);return ge}var i=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(ge){return ge.replace(i,function(he,ce){return ce=ce.toLowerCase(),ce==="colon"?":":ce.charAt(0)==="#"?ce.charAt(1)==="x"?String.fromCharCode(parseInt(ce.substring(2),16)):String.fromCharCode(+ce.substring(1)):""})}var l=/(^|[^\[])\^/g;function E(ge,he){ge=ge.source||ge,he=he||"";var ce={replace:function(q,ae){return ae=ae.source||ae,ae=ae.replace(l,"$1"),ge=ge.replace(q,ae),ce},getRegex:function(){return new RegExp(ge,he)}};return ce}var g=/[^\w:]/g,v=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function O(ge,he,ce){if(ge){var re;try{re=decodeURIComponent(s(ce)).replace(g,"").toLowerCase()}catch(q){return null}if(re.indexOf("javascript:")===0||re.indexOf("vbscript:")===0||re.indexOf("data:")===0)return null}he&&!v.test(ce)&&(ce=u(he,ce));try{ce=encodeURI(ce).replace(/%25/g,"%")}catch(q){return null}return ce}var w={},C=/^[^:]+:\/*[^/]*$/,y=/^([^:]+:)[\s\S]*$/,c=/^([^:]+:\/*[^/]*)[\s\S]*$/;function u(ge,he){w[" "+ge]||(C.test(ge)?w[" "+ge]=ge+"/":w[" "+ge]=P(ge,"/",!0)),ge=w[" "+ge];var ce=ge.indexOf(":")===-1;return he.substring(0,2)==="//"?ce?he:ge.replace(y,"$1")+he:he.charAt(0)==="/"?ce?he:ge.replace(c,"$1")+he:ge+he}var L={exec:function(){}};function S(ge){for(var he=1,ce,re;he<arguments.length;he++){ce=arguments[he];for(re in ce)Object.prototype.hasOwnProperty.call(ce,re)&&(ge[re]=ce[re])}return ge}function A(ge,he){var ce=ge.replace(/\|/g,function(ae,le,Te){for(var be=!1,Fe=le;--Fe>=0&&Te[Fe]==="\\";)be=!be;return be?"|":" |"}),re=ce.split(/ \|/),q=0;if(re.length>he)re.splice(he);else for(;re.length<he;)re.push("");for(;q<re.length;q++)re[q]=re[q].trim().replace(/\\\|/g,"|");return re}function P(ge,he,ce){var re=ge.length;if(re===0)return"";for(var q=0;q<re;){var ae=ge.charAt(re-q-1);if(ae===he&&!ce)q++;else if(ae!==he&&ce)q++;else break}return ge.substr(0,re-q)}function W(ge,he){if(ge.indexOf(he[1])===-1)return-1;for(var ce=ge.length,re=0,q=0;q<ce;q++)if(ge[q]==="\\")q++;else if(ge[q]===he[0])re++;else if(ge[q]===he[1]&&(re--,re<0))return q;return-1}function V(ge){ge&&ge.sanitize&&!ge.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:E,cleanUrl:O,resolveUrl:u,noopTest:L,merge:S,splitCells:A,rtrim:P,findClosingBracket:W,checkSanitizeDeprecation:V},z=j.defaults,F=Z.rtrim,te=Z.splitCells,ie=Z.escape,fe=Z.findClosingBracket;function ye(ge,he,ce){var re=he.href,q=he.title?ie(he.title):null,ae=ge[1].replace(/\\([\[\]])/g,"$1");return ge[0].charAt(0)!=="!"?{type:"link",raw:ce,href:re,title:q,text:ae}:{type:"image",raw:ce,href:re,title:q,text:ie(ae)}}function _e(ge,he){var ce=ge.match(/^(\s+)(?:```)/);if(ce===null)return he;var re=ce[1];return he.split(`
|
|
`).map(function(q){var ae=q.match(/^\s+/);if(ae===null)return q;var le=ae[0];return le.length>=re.length?q.slice(re.length):q}).join(`
|
|
`)}var Le=function(){function ge(ce){this.options=ce||z}var he=ge.prototype;return he.space=function(re){var q=this.rules.block.newline.exec(re);if(q)return q[0].length>1?{type:"space",raw:q[0]}:{raw:`
|
|
`}},he.code=function(re,q){var ae=this.rules.block.code.exec(re);if(ae){var le=q[q.length-1];if(le&&le.type==="paragraph")return{raw:ae[0],text:ae[0].trimRight()};var Te=ae[0].replace(/^ {4}/gm,"");return{type:"code",raw:ae[0],codeBlockStyle:"indented",text:this.options.pedantic?Te:F(Te,`
|
|
`)}}},he.fences=function(re){var q=this.rules.block.fences.exec(re);if(q){var ae=q[0],le=_e(ae,q[3]||"");return{type:"code",raw:ae,lang:q[2]?q[2].trim():q[2],text:le}}},he.heading=function(re){var q=this.rules.block.heading.exec(re);if(q)return{type:"heading",raw:q[0],depth:q[1].length,text:q[2]}},he.nptable=function(re){var q=this.rules.block.nptable.exec(re);if(q){var ae={type:"table",header:te(q[1].replace(/^ *| *\| *$/g,"")),align:q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:q[3]?q[3].replace(/\n$/,"").split(`
|
|
`):[],raw:q[0]};if(ae.header.length===ae.align.length){var le=ae.align.length,Te;for(Te=0;Te<le;Te++)/^ *-+: *$/.test(ae.align[Te])?ae.align[Te]="right":/^ *:-+: *$/.test(ae.align[Te])?ae.align[Te]="center":/^ *:-+ *$/.test(ae.align[Te])?ae.align[Te]="left":ae.align[Te]=null;for(le=ae.cells.length,Te=0;Te<le;Te++)ae.cells[Te]=te(ae.cells[Te],ae.header.length);return ae}}},he.hr=function(re){var q=this.rules.block.hr.exec(re);if(q)return{type:"hr",raw:q[0]}},he.blockquote=function(re){var q=this.rules.block.blockquote.exec(re);if(q){var ae=q[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:q[0],text:ae}}},he.list=function(re){var q=this.rules.block.list.exec(re);if(q){for(var ae=q[0],le=q[2],Te=le.length>1,be=le[le.length-1]===")",Fe={type:"list",raw:ae,ordered:Te,start:Te?+le.slice(0,-1):"",loose:!1,items:[]},Je=q[0].match(this.rules.block.item),pt=!1,ct,At,wt,qe,Mt,St,It,kt=Je.length,Dt=0;Dt<kt;Dt++)ct=Je[Dt],ae=ct,At=ct.length,ct=ct.replace(/^ *([*+-]|\d+[.)]) */,""),~ct.indexOf(`
|
|
`)&&(At-=ct.length,ct=this.options.pedantic?ct.replace(/^ {1,4}/gm,""):ct.replace(new RegExp("^ {1,"+At+"}","gm"),"")),Dt!==kt-1&&(wt=this.rules.block.bullet.exec(Je[Dt+1])[0],(Te?wt.length===1||!be&&wt[wt.length-1]===")":wt.length>1||this.options.smartLists&&wt!==le)&&(qe=Je.slice(Dt+1).join(`
|
|
`),Fe.raw=Fe.raw.substring(0,Fe.raw.length-qe.length),Dt=kt-1)),Mt=pt||/\n\n(?!\s*$)/.test(ct),Dt!==kt-1&&(pt=ct.charAt(ct.length-1)===`
|
|
`,Mt||(Mt=pt)),Mt&&(Fe.loose=!0),St=/^\[[ xX]\] /.test(ct),It=void 0,St&&(It=ct[1]!==" ",ct=ct.replace(/^\[[ xX]\] +/,"")),Fe.items.push({type:"list_item",raw:ae,task:St,checked:It,loose:Mt,text:ct});return Fe}},he.html=function(re){var q=this.rules.block.html.exec(re);if(q)return{type:this.options.sanitize?"paragraph":"html",raw:q[0],pre:!this.options.sanitizer&&(q[1]==="pre"||q[1]==="script"||q[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(q[0]):ie(q[0]):q[0]}},he.def=function(re){var q=this.rules.block.def.exec(re);if(q){q[3]&&(q[3]=q[3].substring(1,q[3].length-1));var ae=q[1].toLowerCase().replace(/\s+/g," ");return{tag:ae,raw:q[0],href:q[2],title:q[3]}}},he.table=function(re){var q=this.rules.block.table.exec(re);if(q){var ae={type:"table",header:te(q[1].replace(/^ *| *\| *$/g,"")),align:q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:q[3]?q[3].replace(/\n$/,"").split(`
|
|
`):[]};if(ae.header.length===ae.align.length){ae.raw=q[0];var le=ae.align.length,Te;for(Te=0;Te<le;Te++)/^ *-+: *$/.test(ae.align[Te])?ae.align[Te]="right":/^ *:-+: *$/.test(ae.align[Te])?ae.align[Te]="center":/^ *:-+ *$/.test(ae.align[Te])?ae.align[Te]="left":ae.align[Te]=null;for(le=ae.cells.length,Te=0;Te<le;Te++)ae.cells[Te]=te(ae.cells[Te].replace(/^ *\| *| *\| *$/g,""),ae.header.length);return ae}}},he.lheading=function(re){var q=this.rules.block.lheading.exec(re);if(q)return{type:"heading",raw:q[0],depth:q[2].charAt(0)==="="?1:2,text:q[1]}},he.paragraph=function(re){var q=this.rules.block.paragraph.exec(re);if(q)return{type:"paragraph",raw:q[0],text:q[1].charAt(q[1].length-1)===`
|
|
`?q[1].slice(0,-1):q[1]}},he.text=function(re,q){var ae=this.rules.block.text.exec(re);if(ae){var le=q[q.length-1];return le&&le.type==="text"?{raw:ae[0],text:ae[0]}:{type:"text",raw:ae[0],text:ae[0]}}},he.escape=function(re){var q=this.rules.inline.escape.exec(re);if(q)return{type:"escape",raw:q[0],text:ie(q[1])}},he.tag=function(re,q,ae){var le=this.rules.inline.tag.exec(re);if(le)return!q&&/^<a /i.test(le[0])?q=!0:q&&/^<\/a>/i.test(le[0])&&(q=!1),!ae&&/^<(pre|code|kbd|script)(\s|>)/i.test(le[0])?ae=!0:ae&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(le[0])&&(ae=!1),{type:this.options.sanitize?"text":"html",raw:le[0],inLink:q,inRawBlock:ae,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(le[0]):ie(le[0]):le[0]}},he.link=function(re){var q=this.rules.inline.link.exec(re);if(q){var ae=fe(q[2],"()");if(ae>-1){var le=q[0].indexOf("!")===0?5:4,Te=le+q[1].length+ae;q[2]=q[2].substring(0,ae),q[0]=q[0].substring(0,Te).trim(),q[3]=""}var be=q[2],Fe="";if(this.options.pedantic){var Je=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(be);Je?(be=Je[1],Fe=Je[3]):Fe=""}else Fe=q[3]?q[3].slice(1,-1):"";be=be.trim().replace(/^<([\s\S]*)>$/,"$1");var pt=ye(q,{href:be&&be.replace(this.rules.inline._escapes,"$1"),title:Fe&&Fe.replace(this.rules.inline._escapes,"$1")},q[0]);return pt}},he.reflink=function(re,q){var ae;if((ae=this.rules.inline.reflink.exec(re))||(ae=this.rules.inline.nolink.exec(re))){var le=(ae[2]||ae[1]).replace(/\s+/g," ");if(le=q[le.toLowerCase()],!le||!le.href){var Te=ae[0].charAt(0);return{type:"text",raw:Te,text:Te}}var be=ye(ae,le,ae[0]);return be}},he.strong=function(re,q,ae){ae===void 0&&(ae="");var le=this.rules.inline.strong.start.exec(re);if(le&&(!le[1]||le[1]&&(ae===""||this.rules.inline.punctuation.exec(ae)))){q=q.slice(-1*re.length);var Te=le[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Te.lastIndex=0;for(var be;(le=Te.exec(q))!=null;)if(be=this.rules.inline.strong.middle.exec(q.slice(0,le.index+3)),be)return{type:"strong",raw:re.slice(0,be[0].length),text:re.slice(2,be[0].length-2)}}},he.em=function(re,q,ae){ae===void 0&&(ae="");var le=this.rules.inline.em.start.exec(re);if(le&&(!le[1]||le[1]&&(ae===""||this.rules.inline.punctuation.exec(ae)))){q=q.slice(-1*re.length);var Te=le[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Te.lastIndex=0;for(var be;(le=Te.exec(q))!=null;)if(be=this.rules.inline.em.middle.exec(q.slice(0,le.index+2)),be)return{type:"em",raw:re.slice(0,be[0].length),text:re.slice(1,be[0].length-1)}}},he.codespan=function(re){var q=this.rules.inline.code.exec(re);if(q){var ae=q[2].replace(/\n/g," "),le=/[^ ]/.test(ae),Te=ae.startsWith(" ")&&ae.endsWith(" ");return le&&Te&&(ae=ae.substring(1,ae.length-1)),ae=ie(ae,!0),{type:"codespan",raw:q[0],text:ae}}},he.br=function(re){var q=this.rules.inline.br.exec(re);if(q)return{type:"br",raw:q[0]}},he.del=function(re){var q=this.rules.inline.del.exec(re);if(q)return{type:"del",raw:q[0],text:q[1]}},he.autolink=function(re,q){var ae=this.rules.inline.autolink.exec(re);if(ae){var le,Te;return ae[2]==="@"?(le=ie(this.options.mangle?q(ae[1]):ae[1]),Te="mailto:"+le):(le=ie(ae[1]),Te=le),{type:"link",raw:ae[0],text:le,href:Te,tokens:[{type:"text",raw:le,text:le}]}}},he.url=function(re,q){var ae;if(ae=this.rules.inline.url.exec(re)){var le,Te;if(ae[2]==="@")le=ie(this.options.mangle?q(ae[0]):ae[0]),Te="mailto:"+le;else{var be;do be=ae[0],ae[0]=this.rules.inline._backpedal.exec(ae[0])[0];while(be!==ae[0]);le=ie(ae[0]),ae[1]==="www."?Te="http://"+le:Te=le}return{type:"link",raw:ae[0],text:le,href:Te,tokens:[{type:"text",raw:le,text:le}]}}},he.inlineText=function(re,q,ae){var le=this.rules.inline.text.exec(re);if(le){var Te;return q?Te=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(le[0]):ie(le[0]):le[0]:Te=ie(this.options.smartypants?ae(le[0]):le[0]),{type:"text",raw:le[0],text:Te}}},ge}(),Ae=Z.noopTest,ke=Z.edit,De=Z.merge,ve={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:Ae,table:Ae,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ve._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ve._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ve.def=ke(ve.def).replace("label",ve._label).replace("title",ve._title).getRegex(),ve.bullet=/(?:[*+-]|\d{1,9}[.)])/,ve.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ve.item=ke(ve.item,"gm").replace(/bull/g,ve.bullet).getRegex(),ve.list=ke(ve.list).replace(/bull/g,ve.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ve.def.source+")").getRegex(),ve._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",ve._comment=/<!--(?!-?>)[\s\S]*?-->/,ve.html=ke(ve.html,"i").replace("comment",ve._comment).replace("tag",ve._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ve.paragraph=ke(ve._paragraph).replace("hr",ve.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",ve._tag).getRegex(),ve.blockquote=ke(ve.blockquote).replace("paragraph",ve.paragraph).getRegex(),ve.normal=De({},ve),ve.gfm=De({},ve.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*|$)"}),ve.gfm.nptable=ke(ve.gfm.nptable).replace("hr",ve.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",ve._tag).getRegex(),ve.gfm.table=ke(ve.gfm.table).replace("hr",ve.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",ve._tag).getRegex(),ve.pedantic=De({},ve.normal,{html:ke(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ve._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:Ae,paragraph:ke(ve.normal._paragraph).replace("hr",ve.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ve.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var ue={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Ae,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:Ae,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};ue._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",ue.punctuation=ke(ue.punctuation).replace(/punctuation/g,ue._punctuation).getRegex(),ue._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",ue._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",ue.em.start=ke(ue.em.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.middle=ke(ue.em.middle).replace(/punctuation/g,ue._punctuation).replace(/overlapSkip/g,ue._overlapSkip).getRegex(),ue.em.endAst=ke(ue.em.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.endUnd=ke(ue.em.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.start=ke(ue.strong.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.middle=ke(ue.strong.middle).replace(/punctuation/g,ue._punctuation).replace(/blockSkip/g,ue._blockSkip).getRegex(),ue.strong.endAst=ke(ue.strong.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.endUnd=ke(ue.strong.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.blockSkip=ke(ue._blockSkip,"g").getRegex(),ue.overlapSkip=ke(ue._overlapSkip,"g").getRegex(),ue._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,ue._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,ue._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])?)+(?![-_])/,ue.autolink=ke(ue.autolink).replace("scheme",ue._scheme).replace("email",ue._email).getRegex(),ue._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,ue.tag=ke(ue.tag).replace("comment",ve._comment).replace("attribute",ue._attribute).getRegex(),ue._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ue._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,ue._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,ue.link=ke(ue.link).replace("label",ue._label).replace("href",ue._href).replace("title",ue._title).getRegex(),ue.reflink=ke(ue.reflink).replace("label",ue._label).getRegex(),ue.reflinkSearch=ke(ue.reflinkSearch,"g").replace("reflink",ue.reflink).replace("nolink",ue.nolink).getRegex(),ue.normal=De({},ue),ue.pedantic=De({},ue.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:ke(/^!?\[(label)\]\((.*?)\)/).replace("label",ue._label).getRegex(),reflink:ke(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ue._label).getRegex()}),ue.gfm=De({},ue.normal,{escape:ke(ue.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),ue.gfm.url=ke(ue.gfm.url,"i").replace("email",ue.gfm._extended_email).getRegex(),ue.breaks=De({},ue.gfm,{br:ke(ue.br).replace("{2,}","*").getRegex(),text:ke(ue.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Me={block:ve,inline:ue},Qe=j.defaults,He=Me.block,rt=Me.inline;function oe(ge){return ge.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 de(ge){var he="",ce,re,q=ge.length;for(ce=0;ce<q;ce++)re=ge.charCodeAt(ce),Math.random()>.5&&(re="x"+re.toString(16)),he+="&#"+re+";";return he}var xe=function(){function ge(ce){this.tokens=[],this.tokens.links=Object.create(null),this.options=ce||Qe,this.options.tokenizer=this.options.tokenizer||new Le,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var re={block:He.normal,inline:rt.normal};this.options.pedantic?(re.block=He.pedantic,re.inline=rt.pedantic):this.options.gfm&&(re.block=He.gfm,this.options.breaks?re.inline=rt.breaks:re.inline=rt.gfm),this.tokenizer.rules=re}ge.lex=function(re,q){var ae=new ge(q);return ae.lex(re)};var he=ge.prototype;return he.lex=function(re){return re=re.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(re,this.tokens,!0),this.inline(this.tokens),this.tokens},he.blockTokens=function(re,q,ae){q===void 0&&(q=[]),ae===void 0&&(ae=!0),re=re.replace(/^ +$/gm,"");for(var le,Te,be,Fe;re;){if(le=this.tokenizer.space(re)){re=re.substring(le.raw.length),le.type&&q.push(le);continue}if(le=this.tokenizer.code(re,q)){re=re.substring(le.raw.length),le.type?q.push(le):(Fe=q[q.length-1],Fe.raw+=`
|
|
`+le.raw,Fe.text+=`
|
|
`+le.text);continue}if(le=this.tokenizer.fences(re)){re=re.substring(le.raw.length),q.push(le);continue}if(le=this.tokenizer.heading(re)){re=re.substring(le.raw.length),q.push(le);continue}if(le=this.tokenizer.nptable(re)){re=re.substring(le.raw.length),q.push(le);continue}if(le=this.tokenizer.hr(re)){re=re.substring(le.raw.length),q.push(le);continue}if(le=this.tokenizer.blockquote(re)){re=re.substring(le.raw.length),le.tokens=this.blockTokens(le.text,[],ae),q.push(le);continue}if(le=this.tokenizer.list(re)){for(re=re.substring(le.raw.length),be=le.items.length,Te=0;Te<be;Te++)le.items[Te].tokens=this.blockTokens(le.items[Te].text,[],!1);q.push(le);continue}if(le=this.tokenizer.html(re)){re=re.substring(le.raw.length),q.push(le);continue}if(ae&&(le=this.tokenizer.def(re))){re=re.substring(le.raw.length),this.tokens.links[le.tag]||(this.tokens.links[le.tag]={href:le.href,title:le.title});continue}if(le=this.tokenizer.table(re)){re=re.substring(le.raw.length),q.push(le);continue}if(le=this.tokenizer.lheading(re)){re=re.substring(le.raw.length),q.push(le);continue}if(ae&&(le=this.tokenizer.paragraph(re))){re=re.substring(le.raw.length),q.push(le);continue}if(le=this.tokenizer.text(re,q)){re=re.substring(le.raw.length),le.type?q.push(le):(Fe=q[q.length-1],Fe.raw+=`
|
|
`+le.raw,Fe.text+=`
|
|
`+le.text);continue}if(re){var Je="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(Je);break}else throw new Error(Je)}}return q},he.inline=function(re){var q,ae,le,Te,be,Fe,Je=re.length;for(q=0;q<Je;q++){Fe=re[q];switch(Fe.type){case"paragraph":case"text":case"heading":{Fe.tokens=[],this.inlineTokens(Fe.text,Fe.tokens);break}case"table":{for(Fe.tokens={header:[],cells:[]},Te=Fe.header.length,ae=0;ae<Te;ae++)Fe.tokens.header[ae]=[],this.inlineTokens(Fe.header[ae],Fe.tokens.header[ae]);for(Te=Fe.cells.length,ae=0;ae<Te;ae++)for(be=Fe.cells[ae],Fe.tokens.cells[ae]=[],le=0;le<be.length;le++)Fe.tokens.cells[ae][le]=[],this.inlineTokens(be[le],Fe.tokens.cells[ae][le]);break}case"blockquote":{this.inline(Fe.tokens);break}case"list":{for(Te=Fe.items.length,ae=0;ae<Te;ae++)this.inline(Fe.items[ae].tokens);break}}}return re},he.inlineTokens=function(re,q,ae,le,Te){q===void 0&&(q=[]),ae===void 0&&(ae=!1),le===void 0&&(le=!1),Te===void 0&&(Te="");var be,Fe=re,Je;if(this.tokens.links){var pt=Object.keys(this.tokens.links);if(pt.length>0)for(;(Je=this.tokenizer.rules.inline.reflinkSearch.exec(Fe))!=null;)pt.includes(Je[0].slice(Je[0].lastIndexOf("[")+1,-1))&&(Fe=Fe.slice(0,Je.index)+"["+"a".repeat(Je[0].length-2)+"]"+Fe.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Je=this.tokenizer.rules.inline.blockSkip.exec(Fe))!=null;)Fe=Fe.slice(0,Je.index)+"["+"a".repeat(Je[0].length-2)+"]"+Fe.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;re;){if(be=this.tokenizer.escape(re)){re=re.substring(be.raw.length),q.push(be);continue}if(be=this.tokenizer.tag(re,ae,le)){re=re.substring(be.raw.length),ae=be.inLink,le=be.inRawBlock,q.push(be);continue}if(be=this.tokenizer.link(re)){re=re.substring(be.raw.length),be.type==="link"&&(be.tokens=this.inlineTokens(be.text,[],!0,le)),q.push(be);continue}if(be=this.tokenizer.reflink(re,this.tokens.links)){re=re.substring(be.raw.length),be.type==="link"&&(be.tokens=this.inlineTokens(be.text,[],!0,le)),q.push(be);continue}if(be=this.tokenizer.strong(re,Fe,Te)){re=re.substring(be.raw.length),be.tokens=this.inlineTokens(be.text,[],ae,le),q.push(be);continue}if(be=this.tokenizer.em(re,Fe,Te)){re=re.substring(be.raw.length),be.tokens=this.inlineTokens(be.text,[],ae,le),q.push(be);continue}if(be=this.tokenizer.codespan(re)){re=re.substring(be.raw.length),q.push(be);continue}if(be=this.tokenizer.br(re)){re=re.substring(be.raw.length),q.push(be);continue}if(be=this.tokenizer.del(re)){re=re.substring(be.raw.length),be.tokens=this.inlineTokens(be.text,[],ae,le),q.push(be);continue}if(be=this.tokenizer.autolink(re,de)){re=re.substring(be.raw.length),q.push(be);continue}if(!ae&&(be=this.tokenizer.url(re,de))){re=re.substring(be.raw.length),q.push(be);continue}if(be=this.tokenizer.inlineText(re,le,oe)){re=re.substring(be.raw.length),Te=be.raw.slice(-1),q.push(be);continue}if(re){var ct="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(ct);break}else throw new Error(ct)}}return q},$(ge,null,[{key:"rules",get:function(){return{block:He,inline:rt}}}]),ge}(),Re=j.defaults,Ie=Z.cleanUrl,Ne=Z.escape,Ge=function(){function ge(ce){this.options=ce||Re}var he=ge.prototype;return he.code=function(re,q,ae){var le=(q||"").match(/\S*/)[0];if(this.options.highlight){var Te=this.options.highlight(re,le);Te!=null&&Te!==re&&(ae=!0,re=Te)}return le?'<pre><code class="'+this.options.langPrefix+Ne(le,!0)+'">'+(ae?re:Ne(re,!0))+`</code></pre>
|
|
`:"<pre><code>"+(ae?re:Ne(re,!0))+`</code></pre>
|
|
`},he.blockquote=function(re){return`<blockquote>
|
|
`+re+`</blockquote>
|
|
`},he.html=function(re){return re},he.heading=function(re,q,ae,le){return this.options.headerIds?"<h"+q+' id="'+this.options.headerPrefix+le.slug(ae)+'">'+re+"</h"+q+`>
|
|
`:"<h"+q+">"+re+"</h"+q+`>
|
|
`},he.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},he.list=function(re,q,ae){var le=q?"ol":"ul",Te=q&&ae!==1?' start="'+ae+'"':"";return"<"+le+Te+`>
|
|
`+re+"</"+le+`>
|
|
`},he.listitem=function(re){return"<li>"+re+`</li>
|
|
`},he.checkbox=function(re){return"<input "+(re?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},he.paragraph=function(re){return"<p>"+re+`</p>
|
|
`},he.table=function(re,q){return q&&(q="<tbody>"+q+"</tbody>"),`<table>
|
|
<thead>
|
|
`+re+`</thead>
|
|
`+q+`</table>
|
|
`},he.tablerow=function(re){return`<tr>
|
|
`+re+`</tr>
|
|
`},he.tablecell=function(re,q){var ae=q.header?"th":"td",le=q.align?"<"+ae+' align="'+q.align+'">':"<"+ae+">";return le+re+"</"+ae+`>
|
|
`},he.strong=function(re){return"<strong>"+re+"</strong>"},he.em=function(re){return"<em>"+re+"</em>"},he.codespan=function(re){return"<code>"+re+"</code>"},he.br=function(){return this.options.xhtml?"<br/>":"<br>"},he.del=function(re){return"<del>"+re+"</del>"},he.link=function(re,q,ae){if(re=Ie(this.options.sanitize,this.options.baseUrl,re),re===null)return ae;var le='<a href="'+Ne(re)+'"';return q&&(le+=' title="'+q+'"'),le+=">"+ae+"</a>",le},he.image=function(re,q,ae){if(re=Ie(this.options.sanitize,this.options.baseUrl,re),re===null)return ae;var le='<img src="'+re+'" alt="'+ae+'"';return q&&(le+=' title="'+q+'"'),le+=this.options.xhtml?"/>":">",le},he.text=function(re){return re},ge}(),ze=function(){function ge(){}var he=ge.prototype;return he.strong=function(re){return re},he.em=function(re){return re},he.codespan=function(re){return re},he.del=function(re){return re},he.html=function(re){return re},he.text=function(re){return re},he.link=function(re,q,ae){return""+ae},he.image=function(re,q,ae){return""+ae},he.br=function(){return""},ge}(),ut=function(){function ge(){this.seen={}}var he=ge.prototype;return he.slug=function(re){var q=re.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(q)){var ae=q;do this.seen[ae]++,q=ae+"-"+this.seen[ae];while(this.seen.hasOwnProperty(q))}return this.seen[q]=0,q},ge}(),Ke=j.defaults,Be=Z.unescape,Xe=function(){function ge(ce){this.options=ce||Ke,this.options.renderer=this.options.renderer||new Ge,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new ze,this.slugger=new ut}ge.parse=function(re,q){var ae=new ge(q);return ae.parse(re)};var he=ge.prototype;return he.parse=function(re,q){q===void 0&&(q=!0);var ae="",le,Te,be,Fe,Je,pt,ct,At,wt,qe,Mt,St,It,kt,Dt,Ar,cr,Et,bt=re.length;for(le=0;le<bt;le++){qe=re[le];switch(qe.type){case"space":continue;case"hr":{ae+=this.renderer.hr();continue}case"heading":{ae+=this.renderer.heading(this.parseInline(qe.tokens),qe.depth,Be(this.parseInline(qe.tokens,this.textRenderer)),this.slugger);continue}case"code":{ae+=this.renderer.code(qe.text,qe.lang,qe.escaped);continue}case"table":{for(At="",ct="",Fe=qe.header.length,Te=0;Te<Fe;Te++)ct+=this.renderer.tablecell(this.parseInline(qe.tokens.header[Te]),{header:!0,align:qe.align[Te]});for(At+=this.renderer.tablerow(ct),wt="",Fe=qe.cells.length,Te=0;Te<Fe;Te++){for(pt=qe.tokens.cells[Te],ct="",Je=pt.length,be=0;be<Je;be++)ct+=this.renderer.tablecell(this.parseInline(pt[be]),{header:!1,align:qe.align[be]});wt+=this.renderer.tablerow(ct)}ae+=this.renderer.table(At,wt);continue}case"blockquote":{wt=this.parse(qe.tokens),ae+=this.renderer.blockquote(wt);continue}case"list":{for(Mt=qe.ordered,St=qe.start,It=qe.loose,Fe=qe.items.length,wt="",Te=0;Te<Fe;Te++)Dt=qe.items[Te],Ar=Dt.checked,cr=Dt.task,kt="",Dt.task&&(Et=this.renderer.checkbox(Ar),It?Dt.tokens.length>0&&Dt.tokens[0].type==="text"?(Dt.tokens[0].text=Et+" "+Dt.tokens[0].text,Dt.tokens[0].tokens&&Dt.tokens[0].tokens.length>0&&Dt.tokens[0].tokens[0].type==="text"&&(Dt.tokens[0].tokens[0].text=Et+" "+Dt.tokens[0].tokens[0].text)):Dt.tokens.unshift({type:"text",text:Et}):kt+=Et),kt+=this.parse(Dt.tokens,It),wt+=this.renderer.listitem(kt,cr,Ar);ae+=this.renderer.list(wt,Mt,St);continue}case"html":{ae+=this.renderer.html(qe.text);continue}case"paragraph":{ae+=this.renderer.paragraph(this.parseInline(qe.tokens));continue}case"text":{for(wt=qe.tokens?this.parseInline(qe.tokens):qe.text;le+1<bt&&re[le+1].type==="text";)qe=re[++le],wt+=`
|
|
`+(qe.tokens?this.parseInline(qe.tokens):qe.text);ae+=q?this.renderer.paragraph(wt):wt;continue}default:{var ht='Token with "'+qe.type+'" type was not found.';if(this.options.silent){console.error(ht);return}else throw new Error(ht)}}}return ae},he.parseInline=function(re,q){q=q||this.renderer;var ae="",le,Te,be=re.length;for(le=0;le<be;le++){Te=re[le];switch(Te.type){case"escape":{ae+=q.text(Te.text);break}case"html":{ae+=q.html(Te.text);break}case"link":{ae+=q.link(Te.href,Te.title,this.parseInline(Te.tokens,q));break}case"image":{ae+=q.image(Te.href,Te.title,Te.text);break}case"strong":{ae+=q.strong(this.parseInline(Te.tokens,q));break}case"em":{ae+=q.em(this.parseInline(Te.tokens,q));break}case"codespan":{ae+=q.codespan(Te.text);break}case"br":{ae+=q.br();break}case"del":{ae+=q.del(this.parseInline(Te.tokens,q));break}case"text":{ae+=q.text(Te.text);break}default:{var Fe='Token with "'+Te.type+'" type was not found.';if(this.options.silent){console.error(Fe);return}else throw new Error(Fe)}}}return ae},ge}(),tt=Z.merge,Ze=Z.checkSanitizeDeprecation,it=Z.escape,we=j.getDefaults,Ye=j.changeDefaults,at=j.defaults;function Oe(ge,he,ce){if(typeof ge=="undefined"||ge===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ge!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ge)+", string expected");if(typeof he=="function"&&(ce=he,he=null),he=tt({},Oe.defaults,he||{}),Ze(he),ce){var re=he.highlight,q;try{q=xe.lex(ge,he)}catch(be){return ce(be)}var ae=function(Fe){var Je;if(!Fe)try{Je=Xe.parse(q,he)}catch(pt){Fe=pt}return he.highlight=re,Fe?ce(Fe):ce(null,Je)};if(!re||re.length<3)return ae();if(delete he.highlight,!q.length)return ae();var le=0;Oe.walkTokens(q,function(be){be.type==="code"&&(le++,setTimeout(function(){re(be.text,be.lang,function(Fe,Je){if(Fe)return ae(Fe);Je!=null&&Je!==be.text&&(be.text=Je,be.escaped=!0),le--,le===0&&ae()})},0))}),le===0&&ae();return}try{var Te=xe.lex(ge,he);return he.walkTokens&&Oe.walkTokens(Te,he.walkTokens),Xe.parse(Te,he)}catch(be){if(be.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,he.silent)return"<p>An error occurred:</p><pre>"+it(be.message+"",!0)+"</pre>";throw be}}Oe.options=Oe.setOptions=function(ge){return tt(Oe.defaults,ge),Ye(Oe.defaults),Oe},Oe.getDefaults=we,Oe.defaults=at,Oe.use=function(ge){var he=tt({},ge);if(ge.renderer&&function(){var re=Oe.defaults.renderer||new Ge,q=function(Te){var be=re[Te];re[Te]=function(){for(var Fe=arguments.length,Je=new Array(Fe),pt=0;pt<Fe;pt++)Je[pt]=arguments[pt];var ct=ge.renderer[Te].apply(re,Je);return ct===!1&&(ct=be.apply(re,Je)),ct}};for(var ae in ge.renderer)q(ae);he.renderer=re}(),ge.tokenizer&&function(){var re=Oe.defaults.tokenizer||new Le,q=function(Te){var be=re[Te];re[Te]=function(){for(var Fe=arguments.length,Je=new Array(Fe),pt=0;pt<Fe;pt++)Je[pt]=arguments[pt];var ct=ge.tokenizer[Te].apply(re,Je);return ct===!1&&(ct=be.apply(re,Je)),ct}};for(var ae in ge.tokenizer)q(ae);he.tokenizer=re}(),ge.walkTokens){var ce=Oe.defaults.walkTokens;he.walkTokens=function(re){ge.walkTokens(re),ce&&ce(re)}}Oe.setOptions(he)},Oe.walkTokens=function(ge,he){for(var ce=I(ge),re;!(re=ce()).done;){var q=re.value;he(q);switch(q.type){case"table":{for(var ae=I(q.tokens.header),le;!(le=ae()).done;){var Te=le.value;Oe.walkTokens(Te,he)}for(var be=I(q.tokens.cells),Fe;!(Fe=be()).done;)for(var Je=Fe.value,pt=I(Je),ct;!(ct=pt()).done;){var At=ct.value;Oe.walkTokens(At,he)}break}case"list":{Oe.walkTokens(q.items,he);break}default:q.tokens&&Oe.walkTokens(q.tokens,he)}}},Oe.Parser=Xe,Oe.parser=Xe.parse,Oe.Renderer=Ge,Oe.TextRenderer=ze,Oe.Lexer=xe,Oe.lexer=xe.lex,Oe.Tokenizer=Le,Oe.Slugger=ut,Oe.parse=Oe;var je=Oe;return je})},ELLl:function(yt,Ee,Q){(function(ne){ne(Q("VrN/"))})(function(ne){var $={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},M=ne.Pos;ne.defineOption("autoCloseBrackets",!1,function(p,b,o){o&&o!=ne.Init&&(p.removeKeyMap(I),p.state.closeBrackets=null),b&&(D(K(b,"pairs")),p.state.closeBrackets=b,p.addKeyMap(I))});function K(p,b){return b=="pairs"&&typeof p=="string"?p:typeof p=="object"&&p[b]!=null?p[b]:$[b]}var I={Backspace:_,Enter:k};function D(p){for(var b=0;b<p.length;b++){var o=p.charAt(b),i="'"+o+"'";I[i]||(I[i]=j(o))}}D($.pairs+"`");function j(p){return function(b){return f(b,p)}}function N(p){var b=p.state.closeBrackets;if(!b||b.override)return b;var o=p.getModeAt(p.getCursor());return o.closeBrackets||b}function _(p){var b=N(p);if(!b||p.getOption("disableInput"))return ne.Pass;for(var o=K(b,"pairs"),i=p.listSelections(),s=0;s<i.length;s++){if(!i[s].empty())return ne.Pass;var l=T(p,i[s].head);if(!l||o.indexOf(l)%2!=0)return ne.Pass}for(var s=i.length-1;s>=0;s--){var E=i[s].head;p.replaceRange("",M(E.line,E.ch-1),M(E.line,E.ch+1),"+delete")}}function k(p){var b=N(p),o=b&&K(b,"explode");if(!o||p.getOption("disableInput"))return ne.Pass;for(var i=p.listSelections(),s=0;s<i.length;s++){if(!i[s].empty())return ne.Pass;var l=T(p,i[s].head);if(!l||o.indexOf(l)%2!=0)return ne.Pass}p.operation(function(){var E=p.lineSeparator()||`
|
|
`;p.replaceSelection(E+E,null),p.execCommand("goCharLeft"),i=p.listSelections();for(var g=0;g<i.length;g++){var v=i[g].head.line;p.indentLine(v,null,!0),p.indentLine(v+1,null,!0)}})}function d(p){var b=ne.cmpPos(p.anchor,p.head)>0;return{anchor:new M(p.anchor.line,p.anchor.ch+(b?-1:1)),head:new M(p.head.line,p.head.ch+(b?1:-1))}}function f(p,b){var o=N(p);if(!o||p.getOption("disableInput"))return ne.Pass;var i=K(o,"pairs"),s=i.indexOf(b);if(s==-1)return ne.Pass;for(var l=K(o,"closeBefore"),E=K(o,"triples"),g=i.charAt(s+1)==b,v=p.listSelections(),O=s%2==0,w,C=0;C<v.length;C++){var y=v[C],c=y.head,u,L=p.getRange(c,M(c.line,c.ch+1));if(O&&!y.empty())u="surround";else if((g||!O)&&L==b)g&&m(p,c)?u="both":E.indexOf(b)>=0&&p.getRange(c,M(c.line,c.ch+3))==b+b+b?u="skipThree":u="skip";else if(g&&c.ch>1&&E.indexOf(b)>=0&&p.getRange(M(c.line,c.ch-2),c)==b+b){if(c.ch>2&&/\bstring/.test(p.getTokenTypeAt(M(c.line,c.ch-2))))return ne.Pass;u="addFour"}else if(g){var S=c.ch==0?" ":p.getRange(M(c.line,c.ch-1),c);if(!ne.isWordChar(L)&&S!=b&&!ne.isWordChar(S))u="both";else return ne.Pass}else if(O&&(L.length===0||/\s/.test(L)||l.indexOf(L)>-1))u="both";else return ne.Pass;if(!w)w=u;else if(w!=u)return ne.Pass}var A=s%2?i.charAt(s-1):b,P=s%2?b:i.charAt(s+1);p.operation(function(){if(w=="skip")p.execCommand("goCharRight");else if(w=="skipThree")for(var W=0;W<3;W++)p.execCommand("goCharRight");else if(w=="surround"){for(var V=p.getSelections(),W=0;W<V.length;W++)V[W]=A+V[W]+P;p.replaceSelections(V,"around"),V=p.listSelections().slice();for(var W=0;W<V.length;W++)V[W]=d(V[W]);p.setSelections(V)}else w=="both"?(p.replaceSelection(A+P,null),p.triggerElectric(A+P),p.execCommand("goCharLeft")):w=="addFour"&&(p.replaceSelection(A+A+A+A,"before"),p.execCommand("goCharRight"))})}function T(p,b){var o=p.getRange(M(b.line,b.ch-1),M(b.line,b.ch+1));return o.length==2?o:null}function m(p,b){var o=p.getTokenAt(M(b.line,b.ch+1));return/\bstring/.test(o.type)&&o.start==b.ch&&(b.ch==0||!/\bstring/.test(p.getTokenTypeAt(b)))}})},G8my:function(yt,Ee,Q){yt.exports={flex:"flex___1FMOA"}},HmJG:function(yt,Ee,Q){},JYp7:function(yt,Ee,Q){"use strict";Q.d(Ee,"c",function(){return $}),Q.d(Ee,"d",function(){return M}),Q.d(Ee,"f",function(){return I}),Q.d(Ee,"a",function(){return D}),Q.d(Ee,"b",function(){return j}),Q.d(Ee,"e",function(){return N});var ne=function(){var _=function(k,d){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,T){f.__proto__=T}||function(f,T){for(var m in T)T.hasOwnProperty(m)&&(f[m]=T[m])},_(k,d)};return function(k,d){_(k,d);function f(){this.constructor=k}k.prototype=d===null?Object.create(d):(f.prototype=d.prototype,new f)}}(),$={done:!0,value:void 0},M;(function(_){var k={next:function(){return $}};function d(){return k}_.empty=d;function f(g){var v=!1;return{next:function(){return v?$:(v=!0,{done:!1,value:g})}}}_.single=f;function T(g,v,O){return v===void 0&&(v=0),O===void 0&&(O=g.length),{next:function(){return v>=O?$:{done:!1,value:g[v++]}}}}_.fromArray=T;function m(g){return{next:function(){var v=g.next();return v.done?$:{done:!1,value:v.value}}}}_.fromNativeIterator=m;function p(g){return g?Array.isArray(g)?_.fromArray(g):g:_.empty()}_.from=p;function b(g,v){return{next:function(){var O=g.next();return O.done?$:{done:!1,value:v(O.value)}}}}_.map=b;function o(g,v){return{next:function(){for(;;){var O=g.next();if(O.done)return $;if(v(O.value))return{done:!1,value:O.value}}}}}_.filter=o;function i(g,v){for(var O=g.next();!O.done;O=g.next())v(O.value)}_.forEach=i;function s(g,v){v===void 0&&(v=Number.POSITIVE_INFINITY);var O=[];if(v===0)return O;for(var w=0,C=g.next();!C.done&&!(O.push(C.value),++w>=v);C=g.next());return O}_.collect=s;function l(){for(var g=[],v=0;v<arguments.length;v++)g[v]=arguments[v];var O=0;return{next:function(){if(O>=g.length)return $;var w=g[O],C=w.next();return C.done?(O++,this.next()):C}}}_.concat=l;function E(g){return new K(g)}_.chain=E})(M||(M={}));var K=function(){function _(k){this.it=k}return _.prototype.next=function(){return this.it.next()},_}();function I(_){return Array.isArray(_)?M.fromArray(_):_||M.empty()}var D=function(){function _(k,d,f,T){d===void 0&&(d=0),f===void 0&&(f=k.length),T===void 0&&(T=d-1),this.items=k,this.start=d,this.end=f,this.index=T}return _.prototype.first=function(){return this.index=this.start,this.current()},_.prototype.next=function(){return this.index=Math.min(this.index+1,this.end),this.current()},_.prototype.current=function(){return this.index===this.start-1||this.index===this.end?null:this.items[this.index]},_}(),j=function(_){ne(k,_);function k(d,f,T,m){return f===void 0&&(f=0),T===void 0&&(T=d.length),m===void 0&&(m=f-1),_.call(this,d,f,T,m)||this}return k.prototype.current=function(){return _.prototype.current.call(this)},k.prototype.previous=function(){return this.index=Math.max(this.index-1,this.start-1),this.current()},k.prototype.first=function(){return this.index=this.start,this.current()},k.prototype.last=function(){return this.index=this.end-1,this.current()},k.prototype.parent=function(){return null},k}(D),N=function(){function _(k,d){this.iterator=k,this.fn=d}return _.prototype.next=function(){return this.fn(this.iterator.next())},_}()},JkjM:function(yt,Ee,Q){"use strict";Q.r(Ee);var ne=Q("9og8"),$=Q("PpiC"),M=Q("WmNS"),K=Q.n(M),I=Q("q1tI"),D=Q.n(I),j=Q("Ty5D"),N=Q("9kvl"),_=Q("14J3"),k=Q("BMrR"),d=Q("jCWc"),f=Q("kPKH"),T=Q("+L6B"),m=Q("2/Rp"),p=Q("k1fw"),b=Q("m3rI"),o=Q("LO5M"),i=Q.n(o),s=Q("h+Ho"),l=function(Be){var Xe,tt,Ze,it,we=Be.user,Ye=Be.forumsDetail,at=Be.globalSetting,Oe=Be.loading,je=Be.dispatch,ge=Object($.a)(Be,["user","forumsDetail","globalSetting","loading","dispatch"]),he=Ye.forumsDetailData||{},ce=he.author_info,re=he.memo,q=he.recommend_shixuns,ae=function(){var le=Object(ne.a)(K.a.mark(function Te(){var be;return K.a.wrap(function(Je){for(;;)switch(Je.prev=Je.next){case 0:if(!(ce!=null&&ce.watched)){Je.next=6;break}return Je.next=3,Object(s.a)({user_id:ce.user_id});case 3:Je.t0=Je.sent,Je.next=9;break;case 6:return Je.next=8,Object(s.o)({user_id:ce.user_id});case 8:Je.t0=Je.sent;case 9:be=Je.t0,be&&je({type:"forumsDetail/setForumsDetailData",payload:Object(p.a)(Object(p.a)({},Ye.forumsDetailData),{},{author_info:Object(p.a)(Object(p.a)({},ce),{},{watched:!(ce!=null&&ce.watched)})})});case 11:case"end":return Je.stop()}},Te)}));return function(){return le.apply(this,arguments)}}();return D.a.createElement("section",{className:i.a.wrap},D.a.createElement("aside",{className:"ml20"},D.a.createElement("div",{className:"bg-white pt40 pb40 pl20 pr20 ".concat(i.a.head)},D.a.createElement("a",{href:"/users/".concat(ce==null?void 0:ce.login),target:"_blank"},(ce==null?void 0:ce.image_url)&&D.a.createElement("img",{src:"".concat(b.a.API_SERVER,"/images/").concat(ce==null?void 0:ce.image_url)})),D.a.createElement("div",{className:"tc font20"},ce==null?void 0:ce.username),D.a.createElement("div",{className:"tc c-grey-999"},ce==null?void 0:ce.identity),((Xe=we.userInfo)===null||Xe===void 0?void 0:Xe.user_id)!==(ce==null?void 0:ce.user_id)&&D.a.createElement(k.a,{justify:"center",className:"mt30 ".concat(i.a.buttonWrap)},D.a.createElement(f.a,null,D.a.createElement(m.a,{type:"primary",className:"mr10",onClick:ae},ce!=null&&ce.watched?"\u53D6\u6D88\u5173\u6CE8":"\u5173\u6CE8")),D.a.createElement(f.a,null,D.a.createElement(m.a,{ghost:!0,className:i.a.privateMessage,href:"/messages/".concat((tt=we.userInfo)===null||tt===void 0?void 0:tt.login,"/message_detail?target_ids=").concat(ce==null?void 0:ce.user_id),target:"_blank"},"\u79C1\u4FE1")))),!!(re!=null&&(Ze=re.tag)!==null&&Ze!==void 0&&Ze.length)&&D.a.createElement("div",{className:"bg-white mt10 pt40 pb40 pl20 pr20"},D.a.createElement("div",{className:"font16"},"\u8BDD\u9898\u6807\u7B7E"),D.a.createElement("div",{className:"mt30 ".concat(i.a.tag)},re==null||((it=re.tag)===null||it===void 0)?void 0:it.map(function(le){return D.a.createElement("a",null,le==null?void 0:le.name)}))),D.a.createElement("div",{className:"pt10 pb10 pl10 pr10"},D.a.createElement("div",{className:"font16 mb20"},"\u63A8\u8350\u5B9E\u8BAD"),D.a.createElement("div",{className:i.a.recommend},q==null?void 0:q.map(function(le){return D.a.createElement("div",{className:i.a.recommendItem},D.a.createElement("a",{href:"/shixuns/".concat(le.identifier,"/challenges"),target:"_blank"},D.a.createElement("img",{alt:le.id,src:"".concat(b.a.API_SERVER,"/").concat(le.image_url)})),D.a.createElement("div",{className:"".concat(i.a.flex1," ml10")},D.a.createElement("a",{href:"/shixuns/".concat(le.identifier,"/challenges"),target:"_blank",title:le.name,className:"".concat(i.a.mWidth147," multi-llipsis1e c-grey-666 mb10")},le.name),D.a.createElement("div",{className:"c-grey-999"},le.myshixuns_count," \u4EBA\u5B66\u4E60")))})))))},E=Object(N.a)(function(Ke){var Be=Ke.user,Xe=Ke.forumsDetail,tt=Ke.loading,Ze=Ke.globalSetting;return{user:Be,forumsDetail:Xe,globalSetting:Ze,loading:tt.models.forumsDetail}})(l),g=Q("qVdP"),v=Q("jsC+"),O=Q("5Dmo"),w=Q("3S7+"),C=Q("sPJy"),y=Q("bE4q"),c=Q("lUTK"),u=Q("BvKs"),L=Q("5NDa"),S=Q("5rEg"),A=Q("2qtc"),P=Q("kLXV"),W=Q("miYZ"),V=Q("tsqr"),Z=Q("55Ip"),z=Q("wd/R"),F=Q.n(z),te=Q("9Bee"),ie=Q("oBTY"),fe=Q("tJVT"),ye=Q("Ot1p"),_e=Q("/MfK"),Le=Q("8JLL"),Ae=Q.n(Le);F.a.lang("ZH-cn");function ke(Ke){var Be=Ke.user,Xe=Ke.vlist,tt=Xe===void 0?[]:Xe,Ze=Ke.dispatch,it=Ke.params,we=Ke.id,Ye=Ke.memo_replies,at=Ke.forumsDetail;return D.a.createElement("aside",{className:Ae.a.comment},tt.map(function(Oe,je){var ge,he;return D.a.createElement(k.a,{key:je,className:Ae.a.commentItem},D.a.createElement(f.a,{span:24},D.a.createElement(k.a,null,D.a.createElement(f.a,{flex:"1"},D.a.createElement("a",{href:"/users/".concat(Oe.user_login),target:"_blank",className:"c-light-black"},Oe==null?void 0:Oe.username),D.a.createElement("span",{className:"c-light-black ml10"},Oe.time)),(Oe.can_delete||Oe.user_id===((ge=Be.userInfo)===null||ge===void 0?void 0:ge.user_id)||Oe.user_login===((he=Be.userInfo)===null||he===void 0?void 0:he.login))&&D.a.createElement(f.a,{className:"forums-comment-delete",style:{display:"none"}},D.a.createElement(w.a,{title:"\u5220\u9664"},D.a.createElement(_e.a,{className:"current",onClick:function(){P.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:D.a.createElement("div",{className:"font16 tc"},"\u786E\u5B9A\u8981\u5220\u9664\u8BE5\u6761\u56DE\u590D\u5417\uFF1F"),onOk:function(){var re=Object(ne.a)(K.a.mark(function ae(){var le,Te;return K.a.wrap(function(Fe){for(;;)switch(Fe.prev=Fe.next){case 0:return Fe.next=2,Object(s.b)({id:Oe.id});case 2:le=Fe.sent,Te=Ye.find(function(Je){return Je.id===we}).children.filter(function(Je){return Je.id!==Oe.id}),Ye.find(function(Je){return Je.id===we}).children=Te,Ze({type:"forumsDetail/setForumsDetailData",payload:Object(p.a)(Object(p.a)({},at.forumsDetailData),{},{memo_replies:Object(ie.a)(Ye)})});case 6:case"end":return Fe.stop()}},ae)}));function q(){return re.apply(this,arguments)}return q}()})}}))))),D.a.createElement(f.a,null,D.a.createElement(te.a,{value:Oe.content})))}))}var De=ke,ve=Q("1vsH");F.a.lang("ZH-cn");var ue=function(Be,Xe){var tt=Be.user,Ze=Be.forumsDetail,it=Be.globalSetting,we=Be.loading,Ye=Be.dispatch,at=Be.handleClick,Oe=Object($.a)(Be,["user","forumsDetail","globalSetting","loading","dispatch","handleClick"]),je=Ze.forumsDetailData||{},ge=je.memo,he=je.memo_replies,ce=Object(j.i)(),re=Object(I.useState)(""),q=Object(fe.a)(re,2),ae=q[0],le=q[1],Te=Object(I.useState)(""),be=Object(fe.a)(Te,2),Fe=be[0],Je=be[1],pt=Object(I.useState)(-1),ct=Object(fe.a)(pt,2),At=ct[0],wt=ct[1],qe=Object(I.useState)(!1),Mt=Object(fe.a)(qe,2),St=Mt[0],It=Mt[1],kt=Object(I.useState)(1),Dt=Object(fe.a)(kt,2),Ar=Dt[0],cr=Dt[1],Et=Object(I.useState)(!1),bt=Object(fe.a)(Et,2),ht=bt[0],Ct=bt[1];Object(I.useImperativeHandle)(Xe,function(){return{onMdFouch:nr}}),Object(I.useEffect)(function(){It((ge==null?void 0:ge.replies_count)>10)},[ge==null?void 0:ge.replies_count]);var $t=function(){var dt=Object(ne.a)(K.a.mark(function lt(){var ir,Ht,Ut;return K.a.wrap(function(Gt){for(;;)switch(Gt.prev=Gt.next){case 0:return ir=Ar+1,cr(ir),Gt.next=4,Object(s.h)({id:ce.memoId,page:ir});case 4:Ht=Gt.sent,Ht!=null&&Ht.memo_replies&&(Ye({type:"forumsDetail/setForumsDetailData",payload:Object(p.a)(Object(p.a)({},Ze.forumsDetailData),{},{memo_replies:[].concat(Object(ie.a)(he),Object(ie.a)(Ht.memo_replies))})}),It(((Ut=Ht.memo_replies)===null||Ut===void 0?void 0:Ut.length)===10));case 6:case"end":return Gt.stop()}},lt)}));return function(){return dt.apply(this,arguments)}}(),rr=function(lt){var ir,Ht,Ut,Pt;return Object(p.a)(Object(p.a)({},lt),{},{image_url:(ir=tt.userInfo)===null||ir===void 0?void 0:ir.image_url,children:[],user_id:(Ht=tt.userInfo)===null||Ht===void 0?void 0:Ht.user_id,user_login:(Ut=tt.userInfo)===null||Ut===void 0?void 0:Ut.login,username:(Pt=tt.userInfo)===null||Pt===void 0?void 0:Pt.username,time:"".concat(Object(ve.X)((new Date().getTime()-new Date(lt.created_at).getTime())/1e3),"\u524D")})},nr=function(){Ct(!0)};return D.a.createElement("section",{className:Ae.a.wrap},!!(he!=null&&he.length)&&D.a.createElement("aside",{className:Ae.a.content},D.a.createElement("div",{style:{padding:"10px 15px 5px 15px",justifyContent:"space-between",display:"flex"}},D.a.createElement("span",null,"\u5168\u90E8\u56DE\u590D\uFF08",ge.replies_count,"\uFF09")),D.a.createElement("aside",{className:Ae.a.replyList},he==null?void 0:he.map(function(dt,lt){var ir;return D.a.createElement(k.a,{gutter:[12,12],key:lt},D.a.createElement(f.a,{flex:"40px"},D.a.createElement("a",{href:"/users/".concat(dt.user_login),target:"_blank"},D.a.createElement("img",{alt:"\u7528\u6237\u5934\u50CF",width:"50",height:"50",src:"".concat(b.a.IMG_SERVER,"/images/").concat(dt==null?void 0:dt.image_url)}))),D.a.createElement(f.a,{flex:"1"},D.a.createElement(k.a,{align:"middle"},D.a.createElement(f.a,{span:24},D.a.createElement("a",{href:"/users/".concat(dt.user_login),target:"_blank"},D.a.createElement("span",{className:"c-light-black"},dt==null?void 0:dt.username)),D.a.createElement("span",{className:"c-light-black ml10"},dt.time)),D.a.createElement(f.a,{span:24},D.a.createElement("div",{onClick:at},D.a.createElement(te.a,{value:dt.content}))),!!(dt!=null&&(ir=dt.children)!==null&&ir!==void 0&&ir.length)&&D.a.createElement(De,{user:tt,id:dt==null?void 0:dt.id,vlist:dt==null?void 0:dt.children,dispatch:Ye,params:ce,memo_replies:he,forumsDetail:Ze}),D.a.createElement(f.a,{span:24,className:"mt5 c-light-black"},At===lt?D.a.createElement("aside",null,D.a.createElement(ye.a,{onChange:function(Ut){Je(Ut)},height:150,isFocus:!0,placeholder:"\u6211\u8981\u56DE\u590D..."}),D.a.createElement(k.a,null,D.a.createElement(f.a,{span:24,className:"tr"},D.a.createElement(m.a,{type:"primary",size:"large",onClick:Object(ne.a)(K.a.mark(function Ht(){var Ut;return K.a.wrap(function(Gt){for(;;)switch(Gt.prev=Gt.next){case 0:if(!(Fe==="")){Gt.next=4;break}V.b.error("\u8BF7\u8F93\u5165\u5185\u5BB9"),Gt.next=9;break;case 4:return Gt.next=6,Object(s.k)({parent_id:dt.id,content:Fe});case 6:Ut=Gt.sent,Je(null),Ut&&(wt(-1),he.find(function(Er){return Er.id===Ut.parent_id}).children.push(rr(Ut)),Ye({type:"forumsDetail/setForumsDetailData",payload:Object(p.a)(Object(p.a)({},Ze.forumsDetailData),{},{memo:Object(p.a)(Object(p.a)({},ge),{},{replies_count:ge.replies_count+1}),memo_replies:Object(ie.a)(he)})}));case 9:case"end":return Gt.stop()}},Ht)}))},"\u53D1\u9001")))):D.a.createElement("div",{className:"tr"},D.a.createElement("span",{className:"iconfont icon-huifu1 mr15 ml30 current",onClick:function(){return wt(lt)}}),D.a.createElement(w.a,{title:dt.user_praise?"\u53D6\u6D88\u70B9\u8D5E":"\u70B9\u8D5E"},D.a.createElement("span",{className:dt.user_praise?"c-orange":"c-gery-888"},D.a.createElement("i",{className:"iconfont icon-dianzan mr3 current",onClick:Object(ne.a)(K.a.mark(function Ht(){var Ut;return K.a.wrap(function(Gt){for(;;)switch(Gt.prev=Gt.next){case 0:return Gt.next=2,Object(s.i)({id:dt.id,container_type:"Memo",type:dt.user_praise?0:1});case 2:Ut=Gt.sent,(Ut==null?void 0:Ut.praise_count)>=0&&(he.find(function(Er){return Er.id===dt.id}).user_praise=!dt.user_praise,he.find(function(Er){return Er.id===dt.id}).praise_count=Ut==null?void 0:Ut.praise_count,Ye({type:"forumsDetail/setForumsDetailData",payload:Object(p.a)(Object(p.a)({},Ze.forumsDetailData),{},{memo_replies:Object(ie.a)(he)})}));case 4:case"end":return Gt.stop()}},Ht)}))}),dt.praise_count>0?dt.praise_count:"")))))))}))),St&&D.a.createElement("aside",{className:"bg-white pb20",style:{display:"flex",justifyContent:"center"}},D.a.createElement(k.a,{justify:"space-between"},D.a.createElement(f.a,null),D.a.createElement(f.a,null,St&&D.a.createElement("a",{className:"c-black",onClick:$t},"\u67E5\u770B\u66F4\u591A\u8BC4\u8BBA")))),D.a.createElement("aside",{className:Ae.a.reply},D.a.createElement(ye.a,{onBlur:function(){return Ct(!1)},isFocus:ht,defaultValue:ae,id:"writeForumsReviewId",onChange:function(lt){le(lt)},placeholder:"\u6211\u8981\u56DE\u590D...",height:240}),D.a.createElement(k.a,null,D.a.createElement(f.a,{flex:"1"}),D.a.createElement(f.a,null,D.a.createElement(m.a,{type:"primary",size:"large",onClick:Object(ne.a)(K.a.mark(function dt(){var lt;return K.a.wrap(function(Ht){for(;;)switch(Ht.prev=Ht.next){case 0:if(!(ae==="")){Ht.next=4;break}V.b.error("\u8BF7\u8F93\u5165\u5185\u5BB9"),Ht.next=9;break;case 4:return Ht.next=6,Object(s.k)({parent_id:ge.id,content:ae});case 6:lt=Ht.sent,le(null),lt&&Ye({type:"forumsDetail/setForumsDetailData",payload:Object(p.a)(Object(p.a)({},Ze.forumsDetailData),{},{memo:Object(p.a)(Object(p.a)({},ge),{},{replies_count:ge.replies_count+1}),memo_replies:[rr(lt)].concat(Object(ie.a)(he))})});case 9:case"end":return Ht.stop()}},dt)}))},"\u53D1\u9001")))))},Me=Object(N.a)(function(Ke){var Be=Ke.user,Xe=Ke.forumsDetail,tt=Ke.loading,Ze=Ke.globalSetting;return{user:Be,forumsDetail:Xe,globalSetting:Ze,loading:tt.models.forumsDetail}},null,null,{forwardRef:!0})(Object(I.forwardRef)(ue)),Qe=Q("smFo"),He=Q.n(Qe),rt=Q("RCxd"),oe=Q("kaH+"),de=Q("dhSg"),xe={5:"\u6280\u672F\u5206\u4EAB",3:"\u64CD\u4F5C\u6307\u5357",16:"\u901A\u77E5\u516C\u544A"},Re=function(Be){var Xe,tt,Ze,it,we,Ye=Be.user,at=Be.forumsDetail,Oe=Be.globalSetting,je=Be.loading,ge=Be.dispatch,he=Object($.a)(Be,["user","forumsDetail","globalSetting","loading","dispatch"]),ce=at.forumsDetailData||{},re=ce.author_info,q=ce.memo,ae=ce.attachments_list,le=Object(I.useRef)(),Te=Object(I.useRef)(),be=function(){var qe=Object(ne.a)(K.a.mark(function Mt(){var St,It;return K.a.wrap(function(Dt){for(;;)switch(Dt.prev=Dt.next){case 0:return St={id:q.id,sticky:q.sticky?0:1},Dt.next=3,Object(s.m)(St);case 3:It=Dt.sent,(It==null?void 0:It.status)===0&&ge({type:"forumsDetail/setForumsDetailData",payload:Object(p.a)(Object(p.a)({},at.forumsDetailData),{},{memo:Object(p.a)(Object(p.a)({},q),{},{sticky:!(q!=null&&q.sticky)})})});case 5:case"end":return Dt.stop()}},Mt)}));return function(){return qe.apply(this,arguments)}}(),Fe=function(){var qe=Object(ne.a)(K.a.mark(function Mt(){var St;return K.a.wrap(function(kt){for(;;)switch(kt.prev=kt.next){case 0:return kt.next=2,Object(s.b)({id:q==null?void 0:q.id});case 2:St=kt.sent,(St==null?void 0:St.status)===0&&(V.b.success("\u5220\u9664\u6210\u529F"),N.d.push("/forums")),(St==null?void 0:St.status)===-1&&N.d.push("/forums");case 5:case"end":return kt.stop()}},Mt)}));return function(){return qe.apply(this,arguments)}}(),Je=function(){var qe=Object(ne.a)(K.a.mark(function Mt(){return K.a.wrap(function(It){for(;;)switch(It.prev=It.next){case 0:P.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u5956\u52B1\u8BBE\u7F6E",content:D.a.createElement("div",{className:"font14 tc"},D.a.createElement(S.a,{defaultValue:le.current,onChange:function(Dt){return le.current=Dt.target.value}})),onOk:function(){var kt=Object(ne.a)(K.a.mark(function Ar(){var cr;return K.a.wrap(function(bt){for(;;)switch(bt.prev=bt.next){case 0:return bt.next=2,Object(s.l)({id:q==null?void 0:q.id,container_type:"Memo",score:le.current?Number(le.current):0,user_id:re==null?void 0:re.user_id});case 2:if(cr=bt.sent,le.current=null,!((cr==null?void 0:cr.code)>0)){bt.next=8;break}return ge({type:"forumsDetail/setForumsDetailData",payload:Object(p.a)(Object(p.a)({},at.forumsDetailData),{},{memo:Object(p.a)(Object(p.a)({},q),{},{reward:cr==null?void 0:cr.code})})}),V.b.success("\u5956\u52B1\u6210\u529F"),bt.abrupt("return");case 8:V.b.success("\u5956\u52B1\u5931\u8D25\uFF0C\u8BF7\u8054\u7CFB\u7CFB\u7EDF\u7BA1\u7406\u5458\uFF01");case 9:case"end":return bt.stop()}},Ar)}));function Dt(){return kt.apply(this,arguments)}return Dt}()});case 1:case"end":return It.stop()}},Mt)}));return function(){return qe.apply(this,arguments)}}(),pt=function(){Te.current.onMdFouch&&Te.current.onMdFouch()},ct=function(){var qe=Object(ne.a)(K.a.mark(function Mt(){var St;return K.a.wrap(function(kt){for(;;)switch(kt.prev=kt.next){case 0:return kt.next=2,Object(s.i)({id:q.id,container_type:"Memo",type:1});case 2:St=kt.sent,(St==null?void 0:St.praise_count)>=0&&ge({type:"forumsDetail/setForumsDetailData",payload:Object(p.a)(Object(p.a)({},at.forumsDetailData),{},{memo:Object(p.a)(Object(p.a)({},q),{},{user_praise:!(q!=null&&q.user_praise),memo_praise_count:St==null?void 0:St.praise_count})})});case 4:case"end":return kt.stop()}},Mt)}));return function(){return qe.apply(this,arguments)}}(),At=D.a.createElement(u.a,{className:He.a.menu},((Xe=Ye.userInfo)===null||Xe===void 0?void 0:Xe.admin)&&(q==null?void 0:q.sticky)&&D.a.createElement(u.a.Item,null,D.a.createElement("a",{onClick:function(){return be()}},"\u53D6\u6D88\u7F6E\u9876")),((tt=Ye.userInfo)===null||tt===void 0?void 0:tt.admin)&&!(q!=null&&q.sticky)&&D.a.createElement(u.a.Item,null,D.a.createElement("a",{onClick:function(){return be()}},"\u7F6E\xA0\xA0\u9876")),D.a.createElement(u.a.Item,null,D.a.createElement(Z.a,{to:"/forums/".concat(q==null?void 0:q.id,"/edit")},"\u7F16\xA0\xA0\u8F91")),D.a.createElement(u.a.Item,null,D.a.createElement("a",{onClick:function(){P.a.confirm({title:"\u63D0\u793A",icon:D.a.createElement(rt.a,null),content:"\u5E16\u5B50\u5C06\u88AB\u5220\u9664\uFF0C\u65E0\u6CD5\u6062\u590D\u3002\u662F\u5426\u786E\u8BA4\u5220\u9664\uFF1F",okText:"\u786E\u8BA4",onOk:function(){Fe()},cancelText:"\u53D6\u6D88"})}},"\u5220\xA0\xA0\u9664"))),wt=function(Mt){var St=Mt.target,It=St.nodeName,kt=St.src;It==="IMG"&&(de.a.publish("preview-image",kt),console.log("src:",kt))};return Object(I.useEffect)(function(){},[]),D.a.createElement("section",{className:He.a.wrap},D.a.createElement(y.a,{separator:"/",className:"mb5"},D.a.createElement(y.a.Item,null,D.a.createElement(Z.a,{to:"/forums/categories/".concat(q==null?void 0:q.forum_id)},xe[q==null?void 0:q.forum_id])),D.a.createElement(y.a.Item,null,"\u8BE6\u60C5")),D.a.createElement("header",{className:"bg-white pt40 pb40 pl30 pr30 ".concat(He.a.header)},D.a.createElement(k.a,{align:"middle"},D.a.createElement(f.a,{flex:1,className:"font24 mb5"},D.a.createElement("span",{className:He.a.title},q==null?void 0:q.subject),(q==null?void 0:q.sticky)&&D.a.createElement("span",{className:He.a.top},"\u7F6E\u9876"),!!(q!=null&&q.reward)&&D.a.createElement(w.a,{placement:"bottom",title:"\u83B7\u5F97\u5E73\u53F0\u5956\u52B1\u91D1\u5E01\uFF1A".concat(q==null?void 0:q.reward)},D.a.createElement("span",{className:"ml10 c-orange-ff7"},D.a.createElement("i",{className:"iconfont icon-gift font16 mr5"}),D.a.createElement("span",{className:"font14"},q==null?void 0:q.reward)))),D.a.createElement(f.a,null,(((Ze=Ye.userInfo)===null||Ze===void 0?void 0:Ze.admin)||((it=Ye.userInfo)===null||it===void 0?void 0:it.user_id)===(re==null?void 0:re.user_id))&&D.a.createElement(v.a,{overlay:At},D.a.createElement("i",{className:"fa fa-bars font-16 current c-grey-bcb"})))),D.a.createElement(k.a,{align:"middle",className:"font14"},D.a.createElement(f.a,{flex:1,className:"c-grey-999"},D.a.createElement("span",null,F()(q==null?void 0:q.time).fromNow()," \u53D1\u5E03")),D.a.createElement(f.a,{className:"c-grey-999"},((we=Ye.userInfo)===null||we===void 0?void 0:we.admin)&&D.a.createElement(w.a,{placement:"bottom",title:"\u5E16\u5B50\u5956\u52B1"},D.a.createElement("span",{className:"current pr10 ".concat(He.a.line),onClick:Je},D.a.createElement("i",{className:"iconfont icon-jiangli font18 mr5"}))),D.a.createElement("span",{className:"pr10 pl10 ".concat(q!=null&&q.replies_count?He.a.line:"")},D.a.createElement("i",{className:"iconfont icon-liulanyan font18 mr5"}),q==null?void 0:q.viewed_count),!!(q!=null&&q.replies_count)&&D.a.createElement(w.a,{placement:"bottom",title:"\u5199\u8BC4\u8BBA"},D.a.createElement("span",{className:"current pl10",onClick:pt},D.a.createElement("i",{className:"iconfont icon-huifu1 font18 mr5"}),q==null?void 0:q.replies_count))))),D.a.createElement("main",{className:"bg-white pt40 pb40 pl40 pr40"},D.a.createElement("div",{onClick:wt},D.a.createElement(te.a,{value:q==null?void 0:q.content})),D.a.createElement("div",{className:"bg-white pl40 pr40 mt40"},D.a.createElement("div",{className:"mt10 mb20 ".concat(He.a.flexCenter)},D.a.createElement("div",{className:"".concat(He.a.like," ").concat(q!=null&&q.user_praise?"":He.a.canLike),onClick:ct},D.a.createElement("i",{className:"iconfont icon-dianzan font18"}),D.a.createElement("br",null),D.a.createElement("span",null,q==null?void 0:q.memo_praise_count)))),!!(ae!=null&&ae.length)&&D.a.createElement("div",{className:"mt40"},ae==null?void 0:ae.map(function(qe){return D.a.createElement("div",{className:"c-grey-888 ".concat(He.a.flexCenter)},D.a.createElement("i",{className:"iconfont icon-fujian mr10 font14 c-green-29b"}),D.a.createElement("a",{href:qe==null?void 0:qe.url,title:qe==null?void 0:qe.title,className:"".concat(He.a.attachmentName," mr10")},qe==null?void 0:qe.title),D.a.createElement("span",{className:"font12 c-grey-666 mt3"},qe==null?void 0:qe.filesize))}))),D.a.createElement(Me,{ref:Te,handleClick:wt}),D.a.createElement(oe.a,null))},Ie=Object(N.a)(function(Ke){var Be=Ke.user,Xe=Ke.forumsDetail,tt=Ke.loading,Ze=Ke.globalSetting;return{user:Be,forumsDetail:Xe,globalSetting:Ze,loading:tt.effects}})(Re),Ne=Q("G8my"),Ge=Q.n(Ne),ze=function(Be){var Xe=Be.forumsDetail,tt=Be.globalSetting,Ze=Be.loading,it=Be.dispatch,we=Object($.a)(Be,["forumsDetail","globalSetting","loading","dispatch"]),Ye=Object(j.i)();Object(I.useEffect)(function(){at()},[Ye.memoId]);var at=function(){var Oe=Object(ne.a)(K.a.mark(function je(){return K.a.wrap(function(he){for(;;)switch(he.prev=he.next){case 0:it({type:"forumsDetail/getForumsDetailData",payload:{id:Ye.memoId}});case 1:case"end":return he.stop()}},je)}));return function(){return Oe.apply(this,arguments)}}();return D.a.createElement("section",{className:"edu-container mb20 mt30 ".concat(Ge.a.flex)},D.a.createElement(Ie,null),D.a.createElement(E,null))},ut=Ee.default=Object(N.a)(function(Ke){var Be=Ke.forumsDetail,Xe=Ke.loading,tt=Ke.globalSetting;return{forumsDetail:Be,globalSetting:tt,loading:Xe.models.forumsDetail}})(ze)},LO5M:function(yt,Ee,Q){yt.exports={wrap:"wrap___1d4rP",head:"head___1_Uzf",recommendItem:"recommendItem___IStR9",buttonWrap:"buttonWrap___3dpFm",privateMessage:"privateMessage___24GfS",flex1:"flex1___3wIqQ",mWidth147:"mWidth147___3ODny"}},LdHM:function(yt,Ee,Q){"use strict";Q.d(Ee,"b",function(){return l}),Q.d(Ee,"a",function(){return g});var ne=Q("1OyB"),$=Q("vuIU"),M=Q("Ji7U"),K=Q("LK+K"),I=Q("q1tI"),D=Q("rePB"),j=Q("Ff2n"),N=Q("ODXe"),_=Q("4IlW"),k=Q("bX4T"),d=Q("YrtM"),f=Q("TSYQ"),T=Q.n(f),m=Q("+nKL"),p=Q("8OUc"),b=function(te,ie){var fe=te.prefixCls,ye=te.id,_e=te.flattenOptions,Le=te.childrenAsData,Ae=te.values,ke=te.searchValue,De=te.multiple,ve=te.defaultActiveFirstOption,ue=te.height,Me=te.itemHeight,Qe=te.notFoundContent,He=te.open,rt=te.menuItemSelectedIcon,oe=te.virtual,de=te.onSelect,xe=te.onToggleOpen,Re=te.onActiveValue,Ie=te.onScroll,Ne=te.onMouseEnter,Ge="".concat(fe,"-item"),ze=Object(d.a)(function(){return _e},[He,_e],function(je,ge){return ge[0]&&je[1]!==ge[1]}),ut=I.useRef(null),Ke=function(ge){ge.preventDefault()},Be=function(ge){ut.current&&ut.current.scrollTo({index:ge})},Xe=function(ge){for(var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ce=ze.length,re=0;re<ce;re+=1){var q=(ge+re*he+ce)%ce,ae=ze[q],le=ae.group,Te=ae.data;if(!le&&!Te.disabled)return q}return-1},tt=I.useState(function(){return Xe(0)}),Ze=Object(N.a)(tt,2),it=Ze[0],we=Ze[1],Ye=function(ge){we(ge);var he=ze[ge];if(!he){Re(null,-1);return}Re(he.data.value,ge)};I.useEffect(function(){Ye(ve!==!1?Xe(0):-1)},[ze.length,ke]),I.useEffect(function(){var je=setTimeout(function(){if(!De&&He&&Ae.size===1){var ge=Array.from(Ae)[0],he=ze.findIndex(function(ce){var re=ce.data;return re.value===ge});Ye(he),Be(he)}});return function(){return clearTimeout(je)}},[He]);var at=function(ge){ge!==void 0&&de(ge,{selected:!Ae.has(ge)}),De||xe(!1)};if(I.useImperativeHandle(ie,function(){return{onKeyDown:function(ge){var he=ge.which;switch(he){case _.a.UP:case _.a.DOWN:{var ce=0;if(he===_.a.UP?ce=-1:he===_.a.DOWN&&(ce=1),ce!==0){var re=Xe(it+ce,ce);Be(re),Ye(re)}break}case _.a.ENTER:{var q=ze[it];q&&!q.data.disabled?at(q.data.value):at(void 0),He&&ge.preventDefault();break}case _.a.ESC:xe(!1)}},onKeyUp:function(){},scrollTo:function(ge){Be(ge)}}}),ze.length===0)return I.createElement("div",{role:"listbox",id:"".concat(ye,"_list"),className:"".concat(Ge,"-empty"),onMouseDown:Ke},Qe);function Oe(je){var ge=ze[je];if(!ge)return null;var he=ge.data||{},ce=he.value,re=he.label,q=he.children,ae=Object(k.a)(he,!0),le=Le?q:re;return ge?I.createElement("div",Object.assign({"aria-label":typeof le=="string"?le:null},ae,{key:je,role:"option",id:"".concat(ye,"_list_").concat(je),"aria-selected":Ae.has(ce)}),ce):null}return I.createElement(I.Fragment,null,I.createElement("div",{role:"listbox",id:"".concat(ye,"_list"),style:{height:0,width:0,overflow:"hidden"}},Oe(it-1),Oe(it),Oe(it+1)),I.createElement(m.a,{itemKey:"key",ref:ut,data:ze,height:ue,itemHeight:Me,fullHeight:!1,onMouseDown:Ke,onScroll:Ie,virtual:oe,onMouseEnter:Ne},function(je,ge){var he,ce=je.group,re=je.groupOption,q=je.data,ae=q.label,le=q.key;if(ce)return I.createElement("div",{className:T()(Ge,"".concat(Ge,"-group"))},ae!==void 0?ae:le);var Te=q.disabled,be=q.value,Fe=q.title,Je=q.children,pt=q.style,ct=q.className,At=Object(j.a)(q,["disabled","value","title","children","style","className"]),wt=Ae.has(be),qe="".concat(Ge,"-option"),Mt=T()(Ge,qe,ct,(he={},Object(D.a)(he,"".concat(qe,"-grouped"),re),Object(D.a)(he,"".concat(qe,"-active"),it===ge&&!Te),Object(D.a)(he,"".concat(qe,"-disabled"),Te),Object(D.a)(he,"".concat(qe,"-selected"),wt),he)),St=Le?Je:ae,It=!rt||typeof rt=="function"||wt;return I.createElement("div",Object.assign({},At,{"aria-selected":wt,className:Mt,title:Fe,onMouseMove:function(){if(it===ge||Te)return;Ye(ge)},onClick:function(){Te||at(be)},style:pt}),I.createElement("div",{className:"".concat(qe,"-content")},St||be),I.isValidElement(rt)||wt,It&&I.createElement(p.a,{className:"".concat(Ge,"-option-state"),customizeIcon:rt,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,E=function(){return null};E.isSelectOptGroup=!0;var g=E,v=Q("VTBJ"),O=Q("Zm9Q");function w(F){var te=F.key,ie=F.props,fe=ie.children,ye=ie.value,_e=Object(j.a)(ie,["children","value"]);return Object(v.a)({key:te,value:ye!==void 0?ye:te,children:fe},_e)}function C(F){var te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(O.a)(F).map(function(ie,fe){if(!I.isValidElement(ie)||!ie.type)return null;var ye=ie.type.isSelectOptGroup,_e=ie.key,Le=ie.props,Ae=Le.children,ke=Object(j.a)(Le,["children"]);return te||!ye?w(ie):Object(v.a)(Object(v.a)({key:"__RC_SELECT_GRP__".concat(_e===null?fe:_e,"__"),label:_e},ke),{},{options:C(Ae)})}).filter(function(ie){return ie})}var y=Q("2Qr1"),c=Q("qNPg"),u=Q("U8pU"),L=Q("Kwbf"),S=Q("WKfj");function A(F){var te=F.mode,ie=F.options,fe=F.children,ye=F.backfill,_e=F.allowClear,Le=F.placeholder,Ae=F.getInputElement,ke=F.showSearch,De=F.onSearch,ve=F.defaultOpen,ue=F.autoFocus,Me=F.labelInValue,Qe=F.value,He=F.inputValue,rt=F.optionLabelProp,oe=te==="multiple"||te==="tags",de=ke!==void 0?ke:oe||te==="combobox",xe=ie||C(fe);if(Object(L.a)(te!=="tags"||xe.every(function(Ge){return!Ge.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),te==="tags"||te==="combobox"){var Re=xe.some(function(Ge){return Ge.options?Ge.options.some(function(ze){return typeof("value"in ze?ze.value:ze.key)=="number"}):typeof("value"in Ge?Ge.value:Ge.key)=="number"});Object(L.a)(!Re,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(L.a)(te!=="combobox"||!rt,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(L.a)(te==="combobox"||!ye,"`backfill` only works with `combobox` mode."),Object(L.a)(te==="combobox"||!Ae,"`getInputElement` only work with `combobox` mode."),Object(L.b)(te!=="combobox"||!Ae||!_e||!Le,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),De&&!de&&te!=="combobox"&&te!=="tags"&&Object(L.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(L.b)(!ve||ue,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),Qe!=null){var Ie=Object(S.d)(Qe);Object(L.a)(!Me||Ie.every(function(Ge){return Object(u.a)(Ge)==="object"&&("key"in Ge||"value"in Ge)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(L.a)(!oe||Array.isArray(Qe),"`value` should be array when `mode` is `multiple` or `tags`")}if(fe){var Ne=null;Object(O.a)(fe).some(function(Ge){if(!I.isValidElement(Ge)||!Ge.type)return!1;var ze=Ge.type;if(ze.isSelectOption)return!1;if(ze.isSelectOptGroup){var ut=Object(O.a)(Ge.props.children).every(function(Ke){return!I.isValidElement(Ke)||!Ge.type||Ke.type.isSelectOption?!0:(Ne=Ke.type,!1)});return!ut}return Ne=ze,!0}),Ne&&Object(L.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Ne.displayName||Ne.name||Ne,"`.")),Object(L.a)(He===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var P=A,W=Object(c.a)({prefixCls:"rc-select",components:{optionList:i},convertChildrenToData:C,flattenOptions:y.d,getLabeledValue:y.e,filterOptions:y.b,isValueDisabled:y.g,findValueOption:y.c,warningProps:P,fillOptionsWithMissingValue:y.a}),V=function(F){Object(M.a)(ie,F);var te=Object(K.a)(ie);function ie(){var fe;return Object(ne.a)(this,ie),fe=te.apply(this,arguments),fe.selectRef=I.createRef(),fe.focus=function(){fe.selectRef.current.focus()},fe.blur=function(){fe.selectRef.current.blur()},fe}return Object($.a)(ie,[{key:"render",value:function(){return I.createElement(W,Object.assign({ref:this.selectRef},this.props))}}]),ie}(I.Component);V.Option=l,V.OptGroup=g;var Z=V,z=Ee.c=Z},M8RZ:function(yt,Ee,Q){"use strict";Q.d(Ee,"a",function(){return _});var ne=Q("fWQN"),$=Q("mtLc"),M=Q("yKVA"),K=Q("879j"),I=Q("q1tI"),D=Q.n(I),j=Q("i8i4"),N=Q.n(j),_=function(k){Object(M.a)(f,k);var d=Object(K.a)(f);function f(T){var m;Object(ne.a)(this,f),m=d.call(this,T);var p=window.document;return m.node=p.createElement("div"),p.body.appendChild(m.node),m}return Object($.a)(f,[{key:"render",value:function(){var m=this.props.children;return Object(j.createPortal)(m,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),f}(D.a.Component)},MI8n:function(yt,Ee,Q){"use strict";Q.d(Ee,"b",function(){return D}),Q.d(Ee,"a",function(){return _}),Q.d(Ee,"e",function(){return k}),Q.d(Ee,"d",function(){return d}),Q.d(Ee,"c",function(){return f}),Q.d(Ee,"f",function(){return T});var ne=Q("/cxE"),$=Q("C/vA"),M=Q("pmY6"),K=Q("24hK"),I=function(){var m=function(p,b){return m=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])},m(p,b)};return function(p,b){m(p,b);function o(){this.constructor=p}p.prototype=b===null?Object.create(b):(o.prototype=b.prototype,new o)}}(),D;(function(m){m.None=function(){return M.a.None};function p(P){return function(W,V,Z){V===void 0&&(V=null);var z=!1,F;return F=P(function(te){return z?void 0:(F?F.dispose():z=!0,W.call(V,te))},null,Z),z&&F.dispose(),F}}m.once=p;function b(P,W){return g(function(V,Z,z){return Z===void 0&&(Z=null),P(function(F){return V.call(Z,W(F))},null,z)})}m.map=b;function o(P,W){return g(function(V,Z,z){return Z===void 0&&(Z=null),P(function(F){W(F),V.call(Z,F)},null,z)})}m.forEach=o;function i(P,W){return g(function(V,Z,z){return Z===void 0&&(Z=null),P(function(F){return W(F)&&V.call(Z,F)},null,z)})}m.filter=i;function s(P){return P}m.signal=s;function l(){for(var P=[],W=0;W<arguments.length;W++)P[W]=arguments[W];return function(V,Z,z){return Z===void 0&&(Z=null),M.e.apply(void 0,P.map(function(F){return F(function(te){return V.call(Z,te)},null,z)}))}}m.any=l;function E(P,W,V){var Z=V;return b(P,function(z){return Z=W(Z,z),Z})}m.reduce=E;function g(P){var W,V=new _({onFirstListenerAdd:function(){W=P(V.fire,V)},onLastListenerRemove:function(){W.dispose()}});return V.event}m.snapshot=g;function v(P,W,V,Z,z){V===void 0&&(V=100),Z===void 0&&(Z=!1);var F,te=void 0,ie=void 0,fe=0,ye=new _({leakWarningThreshold:z,onFirstListenerAdd:function(){F=P(function(_e){fe++,te=W(te,_e),Z&&!ie&&(ye.fire(te),te=void 0),clearTimeout(ie),ie=setTimeout(function(){var Le=te;te=void 0,ie=void 0,(!Z||fe>1)&&ye.fire(Le),fe=0},V)})},onLastListenerRemove:function(){F.dispose()}});return ye.event}m.debounce=v;function O(P){var W=new Date().getTime();return b(p(P),function(V){return new Date().getTime()-W})}m.stopwatch=O;function w(P){var W=!0,V;return i(P,function(Z){var z=W||Z!==V;return W=!1,V=Z,z})}m.latch=w;function C(P,W,V){W===void 0&&(W=!1),V===void 0&&(V=[]);var Z=V.slice(),z=P(function(ie){Z?Z.push(ie):te.fire(ie)}),F=function(){Z&&Z.forEach(function(ie){return te.fire(ie)}),Z=null},te=new _({onFirstListenerAdd:function(){z||(z=P(function(ie){return te.fire(ie)}))},onFirstListenerDidAdd:function(){Z&&(W?setTimeout(F):F())},onLastListenerRemove:function(){z&&z.dispose(),z=null}});return te.event}m.buffer=C;var y=function(){function P(W){this.event=W}return P.prototype.map=function(W){return new P(b(this.event,W))},P.prototype.forEach=function(W){return new P(o(this.event,W))},P.prototype.filter=function(W){return new P(i(this.event,W))},P.prototype.reduce=function(W,V){return new P(E(this.event,W,V))},P.prototype.latch=function(){return new P(w(this.event))},P.prototype.debounce=function(W,V,Z,z){return V===void 0&&(V=100),Z===void 0&&(Z=!1),new P(v(this.event,W,V,Z,z))},P.prototype.on=function(W,V,Z){return this.event(W,V,Z)},P.prototype.once=function(W,V,Z){return p(this.event)(W,V,Z)},P}();function c(P){return new y(P)}m.chain=c;function u(P,W,V){V===void 0&&(V=function(ie){return ie});var Z=function(){for(var ie=[],fe=0;fe<arguments.length;fe++)ie[fe]=arguments[fe];return te.fire(V.apply(void 0,ie))},z=function(){return P.on(W,Z)},F=function(){return P.removeListener(W,Z)},te=new _({onFirstListenerAdd:z,onLastListenerRemove:F});return te.event}m.fromNodeEventEmitter=u;function L(P,W,V){V===void 0&&(V=function(ie){return ie});var Z=function(){for(var ie=[],fe=0;fe<arguments.length;fe++)ie[fe]=arguments[fe];return te.fire(V.apply(void 0,ie))},z=function(){return P.addEventListener(W,Z)},F=function(){return P.removeEventListener(W,Z)},te=new _({onFirstListenerAdd:z,onLastListenerRemove:F});return te.event}m.fromDOMEventEmitter=L;function S(P){var W=new _,V=!1;return P.then(void 0,function(){return null}).then(function(){V?W.fire(void 0):setTimeout(function(){return W.fire(void 0)},0)}),V=!0,W.event}m.fromPromise=S;function A(P){return new Promise(function(W){return p(P)(W)})}m.toPromise=A})(D||(D={}));var j=-1,N=function(){function m(p,b){b===void 0&&(b=Math.random().toString(18).slice(2,5)),this.customThreshold=p,this.name=b,this._warnCountdown=0}return m.prototype.dispose=function(){this._stacks&&this._stacks.clear()},m.prototype.check=function(p){var b=this,o=j;if(typeof this.customThreshold=="number"&&(o=this.customThreshold),o<=0||p<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,E=0;this._stacks.forEach(function(g,v){(!l||E<g)&&(l=v,E=g)}),console.warn("["+this.name+"] potential listener LEAK detected, having "+p+" listeners already. MOST frequent listener ("+E+"):"),console.warn(l)}return function(){var g=b._stacks.get(i)||0;b._stacks.set(i,g-1)}},m}(),_=function(){function m(p){this._disposed=!1,this._options=p,this._leakageMon=j>0?new N(this._options&&this._options.leakWarningThreshold):void 0}return Object.defineProperty(m.prototype,"event",{get:function(){var p=this;return this._event||(this._event=function(b,o,i){p._listeners||(p._listeners=new K.a);var s=p._listeners.isEmpty();s&&p._options&&p._options.onFirstListenerAdd&&p._options.onFirstListenerAdd(p);var l=p._listeners.push(o?[b,o]:b);s&&p._options&&p._options.onFirstListenerDidAdd&&p._options.onFirstListenerDidAdd(p),p._options&&p._options.onListenerDidAdd&&p._options.onListenerDidAdd(p,b,o);var E;p._leakageMon&&(E=p._leakageMon.check(p._listeners.size));var g;return g={dispose:function(){if(E&&E(),g.dispose=m._noop,!p._disposed&&(l(),p._options&&p._options.onLastListenerRemove)){var v=p._listeners&&!p._listeners.isEmpty();v||p._options.onLastListenerRemove(p)}}},i instanceof M.b?i.add(g):Array.isArray(i)&&i.push(g),g}),this._event},enumerable:!0,configurable:!0}),m.prototype.fire=function(p){if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new K.a);for(var b=this._listeners.iterator(),o=b.next();!o.done;o=b.next())this._deliveryQueue.push([o.value,p]);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(E){Object(ne.e)(E)}}}},m.prototype.dispose=function(){this._listeners&&this._listeners.clear(),this._deliveryQueue&&this._deliveryQueue.clear(),this._leakageMon&&this._leakageMon.dispose(),this._disposed=!0},m._noop=function(){},m}(),k=function(m){I(p,m);function p(b){var o=m.call(this,b)||this;return o._isPaused=0,o._eventQueue=new K.a,o._mergeFn=b&&b.merge,o}return p.prototype.pause=function(){this._isPaused++},p.prototype.resume=function(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){var b=this._eventQueue.toArray();this._eventQueue.clear(),m.prototype.fire.call(this,this._mergeFn(b))}else for(;!this._isPaused&&this._eventQueue.size!==0;)m.prototype.fire.call(this,this._eventQueue.shift())},p.prototype.fire=function(b){this._listeners&&(this._isPaused!==0?this._eventQueue.push(b):m.prototype.fire.call(this,b))},p}(_),d=function(){function m(){var p=this;this.hasListeners=!1,this.events=[],this.emitter=new _({onFirstListenerAdd:function(){return p.onFirstListenerAdd()},onLastListenerRemove:function(){return p.onLastListenerRemove()}})}return Object.defineProperty(m.prototype,"event",{get:function(){return this.emitter.event},enumerable:!0,configurable:!0}),m.prototype.add=function(p){var b=this,o={event:p,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(M.h)(Object($.a)(i))},m.prototype.onFirstListenerAdd=function(){var p=this;this.hasListeners=!0,this.events.forEach(function(b){return p.hook(b)})},m.prototype.onLastListenerRemove=function(){var p=this;this.hasListeners=!1,this.events.forEach(function(b){return p.unhook(b)})},m.prototype.hook=function(p){var b=this;p.listener=p.event(function(o){return b.emitter.fire(o)})},m.prototype.unhook=function(p){p.listener&&p.listener.dispose(),p.listener=null},m.prototype.dispose=function(){this.emitter.dispose()},m}(),f=function(){function m(){this.buffers=[]}return m.prototype.wrapEvent=function(p){var b=this;return function(o,i,s){return p(function(l){var E=b.buffers[b.buffers.length-1];E?E.push(function(){return o.call(i,l)}):o.call(i,l)},void 0,s)}},m.prototype.bufferEvents=function(p){var b=[];this.buffers.push(b);var o=p();return this.buffers.pop(),b.forEach(function(i){return i()}),o},m}(),T=function(){function m(){var p=this;this.listening=!1,this.inputEvent=D.None,this.inputEventListener=M.a.None,this.emitter=new _({onFirstListenerDidAdd:function(){p.listening=!0,p.inputEventListener=p.inputEvent(p.emitter.fire,p.emitter)},onLastListenerRemove:function(){p.listening=!1,p.inputEventListener.dispose()}}),this.event=this.emitter.event}return Object.defineProperty(m.prototype,"input",{set:function(p){this.inputEvent=p,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=p(this.emitter.fire,this.emitter))},enumerable:!0,configurable:!0}),m.prototype.dispose=function(){this.inputEventListener.dispose(),this.emitter.dispose()},m}()},N0LK:function(yt,Ee,Q){"use strict";Q.d(Ee,"x",function(){return ne}),Q.d(Ee,"F",function(){return $}),Q.d(Ee,"r",function(){return K}),Q.d(Ee,"o",function(){return I}),Q.d(Ee,"p",function(){return D}),Q.d(Ee,"Q",function(){return j}),Q.d(Ee,"K",function(){return _}),Q.d(Ee,"k",function(){return k}),Q.d(Ee,"N",function(){return d}),Q.d(Ee,"m",function(){return f}),Q.d(Ee,"l",function(){return T}),Q.d(Ee,"I",function(){return m}),Q.d(Ee,"H",function(){return p}),Q.d(Ee,"q",function(){return b}),Q.d(Ee,"t",function(){return o}),Q.d(Ee,"D",function(){return i}),Q.d(Ee,"e",function(){return s}),Q.d(Ee,"f",function(){return l}),Q.d(Ee,"B",function(){return E}),Q.d(Ee,"C",function(){return g}),Q.d(Ee,"n",function(){return O}),Q.d(Ee,"O",function(){return C}),Q.d(Ee,"c",function(){return y}),Q.d(Ee,"d",function(){return c}),Q.d(Ee,"z",function(){return u}),Q.d(Ee,"A",function(){return L}),Q.d(Ee,"u",function(){return S}),Q.d(Ee,"E",function(){return P}),Q.d(Ee,"G",function(){return W}),Q.d(Ee,"i",function(){return Z}),Q.d(Ee,"g",function(){return F}),Q.d(Ee,"v",function(){return ie}),Q.d(Ee,"h",function(){return fe}),Q.d(Ee,"y",function(){return ye}),Q.d(Ee,"w",function(){return _e}),Q.d(Ee,"a",function(){return Le}),Q.d(Ee,"P",function(){return Ae}),Q.d(Ee,"L",function(){return ke}),Q.d(Ee,"J",function(){return De}),Q.d(Ee,"j",function(){return ve}),Q.d(Ee,"M",function(){return ue}),Q.d(Ee,"s",function(){return Me}),Q.d(Ee,"b",function(){return Qe});function ne(oe){return!oe||typeof oe!="string"?!0:oe.trim().length===0}function $(oe,de,xe){xe===void 0&&(xe="0");for(var Re=""+oe,Ie=[Re],Ne=Re.length;Ne<de;Ne++)Ie.push(xe);return Ie.reverse().join("")}var M=/{(\d+)}/g;function K(oe){for(var de=[],xe=1;xe<arguments.length;xe++)de[xe-1]=arguments[xe];return de.length===0?oe:oe.replace(M,function(Re,Ie){var Ne=parseInt(Ie,10);return isNaN(Ne)||Ne<0||Ne>=de.length?Re:de[Ne]})}function I(oe){return oe.replace(/[<>&]/g,function(de){switch(de){case"<":return"<";case">":return">";case"&":return"&";default:return de}})}function D(oe){return oe.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function j(oe,de){de===void 0&&(de=" ");var xe=N(oe,de);return _(xe,de)}function N(oe,de){if(!oe||!de)return oe;var xe=de.length;if(xe===0||oe.length===0)return oe;for(var Re=0;oe.indexOf(de,Re)===Re;)Re=Re+xe;return oe.substring(Re)}function _(oe,de){if(!oe||!de)return oe;var xe=de.length,Re=oe.length;if(xe===0||Re===0)return oe;for(var Ie=Re,Ne=-1;!(Ne=oe.lastIndexOf(de,Ie-1),Ne===-1||Ne+xe!==Ie);){if(Ne===0)return"";Ie=Ne}return oe.substring(0,Ie)}function k(oe){return oe.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function d(oe,de){if(oe.length<de.length)return!1;if(oe===de)return!0;for(var xe=0;xe<de.length;xe++)if(oe[xe]!==de[xe])return!1;return!0}function f(oe,de){var xe=oe.length-de.length;return xe>0?oe.indexOf(de,xe)===xe:xe===0?oe===de:!1}function T(oe,de,xe){if(xe===void 0&&(xe={}),!oe)throw new Error("Cannot create regex from empty string");de||(oe=D(oe)),xe.wholeWord&&(/\B/.test(oe.charAt(0))||(oe="\\b"+oe),/\B/.test(oe.charAt(oe.length-1))||(oe=oe+"\\b"));var Re="";return xe.global&&(Re+="g"),xe.matchCase||(Re+="i"),xe.multiline&&(Re+="m"),xe.unicode&&(Re+="u"),new RegExp(oe,Re)}function m(oe){if(oe.source==="^"||oe.source==="^$"||oe.source==="$"||oe.source==="^\\s*$")return!1;var de=oe.exec("");return!!(de&&oe.lastIndex===0)}function p(oe){return(oe.global?"g":"")+(oe.ignoreCase?"i":"")+(oe.multiline?"m":"")+(oe.unicode?"u":"")}function b(oe){for(var de=0,xe=oe.length;de<xe;de++){var Re=oe.charCodeAt(de);if(Re!==32&&Re!==9)return de}return-1}function o(oe,de,xe){de===void 0&&(de=0),xe===void 0&&(xe=oe.length);for(var Re=de;Re<xe;Re++){var Ie=oe.charCodeAt(Re);if(Ie!==32&&Ie!==9)return oe.substring(de,Re)}return oe.substring(de,xe)}function i(oe,de){de===void 0&&(de=oe.length-1);for(var xe=de;xe>=0;xe--){var Re=oe.charCodeAt(xe);if(Re!==32&&Re!==9)return xe}return-1}function s(oe,de){return oe<de?-1:oe>de?1:0}function l(oe,de){for(var xe=Math.min(oe.length,de.length),Re=0;Re<xe;Re++){var Ie=oe.charCodeAt(Re),Ne=de.charCodeAt(Re);if(Ie===Ne)continue;g(Ie)&&(Ie+=32),g(Ne)&&(Ne+=32);var Ge=Ie-Ne;if(Ge===0)continue;return E(Ie)&&E(Ne)?Ge:s(oe.toLowerCase(),de.toLowerCase())}return oe.length<de.length?-1:oe.length>de.length?1:0}function E(oe){return oe>=97&&oe<=122}function g(oe){return oe>=65&&oe<=90}function v(oe){return E(oe)||g(oe)}function O(oe,de){return oe.length===de.length&&w(oe,de)}function w(oe,de,xe){xe===void 0&&(xe=oe.length);for(var Re=0;Re<xe;Re++){var Ie=oe.charCodeAt(Re),Ne=de.charCodeAt(Re);if(Ie===Ne)continue;if(v(Ie)&&v(Ne)){var Ge=Math.abs(Ie-Ne);if(Ge!==0&&Ge!==32)return!1}else if(String.fromCharCode(Ie).toLowerCase()!==String.fromCharCode(Ne).toLowerCase())return!1}return!0}function C(oe,de){var xe=de.length;return de.length>oe.length?!1:w(oe,de,xe)}function y(oe,de){var xe,Re=Math.min(oe.length,de.length);for(xe=0;xe<Re;xe++)if(oe.charCodeAt(xe)!==de.charCodeAt(xe))return xe;return Re}function c(oe,de){var xe,Re=Math.min(oe.length,de.length),Ie=oe.length-1,Ne=de.length-1;for(xe=0;xe<Re;xe++)if(oe.charCodeAt(Ie-xe)!==de.charCodeAt(Ne-xe))return xe;return Re}function u(oe){return 55296<=oe&&oe<=56319}function L(oe){return 56320<=oe&&oe<=57343}function S(oe,de,xe){var Re=oe.charCodeAt(xe);if(u(Re)&&xe+1<de){var Ie=oe.charCodeAt(xe+1);if(L(Ie))return(Re-55296<<10)+(Ie-56320)+65536}return Re}function A(oe,de){var xe=oe.charCodeAt(de-1);if(L(xe)&&de>1){var Re=oe.charCodeAt(de-2);if(u(Re))return(Re-55296<<10)+(xe-56320)+65536}return xe}function P(oe,de){var xe=He.getInstance(),Re=de,Ie=oe.length,Ne=S(oe,Ie,de);de+=Ne>=65536?2:1;for(var Ge=xe.getGraphemeBreakType(Ne);de<Ie;){var ze=S(oe,Ie,de),ut=xe.getGraphemeBreakType(ze);if(Qe(Ge,ut))break;de+=ze>=65536?2:1,Ge=ut}return de-Re}function W(oe,de){var xe=He.getInstance(),Re=de,Ie=A(oe,de);de-=Ie>=65536?2:1;for(var Ne=xe.getGraphemeBreakType(Ie);de>0;){var Ge=A(oe,de),ze=xe.getGraphemeBreakType(Ge);if(Qe(ze,Ne))break;de-=Ge>=65536?2:1,Ne=ze}return Re-de}var V=/(?:[\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(oe){return V.test(oe)}var z=/(?:[\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(oe){return z.test(oe)}var te=/^[\t\n\r\x20-\x7E]*$/;function ie(oe){return te.test(oe)}function fe(oe){for(var de=0,xe=oe.length;de<xe;de++)if(ye(oe.charCodeAt(de)))return!0;return!1}function ye(oe){return oe=+oe,oe>=11904&&oe<=55215||oe>=63744&&oe<=64255||oe>=65281&&oe<=65374}function _e(oe){return oe>=127462&&oe<=127487||oe>=9728&&oe<=10175||oe>=127744&&oe<=128591||oe>=128640&&oe<=128764||oe>=128992&&oe<=129003||oe>=129280&&oe<=129535||oe>=129648&&oe<=129651||oe>=129656&&oe<=129666||oe>=129680&&oe<=129685}var Le=String.fromCharCode(65279);function Ae(oe){return!!(oe&&oe.length>0&&oe.charCodeAt(0)===65279)}function ke(oe){return btoa(encodeURIComponent(oe))}function De(oe,de){for(var xe="",Re=0;Re<de;Re++)xe+=oe;return xe}function ve(oe,de){return de===void 0&&(de=!1),oe?(de&&(oe=oe.replace(/\\./g,"")),oe.toLowerCase()!==oe):!1}function ue(oe){var de=90-65+1;return oe=oe%(2*de),oe<de?String.fromCharCode(97+oe):String.fromCharCode(65+oe-de)}function Me(oe){var de=He.getInstance();return de.getGraphemeBreakType(oe)}function Qe(oe,de){return oe===0?de!==5&&de!==7:oe===2&&de===3?!1:oe===4||oe===2||oe===3||(de===4||de===2||de===3)?!0:oe===8&&(de===8||de===9||de===11||de===12)||((oe===11||oe===9)&&(de===9||de===10)||((oe===12||oe===10)&&de===10||(de===5||de===13||(de===7||(oe===1||oe===13&&de===14)))))?!1:!(oe===6&&de===6)}var He=function(){function oe(){this._data=rt()}return oe.getInstance=function(){return oe._INSTANCE||(oe._INSTANCE=new oe),oe._INSTANCE},oe.prototype.getGraphemeBreakType=function(de){if(de<32)return de===10?3:de===13?2:4;if(de<127)return 0;for(var xe=this._data,Re=xe.length/3,Ie=1;Ie<=Re;)if(de<xe[3*Ie])Ie=2*Ie;else if(de>xe[3*Ie+1])Ie=2*Ie+1;else return xe[3*Ie+2];return 0},oe._INSTANCE=null,oe}();function rt(){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(yt,Ee,Q){"use strict";var ne=Q("2qtc"),$=Q("kLXV"),M=Q("rAM+"),K=Q("miYZ"),I=Q("tsqr"),D=Q("9og8"),j=Q("tJVT"),N=Q("jrin"),_=Q("WmNS"),k=Q.n(_),d=Q("q1tI"),f=Q.n(d),T=Q("VrN/"),m=Q.n(T),p=Q("bdgK"),b=Q("p77/"),o=Q("Bd2K"),i=Q("ELLl"),s=Q("19Vz"),l=Q("lZu9"),E=Q("+NIl"),g=Q("kSUc"),v=Q("9Bee"),O=function(be){var Fe=be.value,Je=Fe===void 0?"":Fe,pt=be.className,ct=be.showTextOnly,At=be.showLines,wt=be.style,qe=wt===void 0?{}:wt,Mt=Object(d.useMemo)(function(){return""},[Je]);return f.a.createElement(f.a.Fragment,null,f.a.createElement("div",{dangerouslySetInnerHTML:{__html:Mt}}))},w=Q("0Owb"),C=Q("dejd"),y=Q("C+DQ"),c=Q("1vsH"),u=Q("m3rI"),L=[{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(be){var Fe=be.onActionCallback,Je=be.title,pt=be.icon,ct=be.actionName,At=be.className,wt=At===void 0?"":At,qe=be.children;function Mt(){Fe(ct)}return f.a.createElement("a",{title:Je,className:wt,onClick:Mt},f.a.createElement("i",{className:"md-iconfont ".concat(pt)}),qe)}var A=function(be){var Fe=be.watch,Je=be.showNullButton,pt=be.onActionCallback,ct=be.fullScreen,At=be.insertTemp,wt=be.hidetoolBar,qe=be.uuid,Mt=be.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(qe,"&api=").concat(encodeURIComponent(u.a.PROXY_SERVER)));var St=[].concat(L,[{title:"".concat(Fe?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Fe?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return f.a.createElement("ul",{className:"markdown-toolbar-container"},!wt&&St.map(function(It,kt){return f.a.createElement("li",{key:kt},It.actionName?f.a.createElement(S,Object(w.a)({},It,{onActionCallback:pt})):f.a.createElement("span",{className:"v-line"}))}),Je?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:pt},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:pt},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(ct?"icon-shrink":"icon-enlarge"),title:ct?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:pt})))},P=Q("M8RZ"),W=Q("+L6B"),V=Q("2/Rp"),Z=Q("y8nQ"),z=Q("Vl3Y"),F=Q("5NDa"),te=Q("5rEg"),ie={labelCol:{span:4},wrapperCol:{span:20}},fe=function(be){var Fe=be.callback,Je=be.onCancel;function pt(ct){Fe(ct)}return f.a.createElement(z.a,Object(w.a)({},ie,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:pt}),f.a.createElement(z.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},f.a.createElement(te.a,null)),f.a.createElement(z.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},f.a.createElement(te.a,null)),f.a.createElement("div",{className:"flex-container flex-end"},f.a.createElement(V.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),f.a.createElement(V.a,{type:"ghost",onClick:Je},"\u53D6\u6D88")))},ye=Q("7ahc"),_e=Q("k1fw"),Le=Q("HmJG"),Ae=Q("BjJ7"),ke=z.a.useForm,De={width:280,marginRight:10},ve={labelCol:{span:5},wrapperCol:{span:19}},ue=function(be){var Fe=be.callback,Je=be.onCancel,pt=ke(),ct=Object(j.a)(pt,1),At=ct[0],wt=Object(d.useRef)();function qe(It){Fe(Object(_e.a)(Object(_e.a)({},It),{},{name:wt.current}))}function Mt(It,kt){At.setFieldsValue({src:"/api/attachments/".concat(It.id,"?type=").concat(It.content_type),type:kt.type})}function St(It){var kt=It.target.files[0];wt.current=kt.name,Qe(kt,Mt)}return f.a.createElement(z.a,Object(w.a)({form:At},ve,{className:"upload-image-panel",onFinish:qe}),f.a.createElement(z.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},f.a.createElement("div",{className:"flex-container"},f.a.createElement(z.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},f.a.createElement(te.a,{style:De})),f.a.createElement(Me,{onFileChange:St}))),f.a.createElement(z.a.Item,{label:"\u6587\u4EF6\u63CF\u8FF0",name:"alt"},f.a.createElement(te.a,{style:{width:264}})),f.a.createElement(z.a.Item,{style:{textAlign:"right"}},f.a.createElement(V.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),f.a.createElement(V.a,{type:"ghost",onClick:Je},"\u53D6\u6D88")))};function Me(be){var Fe=be.onFileChange;return f.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",f.a.createElement("input",{type:"file",onChange:Fe}))}function Qe(be,Fe){if(!be)throw new String("\u6CA1\u6709\u6587\u4EF6");var Je=new FormData;Je.append("editormd-image-file",be),Je.append("file_param_name","editormd-image-file"),Je.append("byxhr","true");var pt=new window.XMLHttpRequest;pt.withCredentials=!0,pt.addEventListener("load",function(ct){Fe(JSON.parse(ct.target.responseText),be)},!1),pt.addEventListener("error",function(ct){console.error(ct)},!1),pt.open("POST","".concat(Ae.a,"/api/attachments.json")),pt.send(Je)}var He=Q("giR+"),rt=Q("fyUT"),oe=Q("7Kak"),de=Q("9yH6"),xe=de.a.Group,Re={margin:"0 8px"},Ie=function(be){var Fe=be.callback,Je=be.onCancel;function pt(ct){Fe(ct)}return f.a.createElement(z.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:pt},f.a.createElement("div",{className:"flex-container"},f.a.createElement("span",{style:Re},"\u5355\u5143\u683C\u6570\uFF1A"),f.a.createElement("span",{style:Re},"\u884C\u6570"),f.a.createElement(z.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},f.a.createElement(rt.a,null)),f.a.createElement("span",{style:Re},"\u5217\u6570"),f.a.createElement(z.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},f.a.createElement(rt.a,null))),f.a.createElement("div",{className:"flex-container",style:{marginTop:12}},f.a.createElement("span",{style:Re},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),f.a.createElement(z.a.Item,{name:"align"},f.a.createElement(xe,null,f.a.createElement(de.a,{value:"default"},f.a.createElement("i",{className:"fa fa-align-justify"})),f.a.createElement(de.a,{value:"left"},f.a.createElement("i",{className:"fa fa-align-left"})),f.a.createElement(de.a,{value:"center"},f.a.createElement("i",{className:"fa fa-align-center"})),f.a.createElement(de.a,{value:"right"},f.a.createElement("i",{className:"fa fa-align-right"}))))),f.a.createElement("div",{className:"flex-container flex-end"},f.a.createElement(V.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),f.a.createElement(V.a,{type:"ghost",onClick:Je},"\u53D6\u6D88")))},Ne=Q("ErOA"),Ge=Q("7Cbv"),ze="link",ut="upload-image",Ke="code-block",Be="add-table",Xe="------------",tt={default:Xe,left:":".concat(Xe),center:":".concat(Xe,":"),right:"".concat(Xe,":")},Ze=Q("9VGf"),it,we;function Ye(){}var at=0,Oe=1e4,je="\u2581",ge=`
|
|
**\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 he(be){return/^\d+$/.test(be)?"".concat(be,"px"):be}var ce=navigator.platform.toUpperCase().indexOf("MAC")>=0,re=ce?"Cmd":"Ctrl",q=["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"],ae=(it={},Object(N.a)(it,re+"-B","bold"),Object(N.a)(it,re+"-I","italic"),it),le=(we={},Object(N.a)(we,ze,"\u6DFB\u52A0\u94FE\u63A5"),Object(N.a)(we,Ke,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(N.a)(we,ut,"\u6DFB\u52A0\u6587\u4EF6"),Object(N.a)(we,Be,"\u6DFB\u52A0\u8868\u683C"),we),Te=Ee.a=function(be){var Fe=be.defaultValue,Je=Fe===void 0?"":Fe,pt=be.onChange,ct=be.width,At=ct===void 0?"100%":ct,wt=be.height,qe=wt===void 0?400:wt,Mt=be.miniToolbar,St=Mt===void 0?!1:Mt,It=be.isFocus,kt=It===void 0?!1:It,Dt=be.watch,Ar=be.insertTemp,cr=be.mode,Et=cr===void 0?"markdown":cr,bt=be.id,ht=bt===void 0?"markdown-editor-id":bt,Ct=be.showResizeBar,$t=Ct===void 0?!1:Ct,rr=be.noStorage,nr=rr===void 0?!1:rr,dt=be.showNullButton,lt=dt===void 0?!1:dt,ir=be.hidetoolBar,Ht=ir===void 0?!1:ir,Ut=be.fullScreen,Pt=Ut===void 0?!1:Ut,Gt=be.onBlur,Er=be.onCMBeforeChange,rn=be.onFullScreen,Ue=be.className,ft=Ue===void 0?"":Ue,Ft=be.disablePaste,Jt=Ft===void 0?!1:Ft,qt=be.placeholder,ar=qt===void 0?"":qt,H=be.values,h=H===void 0?"":H,x=Object(d.useState)(null),B=Object(j.a)(x,2),X=B[0],G=B[1],me=Object(d.useState)(Je),We=Object(j.a)(me,2),nt=We[0],gt=We[1],Ve=Object(d.useState)(Dt),Ot=Object(j.a)(Ve,2),jt=Ot[0],or=Ot[1],Xr=Object(d.useState)(Pt),Yr=Object(j.a)(Xr,2),br=Yr[0],qr=Yr[1],Gn=Object(d.useState)(""),Ir=Object(j.a)(Gn,2),$r=Ir[0],Gr=Ir[1],bn=Object(d.useState)(0),nn=Object(j.a)(bn,2),mn=nn[0],dn=nn[1],hi=Object(d.useState)(qe),zn=Object(j.a)(hi,2),an=zn[0],Jr=zn[1],kn=Object(d.useState)(!1),On=Object(j.a)(kn,2),ci=On[0],dr=On[1],Vt=Object(d.useRef)(Object(Ge.a)()),Dr=Object(d.useRef)(!1),Kt=Object(d.useRef)(),mr=Object(d.useRef)(),Zt=Object(d.useRef)(),hn=Object(d.useRef)(),fr=Object(d.useRef)(),Nr=function(){var xt=Object(D.a)(k.a.mark(function _t(){var Lt,Bt;return k.a.wrap(function(er){for(;;)switch(er.prev=er.next){case 0:return er.next=2,Object(Ne.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Vt.current}});case 2:Bt=er.sent,Bt!=null&&(Lt=Bt.attachments)!==null&&Lt!==void 0&&Lt.length&&(console.log("cm:",X,mr),Bt.attachments.map(function(zt){zt.content_type.indexOf("image")>-1?X.replaceSelection(".concat(zt.content_type,")")):zt.content_type.indexOf("video")>-1?X.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):zt.content_type.indexOf("pdf")>-1?X.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(zt.content_type,'&disposition=inline" target="_blank">').concat(zt.name,"</a>")):X.replaceSelection("[".concat(zt.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(zt.content_type,")"))}));case 4:case"end":return er.stop()}},_t)}));return function(){return xt.apply(this,arguments)}}();Object(d.useEffect)(function(){gt(h),X==null||X.setValue(h)},[h]),Object(d.useEffect)(function(){rn==null||rn(br)},[br]),Object(d.useEffect)(function(){if(mr.current){var xt=m.a.fromTextArea(mr.current,{mode:Et,lineNumbers:!St,lineWrapping:!0,value:Je,autoCloseTags:!0,autoCloseBrackets:!0});kt&&xt.focus();function _t(Lt,Bt){if(Jt){Bt.preventDefault();return}var Xt=Bt.clipboardData;if(Xt){var er=Xt.types.toString(),zt=Xt.items;if(er==="Files"||Xt.types.indexOf("Files")>-1){if(Bt.preventDefault(),Et=="stex")return;try{var gr,Fr=zt[1];((gr=zt[0])===null||gr===void 0?void 0:gr.kind)==="file"&&(Fr=zt[0]);var Wt=Fr.getAsFile(),En=Wt.name.split(".").pop();Qe(Wt,function(Yt){if(Yt.id){var Cr,en,tn;(Wt==null||((Cr=Wt.type)===null||Cr===void 0)?void 0:Cr.indexOf("image"))>-1?xt.replaceSelection(".concat(Yt.content_type,")")):(Wt==null||((en=Wt.type)===null||en===void 0)?void 0:en.indexOf("video"))>-1?xt.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Yt.id,'"></video>')):(Wt==null||((tn=Wt.type)===null||tn===void 0)?void 0:tn.indexOf("pdf"))>-1?xt.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Yt.id,"?type=").concat(Wt.type,'&disposition=inline" target="_blank">').concat(Wt.name,"</a>")):q.includes(En)?xt.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Yt.id,'?type=office&disposition=inline" target="_blank">').concat(Wt.name,"</a>")):xt.replaceSelection("[".concat(Wt.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(Yt.id,"?type=").concat(Yt.content_type,")"))}else(Yt==null?void 0:Yt.status)===401&&(document.location.href="/user/login")})}catch(Yt){I.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return xt.on("paste",_t),xt.on("dragleave",function(Lt,Bt){Zt.current.classList.remove("mouse-hover-md")}),xt.on("dragover",function(Lt,Bt){Zt.current.classList.add("mouse-hover-md")}),xt.on("drop",function(Lt,Bt){Zt.current.classList.add("mouse-hover-md");var Xt;if(Xt=Bt.dataTransfer.files,Xt.length>0){Bt.preventDefault(),Bt.stopPropagation();for(var er=function(Fr){var Wt=Xt[Fr],En=Wt.name.split(".").pop();Qe(Wt,function(Yt){if(Yt.id){var Cr,en,tn;(Wt==null||((Cr=Wt.type)===null||Cr===void 0)?void 0:Cr.indexOf("image"))>-1?xt.replaceSelection(".concat(Yt.content_type,")")):(Wt==null||((en=Wt.type)===null||en===void 0)?void 0:en.indexOf("video"))>-1?xt.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Yt.id,'"></video>')):(Wt==null||((tn=Wt.type)===null||tn===void 0)?void 0:tn.indexOf("pdf"))>-1?xt.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Yt.id,"?type=").concat(Wt.type,'&disposition=inline" target="_blank">').concat(Wt.name,"</a>")):q.includes(En)?xt.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Yt.id,'?type=office&disposition=inline" target="_blank">').concat(Wt.name,"</a>")):xt.replaceSelection("[".concat(Wt.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(Yt.id,"?type=").concat(Yt.content_type,")"))}else(Yt==null?void 0:Yt.status)===401&&(document.location.href="/user/login")})},zt=0;zt<Xt.length;zt++)er(zt)}}),G(xt),function(){xt.off("paste",_t)}}},[]);var Kn=Object(d.useCallback)(function(){if(Zt.current)try{}catch(xt){console.log(xt,"---- to set md editor body height")}},[an,Zt,br]);Object(d.useEffect)(function(){function xt(){var Lt=new p.default(function(Bt){var Xt=Object(M.a)(Bt),er;try{for(Xt.s();!(er=Xt.n()).done;){var zt=er.value;(zt.target.offsetHeight>0||zt.target.offsetWidth>0)&&(Kn(),X.setSize("100%","100%"),X.refresh())}}catch(gr){Xt.e(gr)}finally{Xt.f()}});return Lt.observe(mr.current.parentElement),Lt}if(X){var _t=xt();return function(){_t.unobserve(mr.current.parentElement)}}},[X,Kn]),Object(d.useEffect)(function(){if(X){for(var xt=[],_t=function(){var zt=Bt[Lt];Xt=Object(j.a)(zt,2);var gr=Xt[0],Fr=Xt[1],Wt=Object(N.a)({},gr,function(){Vn(Fr)});xt.push(Wt),X.addKeyMap(Wt)},Lt=0,Bt=Object.entries(ae);Lt<Bt.length;Lt++){var Xt;_t()}return Kt.current=setInterval(function(){Dr.current&&Nr()},4e3),function(){clearInterval(Kt.current);var er=Object(M.a)(xt),zt;try{for(er.s();!(zt=er.n()).done;){var gr=zt.value;X.removeKeyMap(gr)}}catch(Fr){er.e(Fr)}finally{er.f()}}}},[X]),Object(d.useEffect)(function(){Pt!==br&&qr(Pt)},[Pt]),Object(Ze.a)(function(){if(!nr&&mn>0){var xt=new Date().getTime(),_t=window.sessionStorage.getItem(ht);xt>=mn+Oe&&(!_t||_t!==nt)&&(window.sessionStorage.setItem(ht,nt),dr(!0))}},Oe),Object(d.useEffect)(function(){or(Dt)},[X,Dt]),Object(d.useEffect)(function(){X&&(kt&&X.focus())},[X,kt]),Object(d.useEffect)(function(){if(jt&&X){var xt=X.getScrollerElement();function _t(Lt){var Bt=Lt.target;if(fr.current){var Xt=Bt.scrollTop/Bt.scrollHeight;fr.current.scrollTop=fr.current.scrollHeight*Xt}}return xt.addEventListener("scroll",_t),function(){xt.removeEventListener("scroll",_t)}}},[X,jt]),Object(d.useEffect)(function(){if(X&&Er){function xt(_t,Lt){Er(_t,Lt)}return X.on("beforeChange",xt),function(){X.off("beforeChange",xt)}}},[X,Er]),Object(d.useEffect)(function(){if(X&&Gt){function xt(){Gt(X.getValue())}return X.on("blur",xt),function(){X.off("blur",xt)}}},[X,Gt]),Object(d.useEffect)(function(){if(X){function xt(_t){var Lt=_t.getValue();gt(Lt),dn(new Date().getTime()),_t.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),pt&&pt(Lt)}return X.on("change",xt),function(){X.off("change",xt)}}},[X,pt]),Object(d.useEffect)(function(){X&&(Je==null?(X.setValue(""),gt("")):Je!==X.getValue()&&(X.setValue(Je),gt(Je),X.setCursor(X.lineCount(),0)))},[X,Je]);var Vn=Object(d.useCallback)(function(xt){var _t=X.getCursor(),Lt=X.getSelection(),Bt=Lt.split(`
|
|
`);switch(xt){case"bold":return X.replaceSelection("**"+Lt+"**"),Lt===""&&X.setCursor(_t.line,_t.ch+2),X.focus();case"italic":return X.replaceSelection("*"+Lt+"*"),Lt===""&&X.setCursor(_t.line,_t.ch+1),X.focus();case"code":return X.replaceSelection("`"+Lt+"`"),Lt===""&&X.setCursor(_t.line,_t.ch+1),X.focus();case"inline-latex":return X.replaceSelection("`$$"+Lt+"$$`"),Lt===""&&X.setCursor(_t.line,_t.ch+3),X.focus();case"latex":return X.replaceSelection("```latex\n"+Lt+"\n```"),X.setCursor(_t.line+1,Lt.length+1),X.focus();case"line-break":return X.replaceSelection(`<br/>
|
|
`),X.focus();case"list-ul":return Lt===""?X.replaceSelection("- "+Lt):X.replaceSelection(Bt.map(function(Xt){return Xt===""?"":"- ".concat(Xt)}).join(`
|
|
`)),X.focus();case"list-ol":return Lt===""?X.replaceSelection("1. "+Lt):X.replaceSelection(Bt.map(function(Xt,er){return Xt===""?"":"".concat(er+1,". ").concat(Xt)}).join(`
|
|
`)),X.focus();case"add-null-ch":return Lt===""&&X.setCursor(_t.line,_t.ch+1),X.replaceSelection(je),X.focus();case"inster-template-1":return Lt===""&&X.setCursor(_t.line,_t.ch),X.replaceSelection(ge),X.focus();case"eraser":return X.setValue(""),X.focus();case"trigger-watch":return or(!jt),X.focus();case"trigger-full-screen":return qr(!br),X.focus();case ze:Gr(ze);return;case Ke:Gr(Ke);return;case ut:Gr(ut);return;case Be:Gr(Be);return;default:throw new Error}},[X,jt,br]),xn=Object(d.useCallback)(function(xt){Gr("");switch($r){case ze:var _t=xt.title,Lt=xt.link;return X.replaceSelection("[".concat(_t,"](").concat(Lt,")")),X.focus();case Ke:var Bt=xt.language,Xt=xt.content;return X.replaceSelection(["```"+Bt,Xt,"```"].join(`
|
|
`)),X.focus();case ut:var er=xt.src,zt=xt.alt,gr=xt.name;return er.indexOf("type=image")>-1?X.replaceSelection(".concat(er,' "').concat(zt||"",'" )')):er.indexOf("type=application/pdf")>-1?X.replaceSelection('<a href="'.concat(er,'&disposition=inline" target="_blank">').concat(gr,"</a>")):X.replaceSelection('<a href="'.concat(er,'" target="_blank">').concat(gr,"</a>")),X.focus();case Be:for(var Fr=xt.row,Wt=xt.col,En=xt.align,Yt=`
|
|
`,Cr=0;Cr<Fr;Cr++){for(var en=[],tn=[],Wi=0;Wi<Wt;Wi++)Cr===1&&tn.push(tt[En]),en.push(" ");Cr===1&&(Yt+="| ".concat(tn.join(" | "),` |
|
|
`)),Yt+="| ".concat(en.join(Wt===1?"":" | "),` |
|
|
`)}return X.replaceSelection(Yt+`
|
|
`),X.focus();default:throw new Error}},[X,$r]),Bi=Object(d.useMemo)(function(){switch($r){case ze:return f.a.createElement(fe,{callback:xn,onCancel:zr});case Ke:return f.a.createElement(ye.b,{callback:xn,onCancel:zr});case ut:return f.a.createElement(ue,{callback:xn,onCancel:zr});case Be:return f.a.createElement(Ie,{callback:xn,onCancel:zr});default:return null}},[$r]);function zr(){Gr("")}Object(d.useEffect)(function(){if(hn.current){var xt=hn.current,_t=!1,Lt=0;function Bt(zt){_t=!0,Lt=zt.pageY}function Xt(){_t=!1}function er(zt){if(_t){var gr=zt.pageY-Lt;gr<0&&(gr=0),gr>300&&(gr=300);var Fr=qe+gr+"px";Jr(Fr)}}return xt.addEventListener("mousedown",Bt),document.addEventListener("mousemove",er),document.addEventListener("mouseup",Xt),function(){xt.removeEventListener("mousedown",Bt),document.removeEventListener("mousemove",er),document.removeEventListener("mouseup",Xt)}}},[X,hn]),Object(d.useEffect)(function(){Jr(qe)},[qe]);var fi=he(At),on=he(an),Xn={width:fi,height:on},ji=Object(d.useMemo)(function(){if(mn){var xt=new Date(mn),_t=xt.getHours(),Lt=xt.getMinutes(),Bt=xt.getSeconds();return _t=_t<10?"0"+_t:_t,Lt=Lt<10?"0"+Lt:Lt,Bt=Bt<10?"0"+Bt:Bt,"".concat(_t,":").concat(Lt,":").concat(Bt)}return 0},[mn]);function Mn(){window.sessionStorage.removeItem(ht),dr(!1),dn(0)}function $a(){dr(!1),dn(0),X.setValue(window.sessionStorage.getItem(ht))}function da(xt,_t){var Lt=X.getValue();Lt=Lt.replace(xt,_t),gt(Lt),X==null||X.setValue(Lt)}return f.a.createElement(d.Fragment,null,f.a.createElement("div",{className:"markdown-editor-wrapper",ref:Zt},f.a.createElement("div",{className:"markdown-editor-container ".concat(ft," ").concat(jt?"on-preview":""," ").concat(St?"mini":""," ").concat(br?"full-screen":""),style:Xn},f.a.createElement(A,{insertTemp:Ar,watch:jt,fullScreen:br,showNullButton:lt,onActionCallback:Vn,hidetoolBar:Ht,uuid:Vt.current,setOpenPhones:function(){Dr.current=!0}}),f.a.createElement("div",{className:"markdown-editor-body"},f.a.createElement("div",{className:"codemirror-container"},f.a.createElement("textarea",{ref:mr,placeholder:ar})),jt?f.a.createElement("div",{ref:fr,className:"preview-container"},Et==="stex"&&f.a.createElement(O,{value:nt}),Et!=="stex"&&f.a.createElement(v.a,{edit:!0,value:nt,replaces:da})):null))),$t?f.a.createElement("a",{ref:hn,className:"editor-resize"}):null,f.a.createElement(P.a,null,le[$r]?f.a.createElement($.a,{centered:!0,title:le[$r],visible:!0,onCancel:zr,footer:null},Bi):null))}},QDVR:function(yt,Ee,Q){"use strict";Q.d(Ee,"e",function(){return $}),Q.d(Ee,"d",function(){return M}),Q.d(Ee,"c",function(){return j}),Q.d(Ee,"b",function(){return N}),Q.d(Ee,"a",function(){return k});var ne=function(){var d=function(f,T){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,p){m.__proto__=p}||function(m,p){for(var b in p)p.hasOwnProperty(b)&&(m[b]=p[b])},d(f,T)};return function(f,T){d(f,T);function m(){this.constructor=f}f.prototype=T===null?Object.create(T):(m.prototype=T.prototype,new m)}}();function $(d){var f=[];return d.forEach(function(T){return f.push(T)}),f}function M(d){var f=[];return d.forEach(function(T,m){return f.push(m)}),f}var K=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 T=f.charCodeAt(0),m=this._value.charCodeAt(this._pos);return T-m},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 T=this._value.charCodeAt(this._to);if(T===47||this._splitOnBackslash&&T===92)if(f)this._from++;else break;else f=!1}return this},d.prototype.cmp=function(f){for(var T=0,m=f.length,p=this._from;T<m&&p<this._to;){var b=f.charCodeAt(T)-this._value.charCodeAt(p);if(b!==0)return b;T+=1,p+=1}return m===this._to-this._from?0:T<m?-1:1},d.prototype.value=function(){return this._value.substring(this._from,this._to)},d}(),D=function(){function d(){}return d}(),j=function(){function d(f){this._iter=f}return d.forPaths=function(){return new d(new I)},d.forStrings=function(){return new d(new K)},d.prototype.clear=function(){this._root=void 0},d.prototype.set=function(f,T){var m=this._iter.reset(f),p;for(this._root||(this._root=new D,this._root.segment=m.value()),p=this._root;;){var b=m.cmp(p.segment);if(b>0)p.left||(p.left=new D,p.left.segment=m.value()),p=p.left;else if(b<0)p.right||(p.right=new D,p.right.segment=m.value()),p=p.right;else if(m.hasNext())m.next(),p.mid||(p.mid=new D,p.mid.segment=m.value()),p=p.mid;else break}var o=p.value;return p.value=T,p.key=f,o},d.prototype.get=function(f){for(var T=this._iter.reset(f),m=this._root;m;){var p=T.cmp(m.segment);if(p>0)m=m.left;else if(p<0)m=m.right;else if(T.hasNext())T.next(),m=m.mid;else break}return m?m.value:void 0},d.prototype.findSubstr=function(f){for(var T=this._iter.reset(f),m=this._root,p=void 0;m;){var b=T.cmp(m.segment);if(b>0)m=m.left;else if(b<0)m=m.right;else if(T.hasNext())T.next(),p=m.value||p,m=m.mid;else break}return m&&m.value||p},d.prototype.forEach=function(f){this._forEach(this._root,f)},d.prototype._forEach=function(f,T){f&&(this._forEach(f.left,T),f.value&&T(f.value,f.key),this._forEach(f.mid,T),this._forEach(f.right,T))},d}(),N=function(){function d(){this.map=new Map,this.ignoreCase=!1}return d.prototype.set=function(f,T){this.map.set(this.toKey(f),T)},d.prototype.get=function(f){return this.map.get(this.toKey(f))},d.prototype.toKey=function(f){var T=f.toString();return this.ignoreCase&&(T=T.toLowerCase()),T},d}(),_=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,T){T===void 0&&(T=0);var m=this._map.get(f);return m?(T!==0&&this.touch(m,T),m.value):void 0},d.prototype.set=function(f,T,m){m===void 0&&(m=0);var p=this._map.get(f);if(p)p.value=T,m!==0&&this.touch(p,m);else{p={key:f,value:T,next:void 0,previous:void 0};switch(m){case 0:this.addItemLast(p);break;case 1:this.addItemFirst(p);break;case 2:this.addItemLast(p);break;default:this.addItemLast(p);break}this._map.set(f,p),this._size++}},d.prototype.delete=function(f){return!!this.remove(f)},d.prototype.remove=function(f){var T=this._map.get(f);return T?(this._map.delete(f),this.removeItem(T),this._size--,T.value):void 0},d.prototype.forEach=function(f,T){for(var m=this._head;m;)T?f.bind(T)(m.value,m.key,this):f(m.value,m.key,this),m=m.next},d.prototype.trimOld=function(f){if(f>=this.size)return;if(f===0){this.clear();return}for(var T=this._head,m=this.size;T&&m>f;)this._map.delete(T.key),T=T.next,m--;this._head=T,this._size=m,T&&(T.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 T=f.next,m=f.previous;if(!T||!m)throw new Error("Invalid list");T.previous=m,m.next=T}f.next=void 0,f.previous=void 0},d.prototype.touch=function(f,T){if(!this._head||!this._tail)throw new Error("Invalid list");if(T!==1&&T!==2)return;if(T===1){if(f===this._head)return;var m=f.next,p=f.previous;f===this._tail?(p.next=void 0,this._tail=p):(m.previous=p,p.next=m),f.previous=void 0,f.next=this._head,this._head.previous=f,this._head=f}else if(T===2){if(f===this._tail)return;var m=f.next,p=f.previous;f===this._head?(m.previous=void 0,this._head=m):(m.previous=p,p.next=m),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(T,m){f.push([m,T])}),f},d}(),k=function(d){ne(f,d);function f(T,m){m===void 0&&(m=1);var p=d.call(this)||this;return p._limit=T,p._ratio=Math.min(Math.max(0,m),1),p}return f.prototype.get=function(T){return d.prototype.get.call(this,T,2)},f.prototype.peek=function(T){return d.prototype.get.call(this,T,0)},f.prototype.set=function(T,m){d.prototype.set.call(this,T,m,2),this.checkTrim()},f.prototype.checkTrim=function(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))},f}(_)},SJMd:function(yt,Ee){/**
|
|
* @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,ne,$,M=!1,K,I;window.PR_SHOULD_USE_CONTINUATION=!0;var D,j;(function(){var N=window,_=["break,continue,do,else,for,if,return,while"],k=[_,"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=[k,"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"],T=[d,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],m=[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"],p="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=[_,"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=[_,"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=[_,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],E=[f,m,T,b,o,i,s,l],g=/^(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",O="kwd",w="com",C="typ",y="lit",c="pun",u="pln",L="tag",S="dec",A="src",P="atn",W="atv",V="nocode",Z="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function z(de){for(var xe=0,Re=!1,Ie=!1,Ne=0,Ge=de.length;Ne<Ge;++Ne){var ze=de[Ne];if(ze.ignoreCase)Ie=!0;else if(/[a-z]/i.test(ze.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Re=!0,Ie=!1;break}}var ut={b:8,t:9,n:10,v:11,f:12,r:13};function Ke(it){var we=it.charCodeAt(0);if(we!==92)return we;var Ye=it.charAt(1);return we=ut[Ye],we||("0"<=Ye&&Ye<="7"?parseInt(it.substring(1),8):Ye==="u"||Ye==="x"?parseInt(it.substring(2),16):it.charCodeAt(1))}function Be(it){if(it<32)return(it<16?"\\x0":"\\x")+it.toString(16);var we=String.fromCharCode(it);return we==="\\"||we==="-"||we==="]"||we==="^"?"\\"+we:we}function Xe(it){var we=it.substring(1,it.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")),Ye=[],at=we[0]==="^",Oe=["["];at&&Oe.push("^");for(var je=at?1:0,ge=we.length;je<ge;++je){var he=we[je];if(/\\[bdsw]/i.test(he))Oe.push(he);else{var ce=Ke(he),re;je+2<ge&&we[je+1]==="-"?(re=Ke(we[je+2]),je+=2):re=ce,Ye.push([ce,re]),re<65||ce>122||(re<65||ce>90||Ye.push([Math.max(65,ce)|32,Math.min(re,90)|32]),re<97||ce>122||Ye.push([Math.max(97,ce)&~32,Math.min(re,122)&~32]))}}Ye.sort(function(Te,be){return Te[0]-be[0]||be[1]-Te[1]});for(var q=[],ae=[],je=0;je<Ye.length;++je){var le=Ye[je];le[0]<=ae[1]+1?ae[1]=Math.max(ae[1],le[1]):q.push(ae=le)}for(var je=0;je<q.length;++je){var le=q[je];Oe.push(Be(le[0])),le[1]>le[0]&&(le[1]+1>le[0]&&Oe.push("-"),Oe.push(Be(le[1])))}return Oe.push("]"),Oe.join("")}function tt(it){for(var we=it.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")),Ye=we.length,at=[],Oe=0,je=0;Oe<Ye;++Oe){var ge=we[Oe];if(ge==="(")++je;else if(ge.charAt(0)==="\\"){var he=+ge.substring(1);he&&(he<=je?at[he]=-1:we[Oe]=Be(he))}}for(var Oe=1;Oe<at.length;++Oe)at[Oe]===-1&&(at[Oe]=++xe);for(var Oe=0,je=0;Oe<Ye;++Oe){var ge=we[Oe];if(ge==="(")++je,at[je]||(we[Oe]="(?:");else if(ge.charAt(0)==="\\"){var he=+ge.substring(1);he&&he<=je&&(we[Oe]="\\"+at[he])}}for(var Oe=0;Oe<Ye;++Oe)we[Oe]==="^"&&we[Oe+1]!=="^"&&(we[Oe]="");if(it.ignoreCase&&Re)for(var Oe=0;Oe<Ye;++Oe){var ge=we[Oe],ce=ge.charAt(0);ge.length>=2&&ce==="["?we[Oe]=Xe(ge):ce!=="\\"&&(we[Oe]=ge.replace(/[a-zA-Z]/g,function(ae){var le=ae.charCodeAt(0);return"["+String.fromCharCode(le&~32,le|32)+"]"}))}return we.join("")}for(var Ze=[],Ne=0,Ge=de.length;Ne<Ge;++Ne){var ze=de[Ne];if(ze.global||ze.multiline)throw new Error(""+ze);Ze.push("(?:"+tt(ze)+")")}return new RegExp(Ze.join("|"),Ie?"gi":"g")}function F(de,xe){var Re=/(?:^|\s)nocode(?:\s|$)/,Ie=[],Ne=0,Ge=[],ze=0;function ut(Ke){var Be=Ke.nodeType;if(Be==1){if(Re.test(Ke.className))return;for(var Xe=Ke.firstChild;Xe;Xe=Xe.nextSibling)ut(Xe);var tt=Ke.nodeName.toLowerCase();(tt==="br"||tt==="li")&&(Ie[ze]=`
|
|
`,Ge[ze<<1]=Ne++,Ge[ze++<<1|1]=Ke)}else if(Be==3||Be==4){var Ze=Ke.nodeValue;Ze.length&&(xe?Ze=Ze.replace(/\r\n?/g,`
|
|
`):Ze=Ze.replace(/[ \t\r\n]+/g," "),Ie[ze]=Ze,Ge[ze<<1]=Ne,Ne+=Ze.length,Ge[ze++<<1|1]=Ke)}}return ut(de),{sourceCode:Ie.join("").replace(/\n$/,""),spans:Ge}}function te(de,xe,Re,Ie,Ne){if(!Re)return;var Ge={sourceNode:de,pre:1,langExtension:null,numberLines:null,sourceCode:Re,spans:null,basePos:xe,decorations:null};Ie(Ge),Ne.push.apply(Ne,Ge.decorations)}var ie=/\S/;function fe(de){for(var xe=void 0,Re=de.firstChild;Re;Re=Re.nextSibling){var Ie=Re.nodeType;xe=Ie===1?xe?de:Re:Ie===3&&ie.test(Re.nodeValue)?de:xe}return xe===de?void 0:xe}function ye(de,xe){var Re={},Ie;(function(){for(var ze=de.concat(xe),ut=[],Ke={},Be=0,Xe=ze.length;Be<Xe;++Be){var tt=ze[Be],Ze=tt[3];if(Ze)for(var it=Ze.length;--it>=0;)Re[Ze.charAt(it)]=tt;var we=tt[1],Ye=""+we;Ke.hasOwnProperty(Ye)||(ut.push(we),Ke[Ye]=null)}ut.push(/[\0-\uffff]/),Ie=z(ut)})();var Ne=xe.length,Ge=function(ze){for(var ut=ze.sourceCode,Ke=ze.basePos,Be=ze.sourceNode,Xe=[Ke,u],tt=0,Ze=ut.match(Ie)||[],it={},we=0,Ye=Ze.length;we<Ye;++we){var at=Ze[we],Oe=it[at],je=void 0,ge;if(typeof Oe=="string")ge=!1;else{var he=Re[at.charAt(0)];if(he)je=at.match(he[1]),Oe=he[0];else{for(var ce=0;ce<Ne;++ce)if(he=xe[ce],je=at.match(he[1]),je){Oe=he[0];break}je||(Oe=u)}ge=Oe.length>=5&&Oe.substring(0,5)==="lang-",ge&&!(je&&typeof je[1]=="string")&&(ge=!1,Oe=A),ge||(it[at]=Oe)}var re=tt;if(tt+=at.length,!ge)Xe.push(Ke+re,Oe);else{var q=je[1],ae=at.indexOf(q),le=ae+q.length;je[2]&&(le=at.length-je[2].length,ae=le-q.length);var Te=Oe.substring(5);te(Be,Ke+re,at.substring(0,ae),Ge,Xe),te(Be,Ke+re+ae,q,ue(Te,q),Xe),te(Be,Ke+re+le,at.substring(le),Ge,Xe)}}ze.decorations=Xe};return Ge}function _e(de){var xe=[],Re=[];de.tripleQuotedStrings?xe.push([v,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):de.multiLineStrings?xe.push([v,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):xe.push([v,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),de.verbatimStrings&&Re.push([v,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ie=de.hashComments;Ie&&(de.cStyleComments?(Ie>1?xe.push([w,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):xe.push([w,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Re.push([v,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):xe.push([w,/^#[^\r\n]*/,null,"#"])),de.cStyleComments&&(Re.push([w,/^\/\/[^\r\n]*/,null]),Re.push([w,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ne=de.regexLiterals;if(Ne){var Ge=Ne>1?"":`
|
|
\r`,ze=Ge?".":"[\\S\\s]",ut="/(?=[^/*"+Ge+"])(?:[^/\\x5B\\x5C"+Ge+"]|\\x5C"+ze+"|\\x5B(?:[^\\x5C\\x5D"+Ge+"]|\\x5C"+ze+")*(?:\\x5D|$))+/";Re.push(["lang-regex",RegExp("^"+Z+"("+ut+")")])}var Ke=de.types;Ke&&Re.push([C,Ke]);var Be=(""+de.keywords).replace(/^ | $/g,"");Be.length&&Re.push([O,new RegExp("^(?:"+Be.replace(/[\s,]+/g,"|")+")\\b"),null]),xe.push([u,/^\s+/,null,` \r
|
|
\xA0`]);var Xe="^.[^\\s\\w.$@'\"`/\\\\]*";return de.regexLiterals&&(Xe+="(?!s*/)"),Re.push([y,/^@[a-z_$][a-z_$@0-9]*/i,null],[C,/^(?:[@_]?[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(Xe),null]),ye(xe,Re)}var Le=_e({keywords:E,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Ae(de,xe,Re){for(var Ie=/(?:^|\s)nocode(?:\s|$)/,Ne=/\r\n?|\n/,Ge=de.ownerDocument,ze=Ge.createElement("li");de.firstChild;)ze.appendChild(de.firstChild);var ut=[ze];function Ke(we){var Ye=we.nodeType;if(Ye==1&&!Ie.test(we.className))if(we.nodeName==="br")Be(we),we.parentNode&&we.parentNode.removeChild(we);else for(var at=we.firstChild;at;at=at.nextSibling)Ke(at);else if((Ye==3||Ye==4)&&Re){var Oe=we.nodeValue,je=Oe.match(Ne);if(je){var ge=Oe.substring(0,je.index);we.nodeValue=ge;var he=Oe.substring(je.index+je[0].length);if(he){var ce=we.parentNode;ce.insertBefore(Ge.createTextNode(he),we.nextSibling)}Be(we),ge||we.parentNode.removeChild(we)}}}function Be(we){for(;!we.nextSibling;)if(we=we.parentNode,!we)return;function Ye(je,ge){var he=ge?je.cloneNode(!1):je,ce=je.parentNode;if(ce){var re=Ye(ce,1),q=je.nextSibling;re.appendChild(he);for(var ae=q;ae;ae=q)q=ae.nextSibling,re.appendChild(ae)}return he}for(var at=Ye(we.nextSibling,0),Oe;(Oe=at.parentNode)&&Oe.nodeType===1;)at=Oe;ut.push(at)}for(var Xe=0;Xe<ut.length;++Xe)Ke(ut[Xe]);xe===(xe|0)&&ut[0].setAttribute("value",xe);var tt=Ge.createElement("ol");tt.className="linenums";for(var Ze=Math.max(0,xe-1|0)||0,Xe=0,it=ut.length;Xe<it;++Xe)ze=ut[Xe],ze.className="L"+(Xe+Ze)%10,ze.firstChild||ze.appendChild(Ge.createTextNode("\xA0")),tt.appendChild(ze);de.appendChild(tt)}function ke(de){var xe=/\bMSIE\s(\d+)/.exec(navigator.userAgent);xe=xe&&+xe[1]<=8;var Re=/\n/g,Ie=de.sourceCode,Ne=Ie.length,Ge=0,ze=de.spans,ut=ze.length,Ke=0,Be=de.decorations,Xe=Be.length,tt=0;Be[Xe]=Ne;var Ze,it;for(it=Ze=0;it<Xe;)Be[it]!==Be[it+2]?(Be[Ze++]=Be[it++],Be[Ze++]=Be[it++]):it+=2;for(Xe=Ze,it=Ze=0;it<Xe;){for(var we=Be[it],Ye=Be[it+1],at=it+2;at+2<=Xe&&Be[at+1]===Ye;)at+=2;Be[Ze++]=we,Be[Ze++]=Ye,it=at}Xe=Be.length=Ze;var Oe=de.sourceNode,je="";Oe&&(je=Oe.style.display,Oe.style.display="none");try{for(var ge=null;Ke<ut;){var he=ze[Ke],ce=ze[Ke+2]||Ne,re=Be[tt+2]||Ne,at=Math.min(ce,re),q=ze[Ke+1],ae;if(q.nodeType!==1&&(ae=Ie.substring(Ge,at))){xe&&(ae=ae.replace(Re,"\r")),q.nodeValue=ae;var le=q.ownerDocument,Te=le.createElement("span");Te.className=Be[tt+1];var be=q.parentNode;be.replaceChild(Te,q),Te.appendChild(q),Ge<ce&&(ze[Ke+1]=q=le.createTextNode(Ie.substring(at,ce)),be.insertBefore(q,Te.nextSibling))}Ge=at,Ge>=ce&&(Ke+=2),Ge>=re&&(tt+=2)}}finally{Oe&&(Oe.style.display=je)}}var De={};function ve(de,xe){for(var Re=xe.length;--Re>=0;){var Ie=xe[Re];De.hasOwnProperty(Ie)?N.console&&console.warn("cannot override language handler %s",Ie):De[Ie]=de}}function ue(de,xe){return de&&De.hasOwnProperty(de)||(de=/^\s*</.test(xe)?"default-markup":"default-code"),De[de]}ve(Le,["default-code"]),ve(ye([],[[u,/^[^<?]+/],[S,/^<!\w[^>]*(?:>|$)/],[w,/^<\!--[\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"]),ve(ye([[u,/^[\s]+/,null,` \r
|
|
`],[W,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[L,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!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"]),ve(ye([],[[W,/^[\s\S]+/]]),["uq.val"]),ve(_e({keywords:f,hashComments:!0,cStyleComments:!0,types:g}),["c","cc","cpp","cxx","cyc","m"]),ve(_e({keywords:"null,true,false"}),["json"]),ve(_e({keywords:m,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:g}),["cs"]),ve(_e({keywords:T,cStyleComments:!0}),["java"]),ve(_e({keywords:l,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ve(_e({keywords:i,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ve(_e({keywords:o,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ve(_e({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ve(_e({keywords:b,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ve(_e({keywords:p,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ve(ye([],[[v,/^[\s\S]+/]]),["regex"]);function Me(de){var xe=de.langExtension;try{var Re=F(de.sourceNode,de.pre),Ie=Re.sourceCode;de.sourceCode=Ie,de.spans=Re.spans,de.basePos=0,ue(xe,Ie)(de),ke(de)}catch(Ne){N.console&&console.log(Ne&&Ne.stack||Ne)}}function Qe(de,xe,Re){var Ie=Re||!1,Ne=xe||null,Ge=document.createElement("div");Ge.innerHTML="<pre>"+de+"</pre>",Ge=Ge.firstChild,Ie&&Ae(Ge,Ie,!0);var ze={langExtension:Ne,numberLines:Ie,sourceNode:Ge,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Me(ze),Ge.innerHTML}function He(de,xe){var Re=xe||document.body,Ie=Re.ownerDocument||document;function Ne(he){return Re.getElementsByTagName(he)}for(var Ge=[Ne("pre"),Ne("code"),Ne("xmp")],ze=[],ut=0;ut<Ge.length;++ut)for(var Ke=0,Be=Ge[ut].length;Ke<Be;++Ke)ze.push(Ge[ut][Ke]);Ge=null;var Xe=Date;Xe.now||(Xe={now:function(){return+new Date}});var tt=0,Ze=/\blang(?:uage)?-([\w.]+)(?!\S)/,it=/\bprettyprint\b/,we=/\bprettyprinted\b/,Ye=/pre|xmp/i,at=/^code$/i,Oe=/^(?:pre|code|xmp)$/i,je={};function ge(){for(var he=N.PR_SHOULD_USE_CONTINUATION?Xe.now()+250:Infinity;tt<ze.length&&Xe.now()<he;tt++){for(var ce=ze[tt],re=je,q=ce;q=q.previousSibling;){var ae=q.nodeType,le=(ae===7||ae===8)&&q.nodeValue;if(le?!/^\??prettify\b/.test(le):ae!==3||/\S/.test(q.nodeValue))break;if(le){re={},le.replace(/\b(\w+)=([\w:.%+-]+)/g,function(kt,Dt,Ar){re[Dt]=Ar});break}}var Te=ce.className;if((re!==je||it.test(Te))&&!we.test(Te)){for(var be=!1,Fe=ce.parentNode;Fe;Fe=Fe.parentNode){var Je=Fe.tagName;if(Oe.test(Je)&&Fe.className&&it.test(Fe.className)){be=!0;break}}if(!be){ce.className+=" prettyprinted";var pt=re.lang;if(!pt){pt=Te.match(Ze);var ct;!pt&&(ct=fe(ce))&&at.test(ct.tagName)&&(pt=ct.className.match(Ze)),pt&&(pt=pt[1])}var At;if(Ye.test(ce.tagName))At=1;else{var wt=ce.currentStyle,qe=Ie.defaultView,Mt=wt?wt.whiteSpace:qe&&qe.getComputedStyle?qe.getComputedStyle(ce,null).getPropertyValue("white-space"):0;At=Mt&&Mt.substring(0,3)==="pre"}var St=re.linenums;(St=St==="true"||+St)||(St=Te.match(/\blinenums\b(?::(\d+))?/),St=St?St[1]&&St[1].length?+St[1]:!0:!1),St&&Ae(ce,St,At);var It={langExtension:pt,sourceNode:ce,numberLines:St,pre:At,sourceCode:null,basePos:null,spans:null,decorations:null};Me(It)}}}tt<ze.length?N.setTimeout(ge,250):typeof de=="function"&&de()}ge()}var rt=N.PR={createSimpleLexer:ye,registerLangHandler:ve,sourceDecorator:_e,PR_ATTRIB_NAME:P,PR_ATTRIB_VALUE:W,PR_COMMENT:w,PR_DECLARATION:S,PR_KEYWORD:O,PR_LITERAL:y,PR_NOCODE:V,PR_PLAIN:u,PR_PUNCTUATION:c,PR_SOURCE:A,PR_STRING:v,PR_TAG:L,PR_TYPE:C,prettyPrintOne:M?N.prettyPrintOne=Qe:D=Qe,prettyPrint:j=M?N.prettyPrint=He:j=He},oe=N.define;typeof oe=="function"&&oe.amd&&oe("google-code-prettify",[],function(){return rt})})()},T8No:function(yt,Ee,Q){"use strict";Q.d(Ee,"a",function(){return K}),Q.d(Ee,"b",function(){return T}),Q.d(Ee,"d",function(){return m}),Q.d(Ee,"c",function(){return p}),Q.d(Ee,"e",function(){return b});var ne=Q("N0LK"),$=Q("Cg/j"),M=function(){var o=function(i,s){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,E){l.__proto__=E}||function(l,E){for(var g in E)E.hasOwnProperty(g)&&(l[g]=E[g])},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)}}(),K=function(){function o(){}return o.has=function(i){return D.create(i)},o.equals=function(i,s){return j.create(i,s)},o.regex=function(i,s){return k.create(i,s)},o.not=function(i){return _.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 T.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,E=i.split("||");return T.create(E.map(function(g){return l._deserializeAndExpression(g,s)}))},o._deserializeAndExpression=function(i,s){var l=this,E=i.split("&&");return f.create(E.map(function(g){return l._deserializeOne(g,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 j.create(l[0].trim(),this._deserializeValue(l[1],s))}if(i.indexOf("=~")>=0){var l=i.split("=~");return k.create(l[0].trim(),this._deserializeRegexValue(l[1],s))}return/^\!\s*/.test(i)?_.create(i.substr(1).trim()):D.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(ne.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("/"),E=i.lastIndexOf("/");if(l===E||l<0){if(s)throw new Error("bad regexp-value '"+i+"', missing /-enclosure");return console.warn("bad regexp-value '"+i+"', missing /-enclosure"),null}var g=i.slice(l+1,E),v=i[E+1]==="i"?"i":"";try{return new RegExp(g,v)}catch(O){if(s)throw new Error("bad regexp-value '"+i+"', parse error: "+O);return console.warn("bad regexp-value '"+i+"', parse error: "+O),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 D=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 _.create(this.key)},o}(),j=function(){function o(i,s){this.key=i,this.value=s}return o.create=function(i,s){return typeof s=="boolean"?s?D.create(i):_.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?_.create(i):D.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 j.create(this.key,this.value)},o}(),_=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 D.create(this.key)},o}(),k=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 E=I(this.expr[s],i.expr[s]);if(E!==0)return E}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,E=i.length;l<E;l++){var g=i[l];if(!g)continue;if(g instanceof o){s=s.concat(g.expr);continue}if(g instanceof T)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(g)}s.sort(I)}return s},o.prototype.keys=function(){for(var i=[],s=0,l=this.expr;s<l.length;s++){var E=l[s];i.push.apply(i,E.keys())}return i},o.prototype.negate=function(){for(var i=[],s=0,l=this.expr;s<l.length;s++){var E=l[s];i.push(E.negate())}return T.create(i)},o}(),T=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,E=i.length;l<E;l++){var g=i[l];if(!g)continue;if(g instanceof o){s=s.concat(g.expr);continue}s.push(g)}s.sort(I)}return s},o.prototype.keys=function(){for(var i=[],s=0,l=this.expr;s<l.length;s++){var E=l[s];i.push.apply(i,E.keys())}return i},o.prototype.negate=function(){for(var i=[],s=0,l=this.expr;s<l.length;s++){var E=l[s];i.push(E.negate())}for(var g=function(A){return A instanceof o?A.expr:[A]};i.length>1;){for(var v=i.shift(),O=i.shift(),w=[],C=0,y=g(v);C<y.length;C++)for(var c=y[C],u=0,L=g(O);u<L.length;u++){var S=L[u];w.push(K.and(c,S))}i.unshift(K.or.apply(K,w))}return i[0]},o}(),m=function(o){M(i,o);function i(s,l){var E=o.call(this,s)||this;return E._defaultValue=l,E}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 K.not(this.key)},i}(D),p=Object($.c)("contextKeyService"),b="setContext"},"VrN/":function(yt,Ee,Q){(function(ne,$){yt.exports=$()})(this,function(){"use strict";var ne=navigator.userAgent,$=navigator.platform,M=/gecko\/\d/i.test(ne),K=/MSIE \d/.test(ne),I=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ne),D=/Edge\/(\d+)/.exec(ne),j=K||I||D,N=j&&(K?document.documentMode||6:+(D||I)[1]),_=!D&&/WebKit\//.test(ne),k=_&&/Qt\/\d+\.\d+/.test(ne),d=!D&&/Chrome\//.test(ne),f=/Opera\//.test(ne),T=/Apple Computer/.test(navigator.vendor),m=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ne),p=/PhantomJS/.test(ne),b=!D&&/AppleWebKit/.test(ne)&&/Mobile\/\w+/.test(ne),o=/Android/.test(ne),i=b||o||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ne),s=b||/Mac/.test($),l=/\bCrOS\b/.test(ne),E=/win/i.test($),g=f&&ne.match(/Version\/(\d*\.\d*)/);g&&(g=Number(g[1])),g&&g>=15&&(f=!1,_=!0);var v=s&&(k||f&&(g==null||g<12.11)),O=M||j&&N>=9;function w(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var C=function(e,t){var n=e.className,r=w(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 R=0;R<t.length;++R)a.appendChild(t[R]);return a}function L(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 A(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 P(){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 W(e,t){var n=e.className;w(t).test(n)||(e.className+=(n?" ":"")+t)}function V(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!w(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}:j&&(Z=function(e){try{e.select()}catch(t){}});function z(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 te(e,t,n,r,a){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var R=r||0,U=a||0;;){var Y=e.indexOf(" ",R);if(Y<0||Y>=t)return U+(t-R);U+=Y-R,U+=n-U%n,R=Y+1}}var ie=function(){this.id=null,this.f=null,this.time=0,this.handler=z(this.onTimeout,this)};ie.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ie.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 fe(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var ye=50,_e={toString:function(){return"CodeMirror.Pass"}},Le={scroll:!1},Ae={origin:"*mouse"},ke={origin:"+move"};function De(e,t,n){for(var r=0,a=0;;){var R=e.indexOf(" ",r);R==-1&&(R=e.length);var U=R-r;if(R==e.length||a+U>=t)return r+Math.min(U,t-a);if(a+=R-r,a+=n-a%n,r=R+1,a>=t)return r}}var ve=[""];function ue(e){for(;ve.length<=e;)ve.push(Me(ve)+" ");return ve[e]}function Me(e){return e[e.length-1]}function Qe(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function He(e,t,n){for(var r=0,a=n(t);r<e.length&&n(e[r])<=a;)r++;e.splice(r,0,t)}function rt(){}function oe(e,t){var n;return Object.create?n=Object.create(e):(rt.prototype=e,n=new rt),t&&F(t,n),n}var de=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function xe(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||de.test(e))}function Re(e,t){return t?t.source.indexOf("\\w")>-1&&xe(e)?!0:t.test(e):xe(e)}function Ie(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Ne=/[\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 Ge(e){return e.charCodeAt(0)>=768&&Ne.test(e)}function ze(e,t,n){for(;(n<0?t>0:t<e.length)&&Ge(e.charAt(t));)t+=n;return t}function ut(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var a=(t+n)/2,R=r<0?Math.ceil(a):Math.floor(a);if(R==t)return e(R)?t:n;e(R)?n=R:t=R+r}}function Ke(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var a=!1,R=0;R<e.length;++R){var U=e[R];(U.from<n&&U.to>t||t==n&&U.to==t)&&(r(Math.max(U.from,t),Math.min(U.to,n),U.level==1?"rtl":"ltr",R),a=!0)}a||r(t,n,"ltr")}var Be=null;function Xe(e,t,n){var r;Be=null;for(var a=0;a<e.length;++a){var R=e[a];if(R.from<t&&R.to>t)return a;R.to==t&&(R.from!=R.to&&n=="before"?r=a:Be=a),R.from==t&&(R.from!=R.to&&n!="before"?r=a:Be=a)}return r!=null?r:Be}var tt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(ee){return ee<=247?e.charAt(ee):1424<=ee&&ee<=1524?"R":1536<=ee&&ee<=1785?t.charAt(ee-1536):1774<=ee&&ee<=2220?"r":8192<=ee&&ee<=8203?"w":ee==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,a=/[stwN]/,R=/[LRr]/,U=/[Lb1n]/,Y=/[1n]/;function J(ee,se,pe){this.level=ee,this.from=se,this.to=pe}return function(ee,se){var pe=se=="ltr"?"L":"R";if(ee.length==0||se=="ltr"&&!r.test(ee))return!1;for(var Se=ee.length,Ce=[],Pe=0;Pe<Se;++Pe)Ce.push(n(ee.charCodeAt(Pe)));for(var $e=0,et=pe;$e<Se;++$e){var ot=Ce[$e];ot=="m"?Ce[$e]=et:et=ot}for(var mt=0,st=pe;mt<Se;++mt){var vt=Ce[mt];vt=="1"&&st=="r"?Ce[mt]="n":R.test(vt)&&(st=vt,vt=="r"&&(Ce[mt]="R"))}for(var Rt=1,Tt=Ce[0];Rt<Se-1;++Rt){var Nt=Ce[Rt];Nt=="+"&&Tt=="1"&&Ce[Rt+1]=="1"?Ce[Rt]="1":Nt==","&&Tt==Ce[Rt+1]&&(Tt=="1"||Tt=="n")&&(Ce[Rt]=Tt),Tt=Nt}for(var sr=0;sr<Se;++sr){var wr=Ce[sr];if(wr==",")Ce[sr]="N";else if(wr=="%"){var ur=void 0;for(ur=sr+1;ur<Se&&Ce[ur]=="%";++ur);for(var Vr=sr&&Ce[sr-1]=="!"||ur<Se&&Ce[ur]=="1"?"1":"N",jr=sr;jr<ur;++jr)Ce[jr]=Vr;sr=ur-1}}for(var vr=0,Wr=pe;vr<Se;++vr){var kr=Ce[vr];Wr=="L"&&kr=="1"?Ce[vr]="L":R.test(kr)&&(Wr=kr)}for(var xr=0;xr<Se;++xr)if(a.test(Ce[xr])){var yr=void 0;for(yr=xr+1;yr<Se&&a.test(Ce[yr]);++yr);for(var hr=(xr?Ce[xr-1]:pe)=="L",Hr=(yr<Se?Ce[yr]:pe)=="L",ui=hr==Hr?hr?"L":"R":pe,Rn=xr;Rn<yr;++Rn)Ce[Rn]=ui;xr=yr-1}for(var Mr=[],pn,Lr=0;Lr<Se;)if(U.test(Ce[Lr])){var Xa=Lr;for(++Lr;Lr<Se&&U.test(Ce[Lr]);++Lr);Mr.push(new J(0,Xa,Lr))}else{var yn=Lr,Wn=Mr.length,Hn=se=="rtl"?1:0;for(++Lr;Lr<Se&&Ce[Lr]!="L";++Lr);for(var Pr=yn;Pr<Lr;)if(Y.test(Ce[Pr])){yn<Pr&&(Mr.splice(Wn,0,new J(1,yn,Pr)),Wn+=Hn);var di=Pr;for(++Pr;Pr<Lr&&Y.test(Ce[Pr]);++Pr);Mr.splice(Wn,0,new J(2,di,Pr)),Wn+=Hn,yn=Pr}else++Pr;yn<Lr&&Mr.splice(Wn,0,new J(1,yn,Lr))}return se=="ltr"&&(Mr[0].level==1&&(pn=ee.match(/^\s+/))&&(Mr[0].from=pn[0].length,Mr.unshift(new J(0,0,pn[0].length))),Me(Mr).level==1&&(pn=ee.match(/\s+$/))&&(Me(Mr).to-=pn[0].length,Mr.push(new J(0,Se-pn[0].length,Se)))),se=="rtl"?Mr.reverse():Mr}}();function Ze(e,t){var n=e.order;return n==null&&(n=e.order=tt(e.text,t)),n}var it=[],we=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]||it).concat(n)}};function Ye(e,t){return e._handlers&&e._handlers[t]||it}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 R=fe(a,n);R>-1&&(r[t]=a.slice(0,R).concat(a.slice(R+1)))}}}function Oe(e,t){var n=Ye(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 je(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Oe(e,n||t.type,e,t),ae(t)||t.codemirrorIgnore}function ge(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)fe(n,t[r])==-1&&n.push(t[r])}function he(e,t){return Ye(e,t).length>0}function ce(e){e.prototype.on=function(t,n){we(this,t,n)},e.prototype.off=function(t,n){at(this,t,n)}}function re(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function q(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ae(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function le(e){re(e),q(e)}function Te(e){return e.target||e.srcElement}function be(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 Fe=function(){if(j&&N<9)return!1;var e=u("div");return"draggable"in e||"dragDrop"in e}(),Je;function pt(e){if(Je==null){var t=u("span","\u200B");c(e,u("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Je=t.offsetWidth<=1&&t.offsetHeight>2&&!(j&&N<8))}var n=Je?u("span","\u200B"):u("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var ct;function At(e){if(ct!=null)return ct;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:ct=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 R=e.slice(t,e.charAt(a-1)=="\r"?a-1:a),U=R.indexOf("\r");U!=-1?(n.push(R.slice(0,U)),t+=U+1):(n.push(R),t=a+1)}return n}:function(e){return e.split(/\r\n?|\n/)},qe=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},Mt=function(){var e=u("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),St=null;function It(e){if(St!=null)return St;var t=c(e,u("span","x")),n=t.getBoundingClientRect(),r=S(t,0,1).getBoundingClientRect();return St=Math.abs(n.left-r.left)>1}var kt={},Dt={};function Ar(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),kt[e]=t}function cr(e,t){Dt[e]=t}function Et(e){if(typeof e=="string"&&Dt.hasOwnProperty(e))e=Dt[e];else if(e&&typeof e.name=="string"&&Dt.hasOwnProperty(e.name)){var t=Dt[e.name];typeof t=="string"&&(t={name:t}),e=oe(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Et("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Et("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function bt(e,t){t=Et(t);var n=kt[t.name];if(!n)return bt(e,"text/plain");var r=n(e,t);if(ht.hasOwnProperty(t.name)){var a=ht[t.name];for(var R in a){if(!a.hasOwnProperty(R))continue;r.hasOwnProperty(R)&&(r["_"+R]=r[R]),r[R]=a[R]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var U in t.modeProps)r[U]=t.modeProps[U];return r}var ht={};function Ct(e,t){var n=ht.hasOwnProperty(e)?ht[e]:ht[e]={};F(t,n)}function $t(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 rr(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 nr(e,t,n){return e.startState?e.startState(t,n):!0}var dt=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};dt.prototype.eol=function(){return this.pos>=this.string.length},dt.prototype.sol=function(){return this.pos==this.lineStart},dt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},dt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},dt.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},dt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},dt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},dt.prototype.skipToEnd=function(){this.pos=this.string.length},dt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},dt.prototype.backUp=function(e){this.pos-=e},dt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=te(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?te(this.string,this.lineStart,this.tabSize):0)},dt.prototype.indentation=function(){return te(this.string,null,this.tabSize)-(this.lineStart?te(this.string,this.lineStart,this.tabSize):0)},dt.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(U){return n?U.toLowerCase():U},a=this.string.substr(this.pos,e.length);if(r(a)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var R=this.string.slice(this.pos).match(e);return R&&R.index>0?null:(R&&t!==!1&&(this.pos+=R[0].length),R)}},dt.prototype.current=function(){return this.string.slice(this.start,this.pos)},dt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},dt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},dt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function lt(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],R=a.chunkSize();if(t<R){n=a;break}t-=R}return n.lines[t]}function ir(e,t,n){var r=[],a=t.line;return e.iter(t.line,n.line+1,function(R){var U=R.text;a==n.line&&(U=U.slice(0,n.ch)),a==t.line&&(U=U.slice(t.ch)),r.push(U),++a}),r}function Ht(e,t,n){var r=[];return e.iter(t,n,function(a){r.push(a.text)}),r}function Ut(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Pt(e){if(e.parent==null)return null;for(var t=e.parent,n=fe(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 Gt(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var a=e.children[r],R=a.height;if(t<R){e=a;continue e}t-=R,n+=a.chunkSize()}return n}while(!e.lines);for(var U=0;U<e.lines.length;++U){var Y=e.lines[U],J=Y.height;if(t<J)break;t-=J}return n+U}function Er(e,t){return t>=e.first&&t<e.first+e.size}function rn(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ue(e,t,n){if(n===void 0&&(n=null),!(this instanceof Ue))return new Ue(e,t,n);this.line=e,this.ch=t,this.sticky=n}function ft(e,t){return e.line-t.line||e.ch-t.ch}function Ft(e,t){return e.sticky==t.sticky&&ft(e,t)==0}function Jt(e){return Ue(e.line,e.ch)}function qt(e,t){return ft(e,t)<0?t:e}function ar(e,t){return ft(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 Ue(e.first,0);var n=e.first+e.size-1;return t.line>n?Ue(n,lt(e,n).text.length):x(t,lt(e,t.line).text.length)}function x(e,t){var n=e.ch;return n==null||n>t?Ue(e.line,t):n<0?Ue(e.line,0):e}function B(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,$t(e.mode,t.state),n,t.lookAhead):new G(e,$t(e.mode,t),n)},G.prototype.save=function(e){var t=e!==!1?$t(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new X(t,this.maxLookAhead):t};function me(e,t,n,r){var a=[e.state.modeGen],R={};Yr(e,t.text,e.doc.mode,n,function(ee,se){return a.push(ee,se)},R,r);for(var U=n.state,Y=function(ee){n.baseTokens=a;var se=e.state.overlays[ee],pe=1,Se=0;n.state=!0,Yr(e,t.text,se.mode,n,function(Ce,Pe){for(var $e=pe;Se<Ce;){var et=a[pe];et>Ce&&a.splice(pe,1,Ce,a[pe+1],et),pe+=2,Se=Math.min(Ce,et)}if(!Pe)return;if(se.opaque)a.splice($e,pe-$e,Ce,"overlay "+Pe),pe=$e+2;else for(;$e<pe;$e+=2){var ot=a[$e+1];a[$e+1]=(ot?ot+" ":"")+"overlay "+Pe}},R),n.state=U,n.baseTokens=null,n.baseTokenPos=1},J=0;J<e.state.overlays.length;++J)Y(J);return{styles:a,classes:R.bgClass||R.textClass?R:null}}function We(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=nt(e,Pt(t)),a=t.text.length>e.options.maxHighlightLength&&$t(e.doc.mode,r.state),R=me(e,t,r);a&&(r.state=a),t.stateAfter=r.save(!a),t.styles=R.styles,R.classes?t.styleClasses=R.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 nt(e,t,n){var r=e.doc,a=e.display;if(!r.mode.startState)return new G(r,!0,t);var R=br(e,t,n),U=R>r.first&<(r,R-1).stateAfter,Y=U?G.fromSaved(r,U,R):new G(r,nr(r.mode),R);return r.iter(R,t,function(J){gt(e,J.text,Y);var ee=Y.line;J.stateAfter=ee==t-1||ee%5==0||ee>=a.viewFrom&&ee<a.viewTo?Y.save():null,Y.nextLine()}),n&&(r.modeFrontier=Y.line),Y}function gt(e,t,n,r){var a=e.doc.mode,R=new dt(t,e.options.tabSize,n);for(R.start=R.pos=r||0,t==""&&Ve(a,n.state);!R.eol();)Ot(a,R,n.state),R.start=R.pos}function Ve(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=rr(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function Ot(e,t,n,r){for(var a=0;a<10;a++){r&&(r[0]=rr(e,n).mode);var R=e.token(t,n);if(t.pos>t.start)return R}throw new Error("Mode "+e.name+" failed to advance stream.")}var jt=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function or(e,t,n,r){var a=e.doc,R=a.mode,U;t=h(a,t);var Y=lt(a,t.line),J=nt(e,t.line,n),ee=new dt(Y.text,e.options.tabSize,J),se;for(r&&(se=[]);(r||ee.pos<t.ch)&&!ee.eol();)ee.start=ee.pos,U=Ot(R,ee,J.state),r&&se.push(new jt(ee,U,$t(a.mode,J.state)));return r?se:new jt(ee,U,J.state)}function Xr(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 Yr(e,t,n,r,a,R,U){var Y=n.flattenSpans;Y==null&&(Y=e.options.flattenSpans);var J=0,ee=null,se=new dt(t,e.options.tabSize,r),pe,Se=e.options.addModeClass&&[null];for(t==""&&Xr(Ve(n,r.state),R);!se.eol();){if(se.pos>e.options.maxHighlightLength?(Y=!1,U&>(e,t,r,se.pos),se.pos=t.length,pe=null):pe=Xr(Ot(n,se,r.state,Se),R),Se){var Ce=Se[0].name;Ce&&(pe="m-"+(pe?Ce+" "+pe:Ce))}if(!Y||ee!=pe){for(;J<se.start;)J=Math.min(se.start,J+5e3),a(J,ee);ee=pe}se.start=se.pos}for(;J<se.pos;){var Pe=Math.min(se.pos,J+5e3);a(Pe,ee),J=Pe}}function br(e,t,n){for(var r,a,R=e.doc,U=n?-1:t-(e.doc.mode.innerMode?1e3:100),Y=t;Y>U;--Y){if(Y<=R.first)return R.first;var J=lt(R,Y-1),ee=J.stateAfter;if(ee&&(!n||Y+(ee instanceof X?ee.lookAhead:0)<=R.modeFrontier))return Y;var se=te(J.text,null,e.options.tabSize);(a==null||r>se)&&(a=Y-1,r=se)}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=lt(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,Ir=!1;function $r(){Gn=!0}function Gr(){Ir=!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 R=e[a],U=R.marker,Y=R.from==null||(U.inclusiveLeft?R.from<=t:R.from<t);if(Y||R.from==t&&U.type=="bookmark"&&(!n||!R.marker.insertLeft)){var J=R.to==null||(U.inclusiveRight?R.to>=t:R.to>t);(r||(r=[])).push(new bn(U,R.from,J?null:R.to))}}return r}function zn(e,t,n){var r;if(e)for(var a=0;a<e.length;++a){var R=e[a],U=R.marker,Y=R.to==null||(U.inclusiveRight?R.to>=t:R.to>t);if(Y||R.from==t&&U.type=="bookmark"&&(!n||R.marker.insertLeft)){var J=R.from==null||(U.inclusiveLeft?R.from<=t:R.from<t);(r||(r=[])).push(new bn(U,J?null:R.from-t,R.to==null?null:R.to-t))}}return r}function an(e,t){if(t.full)return null;var n=Er(e,t.from.line)&<(e,t.from.line).markedSpans,r=Er(e,t.to.line)&<(e,t.to.line).markedSpans;if(!n&&!r)return null;var a=t.from.ch,R=t.to.ch,U=ft(t.from,t.to)==0,Y=hi(n,a,U),J=zn(r,R,U),ee=t.text.length==1,se=Me(t.text).length+(ee?a:0);if(Y)for(var pe=0;pe<Y.length;++pe){var Se=Y[pe];if(Se.to==null){var Ce=nn(J,Se.marker);Ce?ee&&(Se.to=Ce.to==null?null:Ce.to+se):Se.to=a}}if(J)for(var Pe=0;Pe<J.length;++Pe){var $e=J[Pe];if($e.to!=null&&($e.to+=se),$e.from==null){var et=nn(Y,$e.marker);et||($e.from=se,ee&&(Y||(Y=[])).push($e))}else $e.from+=se,ee&&(Y||(Y=[])).push($e)}Y&&(Y=Jr(Y)),J&&J!=Y&&(J=Jr(J));var ot=[Y];if(!ee){var mt=t.text.length-2,st;if(mt>0&&Y)for(var vt=0;vt<Y.length;++vt)Y[vt].to==null&&(st||(st=[])).push(new bn(Y[vt].marker,null,null));for(var Rt=0;Rt<mt;++Rt)ot.push(st);ot.push(J)}return ot}function Jr(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(Ce){if(Ce.markedSpans)for(var Pe=0;Pe<Ce.markedSpans.length;++Pe){var $e=Ce.markedSpans[Pe].marker;$e.readOnly&&(!r||fe(r,$e)==-1)&&(r||(r=[])).push($e)}}),!r)return null;for(var a=[{from:t,to:n}],R=0;R<r.length;++R)for(var U=r[R],Y=U.find(0),J=0;J<a.length;++J){var ee=a[J];if(ft(ee.to,Y.from)<0||ft(ee.from,Y.to)>0)continue;var se=[J,1],pe=ft(ee.from,Y.from),Se=ft(ee.to,Y.to);(pe<0||!U.inclusiveLeft&&!pe)&&se.push({from:ee.from,to:Y.from}),(Se>0||!U.inclusiveRight&&!Se)&&se.push({from:Y.to,to:ee.to}),a.splice.apply(a,se),J+=se.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 dr(e){return e.inclusiveLeft?-1:0}function Vt(e){return e.inclusiveRight?1:0}function Dr(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),a=t.find(),R=ft(r.from,a.from)||dr(e)-dr(t);if(R)return-R;var U=ft(r.to,a.to)||Vt(e)-Vt(t);return U||t.id-e.id}function Kt(e,t){var n=Ir&&e.markedSpans,r;if(n)for(var a=void 0,R=0;R<n.length;++R)a=n[R],a.marker.collapsed&&(t?a.from:a.to)==null&&(!r||Dr(r,a.marker)<0)&&(r=a.marker);return r}function mr(e){return Kt(e,!0)}function Zt(e){return Kt(e,!1)}function hn(e,t){var n=Ir&&e.markedSpans,r;if(n)for(var a=0;a<n.length;++a){var R=n[a];R.marker.collapsed&&(R.from==null||R.from<t)&&(R.to==null||R.to>t)&&(!r||Dr(r,R.marker)<0)&&(r=R.marker)}return r}function fr(e,t,n,r,a){var R=lt(e,t),U=Ir&&R.markedSpans;if(U)for(var Y=0;Y<U.length;++Y){var J=U[Y];if(!J.marker.collapsed)continue;var ee=J.marker.find(0),se=ft(ee.from,n)||dr(J.marker)-dr(a),pe=ft(ee.to,r)||Vt(J.marker)-Vt(a);if(se>=0&&pe<=0||se<=0&&pe>=0)continue;if(se<=0&&(J.marker.inclusiveRight&&a.inclusiveLeft?ft(ee.to,n)>=0:ft(ee.to,n)>0)||se>=0&&(J.marker.inclusiveRight&&a.inclusiveLeft?ft(ee.from,r)<=0:ft(ee.from,r)<0))return!0}}function Nr(e){for(var t;t=mr(e);)e=t.find(-1,!0).line;return e}function Kn(e){for(var t;t=Zt(e);)e=t.find(1,!0).line;return e}function Vn(e){for(var t,n;t=Zt(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function xn(e,t){var n=lt(e,t),r=Nr(n);return n==r?t:Pt(r)}function Bi(e,t){if(t>e.lastLine())return t;var n=lt(e,t),r;if(!zr(e,n))return t;for(;r=Zt(n);)n=r.find(1,!0).line;return Pt(n)+1}function zr(e,t){var n=Ir&&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,R=0;R<t.markedSpans.length;++R)if(a=t.markedSpans[R],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=Nr(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 R=n.parent;R;n=R,R=n.parent)for(var U=0;U<R.children.length;++U){var Y=R.children[U];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=mr(r);){var a=n.find(0,!0);r=a.from.line,t+=a.from.ch-a.to.ch}for(r=e;n=Zt(r);){var R=n.find(0,!0);t-=r.text.length-R.from.ch,r=R.to.line,t+=r.text.length-R.to.ch}return t}function ji(e){var t=e.display,n=e.doc;t.maxLine=lt(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 Mn=function(e,t,n){this.text=e,ci(this,t),this.height=n?n(this):1};Mn.prototype.lineNo=function(){return Pt(this)},ce(Mn);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&&Ut(e,a)}function da(e){e.parent=null,On(e)}var xt={},_t={};function Lt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?_t:xt;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Bt(e,t){var n=L("span",null,null,_?"padding-right: .1px":null),r={pre:L("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 R=a?t.rest[a-1]:t.line,U=void 0;r.pos=0,r.addToken=er,At(e.display.measure)&&(U=Ze(R,e.doc.direction))&&(r.addToken=gr(r.addToken,U)),r.map=[];var Y=t!=e.display.externalMeasured&&Pt(R);Wt(R,r,We(e,R,Y)),R.styleClasses&&(R.styleClasses.bgClass&&(r.bgClass=V(R.styleClasses.bgClass,r.bgClass||"")),R.styleClasses.textClass&&(r.textClass=V(R.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(pt(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(_){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 Oe(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=V(r.pre.className,r.textClass||"")),r}function Xt(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 er(e,t,n,r,a,R,U){if(!t)return;var Y=e.splitSpaces?zt(t,e.trailingSpace):t,J=e.cm.state.specialChars,ee=!1,se;if(!J.test(t))e.col+=t.length,se=document.createTextNode(Y),e.map.push(e.pos,e.pos+t.length,se),j&&N<9&&(ee=!0),e.pos+=t.length;else{se=document.createDocumentFragment();for(var pe=0;;){J.lastIndex=pe;var Se=J.exec(t),Ce=Se?Se.index-pe:t.length-pe;if(Ce){var Pe=document.createTextNode(Y.slice(pe,pe+Ce));j&&N<9?se.appendChild(u("span",[Pe])):se.appendChild(Pe),e.map.push(e.pos,e.pos+Ce,Pe),e.col+=Ce,e.pos+=Ce}if(!Se)break;pe+=Ce+1;var $e=void 0;if(Se[0]==" "){var et=e.cm.options.tabSize,ot=et-e.col%et;$e=se.appendChild(u("span",ue(ot),"cm-tab")),$e.setAttribute("role","presentation"),$e.setAttribute("cm-text"," "),e.col+=ot}else Se[0]=="\r"||Se[0]==`
|
|
`?($e=se.appendChild(u("span",Se[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),$e.setAttribute("cm-text",Se[0]),e.col+=1):($e=e.cm.options.specialCharPlaceholder(Se[0]),$e.setAttribute("cm-text",Se[0]),j&&N<9?se.appendChild(u("span",[$e])):se.appendChild($e),e.col+=1);e.map.push(e.pos,e.pos+1,$e),e.pos++}}if(e.trailingSpace=Y.charCodeAt(t.length-1)==32,n||r||a||ee||R||U){var mt=n||"";r&&(mt+=r),a&&(mt+=a);var st=u("span",[se],mt,R);if(U)for(var vt in U)U.hasOwnProperty(vt)&&vt!="style"&&vt!="class"&&st.setAttribute(vt,U[vt]);return e.content.appendChild(st)}e.content.appendChild(se)}function zt(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",a=0;a<e.length;a++){var R=e.charAt(a);R==" "&&n&&(a==e.length-1||e.charCodeAt(a+1)==32)&&(R="\xA0"),r+=R,n=R==" "}return r}function gr(e,t){return function(n,r,a,R,U,Y,J){a=a?a+" cm-force-border":"cm-force-border";for(var ee=n.pos,se=ee+r.length;;){for(var pe=void 0,Se=0;Se<t.length&&!(pe=t[Se],pe.to>ee&&pe.from<=ee);Se++);if(pe.to>=se)return e(n,r,a,R,U,Y,J);e(n,r.slice(0,pe.to-ee),a,R,null,Y,J),R=null,r=r.slice(pe.to-ee),ee=pe.to}}}function Fr(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 Wt(e,t,n){var r=e.markedSpans,a=e.text,R=0;if(!r){for(var U=1;U<n.length;U+=2)t.addToken(t,a.slice(R,R=n[U]),Lt(n[U+1],t.cm.options));return}for(var Y=a.length,J=0,ee=1,se="",pe,Se,Ce=0,Pe,$e,et,ot,mt;;){if(Ce==J){Pe=$e=et=Se="",mt=null,ot=null,Ce=Infinity;for(var st=[],vt=void 0,Rt=0;Rt<r.length;++Rt){var Tt=r[Rt],Nt=Tt.marker;if(Nt.type=="bookmark"&&Tt.from==J&&Nt.widgetNode)st.push(Nt);else if(Tt.from<=J&&(Tt.to==null||Tt.to>J||Nt.collapsed&&Tt.to==J&&Tt.from==J)){if(Tt.to!=null&&Tt.to!=J&&Ce>Tt.to&&(Ce=Tt.to,$e=""),Nt.className&&(Pe+=" "+Nt.className),Nt.css&&(Se=(Se?Se+";":"")+Nt.css),Nt.startStyle&&Tt.from==J&&(et+=" "+Nt.startStyle),Nt.endStyle&&Tt.to==Ce&&(vt||(vt=[])).push(Nt.endStyle,Tt.to),Nt.title&&((mt||(mt={})).title=Nt.title),Nt.attributes)for(var sr in Nt.attributes)(mt||(mt={}))[sr]=Nt.attributes[sr];Nt.collapsed&&(!ot||Dr(ot.marker,Nt)<0)&&(ot=Tt)}else Tt.from>J&&Ce>Tt.from&&(Ce=Tt.from)}if(vt)for(var wr=0;wr<vt.length;wr+=2)vt[wr+1]==Ce&&($e+=" "+vt[wr]);if(!ot||ot.from==J)for(var ur=0;ur<st.length;++ur)Fr(t,0,st[ur]);if(ot&&(ot.from||0)==J){if(Fr(t,(ot.to==null?Y+1:ot.to)-J,ot.marker,ot.from==null),ot.to==null)return;ot.to==J&&(ot=!1)}}if(J>=Y)break;for(var Vr=Math.min(Y,Ce);;){if(se){var jr=J+se.length;if(!ot){var vr=jr>Vr?se.slice(0,Vr-J):se;t.addToken(t,vr,pe?pe+Pe:Pe,et,J+vr.length==Ce?$e:"",Se,mt)}if(jr>=Vr){se=se.slice(Vr-J),J=Vr;break}J=jr,et=""}se=a.slice(R,R=n[ee++]),pe=Lt(n[ee++],t.cm.options)}}}function En(e,t,n){this.line=t,this.rest=Vn(t),this.size=this.rest?Pt(Me(this.rest))-n+1:1,this.node=this.text=null,this.hidden=zr(e,t)}function Yt(e,t,n){for(var r=[],a,R=t;R<n;R=a){var U=new En(e.doc,lt(e.doc,R),R);a=R+U.size,r.push(U)}return r}var Cr=null;function en(e){Cr?Cr.ops.push(e):e.ownsGroup=Cr={ops:[e],delayedCallbacks:[]}}function tn(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{tn(n)}finally{Cr=null,t(n)}}var pi=null;function Rr(e,t){var n=Ye(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),a;Cr?a=Cr.delayedCallbacks:pi?a=pi:(a=pi=[],setTimeout(Ms,0));for(var R=function(Y){a.push(function(){return n[Y].apply(null,r)})},U=0;U<n.length;++U)R(U)}function Ms(){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 R=t.changes[a];R=="text"?Ps(e,t):R=="gutter"?Qa(e,t,n,r):R=="class"?ha(e,t):R=="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),j&&N<8&&(e.node.style.zIndex=2)),e.node}function _s(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):Bt(e,t)}function Ps(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){_s(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 R=t.line.gutterMarkers;if(e.options.lineNumbers||R){var U=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),U.insertBefore(Y,t.text),t.line.gutterClass&&(Y.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!R||!R["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"))),R)for(var J=0;J<e.display.gutterSpecs.length;++J){var ee=e.display.gutterSpecs[J].className,se=R.hasOwnProperty(ee)&&R[ee];se&&Y.appendChild(u("div",[se],"CodeMirror-gutter-elt","left: "+r.gutterLeft[ee]+"px; width: "+r.gutterWidth[ee]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=w("CodeMirror-linewidget"),a=t.node.firstChild,R=void 0;a;a=R)R=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 R=mi(n),U=0,Y=t.widgets;U<Y.length;++U){var J=Y[U],ee=u("div",[J.node],"CodeMirror-linewidget"+(J.className?" "+J.className:""));J.handleMouseEvents||ee.setAttribute("cm-ignore-events","true"),Fs(J,ee,n,r),e.display.input.setUneditable(ee),a&&J.above?R.insertBefore(ee,n.gutter||n.text):R.appendChild(ee),Rr(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(!A(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=Te(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 ye-e.display.nativeBarWidth}function _n(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 Us(e,t,n){var r=e.options.lineWrapping,a=r&&_n(e);if(!t.measure.heights||r&&t.measure.width!=a){var R=t.measure.heights=[];if(r){t.measure.width=a;for(var U=t.text.firstChild.getClientRects(),Y=0;Y<U.length-1;Y++){var J=U[Y],ee=U[Y+1];Math.abs(J.bottom-ee.bottom)>2&&R.push((J.bottom+ee.top)/2-n.top)}}R.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(Pt(e.rest[a])>n)return{map:e.measure.maps[a],cache:e.measure.caches[a],before:!0}}function Bs(e,t){t=Nr(t);var n=Pt(t),r=e.display.externalMeasured=new En(e.doc,t,n);r.lineN=n;var a=r.built=Bt(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=Pt(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=Bs(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 R=n+(r||""),U;return t.cache.hasOwnProperty(R)?U=t.cache[R]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Us(e,t.view,t.rect),t.hasHeights=!0),U=Ws(e,t,n,r),U.bogus||(t.cache[R]=U)),{left:U.left,right:U.right,top:a?U.rtop:U.top,bottom:a?U.rbottom:U.bottom}}var io={left:0,right:0,top:0,bottom:0};function ao(e,t,n){for(var r,a,R,U,Y,J,ee=0;ee<e.length;ee+=3)if(Y=e[ee],J=e[ee+1],t<Y?(a=0,R=1,U="left"):t<J?(a=t-Y,R=a+1):(ee==e.length-3||t==J&&e[ee+3]>t)&&(R=J-Y,a=R-1,t>=J&&(U="right")),a!=null){if(r=e[ee+2],Y==J&&n==(r.insertLeft?"left":"right")&&(U=n),n=="left"&&a==0)for(;ee&&e[ee-2]==e[ee-3]&&e[ee-1].insertLeft;)r=e[(ee-=3)+2],U="left";if(n=="right"&&a==J-Y)for(;ee<e.length-3&&e[ee+3]==e[ee+4]&&!e[ee+5].insertLeft;)r=e[(ee+=3)+2],U="right";break}return{node:r,start:a,end:R,collapse:U,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),R=a.node,U=a.start,Y=a.end,J=a.collapse,ee;if(R.nodeType==3){for(var se=0;se<4;se++){for(;U&&Ge(t.line.text.charAt(a.coverStart+U));)--U;for(;a.coverStart+Y<a.coverEnd&&Ge(t.line.text.charAt(a.coverStart+Y));)++Y;if(j&&N<9&&U==0&&Y==a.coverEnd-a.coverStart?ee=R.parentNode.getBoundingClientRect():ee=js(S(R,U,Y).getClientRects(),r),ee.left||ee.right||U==0)break;Y=U,U=U-1,J="right"}j&&N<11&&(ee=Hs(e.display.measure,ee))}else{U>0&&(J=r="right");var pe;e.options.lineWrapping&&(pe=R.getClientRects()).length>1?ee=pe[r=="right"?pe.length-1:0]:ee=R.getBoundingClientRect()}if(j&&N<9&&!U&&(!ee||!ee.left&&!ee.right)){var Se=R.parentNode.getClientRects()[0];Se?ee={left:Se.left,right:Se.left+Jn(e.display),top:Se.top,bottom:Se.bottom}:ee=io}for(var Ce=ee.top-t.rect.top,Pe=ee.bottom-t.rect.top,$e=(Ce+Pe)/2,et=t.view.measure.heights,ot=0;ot<et.length-1&&!($e<et[ot]);ot++);var mt=ot?et[ot-1]:0,st=et[ot],vt={left:(J=="right"?ee.right:ee.left)-t.rect.left,right:(J=="left"?ee.left:ee.right)-t.rect.left,top:mt,bottom:st};return!ee.left&&!ee.right&&(vt.bogus=!0),e.options.singleCursorHeightPerLine||(vt.rtop=Ce,vt.rbottom=Pe),vt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!It(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 R=ma(t);n.top+=R,n.bottom+=R}if(r=="line")return n;r||(r="local");var U=on(t);if(r=="local"?U+=Hi(e.display):U-=e.display.viewOffset,r=="page"||r=="window"){var Y=e.display.lineSpace.getBoundingClientRect();U+=Y.top+(r=="window"?0:uo());var J=Y.left+(r=="window"?0:lo());n.left+=J,n.right+=J}return n.top+=U,n.bottom+=U,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 R=e.display.sizer.getBoundingClientRect();r+=R.left,a+=R.top}var U=e.display.lineSpace.getBoundingClientRect();return{left:r-U.left,top:a-U.top}}function ga(e,t,n,r,a){return r||(r=lt(e.doc,t.line)),Gi(e,r,no(e,r,t.ch,a),n)}function sn(e,t,n,r,a,R){r=r||lt(e.doc,t.line),a||(a=Yn(e,r));function U(Pe,$e){var et=fn(e,a,Pe,$e?"right":"left",R);return $e?et.left=et.right:et.right=et.left,Gi(e,r,et,n)}var Y=Ze(r,e.doc.direction),J=t.ch,ee=t.sticky;if(J>=r.text.length?(J=r.text.length,ee="before"):J<=0&&(J=0,ee="after"),!Y)return U(ee=="before"?J-1:J,ee=="before");function se(Pe,$e,et){var ot=Y[$e],mt=ot.level==1;return U(et?Pe-1:Pe,mt!=et)}var pe=Xe(Y,J,ee),Se=Be,Ce=se(J,pe,ee=="before");return Se!=null&&(Ce.other=se(J,Se,ee!="before")),Ce}function co(e,t){var n=0;t=h(e.doc,t),e.options.lineWrapping||(n=Jn(e.display)*t.ch);var r=lt(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 R=Ue(e,t,n);return R.xRel=a,r&&(R.outside=r),R}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=Gt(r,n),R=r.first+r.size-1;if(a>R)return va(r.first+r.size-1,lt(r,R).text.length,null,1,1);t<0&&(t=0);for(var U=lt(r,a);;){var Y=Gs(e,U,a,t,n),J=hn(U,Y.ch+(Y.xRel>0||Y.outside>0?1:0));if(!J)return Y;var ee=J.find(1);if(ee.line==a)return ee;U=lt(r,a=ee.line)}}function fo(e,t,n,r){r-=ma(t);var a=t.text.length,R=ut(function(U){return fn(e,n,U-1).bottom<=r},a,0);return a=ut(function(U){return fn(e,n,U).top>r},R,a),{begin:R,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 R=Yn(e,t),U=ma(t),Y=0,J=t.text.length,ee=!0,se=Ze(t,e.doc.direction);if(se){var pe=(e.options.lineWrapping?Ks:zs)(e,t,n,R,se,r,a);ee=pe.level!=1,Y=ee?pe.from:pe.to-1,J=ee?pe.to:pe.from-1}var Se=null,Ce=null,Pe=ut(function(Rt){var Tt=fn(e,R,Rt);return Tt.top+=U,Tt.bottom+=U,ba(Tt,r,a,!1)?(Tt.top<=a&&Tt.left<=r&&(Se=Rt,Ce=Tt),!0):!1},Y,J),$e,et,ot=!1;if(Ce){var mt=r-Ce.left<Ce.right-r,st=mt==ee;Pe=Se+(st?0:1),et=st?"after":"before",$e=mt?Ce.left:Ce.right}else{!ee&&(Pe==J||Pe==Y)&&Pe++,et=Pe==0?"after":Pe==t.text.length?"before":fn(e,R,Pe-(ee?1:0)).bottom+U<=a==ee?"after":"before";var vt=sn(e,Ue(n,Pe,et),"line",t,R);$e=vt.left,ot=a<vt.top?-1:a>=vt.bottom?1:0}return Pe=ze(t.text,Pe,1),va(n,Pe,et,ot,r-$e)}function zs(e,t,n,r,a,R,U){var Y=ut(function(pe){var Se=a[pe],Ce=Se.level!=1;return ba(sn(e,Ue(n,Ce?Se.to:Se.from,Ce?"before":"after"),"line",t,r),R,U,!0)},0,a.length-1),J=a[Y];if(Y>0){var ee=J.level!=1,se=sn(e,Ue(n,ee?J.from:J.to,ee?"after":"before"),"line",t,r);ba(se,R,U,!0)&&se.top>U&&(J=a[Y-1])}return J}function Ks(e,t,n,r,a,R,U){var Y=fo(e,t,r,U),J=Y.begin,ee=Y.end;/\s/.test(t.text.charAt(ee-1))&&ee--;for(var se=null,pe=null,Se=0;Se<a.length;Se++){var Ce=a[Se];if(Ce.from>=ee||Ce.to<=J)continue;var Pe=Ce.level!=1,$e=fn(e,r,Pe?Math.min(ee,Ce.to)-1:Math.max(J,Ce.from)).right,et=$e<R?R-$e+1e9:$e-R;(!se||pe>et)&&(se=Ce,pe=et)}return se||(se=a[a.length-1]),se.from<J&&(se={from:J,to:se.to,level:se.level}),se.to>ee&&(se={from:se.from,to:ee,level:se.level}),se}var Pn;function $n(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Pn==null){Pn=u("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Pn.appendChild(document.createTextNode("x")),Pn.appendChild(u("br"));Pn.appendChild(document.createTextNode("x"))}c(e.measure,Pn);var n=Pn.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,R=t.gutters.firstChild,U=0;R;R=R.nextSibling,++U){var Y=e.display.gutterSpecs[U].className;n[Y]=R.offsetLeft+R.clientLeft+a,r[Y]=R.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(zr(e.doc,a))return 0;var R=0;if(a.widgets)for(var U=0;U<a.widgets.length;U++)a.widgets[U].height&&(R+=a.widgets[U].height);return n?R+(Math.ceil(a.text.length/r)||1)*t:R+t}}function Ca(e){var t=e.doc,n=mo(e);t.iter(function(r){var a=n(r);a!=r.height&&Ut(r,a)})}function In(e,t,n,r){var a=e.display;if(!n&&Te(t).getAttribute("cm-not-content")=="true")return null;var R,U,Y=a.lineSpace.getBoundingClientRect();try{R=t.clientX-Y.left,U=t.clientY-Y.top}catch(pe){return null}var J=ya(e,R,U),ee;if(r&&J.xRel>0&&(ee=lt(e.doc,J.line).text).length==J.ch){var se=te(ee,ee.length,e.options.tabSize)-ee.length;J=Ue(J.line,Math.max(0,Math.round((R-to(e.display).left)/Jn(e.display))-se))}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 Ur(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)Ir&&xn(e.doc,t)<a.viewTo&&Sn(e);else if(n<=a.viewFrom)Ir&&Bi(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 R=zi(e,n,n+r,1);R?(a.view=a.view.slice(R.index),a.viewFrom=R.lineN,a.viewTo+=r):Sn(e)}else if(n>=a.viewTo){var U=zi(e,t,t,-1);U?(a.view=a.view.slice(0,U.index),a.viewTo=U.lineN):Sn(e)}else{var Y=zi(e,t,t,-1),J=zi(e,n,n+r,1);Y&&J?(a.view=a.view.slice(0,Y.index).concat(Yt(e,Y.lineN,J.lineN)).concat(a.view.slice(J.index)),a.viewTo+=r):Sn(e)}var ee=a.externalMeasured;ee&&(n<ee.lineN?ee.lineN+=r:t<ee.lineN+ee.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 R=r.view[Nn(e,t)];if(R.node==null)return;var U=R.changes||(R.changes=[]);fe(U,n)==-1&&U.push(n)}function Sn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function zi(e,t,n,r){var a=Nn(e,t),R,U=e.display.view;if(!Ir||n==e.doc.first+e.doc.size)return{index:a,lineN:n};for(var Y=e.display.viewFrom,J=0;J<a;J++)Y+=U[J].size;if(Y!=t){if(r>0){if(a==U.length-1)return null;R=Y+U[a].size-t,a++}else R=Y-t;t+=R,n+=R}for(;xn(e.doc,n)!=n;){if(a==(r<0?0:U.length-1))return null;n+=r*U[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=Yt(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Yt(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(Yt(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(),R=r.selection=document.createDocumentFragment(),U=0;U<n.sel.ranges.length;U++){if(!t&&U==n.sel.primIndex)continue;var Y=n.sel.ranges[U];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,R)}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 R=n.appendChild(u("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));R.style.display="",R.style.left=r.other.left+"px",R.style.top=r.other.top+"px",R.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Ki(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,a=e.doc,R=document.createDocumentFragment(),U=to(e.display),Y=U.left,J=Math.max(r.sizerWidth,_n(e)-r.sizer.offsetLeft)-U.right,ee=a.direction=="ltr";function se(st,vt,Rt,Tt){vt<0&&(vt=0),vt=Math.round(vt),Tt=Math.round(Tt),R.appendChild(u("div",null,"CodeMirror-selected","position: absolute; left: "+st+`px;
|
|
top: `+vt+"px; width: "+(Rt==null?J-st:Rt)+`px;
|
|
height: `+(Tt-vt)+"px"))}function pe(st,vt,Rt){var Tt=lt(a,st),Nt=Tt.text.length,sr,wr;function ur(vr,Wr){return ga(e,Ue(st,vr),"div",Tt,Wr)}function Vr(vr,Wr,kr){var xr=po(e,Tt,null,vr),yr=Wr=="ltr"==(kr=="after")?"left":"right",hr=kr=="after"?xr.begin:xr.end-(/\s/.test(Tt.text.charAt(xr.end-1))?2:1);return ur(hr,yr)[yr]}var jr=Ze(Tt,a.direction);return Ke(jr,vt||0,Rt==null?Nt:Rt,function(vr,Wr,kr,xr){var yr=kr=="ltr",hr=ur(vr,yr?"left":"right"),Hr=ur(Wr-1,yr?"right":"left"),ui=vt==null&&vr==0,Rn=Rt==null&&Wr==Nt,Mr=xr==0,pn=!jr||xr==jr.length-1;if(Hr.top-hr.top<=3){var Lr=(ee?ui:Rn)&&Mr,Xa=(ee?Rn:ui)&&pn,yn=Lr?Y:(yr?hr:Hr).left,Wn=Xa?J:(yr?Hr:hr).right;se(yn,hr.top,Wn-yn,hr.bottom)}else{var Hn,Pr,di,Ya;yr?(Hn=ee&&ui&&Mr?Y:hr.left,Pr=ee?J:Vr(vr,kr,"before"),di=ee?Y:Vr(Wr,kr,"after"),Ya=ee&&Rn&&pn?J:Hr.right):(Hn=ee?Vr(vr,kr,"before"):Y,Pr=!ee&&ui&&Mr?J:hr.right,di=!ee&&Rn&&pn?Y:Hr.left,Ya=ee?Vr(Wr,kr,"after"):J),se(Hn,hr.top,Pr-Hn,hr.bottom),hr.bottom<Hr.top&&se(Y,hr.bottom,null,Hr.top),se(di,Hr.top,Ya-di,Hr.bottom)}(!sr||Ki(hr,sr)<0)&&(sr=hr),Ki(Hr,sr)<0&&(sr=Hr),(!wr||Ki(hr,wr)<0)&&(wr=hr),Ki(Hr,wr)<0&&(wr=Hr)}),{start:sr,end:wr}}var Se=t.from(),Ce=t.to();if(Se.line==Ce.line)pe(Se.line,Se.ch,Ce.ch);else{var Pe=lt(a,Se.line),$e=lt(a,Ce.line),et=Nr(Pe)==Nr($e),ot=pe(Se.line,Se.ch,et?Pe.text.length+1:null).end,mt=pe(Ce.line,et?0:null,Ce.ch).start;et&&(ot.top<mt.top-2?(se(ot.right,ot.top,null,ot.bottom),se(Y,mt.top,mt.left,mt.bottom)):se(ot.right,ot.top,mt.left-ot.right,ot.bottom)),ot.bottom<mt.top&&se(Y,ot.bottom,null,mt.top)}n.appendChild(R)}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||(Oe(e,"focus",e,t),e.state.focused=!0,W(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),_&&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&&(Oe(e,"blur",e,t),e.state.focused=!1,C(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],R=e.options.lineWrapping,U=void 0,Y=0;if(a.hidden)continue;if(j&&N<8){var J=a.node.offsetTop+a.node.offsetHeight;U=J-n,n=J}else{var ee=a.node.getBoundingClientRect();U=ee.bottom-ee.top,!R&&a.text.firstChild&&(Y=a.text.firstChild.getBoundingClientRect().right-ee.left-1)}var se=a.line.height-U;if((se>.005||se<-.005)&&(Ut(a.line,U),Eo(a.line),a.rest))for(var pe=0;pe<a.rest.length;pe++)Eo(a.rest[pe]);if(Y>e.display.sizerWidth){var Se=Math.ceil(Y/Jn(e.display));Se>e.display.maxLineLength&&(e.display.maxLineLength=Se,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,R=Gt(t,r),U=Gt(t,a);if(n&&n.ensure){var Y=n.ensure.from.line,J=n.ensure.to.line;Y<R?(R=Y,U=Gt(t,on(lt(t,Y))+e.wrapper.clientHeight)):Math.min(J,t.lastLine())>=U&&(R=Gt(t,on(lt(t,J))-e.wrapper.clientHeight),U=J)}return{from:R,to:Math.max(U,R+1)}}function Ys(e,t){if(je(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&&!p){var R=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(R),R.scrollIntoView(a),e.display.lineSpace.removeChild(R)}}function $s(e,t,n,r){r==null&&(r=0);var a;!e.options.lineWrapping&&t==n&&(t=t.ch?Ue(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Ue(t.line,t.ch+1,"before"):t);for(var R=0;R<5;R++){var U=!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 ee=wa(e,a),se=e.doc.scrollTop,pe=e.doc.scrollLeft;if(ee.scrollTop!=null&&(xi(e,ee.scrollTop),Math.abs(e.doc.scrollTop-se)>1&&(U=!0)),ee.scrollLeft!=null&&(Fn(e,ee.scrollLeft),Math.abs(e.doc.scrollLeft-pe)>1&&(U=!0)),!U)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,R=fa(e),U={};t.bottom-t.top>R&&(t.bottom=t.top+R);var Y=e.doc.height+ca(n),J=t.top<r,ee=t.bottom>Y-r;if(t.top<a)U.scrollTop=J?0:t.top;else if(t.bottom>a+R){var se=Math.min(t.top,(ee?Y:t.bottom)-R);se!=a&&(U.scrollTop=se)}var pe=e.options.fixedGutter?0:n.gutters.offsetWidth,Se=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-pe,Ce=_n(e)-n.gutters.offsetWidth,Pe=t.right-t.left>Ce;return Pe&&(t.right=t.left+Ce),t.left<10?U.scrollLeft=0:t.left<Se?U.scrollLeft=Math.max(0,t.left+pe-(Pe?0:10)):t.right>Ce+Se-3&&(U.scrollLeft=t.right+(Pe?0:10)-Ce),U}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;M||Da(e,{top:t}),So(e,t,!0),M&&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 Un=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),we(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),we(a,"scroll",function(){a.clientWidth&&t(a.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,j&&N<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Un.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 R=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+R)+"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}},Un.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Un.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Un.prototype.zeroWidthHack=function(){var e=s&&!m?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ie,this.disableVert=new ie},Un.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var a=e.getBoundingClientRect(),R=n=="vert"?document.elementFromPoint(a.right-1,(a.top+a.bottom)/2):document.elementFromPoint((a.right+a.left)/2,a.bottom-1);R!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},Un.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:Un,null:Ci};function Lo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&C(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),we(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&&W(e.display.wrapper,e.display.scrollbars.addClass)}var Qs=0;function Bn(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},en(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 R=0;R<t.length;R++)nl(t[R]);for(var U=0;U<t.length;U++)il(t[U])}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-_n(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==P();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 R=e.maybeHiddenMarkers,U=e.maybeUnhiddenMarkers;if(R)for(var Y=0;Y<R.length;++Y)R[Y].lines.length||Oe(R[Y],"hide");if(U)for(var J=0;J<U.length;++J)U[J].lines.length&&Oe(U[J],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Oe(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Kr(e,t){if(e.curOp)return t();Bn(e);try{return t()}finally{jn(e)}}function Sr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Bn(e);try{return t.apply(e,arguments)}finally{jn(e)}}}function _r(e){return function(){if(this.curOp)return e.apply(this,arguments);Bn(this);try{return e.apply(this,arguments)}finally{jn(this)}}}function Tr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Bn(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,z(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=nt(e,t.highlightFrontier),a=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(R){if(r.line>=e.display.viewFrom){var U=R.styles,Y=R.text.length>e.options.maxHighlightLength?$t(t.mode,r.state):null,J=me(e,R,r,!0);Y&&(r.state=Y),R.styles=J.styles;var ee=R.styleClasses,se=J.classes;se?R.styleClasses=se:ee&&(R.styleClasses=null);for(var pe=!U||U.length!=R.styles.length||ee!=se&&(!ee||!se||ee.bgClass!=se.bgClass||ee.textClass!=se.textClass),Se=0;!pe&&Se<U.length;++Se)pe=U[Se]!=R.styles[Se];pe&&a.push(r.line),R.stateAfter=r.save(),r.nextLine()}else R.text.length<=e.options.maxHighlightLength&>(e,R.text,r),R.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&&Kr(e,function(){for(var R=0;R<a.length;R++)Cn(e,a[R],"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=_n(e),this.force=n,this.dims=xa(e),this.events=[]};$i.prototype.signal=function(e,t){he(e,t)&&this.events.push(arguments)},$i.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Oe.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=P();if(!t||!A(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&A(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==P())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&A(document.body,e.anchorNode)&&A(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,R=Math.max(t.visible.from-e.options.viewportMargin,r.first),U=Math.min(a,t.visible.to+e.options.viewportMargin);n.viewFrom<R&&R-n.viewFrom<20&&(R=Math.max(r.first,n.viewFrom)),n.viewTo>U&&n.viewTo-U<20&&(U=Math.min(a,n.viewTo)),Ir&&(R=xn(e.doc,R),U=Bi(e.doc,U));var Y=R!=n.viewFrom||U!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,R,U),n.viewOffset=on(lt(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 ee=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(ee),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==_n(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,R=r.lineDiv,U=R.firstChild;function Y(Pe){var $e=Pe.nextSibling;return _&&s&&e.display.currentWheelTarget==Pe?Pe.style.display="none":Pe.parentNode.removeChild(Pe),$e}for(var J=r.view,ee=r.viewFrom,se=0;se<J.length;se++){var pe=J[se];if(!pe.hidden)if(!pe.node||pe.node.parentNode!=R){var Se=Ns(e,pe,ee,n);R.insertBefore(Se,U)}else{for(;U!=pe.node;)U=Y(U);var Ce=a&&t!=null&&t<=ee&&pe.lineNumber;pe.changes&&(fe(pe.changes,"gutter")>-1&&(Ce=!1),Ja(e,pe,ee,n)),Ce&&(y(pe.lineNumber),pe.lineNumber.appendChild(document.createTextNode(rn(e.options,ee)))),U=pe.node.nextSibling}ee+=pe.size}for(;U;)U=Y(U)}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,R=r+"px",U=0;U<n.length;U++)if(!n[U].hidden){e.options.fixedGutter&&(n[U].gutter&&(n[U].gutter.style.left=R),n[U].gutterBackground&&(n[U].gutterBackground.style.left=R));var Y=n[U].alignable;if(Y)for(var J=0;J<Y.length;J++)Y[J].style.left=R}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")),R=a.firstChild.offsetWidth,U=a.offsetWidth-R;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(R,r.lineGutter.offsetWidth-U)+1,r.lineNumWidth=r.lineNumInnerWidth+U,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 R=e[a],U=null;if(typeof R!="string"&&(U=R.style,R=R.className),R=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:R,style:U})}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],R=a.className,U=a.style,Y=t.appendChild(u("div",null,"CodeMirror-gutter "+R));U&&(Y.style.cssText=U),R=="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),Ur(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=L("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=L("div",[a.measure,a.lineMeasure,a.selectionDiv,a.cursorDiv,a.lineDiv],null,"position: relative; outline: none");var R=L("div",[a.lineSpace],"CodeMirror-lines");a.mover=u("div",[R],null,"position: relative"),a.sizer=u("div",[a.mover],"CodeMirror-sizer"),a.sizerWidth=null,a.heightForcer=u("div",null,null,"position: absolute; height: "+ye+"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"),j&&N<8&&(a.gutters.style.zIndex=-1,a.scroller.style.paddingRight=0),!_&&!(M&&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,Zr=null;j?Zr=-.53:M?Zr=15:d?Zr=-.7:T&&(Zr=-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*=Zr,t.y*=Zr,t}function Mo(e,t){var n=Oo(t),r=n.x,a=n.y,R=e.display,U=R.scroller,Y=U.scrollWidth>U.clientWidth,J=U.scrollHeight>U.clientHeight;if(!(r&&Y||a&&J))return;if(a&&s&&_){e:for(var ee=t.target,se=R.view;ee!=U;ee=ee.parentNode)for(var pe=0;pe<se.length;pe++)if(se[pe].node==ee){e.display.currentWheelTarget=ee;break e}}if(r&&!M&&!f&&Zr!=null){a&&J&&xi(e,Math.max(0,U.scrollTop+a*Zr)),Fn(e,Math.max(0,U.scrollLeft+r*Zr)),(!a||a&&J)&&re(t),R.wheelStartX=null;return}if(a&&Zr!=null){var Se=a*Zr,Ce=e.doc.scrollTop,Pe=Ce+R.wrapper.clientHeight;Se<0?Ce=Math.max(0,Ce+Se-50):Pe=Math.min(e.doc.height,Pe+Se+50),Da(e,{top:Ce,bottom:Pe})}Ji<20&&(R.wheelStartX==null?(R.wheelStartX=U.scrollLeft,R.wheelStartY=U.scrollTop,R.wheelDX=r,R.wheelDY=a,setTimeout(function(){if(R.wheelStartX==null)return;var $e=U.scrollLeft-R.wheelStartX,et=U.scrollTop-R.wheelStartY,ot=et&&R.wheelDY&&et/R.wheelDY||$e&&R.wheelDX&&$e/R.wheelDX;if(R.wheelStartX=R.wheelStartY=null,!ot)return;Zr=(Zr*Ji+ot)/(Ji+1),++Ji},200)):(R.wheelDX+=r,R.wheelDY+=a))}var Qr=function(e,t){this.ranges=e,this.primIndex=t};Qr.prototype.primary=function(){return this.ranges[this.primIndex]},Qr.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(!Ft(n.anchor,r.anchor)||!Ft(n.head,r.head))return!1}return!0},Qr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Qt(Jt(this.ranges[t].anchor),Jt(this.ranges[t].head));return new Qr(e,this.primIndex)},Qr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Qr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(ft(t,r.from())>=0&&ft(e,r.to())<=0)return n}return-1};var Qt=function(e,t){this.anchor=e,this.head=t};Qt.prototype.from=function(){return ar(this.anchor,this.head)},Qt.prototype.to=function(){return qt(this.anchor,this.head)},Qt.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(Se,Ce){return ft(Se.from(),Ce.from())}),n=fe(t,a);for(var R=1;R<t.length;R++){var U=t[R],Y=t[R-1],J=ft(Y.to(),U.from());if(r&&!U.empty()?J>0:J>=0){var ee=ar(Y.from(),U.from()),se=qt(Y.to(),U.to()),pe=Y.empty()?U.from()==U.head:Y.from()==Y.head;R<=n&&--n,t.splice(--R,2,new Qt(pe?se:ee,pe?ee:se))}}return new Qr(t,n)}function Tn(e,t){return new Qr([new Qt(e,t||e)],0)}function wn(e){return e.text?Ue(e.from.line+e.text.length-1,Me(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function _o(e,t){if(ft(e,t.from)<0)return e;if(ft(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),Ue(n,r)}function Ma(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var a=e.sel.ranges[r];n.push(new Qt(_o(a.anchor,t),_o(a.head,t)))}return ln(e.cm,n,e.sel.primIndex)}function Po(e,t,n){return e.line==t.line?Ue(n.line,e.ch-t.ch+n.ch):Ue(n.line+(e.line-t.line),e.ch)}function cl(e,t,n){for(var r=[],a=Ue(e.first,0),R=a,U=0;U<t.length;U++){var Y=t[U],J=Po(Y.from,a,R),ee=Po(wn(Y),a,R);if(a=Y.to,R=ee,n=="around"){var se=e.sel.ranges[U],pe=ft(se.head,se.anchor)<0;r[U]=new Qt(pe?ee:J,pe?J:ee)}else r[U]=new Qt(J,J)}return new Qr(r,e.sel.primIndex)}function _a(e){e.doc.mode=bt(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&&Ur(e)}function Io(e,t){return t.from.ch==0&&t.to.ch==0&&Me(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Pa(e,t,n,r){function a(mt){return n?n[mt]:null}function R(mt,st,vt){$a(mt,st,vt,r),Rr(mt,"change",mt,t)}function U(mt,st){for(var vt=[],Rt=mt;Rt<st;++Rt)vt.push(new Mn(ee[Rt],a(Rt),r));return vt}var Y=t.from,J=t.to,ee=t.text,se=lt(e,Y.line),pe=lt(e,J.line),Se=Me(ee),Ce=a(ee.length-1),Pe=J.line-Y.line;if(t.full)e.insert(0,U(0,ee.length)),e.remove(ee.length,e.size-ee.length);else if(Io(e,t)){var $e=U(0,ee.length-1);R(pe,pe.text,Ce),Pe&&e.remove(Y.line,Pe),$e.length&&e.insert(Y.line,$e)}else if(se==pe)if(ee.length==1)R(se,se.text.slice(0,Y.ch)+Se+se.text.slice(J.ch),Ce);else{var et=U(1,ee.length-1);et.push(new Mn(Se+se.text.slice(J.ch),Ce,r)),R(se,se.text.slice(0,Y.ch)+ee[0],a(0)),e.insert(Y.line+1,et)}else if(ee.length==1)R(se,se.text.slice(0,Y.ch)+ee[0]+pe.text.slice(J.ch),a(0)),e.remove(Y.line+1,Pe);else{R(se,se.text.slice(0,Y.ch)+ee[0],a(0)),R(pe,Se+pe.text.slice(J.ch),Ce);var ot=U(1,ee.length-1);Pe>1&&e.remove(Y.line+1,Pe-1),e.insert(Y.line+1,ot)}Rr(e,"change",e,t)}function Ln(e,t,n){function r(a,R,U){if(a.linked)for(var Y=0;Y<a.linked.length;++Y){var J=a.linked[Y];if(J.doc==R)continue;var ee=U&&J.sharedHist;if(n&&!ee)continue;t(J.doc,ee),r(J.doc,a,ee)}}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),_a(e),Fo(e),e.options.lineWrapping||ji(e),e.options.mode=t.modeOption,Ur(e)}function Fo(e){(e.doc.direction=="rtl"?W:C)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Kr(e,function(){Fo(e),Ur(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:Jt(t.from),to:wn(t),text:ir(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 Uo(e){for(;e.length;){var t=Me(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Uo(e.done),Me(e.done);if(e.done.length&&!Me(e.done).ranges)return Me(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Me(e.done)}function Bo(e,t,n,r){var a=e.history;a.undone.length=0;var R=+new Date,U,Y;if((a.lastOp==r||a.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&a.lastModTime>R-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(U=pl(a,a.lastOp==r)))Y=Me(U.changes),ft(t.from,t.to)==0&&ft(t.from,Y.to)==0?Y.to=wn(t):U.changes.push(Ia(e,t));else{var J=Me(a.done);for((!J||!J.ranges)&&Qi(e.sel,a.done),U={changes:[Ia(e,t)],generation:a.generation},a.done.push(U);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=R,a.lastOp=a.lastSelOp=r,a.lastOrigin=a.lastSelOrigin=t.origin,Y||Oe(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,R=r&&r.origin;n==a.lastSelOp||R&&a.lastSelOrigin==R&&(a.lastModTime==a.lastSelTime&&a.lastOrigin==R||ml(e,R,Me(a.done),t))?a.done[a.done.length-1]=t:Qi(t,a.done),a.lastSelTime=+new Date,a.lastSelOrigin=R,a.lastSelOp=n,r&&r.clearRedo!==!1&&Uo(a.undone)}function Qi(e,t){var n=Me(t);n&&n.ranges&&n.equals(e)||t.push(e)}function jo(e,t,n,r){var a=t["spans_"+e.id],R=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(U){U.markedSpans&&((a||(a=t["spans_"+e.id]={}))[R]=U.markedSpans),++R})}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 R=n[a],U=r[a];if(R&&U){e:for(var Y=0;Y<U.length;++Y){for(var J=U[Y],ee=0;ee<R.length;++ee)if(R[ee].marker==J.marker)continue e;R.push(J)}}else U&&(n[a]=U)}return n}function ei(e,t,n){for(var r=[],a=0;a<e.length;++a){var R=e[a];if(R.ranges){r.push(n?Qr.prototype.deepCopy.call(R):R);continue}var U=R.changes,Y=[];r.push({changes:Y});for(var J=0;J<U.length;++J){var ee=U[J],se=void 0;if(Y.push({from:ee.from,to:ee.to,text:ee.text}),t)for(var pe in ee)(se=pe.match(/^spans_(\d+)$/))&&(fe(t,Number(se[1]))>-1&&(Me(Y)[pe]=ee[pe],delete ee[pe]))}}return r}function Na(e,t,n,r){if(r){var a=e.anchor;if(n){var R=ft(t,a)<0;R!=ft(n,a)<0?(a=t,t=n):R!=ft(t,n)<0&&(t=n)}return new Qt(a,t)}else return new Qt(n||t,t)}function qi(e,t,n,r,a){a==null&&(a=e.cm&&(e.cm.display.shift||e.extend)),Or(e,new Qr([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),R=0;R<e.sel.ranges.length;R++)r[R]=Na(e.sel.ranges[R],t[R],null,a);var U=ln(e.cm,r,e.sel.primIndex);Or(e,U,n)}function Fa(e,t,n,r){var a=e.sel.ranges.slice(0);a[t]=n,Or(e,ln(e.cm,a,e.sel.primIndex),r)}function Go(e,t,n,r){Or(e,Tn(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(a){this.ranges=[];for(var R=0;R<a.length;R++)this.ranges[R]=new Qt(h(e,a[R].anchor),h(e,a[R].head))},origin:n&&n.origin};return Oe(e,"beforeSelectionChange",e,r),e.cm&&Oe(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?ln(e.cm,r.ranges,r.ranges.length-1):t}function zo(e,t,n){var r=e.history.done,a=Me(r);a&&a.ranges?(r[r.length-1]=t,ea(e,t,n)):Or(e,t,n)}function Or(e,t,n){ea(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function ea(e,t,n){(he(e,"beforeSelectionChange")||e.cm&&he(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(ft(t.primary().head,e.sel.primary().head)<0?-1:1);Ko(e,Xo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&Qn(e.cm)}function Ko(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ge(e.cm)),Rr(e,"cursorActivity",e)}function Vo(e){Ko(e,Xo(e,e.sel,null,!1))}function Xo(e,t,n,r){for(var a,R=0;R<t.ranges.length;R++){var U=t.ranges[R],Y=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[R],J=ta(e,U.anchor,Y&&Y.anchor,n,r),ee=ta(e,U.head,Y&&Y.head,n,r);(a||J!=U.anchor||ee!=U.head)&&(a||(a=t.ranges.slice(0,R)),a[R]=new Qt(J,ee))}return a?ln(e.cm,a,t.primIndex):t}function ti(e,t,n,r,a){var R=lt(e,t.line);if(R.markedSpans)for(var U=0;U<R.markedSpans.length;++U){var Y=R.markedSpans[U],J=Y.marker,ee="selectLeft"in J?!J.selectLeft:J.inclusiveLeft,se="selectRight"in J?!J.selectRight:J.inclusiveRight;if((Y.from==null||(ee?Y.from<=t.ch:Y.from<t.ch))&&(Y.to==null||(se?Y.to>=t.ch:Y.to>t.ch))){if(a&&(Oe(J,"beforeCursorEnter"),J.explicitlyCleared))if(R.markedSpans){--U;continue}else break;if(!J.atomic)continue;if(n){var pe=J.find(r<0?1:-1),Se=void 0;if((r<0?se:ee)&&(pe=Yo(e,pe,-r,pe&&pe.line==t.line?R:null)),pe&&pe.line==t.line&&(Se=ft(pe,n))&&(r<0?Se<0:Se>0))return ti(e,pe,t,r,a)}var Ce=J.find(r<0?-1:1);return(r<0?ee:se)&&(Ce=Yo(e,Ce,r,Ce.line==t.line?R:null)),Ce?ti(e,Ce,t,r,a):null}}return t}function ta(e,t,n,r,a){var R=r||1,U=ti(e,t,n,R,a)||!a&&ti(e,t,n,R,!0)||ti(e,t,n,-R,a)||!a&&ti(e,t,n,-R,!0);return U||(e.cantEdit=!0,Ue(e.first,0))}function Yo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?h(e,Ue(t.line-1)):null:n>0&&t.ch==(r||lt(e,t.line)).text.length?t.line<e.first+e.size-1?Ue(t.line+1,0):null:new Ue(t.line,t.ch+n)}function $o(e){e.setSelection(Ue(e.firstLine(),0),Ue(e.lastLine()),Le)}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,R,U,Y){a&&(r.from=h(e,a)),R&&(r.to=h(e,R)),U&&(r.text=U),Y!==void 0&&(r.origin=Y)}),Oe(e,"beforeChange",e,r),e.cm&&Oe(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 Sr(e.cm,ri)(e,t,n);if(e.cm.state.suppressEdits)return}if((he(e,"beforeChange")||e.cm&&he(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]==""&&ft(t.from,t.to)==0)return;var n=Ma(e,t);Bo(e,t,n,e.cm?e.cm.curOp.id:NaN),Li(e,t,n,an(e,t));var r=[];Ln(e,function(a,R){!R&&fe(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,R,U=e.sel,Y=t=="undo"?a.done:a.undone,J=t=="undo"?a.undone:a.done,ee=0;ee<Y.length&&!(R=Y[ee],n?R.ranges&&!R.equals(e.sel):!R.ranges);ee++);if(ee==Y.length)return;for(a.lastOrigin=a.lastSelOrigin=null;;)if(R=Y.pop(),R.ranges){if(Qi(R,J),n&&!R.equals(e.sel)){Or(e,R,{clearRedo:!1});return}U=R}else if(r){Y.push(R);return}else break;var se=[];Qi(U,J),J.push({changes:se,generation:a.generation}),a.generation=R.generation||++a.maxGeneration;for(var pe=he(e,"beforeChange")||e.cm&&he(e.cm,"beforeChange"),Se=function($e){var et=R.changes[$e];if(et.origin=t,pe&&!Jo(e,et,!1))return Y.length=0,{};se.push(Ia(e,et));var ot=$e?Ma(e,et):Me(Y);Li(e,et,ot,Wo(e,et)),!$e&&e.cm&&e.cm.scrollIntoView({from:et.from,to:wn(et)});var mt=[];Ln(e,function(st,vt){!vt&&fe(mt,st.history)==-1&&(ts(st.history,et),mt.push(st.history)),Li(st,et,null,Wo(st,et))})},Ce=R.changes.length-1;Ce>=0;--Ce){var Pe=Se(Ce);if(Pe)return Pe.v}}function Qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new Qr(Qe(e.sel.ranges,function(a){return new Qt(Ue(a.anchor.line+t,a.anchor.ch),Ue(a.head.line+t,a.head.ch))}),e.sel.primIndex),e.cm){Ur(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 Sr(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:Ue(e.first,0),to:Ue(t.to.line+a,t.to.ch),text:[Me(t.text)],origin:t.origin}}var R=e.lastLine();t.to.line>R&&(t={from:t.from,to:Ue(R,lt(e,R).text.length),text:[t.text[0]],origin:t.origin}),t.removed=ir(e,t.from,t.to),n||(n=Ma(e,t)),e.cm?xl(e.cm,t,r):Pa(e,t,r),ea(e,n,Le),e.cantEdit&&ta(e,Ue(e.firstLine(),0))&&(e.cantEdit=!1)}function xl(e,t,n){var r=e.doc,a=e.display,R=t.from,U=t.to,Y=!1,J=R.line;e.options.lineWrapping||(J=Pt(Nr(lt(r,R.line))),r.iter(J,U.line+1,function(Ce){if(Ce==a.maxLine)return Y=!0,!0})),r.sel.contains(t.from,t.to)>-1&&ge(e),Pa(r,t,n,mo(e)),e.options.lineWrapping||(r.iter(J,R.line+t.text.length,function(Ce){var Pe=Xn(Ce);Pe>a.maxLineLength&&(a.maxLine=Ce,a.maxLineLength=Pe,a.maxLineChanged=!0,Y=!1)}),Y&&(e.curOp.updateMaxLine=!0)),qr(r,R.line),Si(e,400);var ee=t.text.length-(U.line-R.line)-1;t.full?Ur(e):R.line==U.line&&t.text.length==1&&!Io(e.doc,t)?Cn(e,R.line,"text"):Ur(e,R.line,U.line+1,ee);var se=he(e,"changes"),pe=he(e,"change");if(pe||se){var Se={from:R,to:U,text:t.text,removed:t.removed,origin:t.origin};pe&&Rr(e,"change",e,Se),se&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Se)}e.display.selForContextMenu=null}function ni(e,t,n,r,a){var R;r||(r=n),ft(r,n)<0&&(R=[r,n],n=R[0],r=R[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 R=e[a],U=!0;if(R.ranges){R.copied||(R=e[a]=R.deepCopy(),R.copied=!0);for(var Y=0;Y<R.ranges.length;Y++)qo(R.ranges[Y].anchor,t,n,r),qo(R.ranges[Y].head,t,n,r);continue}for(var J=0;J<R.changes.length;++J){var ee=R.changes[J];if(n<ee.from.line)ee.from=Ue(ee.from.line+r,ee.from.ch),ee.to=Ue(ee.to.line+r,ee.to.ch);else if(t<=ee.to.line){U=!1;break}}U||(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,R=t;return typeof t=="number"?R=lt(e,H(e,t)):a=Pt(t),a==null?null:(r(R,a)&&e.cm&&Cn(e.cm,a,n),R)}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),Rr(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 R=Math.min(t,a-e),U=r.height;if(r.removeInner(e,R),this.height-=U-r.height,a==R&&(this.children.splice(n--,1),r.parent=null),(t-=R)==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],R=a.chunkSize();if(e<=R){if(a.insertInner(e,t,n),a.lines&&a.lines.length>50){for(var U=a.lines.length%25+25,Y=U;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,U),this.maybeSpill()}break}e-=R}},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=fe(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],R=a.chunkSize();if(e<R){var U=Math.min(t,R-e);if(a.iterN(e,U,n))return!0;if((t-=U)==0)break;e=0}else e-=R}}};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=Pt(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 R=gi(this);Ut(n,Math.max(0,n.height-R)),e&&(Kr(e,function(){rs(e,n,-R),Cn(e,r,"widget")}),Rr(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;zr(this.doc,r)||Ut(r,r.height+a),n&&Kr(n,function(){n.curOp.forceUpdate=!0,rs(n,r,a),Rr(n,"lineWidgetChanged",n,e,Pt(r))})},ce(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),R=e.cm;return R&&a.noHScroll&&(R.display.alignWidgets=!0),Ai(e,t,"widget",function(U){var Y=U.widgets||(U.widgets=[]);if(a.insertAt==null?Y.push(a):Y.splice(Math.min(Y.length-1,Math.max(0,a.insertAt)),0,a),a.line=U,R&&!zr(e,U)){var J=on(U)<e.scrollTop;Ut(U,U.height+gi(a)),J&&La(R,a.height),R.curOp.forceUpdate=!0}return!0}),R&&Rr(R,"lineWidgetAdded",R,a,typeof t=="number"?t:Pt(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&&Bn(e),he(this,"clear")){var n=this.find();n&&Rr(this,"clear",n.from,n.to)}for(var r=null,a=null,R=0;R<this.lines.length;++R){var U=this.lines[R],Y=nn(U.markedSpans,this);e&&!this.collapsed?Cn(e,Pt(U),"text"):e&&(Y.to!=null&&(a=Pt(U)),Y.from!=null&&(r=Pt(U))),U.markedSpans=mn(U.markedSpans,Y),Y.from==null&&this.collapsed&&!zr(this.doc,U)&&e&&Ut(U,$n(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var J=0;J<this.lines.length;++J){var ee=Nr(this.lines[J]),se=Xn(ee);se>e.display.maxLineLength&&(e.display.maxLine=ee,e.display.maxLineLength=se,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Ur(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&&Rr(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 R=this.lines[a],U=nn(R.markedSpans,this);if(U.from!=null&&(n=Ue(t?R:Pt(R),U.from),e==-1))return n;if(U.to!=null&&(r=Ue(t?R:Pt(R),U.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;Kr(r,function(){var a=t.line,R=Pt(t.line),U=pa(r,R);if(U&&(oo(U),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!zr(n.doc,a)&&n.height!=null){var Y=n.height;n.height=null;var J=gi(n)-Y;J&&Ut(a,a.height+J)}Rr(r,"markerChanged",r,e)})},An.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||fe(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},An.prototype.detachLine=function(e){if(this.lines.splice(fe(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ce(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 Sr(e.cm,ii)(e,t,n,r,a);var R=new An(e,a),U=ft(t,n);if(r&&F(r,R,!1),U>0||U==0&&R.clearWhenEmpty!==!1)return R;if(R.replacedWith&&(R.collapsed=!0,R.widgetNode=L("span",[R.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||R.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(R.widgetNode.insertLeft=!0)),R.collapsed){if(fr(e,t.line,t,n,R)||t.line!=n.line&&fr(e,n.line,t,n,R))throw new Error("Inserting collapsed marker partially overlapping an existing one");Gr()}R.addToHistory&&Bo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var Y=t.line,J=e.cm,ee;if(e.iter(Y,n.line+1,function(pe){J&&R.collapsed&&!J.options.lineWrapping&&Nr(pe)==J.display.maxLine&&(ee=!0),R.collapsed&&Y!=t.line&&Ut(pe,0),dn(pe,new bn(R,Y==t.line?t.ch:null,Y==n.line?n.ch:null)),++Y}),R.collapsed&&e.iter(t.line,n.line+1,function(pe){zr(e,pe)&&Ut(pe,0)}),R.clearOnEnter&&we(R,"beforeCursorEnter",function(){return R.clear()}),R.readOnly&&($r(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),R.collapsed&&(R.id=++ns,R.atomic=!0),J){if(ee&&(J.curOp.updateMaxLine=!0),R.collapsed)Ur(J,t.line,n.line+1);else if(R.className||R.startStyle||R.endStyle||R.css||R.attributes||R.title)for(var se=t.line;se<=n.line;se++)Cn(J,se,"text");R.atomic&&Vo(J.doc),Rr(J,"markerAdded",J,R)}return R}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();Rr(this,"clear")},Oi.prototype.find=function(e,t){return this.primary.find(e,t)},ce(Oi);function Cl(e,t,n,r,a){r=F(r),r.shared=!1;var R=[ii(e,t,n,r,a)],U=R[0],Y=r.widgetNode;return Ln(e,function(J){Y&&(r.widgetNode=Y.cloneNode(!0)),R.push(ii(J,h(J,t),h(J,n),r,a));for(var ee=0;ee<J.linked.length;++ee)if(J.linked[ee].isParent)return;U=Me(R)}),new Oi(R,U)}function is(e){return e.findMarks(Ue(e.first,0),e.clipPos(Ue(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(),R=e.clipPos(a.from),U=e.clipPos(a.to);if(ft(R,U)){var Y=ii(e,R,U,r.primary,r.primary.type);r.markers.push(Y),Y.parent=r}}}function Tl(e){for(var t=function(r){var a=e[r],R=[a.primary.doc];Ln(a.primary.doc,function(J){return R.push(J)});for(var U=0;U<a.markers.length;U++){var Y=a.markers[U];fe(R,Y.doc)==-1&&(Y.parent=null,a.markers.splice(U--,1))}},n=0;n<e.length;n++)t(n)}var wl=0,Br=function(e,t,n,r,a){if(!(this instanceof Br))return new Br(e,t,n,r,a);n==null&&(n=0),Ri.call(this,[new Di([new Mn("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var R=Ue(n,0);this.sel=Tn(R),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)),Pa(this,{from:R,to:R,text:e}),Or(this,Tn(R),Le)};Br.prototype=oe(Ri.prototype,{constructor:Br,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=Ht(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Tr(function(e){var t=Ue(this.first,0),n=this.first+this.size-1;ri(this,{from:t,to:Ue(n,lt(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&bi(this.cm,0,0),Or(this,Tn(t),Le)}),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=ir(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(Er(this,e))return lt(this,e)},getLineNumber:function(e){return Pt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=lt(this,e)),Nr(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:Tr(function(e,t,n){Go(this,h(this,typeof e=="number"?Ue(e,t||0):e),null,n)}),setSelection:Tr(function(e,t,n){Go(this,h(this,e),h(this,t||e),n)}),extendSelection:Tr(function(e,t,n){qi(this,h(this,e),t&&h(this,t),n)}),extendSelections:Tr(function(e,t){Ho(this,B(this,e),t)}),extendSelectionsBy:Tr(function(e,t){var n=Qe(this.sel.ranges,e);Ho(this,B(this,n),t)}),setSelections:Tr(function(e,t,n){if(!e.length)return;for(var r=[],a=0;a<e.length;a++)r[a]=new Qt(h(this,e[a].anchor),h(this,e[a].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Or(this,ln(this.cm,r,t),n)}),addSelection:Tr(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new Qt(h(this,e),h(this,t||e))),Or(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=ir(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=ir(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:Tr(function(e,t,n){for(var r=[],a=this.sel,R=0;R<a.ranges.length;R++){var U=a.ranges[R];r[R]={from:U.from(),to:U.to(),text:this.splitLines(e[R]),origin:n}}for(var Y=t&&t!="end"&&cl(this,r,t),J=r.length-1;J>=0;J--)ri(this,r[J]);Y?zo(this,Y):this.cm&&Qn(this.cm)}),undo:Tr(function(){ra(this,"undo")}),redo:Tr(function(){ra(this,"redo")}),undoSelection:Tr(function(){ra(this,"undo",!0)}),redoSelection:Tr(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:Tr(function(e,t,n){return Ai(this,e,"gutter",function(r){var a=r.gutterMarkers||(r.gutterMarkers={});return a[t]=n,!n&&Ie(a)&&(r.gutterMarkers=null),!0})}),clearGutter:Tr(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&Ai(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Ie(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Er(this,e))return null;if(t=e,e=lt(this,e),!e)return null}else if(t=Pt(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:Tr(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(w(n).test(r[a]))return!1;r[a]+=" "+n}return!0})}),removeLineClass:Tr(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",R=r[a];if(R)if(n==null)r[a]=null;else{var U=R.match(w(n));if(!U)return!1;var Y=U.index+U[0].length;r[a]=R.slice(0,U.index)+(!U.index||Y==R.length?"":" ")+R.slice(Y)||null}else return!1;return!0})}),addLineWidget:Tr(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=lt(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(R){var U=R.markedSpans;if(U)for(var Y=0;Y<U.length;Y++){var J=U[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 R=a.text.length+r;if(R>e)return t=e,!0;e-=R,++n}),h(this,Ue(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 Br(Ht(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 Br(Ht(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 lr&&(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:Tr(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)})}),Br.prototype.eachLine=Br.prototype.iter;var as=0;function Ll(e){var t=this;if(os(t),je(t,e)||gn(t.display,e))return;re(e),j&&(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,R=Array(a),U=0,Y=function(){++U==a&&Sr(t,function(){n=h(t.doc,n);var Ce={from:n,to:n,text:t.doc.splitLines(R.filter(function(Pe){return Pe!=null}).join(t.doc.lineSeparator())),origin:"paste"};ri(t.doc,Ce),zo(t.doc,Tn(h(t.doc,n),h(t.doc,wn(Ce))))})()},J=function(Ce,Pe){if(t.options.allowDropFileTypes&&fe(t.options.allowDropFileTypes,Ce.type)==-1){Y();return}var $e=new FileReader;$e.onerror=function(){return Y()},$e.onload=function(){var et=$e.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(et)){Y();return}R[Pe]=et,Y()},$e.readAsText(Ce)},ee=0;ee<r.length;ee++)J(r[ee],ee);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 se=e.dataTransfer.getData("Text");if(se){var pe;if(t.state.draggingText&&!t.state.draggingText.copy&&(pe=t.listSelections()),ea(t.doc,Tn(n,n)),pe)for(var Se=0;Se<pe.length;++Se)ni(t.doc,"",pe[Se].anchor,pe[Se].head,"drag");t.replaceSelection(se,"around","paste"),t.display.input.focus()}}catch(Ce){}}}function Al(e,t){if(j&&(!e.state.draggingText||+new Date-as<100)){le(t);return}if(je(e,t)||gn(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!T){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 R=0;R<n.length;R++)e(n[R])})}var ls=!1;function Rl(){if(ls)return;kl(),ls=!0}function kl(){var e;we(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ss(Ol)},100))}),we(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"},Mi=0;Mi<10;Mi++)Dn[Mi+48]=Dn[Mi+96]=String(Mi);for(var na=65;na<=90;na++)Dn[na]=String.fromCharCode(na);for(var _i=1;_i<=12;_i++)Dn[_i+111]=Dn[_i+63235]="F"+_i;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 Ml(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,a,R,U=0;U<t.length-1;U++){var Y=t[U];if(/^(cmd|meta|m)$/i.test(Y))R=!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),R&&(e="Cmd-"+e),a&&(e="Shift-"+e),e}function _l(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=Qe(n.split(" "),Ml),R=0;R<a.length;R++){var U=void 0,Y=void 0;R==a.length-1?(Y=a.join(" "),U=r):(Y=a.slice(0,R+1).join(" "),U="...");var J=t[Y];if(!J)t[Y]=U;else if(J!=U)throw new Error("Inconsistent bindings for "+Y)}delete e[n]}for(var ee in t)e[ee]=t[ee];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 R=0;R<t.fallthrough.length;R++){var U=ai(e,t.fallthrough[R],n,r);if(U)return U}}}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 R=t(n[a]);r.length&&ft(R.from,Me(r).to)<=0;){var U=r.pop();if(ft(U.from,R.from)<0){R.from=U.from;break}}r.push(R)}Kr(e,function(){for(var Y=r.length-1;Y>=0;Y--)ni(e.doc,"",r[Y].from,r[Y].to,"+delete");Qn(e)})}function Ua(e,t,n){var r=ze(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Ba(e,t,n){var r=Ua(e,t.ch,n);return r==null?null:new Ue(t.line,r,n<0?"after":"before")}function ja(e,t,n,r,a){if(e){t.doc.direction=="rtl"&&(a=-a);var R=Ze(n,t.doc.direction);if(R){var U=a<0?Me(R):R[0],Y=a<0==(U.level==1),J=Y?"after":"before",ee;if(U.level>0||t.doc.direction=="rtl"){var se=Yn(t,n);ee=a<0?n.text.length-1:0;var pe=fn(t,se,ee).top;ee=ut(function(Se){return fn(t,se,Se).top==pe},a<0==(U.level==1)?U.from:U.to-1,ee),J=="before"&&(ee=Ua(n,ee,1))}else ee=a<0?U.to:U.from;return new Ue(r,ee,J)}}return new Ue(r,a<0?n.text.length:0,a<0?"before":"after")}function Pl(e,t,n,r){var a=Ze(t,e.doc.direction);if(!a)return Ba(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 R=Xe(a,n.ch,n.sticky),U=a[R];if(e.doc.direction=="ltr"&&U.level%2==0&&(r>0?U.to>n.ch:U.from<n.ch))return Ba(t,n,r);var Y=function(ot,mt){return Ua(t,ot instanceof Ue?ot.ch:ot,mt)},J,ee=function(ot){return e.options.lineWrapping?(J=J||Yn(e,t),po(e,t,J,ot)):{begin:0,end:t.text.length}},se=ee(n.sticky=="before"?Y(n,-1):n.ch);if(e.doc.direction=="rtl"||U.level==1){var pe=U.level==1==r<0,Se=Y(n,pe?1:-1);if(Se!=null&&(pe?Se<=U.to&&Se<=se.end:Se>=U.from&&Se>=se.begin)){var Ce=pe?"before":"after";return new Ue(n.line,Se,Ce)}}var Pe=function(ot,mt,st){for(var vt=function(sr,wr){return wr?new Ue(n.line,Y(sr,1),"before"):new Ue(n.line,sr,"after")};ot>=0&&ot<a.length;ot+=mt){var Rt=a[ot],Tt=mt>0==(Rt.level!=1),Nt=Tt?st.begin:Y(st.end,-1);if(Rt.from<=Nt&&Nt<Rt.to)return vt(Nt,Tt);if(Nt=Tt?Rt.from:Y(Rt.to,-1),st.begin<=Nt&&Nt<st.end)return vt(Nt,Tt)}},$e=Pe(R+r,r,se);if($e)return $e;var et=r>0?se.end:Y(se.begin,-1);return et!=null&&!(r>0&&et==t.text.length)&&($e=Pe(r>0?0:a.length-1,r,ee(et)),$e)?$e:null}var Pi={selectAll:$o,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Le)},killLine:function(e){return oi(e,function(t){if(t.empty()){var n=lt(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Ue(t.head.line+1,0)}:{from:t.head,to:Ue(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return oi(e,function(t){return{from:Ue(t.from().line,0),to:h(e.doc,Ue(t.to().line+1,0))}})},delLineLeft:function(e){return oi(e,function(t){return{from:Ue(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(Ue(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ue(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")},ke)},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")},ke)},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},ke)},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 R=n[a].from(),U=te(e.getLine(R.line),R.ch,r);t.push(ue(r-U%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Kr(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var a=t[r].head,R=lt(e.doc,a.line).text;if(R){if(a.ch==R.length&&(a=new Ue(a.line,a.ch-1)),a.ch>0)a=new Ue(a.line,a.ch+1),e.replaceRange(R.charAt(a.ch-1)+R.charAt(a.ch-2),Ue(a.line,a.ch-2),a,"+transpose");else if(a.line>e.doc.first){var U=lt(e.doc,a.line-1).text;U&&(a=new Ue(a.line,1),e.replaceRange(R.charAt(0)+e.doc.lineSeparator()+U.charAt(U.length-1),Ue(a.line-1,U.length-1),a,"+transpose"))}}n.push(new Qt(a,a))}e.setSelections(n)})},newlineAndIndent:function(e){return Kr(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=lt(e.doc,t),r=Nr(n);return r!=n&&(t=Pt(r)),ja(!0,e,r,t,1)}function Il(e,t){var n=lt(e.doc,t),r=Kn(n);return r!=n&&(t=Pt(r)),ja(!0,e,n,t,-1)}function fs(e,t){var n=cs(e,t.line),r=lt(e.doc,n.line),a=Ze(r,e.doc.direction);if(!a||a[0].level==0){var R=Math.max(n.ch,r.text.search(/\S/)),U=t.line==n.line&&t.ch<=R&&t.ch;return Ue(n.line,U?0:R,n.sticky)}return n}function aa(e,t,n){if(typeof t=="string"&&(t=Pi[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)!=_e}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 ie;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"&&Rr(e,"keyHandled",e,t,n),(a=="handled"||a=="multi")&&(re(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 Ul(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=P(),je(t,e))return;j&&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&&!Mt&&(s?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),M&&!s&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bl(t)}function Bl(e){var t=e.display.lineDiv;W(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(C(t,"CodeMirror-crosshair"),at(document,"keyup",n),at(document,"mouseover",n))}we(document,"keyup",n),we(document,"mouseover",n)}function vs(e){e.keyCode==16&&(this.doc.sel.shift=!1),je(this,e)}function ys(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(gn(t.display,e)||je(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(f&&n==Wa){Wa=null,re(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(Ul(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&&ft(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(je(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,gn(n,e)){_||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ga(t,e))return;var r=In(t,e),a=be(e),R=r?Wl(r,a):"single";if(window.focus(),a==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,a,r,R,e))return;a==1?r?zl(t,r,R,e):Te(e)==n.scroller&&re(e):a==2?(r&&qi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):a==3&&(O?t.display.input.onContextMenu(e):xo(t))}function Hl(e,t,n,r,a){var R="Click";return r=="double"?R="Double"+R:r=="triple"&&(R="Triple"+R),R=(t==1?"Left":t==2?"Middle":"Right")+R,Ii(e,ds(R,a),a,function(U){if(typeof U=="string"&&(U=Pi[U]),!U)return!1;var Y=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Y=U(e,n)!=_e}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 R=l?n.shiftKey&&n.metaKey:n.altKey;a.unit=R?"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 zl(e,t,n,r){j?setTimeout(z(bo,e),0):e.curOp.focus=P();var a=Gl(e,n,r),R=e.doc.sel,U;e.options.dragDrop&&Fe&&!e.isReadOnly()&&n=="single"&&(U=R.contains(t))>-1&&(ft((U=R.ranges[U]).from(),t)<0||t.xRel>0)&&(ft(U.to(),t)>0||t.xRel<0)?Kl(e,r,t,a):Vl(e,r,t,a)}function Kl(e,t,n,r){var a=e.display,R=!1,U=Sr(e,function(ee){_&&(a.scroller.draggable=!1),e.state.draggingText=!1,at(a.wrapper.ownerDocument,"mouseup",U),at(a.wrapper.ownerDocument,"mousemove",Y),at(a.scroller,"dragstart",J),at(a.scroller,"drop",U),R||(re(ee),r.addNew||qi(e.doc,n,null,null,r.extend),_&&!T||j&&N==9?setTimeout(function(){a.wrapper.ownerDocument.body.focus({preventScroll:!0}),a.input.focus()},20):a.input.focus())}),Y=function(ee){R=R||Math.abs(t.clientX-ee.clientX)+Math.abs(t.clientY-ee.clientY)>=10},J=function(){return R=!0};_&&(a.scroller.draggable=!0),e.state.draggingText=U,U.copy=!r.moveOnDrag,a.scroller.dragDrop&&a.scroller.dragDrop(),we(a.wrapper.ownerDocument,"mouseup",U),we(a.wrapper.ownerDocument,"mousemove",Y),we(a.scroller,"dragstart",J),we(a.scroller,"drop",U),xo(e),setTimeout(function(){return a.input.focus()},20)}function xs(e,t,n){if(n=="char")return new Qt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new Qt(Ue(t.line,0),h(e.doc,Ue(t.line+1,0)));var r=n(e,t);return new Qt(r.from,r.to)}function Vl(e,t,n,r){var a=e.display,R=e.doc;re(t);var U,Y,J=R.sel,ee=J.ranges;if(r.addNew&&!r.extend?(Y=R.sel.contains(n),Y>-1?U=ee[Y]:U=new Qt(n,n)):(U=R.sel.primary(),Y=R.sel.primIndex),r.unit=="rectangle")r.addNew||(U=new Qt(n,n)),n=In(e,t,!0,!0),Y=-1;else{var se=xs(e,n,r.unit);r.extend?U=Na(U,se.anchor,se.head,r.extend):U=se}r.addNew?Y==-1?(Y=ee.length,Or(R,ln(e,ee.concat([U]),Y),{scroll:!1,origin:"*mouse"})):ee.length>1&&ee[Y].empty()&&r.unit=="char"&&!r.extend?(Or(R,ln(e,ee.slice(0,Y).concat(ee.slice(Y+1)),0),{scroll:!1,origin:"*mouse"}),J=R.sel):Fa(R,Y,U,Ae):(Y=0,Or(R,new Qr([U],0),Ae),J=R.sel);var pe=n;function Se(st){if(ft(pe,st)==0)return;if(pe=st,r.unit=="rectangle"){for(var vt=[],Rt=e.options.tabSize,Tt=te(lt(R,n.line).text,n.ch,Rt),Nt=te(lt(R,st.line).text,st.ch,Rt),sr=Math.min(Tt,Nt),wr=Math.max(Tt,Nt),ur=Math.min(n.line,st.line),Vr=Math.min(e.lastLine(),Math.max(n.line,st.line));ur<=Vr;ur++){var jr=lt(R,ur).text,vr=De(jr,sr,Rt);sr==wr?vt.push(new Qt(Ue(ur,vr),Ue(ur,vr))):jr.length>vr&&vt.push(new Qt(Ue(ur,vr),Ue(ur,De(jr,wr,Rt))))}vt.length||vt.push(new Qt(n,n)),Or(R,ln(e,J.ranges.slice(0,Y).concat(vt),Y),{origin:"*mouse",scroll:!1}),e.scrollIntoView(st)}else{var Wr=U,kr=xs(e,st,r.unit),xr=Wr.anchor,yr;ft(kr.anchor,xr)>0?(yr=kr.head,xr=ar(Wr.from(),kr.anchor)):(yr=kr.anchor,xr=qt(Wr.to(),kr.head));var hr=J.ranges.slice(0);hr[Y]=Xl(e,new Qt(h(R,xr),yr)),Or(R,ln(e,hr,Y),Ae)}}var Ce=a.wrapper.getBoundingClientRect(),Pe=0;function $e(st){var vt=++Pe,Rt=In(e,st,!0,r.unit=="rectangle");if(!Rt)return;if(ft(Rt,pe)!=0){e.curOp.focus=P(),Se(Rt);var Tt=Xi(a,R);(Rt.line>=Tt.to||Rt.line<Tt.from)&&setTimeout(Sr(e,function(){Pe==vt&&$e(st)}),150)}else{var Nt=st.clientY<Ce.top?-20:st.clientY>Ce.bottom?20:0;Nt&&setTimeout(Sr(e,function(){if(Pe!=vt)return;a.scroller.scrollTop+=Nt,$e(st)}),50)}}function et(st){e.state.selectingText=!1,Pe=Infinity,st&&(re(st),a.input.focus()),at(a.wrapper.ownerDocument,"mousemove",ot),at(a.wrapper.ownerDocument,"mouseup",mt),R.history.lastSelOrigin=null}var ot=Sr(e,function(st){st.buttons===0||!be(st)?et(st):$e(st)}),mt=Sr(e,et);e.state.selectingText=mt,we(a.wrapper.ownerDocument,"mousemove",ot),we(a.wrapper.ownerDocument,"mouseup",mt)}function Xl(e,t){var n=t.anchor,r=t.head,a=lt(e.doc,n.line);if(ft(n,r)==0&&n.sticky==r.sticky)return t;var R=Ze(a);if(!R)return t;var U=Xe(R,n.ch,n.sticky),Y=R[U];if(Y.from!=n.ch&&Y.to!=n.ch)return t;var J=U+(Y.from==n.ch==(Y.level!=1)?0:1);if(J==0||J==R.length)return t;var ee;if(r.line!=n.line)ee=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var se=Xe(R,r.ch,r.sticky),pe=se-U||(r.ch-n.ch)*(Y.level==1?-1:1);se==J-1||se==J?ee=pe<0:ee=pe>0}var Se=R[J+(ee?-1:0)],Ce=ee==(Se.level==1),Pe=Ce?Se.from:Se.to,$e=Ce?"after":"before";return n.ch==Pe&&n.sticky==$e?t:new Qt(new Ue(n.line,Pe,$e),r)}function Es(e,t,n,r){var a,R;if(t.touches)a=t.touches[0].clientX,R=t.touches[0].clientY;else try{a=t.clientX,R=t.clientY}catch(Se){return!1}if(a>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&re(t);var U=e.display,Y=U.lineDiv.getBoundingClientRect();if(R>Y.bottom||!he(e,n))return ae(t);R-=Y.top-U.viewOffset;for(var J=0;J<e.display.gutterSpecs.length;++J){var ee=U.gutters.childNodes[J];if(ee&&ee.getBoundingClientRect().right>=a){var se=Gt(e.doc,R),pe=e.display.gutterSpecs[J];return Oe(e,n,e,se,pe.className,t),ae(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(je(e,t,"contextmenu"))return;O||e.display.input.onContextMenu(t)}function Yl(e,t){return he(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,R,U){e.defaults[r]=a,R&&(t[r]=U?function(Y,J,ee){ee!=si&&R(Y,J,ee)}:R)}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,_a(r)},!0),n("indentUnit",2,_a,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){wi(r),vi(r),Ur(r)},!0),n("lineSeparator",null,function(r,a){if(r.doc.lineSep=a,!a)return;var R=[],U=r.doc.first;r.doc.iter(function(J){for(var ee=0;;){var se=J.text.indexOf(a,ee);if(se==-1)break;ee=se+a.length,R.push(Ue(U,se))}U++});for(var Y=R.length-1;Y>=0;Y--)ni(r.doc,a,R[Y],Ue(R[Y].line,R[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,R){r.state.specialChars=new RegExp(a.source+(a.test(" ")?"":"| "),"g"),R!=si&&r.refresh()}),n("specialCharPlaceholder",Xt,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",!E),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){Ss(r),Ti(r)},!0),n("keyMap","default",function(r,a,R){var U=ia(a),Y=R!=si&&ia(R);Y&&Y.detach&&Y.detach(r,U),U.attach&&U.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,R=t?we:at;R(e.display.scroller,"dragstart",a.start),R(e.display.scroller,"dragenter",a.enter),R(e.display.scroller,"dragover",a.over),R(e.display.scroller,"dragleave",a.leave),R(e.display.scroller,"drop",a.drop)}}function Zl(e){e.options.lineWrapping?(W(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(C(e.display.wrapper,"CodeMirror-wrap"),ji(e)),Ca(e),Ur(e),vi(e),setTimeout(function(){return qn(e)},100)}function lr(e,t){var n=this;if(!(this instanceof lr))return new lr(e,t);this.options=t=t?F(t):{},F(Ts,t,!1);var r=t.value;typeof r=="string"?r=new Br(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var a=new lr.inputStyles[t.inputStyle](this),R=this.display=new dl(e,r,a,t);R.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 ie,keySeq:null,specialChars:null},t.autofocus&&!i&&R.input.focus(),j&&N<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Ql(this),Rl(),Bn(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 U in oa)oa.hasOwnProperty(U)&&oa[U](this,t[U],si);Ro(this),t.finishInit&&t.finishInit(this);for(var Y=0;Y<za.length;++Y)za[Y](this);jn(this),_&&t.lineWrapping&&getComputedStyle(R.lineDiv).textRendering=="optimizelegibility"&&(R.lineDiv.style.textRendering="auto")}lr.defaults=Ts,lr.optionHandlers=oa;function Ql(e){var t=e.display;we(t.scroller,"mousedown",Sr(e,bs)),j&&N<11?we(t.scroller,"dblclick",Sr(e,function(J){if(je(e,J))return;var ee=In(e,J);if(!ee||Ga(e,J)||gn(e.display,J))return;re(J);var se=e.findWordAt(ee);qi(e.doc,se.anchor,se.head)})):we(t.scroller,"dblclick",function(J){return je(e,J)||re(J)}),we(t.scroller,"contextmenu",function(J){return Cs(e,J)}),we(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 R(J){if(J.touches.length!=1)return!1;var ee=J.touches[0];return ee.radiusX<=1&&ee.radiusY<=1}function U(J,ee){if(ee.left==null)return!0;var se=ee.left-J.left,pe=ee.top-J.top;return se*se+pe*pe>20*20}we(t.scroller,"touchstart",function(J){if(!je(e,J)&&!R(J)&&!Ga(e,J)){t.input.ensurePolled(),clearTimeout(n);var ee=+new Date;t.activeTouch={start:ee,moved:!1,prev:ee-r.end<=300?r:null},J.touches.length==1&&(t.activeTouch.left=J.touches[0].pageX,t.activeTouch.top=J.touches[0].pageY)}}),we(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),we(t.scroller,"touchend",function(J){var ee=t.activeTouch;if(ee&&!gn(t,J)&&ee.left!=null&&!ee.moved&&new Date-ee.start<300){var se=e.coordsChar(t.activeTouch,"page"),pe;!ee.prev||U(ee,ee.prev)?pe=new Qt(se,se):!ee.prev.prev||U(ee,ee.prev.prev)?pe=e.findWordAt(se):pe=new Qt(Ue(se.line,0),h(e.doc,Ue(se.line+1,0))),e.setSelection(pe.anchor,pe.head),e.focus(),re(J)}a()}),we(t.scroller,"touchcancel",a),we(t.scroller,"scroll",function(){t.scroller.clientHeight&&(xi(e,t.scroller.scrollTop),Fn(e,t.scroller.scrollLeft,!0),Oe(e,"scroll",e))}),we(t.scroller,"mousewheel",function(J){return Mo(e,J)}),we(t.scroller,"DOMMouseScroll",function(J){return Mo(e,J)}),we(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(J){je(e,J)||le(J)},over:function(J){je(e,J)||(Dl(e,J),le(J))},start:function(J){return Al(e,J)},drop:Sr(e,Ll),leave:function(J){je(e,J)||os(e)}};var Y=t.input.getField();we(Y,"keyup",function(J){return vs.call(e,J)}),we(Y,"keydown",Sr(e,gs)),we(Y,"keypress",Sr(e,ys)),we(Y,"focus",function(J){return Ta(e,J)}),we(Y,"blur",function(J){return Zn(e,J)})}var za=[];lr.defineInitHook=function(e){return za.push(e)};function Ui(e,t,n,r){var a=e.doc,R;n==null&&(n="add"),n=="smart"&&(a.mode.indent?R=nt(e,t).state:n="prev");var U=e.options.tabSize,Y=lt(a,t),J=te(Y.text,null,U);Y.stateAfter&&(Y.stateAfter=null);var ee=Y.text.match(/^\s*/)[0],se;if(!r&&!/\S/.test(Y.text))se=0,n="not";else if(n=="smart"&&(se=a.mode.indent(R,Y.text.slice(ee.length),Y.text),se==_e||se>150)){if(!r)return;n="prev"}n=="prev"?t>a.first?se=te(lt(a,t-1).text,null,U):se=0:n=="add"?se=J+e.options.indentUnit:n=="subtract"?se=J-e.options.indentUnit:typeof n=="number"&&(se=J+n),se=Math.max(0,se);var pe="",Se=0;if(e.options.indentWithTabs)for(var Ce=Math.floor(se/U);Ce;--Ce)Se+=U,pe+=" ";if(Se<se&&(pe+=ue(se-Se)),pe!=ee)return ni(a,pe,Ue(t,0),Ue(t,ee.length),"+input"),Y.stateAfter=null,!0;for(var Pe=0;Pe<a.sel.ranges.length;Pe++){var $e=a.sel.ranges[Pe];if($e.head.line==t&&$e.head.ch<ee.length){var et=Ue(t,ee.length);Fa(a,Pe,new Qt(et,et));break}}}var un=null;function sa(e){un=e}function Ka(e,t,n,r,a){var R=e.doc;e.display.shift=!1,r||(r=R.sel);var U=+new Date-200,Y=a=="paste"||e.state.pasteIncoming>U,J=wt(t),ee=null;if(Y&&r.ranges.length>1)if(un&&un.text.join(`
|
|
`)==t){if(r.ranges.length%un.text.length==0){ee=[];for(var se=0;se<un.text.length;se++)ee.push(R.splitLines(un.text[se]))}}else J.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(ee=Qe(J,function(ot){return[ot]}));for(var pe=e.curOp.updateInput,Se=r.ranges.length-1;Se>=0;Se--){var Ce=r.ranges[Se],Pe=Ce.from(),$e=Ce.to();Ce.empty()&&(n&&n>0?Pe=Ue(Pe.line,Pe.ch-n):e.state.overwrite&&!Y?$e=Ue($e.line,Math.min(lt(R,$e.line).text.length,$e.ch+Me(J).length)):Y&&un&&un.lineWise&&un.text.join(`
|
|
`)==J.join(`
|
|
`)&&(Pe=$e=Ue(Pe.line,0)));var et={from:Pe,to:$e,text:ee?ee[Se%ee.length]:J,origin:a||(Y?"paste":e.state.cutIncoming>U?"cut":"+input")};ri(e.doc,et),Rr(e,"inputRead",e,et)}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&&Kr(t,function(){return Ka(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 R=e.getModeAt(a.head),U=!1;if(R.electricChars){for(var Y=0;Y<R.electricChars.length;Y++)if(t.indexOf(R.electricChars.charAt(Y))>-1){U=Ui(e,a.head.line,"smart");break}}else R.electricInput&&(R.electricInput.test(lt(e.doc,a.head.line).text.slice(0,a.head.ch))&&(U=Ui(e,a.head.line,"smart")));U&&Rr(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,R={anchor:Ue(a,0),head:Ue(a+1,0)};n.push(R),t.push(e.getRange(R.anchor,R.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 _?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 R=this.options,U=R[r];if(R[r]==a&&r!="mode")return;R[r]=a,t.hasOwnProperty(r)&&Sr(this,t[r])(this,a,U),Oe(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,R=0;R<a.length;++R)if(a[R]==r||a[R].name==r)return a.splice(R,1),!0},addOverlay:_r(function(r,a){var R=r.token?r:e.getMode(this.options,r);if(R.startState)throw new Error("Overlays may not be stateful.");He(this.state.overlays,{mode:R,modeSpec:r,opaque:a&&a.opaque,priority:a&&a.priority||0},function(U){return U.priority}),this.state.modeGen++,Ur(this)}),removeOverlay:_r(function(r){for(var a=this.state.overlays,R=0;R<a.length;++R){var U=a[R].modeSpec;if(U==r||typeof r=="string"&&U.name==r){a.splice(R,1),this.state.modeGen++,Ur(this);return}}}),indentLine:_r(function(r,a,R){typeof a!="string"&&typeof a!="number"&&(a==null?a=this.options.smartIndent?"smart":"prev":a=a?"add":"subtract"),Er(this.doc,r)&&Ui(this,r,a,R)}),indentSelection:_r(function(r){for(var a=this.doc.sel.ranges,R=-1,U=0;U<a.length;U++){var Y=a[U];if(Y.empty())Y.head.line>R&&(Ui(this,Y.head.line,r,!0),R=Y.head.line,U==this.doc.sel.primIndex&&Qn(this));else{var J=Y.from(),ee=Y.to(),se=Math.max(R,J.line);R=Math.min(this.lastLine(),ee.line-(ee.ch?0:1))+1;for(var pe=se;pe<R;++pe)Ui(this,pe,r);var Se=this.doc.sel.ranges;J.ch==0&&a.length==Se.length&&Se[U].from().ch>0&&Fa(this.doc,U,new Qt(J,Se[U].to()),Le)}}}),getTokenAt:function(r,a){return or(this,r,a)},getLineTokens:function(r,a){return or(this,Ue(r),a,!0)},getTokenTypeAt:function(r){r=h(this.doc,r);var a=We(this,lt(this.doc,r.line)),R=0,U=(a.length-1)/2,Y=r.ch,J;if(Y==0)J=a[2];else for(;;){var ee=R+U>>1;if((ee?a[ee*2-1]:0)>=Y)U=ee;else if(a[ee*2+1]<Y)R=ee+1;else{J=a[ee*2+2];break}}var se=J?J.indexOf("overlay "):-1;return se<0?J:se==0?null:J.slice(0,se-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 R=[];if(!n.hasOwnProperty(a))return R;var U=n[a],Y=this.getModeAt(r);if(typeof Y[a]=="string")U[Y[a]]&&R.push(U[Y[a]]);else if(Y[a])for(var J=0;J<Y[a].length;J++){var ee=U[Y[a][J]];ee&&R.push(ee)}else Y.helperType&&U[Y.helperType]?R.push(U[Y.helperType]):U[Y.name]&&R.push(U[Y.name]);for(var se=0;se<U._global.length;se++){var pe=U._global[se];pe.pred(Y,this)&&fe(R,pe.val)==-1&&R.push(pe.val)}return R},getStateAfter:function(r,a){var R=this.doc;return r=H(R,r==null?R.first+R.size-1:r),nt(this,r+1,a).state},cursorCoords:function(r,a){var R,U=this.doc.sel.primary();return r==null?R=U.head:typeof r=="object"?R=h(this.doc,r):R=r?U.from():U.to(),sn(this,R,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,Gt(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,a,R){var U=!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,U=!0),Y=lt(this.doc,r)}else Y=r;return Gi(this,Y,{top:0,left:0},a||"page",R||U).top+(U?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,R,U,Y){var J=this.display;r=sn(this,h(this.doc,r));var ee=r.bottom,se=r.left;if(a.style.position="absolute",a.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(a),J.sizer.appendChild(a),U=="over")ee=r.top;else if(U=="above"||U=="near"){var pe=Math.max(J.wrapper.clientHeight,this.doc.height),Se=Math.max(J.sizer.clientWidth,J.lineSpace.clientWidth);(U=="above"||r.bottom+a.offsetHeight>pe)&&r.top>a.offsetHeight?ee=r.top-a.offsetHeight:r.bottom+a.offsetHeight<=pe&&(ee=r.bottom),se+a.offsetWidth>Se&&(se=Se-a.offsetWidth)}a.style.top=ee+"px",a.style.left=a.style.right="",Y=="right"?(se=J.sizer.clientWidth-a.offsetWidth,a.style.right="0px"):(Y=="left"?se=0:Y=="middle"&&(se=(J.sizer.clientWidth-a.offsetWidth)/2),a.style.left=se+"px"),R&&Js(this,{left:se,top:ee,right:se+a.offsetWidth,bottom:ee+a.offsetHeight})},triggerOnKeyDown:_r(gs),triggerOnKeyPress:_r(ys),triggerOnKeyUp:vs,triggerOnMouseDown:_r(bs),execCommand:function(r){if(Pi.hasOwnProperty(r))return Pi[r].call(null,this)},triggerElectric:_r(function(r){Ls(this,r)}),findPosH:function(r,a,R,U){var Y=1;a<0&&(Y=-1,a=-a);for(var J=h(this.doc,r),ee=0;ee<a&&!(J=Va(this.doc,J,Y,R,U),J.hitSide);++ee);return J},moveH:_r(function(r,a){var R=this;this.extendSelectionsBy(function(U){return R.display.shift||R.doc.extend||U.empty()?Va(R.doc,U.head,r,a,R.options.rtlMoveVisually):r<0?U.from():U.to()},ke)}),deleteH:_r(function(r,a){var R=this.doc.sel,U=this.doc;R.somethingSelected()?U.replaceSelection("",null,"+delete"):oi(this,function(Y){var J=Va(U,Y.head,r,a,!1);return r<0?{from:J,to:Y.head}:{from:Y.head,to:J}})}),findPosV:function(r,a,R,U){var Y=1,J=U;a<0&&(Y=-1,a=-a);for(var ee=h(this.doc,r),se=0;se<a;++se){var pe=sn(this,ee,"div");if(J==null?J=pe.left:pe.left=J,ee=ks(this,pe,Y,R),ee.hitSide)break}return ee},moveV:_r(function(r,a){var R=this,U=this.doc,Y=[],J=!this.display.shift&&!U.extend&&U.sel.somethingSelected();if(U.extendSelectionsBy(function(se){if(J)return r<0?se.from():se.to();var pe=sn(R,se.head,"div");se.goalColumn!=null&&(pe.left=se.goalColumn),Y.push(pe.left);var Se=ks(R,pe,r,a);return a=="page"&&se==U.sel.primary()&&La(R,ga(R,Se,"div").top-pe.top),Se},ke),Y.length)for(var ee=0;ee<U.sel.ranges.length;ee++)U.sel.ranges[ee].goalColumn=Y[ee]}),findWordAt:function(r){var a=this.doc,R=lt(a,r.line).text,U=r.ch,Y=r.ch;if(R){var J=this.getHelper(r,"wordChars");(r.sticky=="before"||Y==R.length)&&U?--U:++Y;for(var ee=R.charAt(U),se=Re(ee,J)?function(pe){return Re(pe,J)}:/\s/.test(ee)?function(pe){return/\s/.test(pe)}:function(pe){return!/\s/.test(pe)&&!Re(pe)};U>0&&se(R.charAt(U-1));)--U;for(;Y<R.length&&se(R.charAt(Y));)++Y}return new Qt(Ue(r.line,U),Ue(r.line,Y))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?W(this.display.cursorDiv,"CodeMirror-overwrite"):C(this.display.cursorDiv,"CodeMirror-overwrite"),Oe(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==P()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:_r(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:_n(this)}},scrollIntoView:_r(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:Ue(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:_r(function(r,a){var R=this,U=function(J){return typeof J=="number"||/^\d+$/.test(String(J))?J+"px":J};r!=null&&(this.display.wrapper.style.width=U(r)),a!=null&&(this.display.wrapper.style.height=U(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 ee=0;ee<J.widgets.length;ee++)if(J.widgets[ee].noHScroll){Cn(R,Y,"widget");break}}++Y}),this.curOp.forceUpdate=!0,Oe(this,"refresh",this)}),operation:function(r){return Kr(this,r)},startOperation:function(){return Bn(this)},endOperation:function(){return jn(this)},refresh:_r(function(){var r=this.display.cachedTextHeight;Ur(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),Oe(this,"refresh",this)}),swapDoc:_r(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,Rr(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}},ce(e),e.registerHelper=function(r,a,R){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][a]=R},e.registerGlobalHelper=function(r,a,R,U){e.registerHelper(r,a,U),n[r]._global.push({pred:R,val:U})}}function Va(e,t,n,r,a){var R=t,U=n,Y=lt(e,t.line),J=a&&e.direction=="rtl"?-n:n;function ee(){var mt=t.line+J;return mt<e.first||mt>=e.first+e.size?!1:(t=new Ue(mt,t.ch,t.sticky),Y=lt(e,mt))}function se(mt){var st;if(r=="codepoint"){var vt=Y.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(vt)?st=null:st=new Ue(t.line,Math.max(0,Math.min(Y.text.length,t.ch+n*(vt>=55296&&vt<56320?2:1))),-n)}else a?st=Pl(e.cm,Y,t,n):st=Ba(Y,t,n);if(st==null)if(!mt&&ee())t=ja(a,e.cm,Y,t.line,J);else return!1;else t=st;return!0}if(r=="char"||r=="codepoint")se();else if(r=="column")se(!0);else if(r=="word"||r=="group")for(var pe=null,Se=r=="group",Ce=e.cm&&e.cm.getHelper(t,"wordChars"),Pe=!0;!(n<0&&!se(!Pe));Pe=!1){var $e=Y.text.charAt(t.ch)||`
|
|
`,et=Re($e,Ce)?"w":Se&&$e==`
|
|
`?"n":!Se||/\s/.test($e)?null:"p";if(Se&&!Pe&&!et&&(et="s"),pe&&pe!=et){n<0&&(n=1,se(),t.sticky="after");break}if(et&&(pe=et),n>0&&!se(!Pe))break}var ot=ta(e,t,R,U,!0);return Ft(R,ot)&&(ot.hitSide=!0),ot}function ks(e,t,n,r){var a=e.doc,R=t.left,U;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);U=(n>0?t.bottom:t.top)+n*J}else r=="line"&&(U=n>0?t.bottom+3:t.top-3);for(var ee;!(ee=ya(e,R,U),!ee.outside);){if(n<0?U<=0:U>=a.height){ee.hitSide=!0;break}U+=n*5}return ee}var tr=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ie,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};tr.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 R(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}we(a,"paste",function(Y){if(!R(Y)||je(r,Y)||ws(Y,r))return;N<=11&&setTimeout(Sr(r,function(){return t.updateFromDOM()}),20)}),we(a,"compositionstart",function(Y){t.composing={data:Y.data,done:!1}}),we(a,"compositionupdate",function(Y){t.composing||(t.composing={data:Y.data,done:!1})}),we(a,"compositionend",function(Y){t.composing&&(Y.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),we(a,"touchstart",function(){return n.forceCompositionEnd()}),we(a,"input",function(){t.composing||t.readFromDOMSoon()});function U(Y){if(!R(Y)||je(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,Le),r.replaceSelection("",null,"cut")})}else return;if(Y.clipboardData){Y.clipboardData.clearData();var ee=un.text.join(`
|
|
`);if(Y.clipboardData.setData("Text",ee),Y.clipboardData.getData("Text")==ee){Y.preventDefault();return}}var se=Rs(),pe=se.firstChild;r.display.lineSpace.insertBefore(se,r.display.lineSpace.firstChild),pe.value=un.text.join(`
|
|
`);var Se=document.activeElement;Z(pe),setTimeout(function(){r.display.lineSpace.removeChild(se),Se.focus(),Se==a&&n.showPrimarySelection()},50)}we(a,"copy",U),we(a,"cut",U)},tr.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},tr.prototype.prepareSelection=function(){var e=vo(this.cm,!1);return e.focus=document.activeElement==this.div,e},tr.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},tr.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},tr.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 R=la(t,e.anchorNode,e.anchorOffset),U=la(t,e.focusNode,e.focusOffset);if(R&&!R.bad&&U&&!U.bad&&ft(ar(R,U),r)==0&&ft(qt(R,U),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},ee=a.line<t.display.viewTo&&Os(t,a);if(!ee){var se=Y[Y.length-1].measure,pe=se.maps?se.maps[se.maps.length-1]:se.map;ee={node:pe[pe.length-1],offset:pe[pe.length-2]-pe[pe.length-3]}}if(!J||!ee){e.removeAllRanges();return}var Se=e.rangeCount&&e.getRangeAt(0),Ce;try{Ce=S(J.node,J.offset,ee.offset,ee.node)}catch(Pe){}Ce&&(!M&&t.state.focused?(e.collapse(J.node,J.offset),Ce.collapsed||(e.removeAllRanges(),e.addRange(Ce))):(e.removeAllRanges(),e.addRange(Ce)),Se&&e.anchorNode==null?e.addRange(Se):M&&this.startGracePeriod()),this.rememberSelection()},tr.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)},tr.prototype.showMultipleSelections=function(e){c(this.cm.display.cursorDiv,e.cursors),c(this.cm.display.selectionDiv,e.selection)},tr.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},tr.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return A(this.div,t)},tr.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},tr.prototype.blur=function(){this.div.blur()},tr.prototype.getField=function(){return this.div},tr.prototype.supportsTouch=function(){return!0},tr.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Kr(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)},tr.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},tr.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&&Kr(t,function(){Or(t.doc,Tn(n,r),Le),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},tr.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=Ue(r.line-1,lt(e.doc,r.line-1).length)),a.ch==lt(e.doc,a.line).text.length&&a.line<e.lastLine()&&(a=Ue(a.line+1,0)),r.line<t.viewFrom||a.line>t.viewTo-1)return!1;var R,U,Y;r.line==t.viewFrom||(R=Nn(e,r.line))==0?(U=Pt(t.view[0].line),Y=t.view[0].node):(U=Pt(t.view[R].line),Y=t.view[R-1].node.nextSibling);var J=Nn(e,a.line),ee,se;if(J==t.view.length-1?(ee=t.viewTo-1,se=t.lineDiv.lastChild):(ee=Pt(t.view[J+1].line)-1,se=t.view[J+1].node.previousSibling),!Y)return!1;for(var pe=e.doc.splitLines(tu(e,Y,se,U,ee)),Se=ir(e.doc,Ue(U,0),Ue(ee,lt(e.doc,ee).text.length));pe.length>1&&Se.length>1;)if(Me(pe)==Me(Se))pe.pop(),Se.pop(),ee--;else if(pe[0]==Se[0])pe.shift(),Se.shift(),U++;else break;for(var Ce=0,Pe=0,$e=pe[0],et=Se[0],ot=Math.min($e.length,et.length);Ce<ot&&$e.charCodeAt(Ce)==et.charCodeAt(Ce);)++Ce;for(var mt=Me(pe),st=Me(Se),vt=Math.min(mt.length-(pe.length==1?Ce:0),st.length-(Se.length==1?Ce:0));Pe<vt&&mt.charCodeAt(mt.length-Pe-1)==st.charCodeAt(st.length-Pe-1);)++Pe;if(pe.length==1&&Se.length==1&&U==r.line)for(;Ce&&Ce>r.ch&&mt.charCodeAt(mt.length-Pe-1)==st.charCodeAt(st.length-Pe-1);)Ce--,Pe++;pe[pe.length-1]=mt.slice(0,mt.length-Pe).replace(/^\u200b+/,""),pe[0]=pe[0].slice(Ce).replace(/\u200b+$/,"");var Rt=Ue(U,Ce),Tt=Ue(ee,Se.length?Me(Se).length-Pe:0);if(pe.length>1||pe[0]||ft(Rt,Tt))return ni(e.doc,pe,Rt,Tt,"+input"),!0},tr.prototype.ensurePolled=function(){this.forceCompositionEnd()},tr.prototype.reset=function(){this.forceCompositionEnd()},tr.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},tr.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)},tr.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Kr(this.cm,function(){return Ur(e.cm)})},tr.prototype.setUneditable=function(e){e.contentEditable="false"},tr.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Sr(this.cm,Ka)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},tr.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},tr.prototype.onContextMenu=function(){},tr.prototype.resetPosition=function(){},tr.prototype.needsContentAttribute=!0;function Os(e,t){var n=pa(e,t.line);if(!n||n.hidden)return null;var r=lt(e.doc,t.line),a=ro(n,r,t.line),R=Ze(r,e.doc.direction),U="left";if(R){var Y=Xe(R,t.ch);U=Y%2?"right":"left"}var J=ao(a.map,t.ch,U);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 R="",U=!1,Y=e.doc.lineSeparator(),J=!1;function ee(Ce){return function(Pe){return Pe.id==Ce}}function se(){U&&(R+=Y,J&&(R+=Y),U=J=!1)}function pe(Ce){Ce&&(se(),R+=Ce)}function Se(Ce){if(Ce.nodeType==1){var Pe=Ce.getAttribute("cm-text");if(Pe){pe(Pe);return}var $e=Ce.getAttribute("cm-marker"),et;if($e){var ot=e.findMarks(Ue(r,0),Ue(a+1,0),ee(+$e));ot.length&&(et=ot[0].find(0))&&pe(ir(e.doc,et.from,et.to).join(Y));return}if(Ce.getAttribute("contenteditable")=="false")return;var mt=/^(pre|div|p|li|table|br)$/i.test(Ce.nodeName);if(!/^br$/i.test(Ce.nodeName)&&Ce.textContent.length==0)return;mt&&se();for(var st=0;st<Ce.childNodes.length;st++)Se(Ce.childNodes[st]);/^(pre|p)$/i.test(Ce.nodeName)&&(J=!0),mt&&(U=!0)}else Ce.nodeType==3&&pe(Ce.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Se(t),t==n);)t=t.nextSibling,J=!1;return R}function la(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return li(e.clipPos(Ue(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 R=e.display.view[a];if(R.node==r)return ru(R,t,n)}}function ru(e,t,n){var r=e.text.firstChild,a=!1;if(!t||!A(r,t))return li(Ue(Pt(e.line),0),!0);if(t==r&&(a=!0,t=r.childNodes[n],n=0,!t)){var R=e.rest?Me(e.rest):e.line;return li(Ue(Pt(R),R.text.length),a)}var U=t.nodeType==3?t:null,Y=t;for(!U&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(U=t.firstChild,n&&(n=U.nodeValue.length));Y.parentNode!=r;)Y=Y.parentNode;var J=e.measure,ee=J.maps;function se(et,ot,mt){for(var st=-1;st<(ee?ee.length:0);st++)for(var vt=st<0?J.map:ee[st],Rt=0;Rt<vt.length;Rt+=3){var Tt=vt[Rt+2];if(Tt==et||Tt==ot){var Nt=Pt(st<0?e.line:e.rest[st]),sr=vt[Rt]+mt;return(mt<0||Tt!=et)&&(sr=vt[Rt+(mt?1:0)]),Ue(Nt,sr)}}}var pe=se(U,Y,n);if(pe)return li(pe,a);for(var Se=Y.nextSibling,Ce=U?U.nodeValue.length-n:0;Se;Se=Se.nextSibling){if(pe=se(Se,Se.firstChild,0),pe)return li(Ue(pe.line,pe.ch-Ce),a);Ce+=Se.textContent.length}for(var Pe=Y.previousSibling,$e=n;Pe;Pe=Pe.previousSibling){if(pe=se(Pe,Pe.firstChild,-1),pe)return li(Ue(pe.line,pe.ch+$e),a);$e+=Pe.textContent.length}}var pr=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ie,this.hasSelection=!1,this.composing=null};pr.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"),we(a,"input",function(){j&&N>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),we(a,"paste",function(U){if(je(r,U)||ws(U,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function R(U){if(je(r,U))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}),U.type=="cut"?r.setSelections(Y.ranges,null,Le):(n.prevInput="",a.value=Y.text.join(`
|
|
`),Z(a))}else return;U.type=="cut"&&(r.state.cutIncoming=+new Date)}we(a,"cut",R),we(a,"copy",R),we(e.scroller,"paste",function(U){if(gn(e,U)||je(r,U))return;if(!a.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var Y=new Event("paste");Y.clipboardData=U.clipboardData,a.dispatchEvent(Y)}),we(e.lineSpace,"selectstart",function(U){gn(e,U)||re(U)}),we(a,"compositionstart",function(){var U=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:U,range:r.markText(U,r.getCursor("to"),{className:"CodeMirror-composing"})}}),we(a,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},pr.prototype.createField=function(e){this.wrapper=Rs(),this.textarea=this.wrapper.firstChild},pr.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},pr.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"),R=t.wrapper.getBoundingClientRect(),U=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,a.top+U.top-R.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,a.left+U.left-R.left))}return r},pr.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")},pr.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),j&&N>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",j&&N>=9&&(this.hasSelection=null))},pr.prototype.getField=function(){return this.textarea},pr.prototype.supportsTouch=function(){return!1},pr.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!i||P()!=this.textarea))try{this.textarea.focus()}catch(e){}},pr.prototype.blur=function(){this.textarea.blur()},pr.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},pr.prototype.receivedFocus=function(){this.slowPoll()},pr.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()})},pr.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)},pr.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||qe(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(j&&N>=9&&this.hasSelection===a||s&&/[\uf700-\uf7ff]/.test(a))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var R=a.charCodeAt(0);if(R==8203&&!r&&(r="\u200B"),R==8666)return this.reset(),this.cm.execCommand("undo")}for(var U=0,Y=Math.min(r.length,a.length);U<Y&&r.charCodeAt(U)==a.charCodeAt(U);)++U;return Kr(t,function(){Ka(t,a.slice(U),r.length-U,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},pr.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},pr.prototype.onKeyPress=function(){j&&N>=9&&(this.hasSelection=null),this.fastPoll()},pr.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,a=t.textarea;t.contextMenuPending&&t.contextMenuPending();var R=In(n,e),U=r.scroller.scrollTop;if(!R||f)return;var Y=n.options.resetSelectionOnContextMenu;Y&&n.doc.sel.contains(R)==-1&&Sr(n,Or)(n.doc,Tn(R),Le);var J=a.style.cssText,ee=t.wrapper.style.cssText,se=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",a.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-se.top-5)+"px; left: "+(e.clientX-se.left-5)+`px;
|
|
z-index: 1000; background: `+(j?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var pe;_&&(pe=window.scrollY),r.input.focus(),_&&window.scrollTo(null,pe),r.input.reset(),n.somethingSelected()||(a.value=t.prevInput=" "),t.contextMenuPending=Ce,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function Se(){if(a.selectionStart!=null){var $e=n.somethingSelected(),et="\u200B"+($e?a.value:"");a.value="\u21DA",a.value=et,t.prevInput=$e?"":"\u200B",a.selectionStart=1,a.selectionEnd=et.length,r.selForContextMenu=n.doc.sel}}function Ce(){if(t.contextMenuPending!=Ce)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=ee,a.style.cssText=J,j&&N<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=U),a.selectionStart!=null){(!j||j&&N<9)&&Se();var $e=0,et=function(){r.selForContextMenu==n.doc.sel&&a.selectionStart==0&&a.selectionEnd>0&&t.prevInput=="\u200B"?Sr(n,$o)(n):$e++<10?r.detectingSelectAll=setTimeout(et,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(et,200)}}if(j&&N>=9&&Se(),O){le(e);var Pe=function(){at(window,"mouseup",Pe),setTimeout(Ce,20)};we(window,"mouseup",Pe)}else setTimeout(Ce,50)},pr.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},pr.prototype.setUneditable=function(){},pr.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=P();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=Y.getValue()}var a;if(e.form&&(we(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var R=e.form;a=R.submit;try{var U=R.submit=function(){r(),R.submit=a,R.submit(),R.submit=U}}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=lr(function(J){return e.parentNode.insertBefore(J,e.nextSibling)},t);return Y}function iu(e){e.off=at,e.on=we,e.wheelEventPixels=hl,e.Doc=Br,e.splitLines=wt,e.countColumn=te,e.findColumn=De,e.isWordChar=xe,e.Pass=_e,e.signal=Oe,e.Line=Mn,e.changeEnd=wn,e.scrollbarModel=wo,e.Pos=Ue,e.cmpPos=ft,e.modes=kt,e.mimeModes=Dt,e.resolveMode=Et,e.getMode=bt,e.modeExtensions=ht,e.extendMode=Ct,e.copyState=$t,e.startState=nr,e.innerMode=rr,e.commands=Pi,e.keyMap=vn,e.keyName=hs,e.isModifierKey=us,e.lookupKey=ai,e.normalizeKeyMap=_l,e.StringStream=dt,e.SharedTextMarker=Oi,e.TextMarker=An,e.LineWidget=ki,e.e_preventDefault=re,e.e_stopPropagation=q,e.e_stop=le,e.addClass=W,e.contains=A,e.rmClass=C,e.keyNames=Dn}$l(lr),ql(lr);var au="iter insert remove copy getEditor constructor".split(" ");for(var ua in Br.prototype)Br.prototype.hasOwnProperty(ua)&&fe(au,ua)<0&&(lr.prototype[ua]=function(e){return function(){return e.apply(this.doc,arguments)}}(Br.prototype[ua]));return ce(Br),lr.inputStyles={textarea:pr,contenteditable:tr},lr.defineMode=function(e){!lr.defaults.mode&&e!="null"&&(lr.defaults.mode=e),Ar.apply(this,arguments)},lr.defineMIME=cr,lr.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),lr.defineMIME("text/plain","null"),lr.defineExtension=function(e,t){lr.prototype[e]=t},lr.defineDocExtension=function(e,t){Br.prototype[e]=t},lr.fromTextArea=nu,iu(lr),lr.version="5.58.2",lr})},XFxt:function(yt,Ee,Q){yt.exports={"image-preview-container":"image-preview-container___1L8o9","image-preview":"image-preview___3YjNO","button-group":"button-group___3y9R5","preview-wrp-group":"preview-wrp-group___19bWd"}},Y1PL:function(yt,Ee,Q){"use strict";Q.r(Ee),Q.d(Ee,"ResizableTextArea",function(){return fe});var ne=Q("wx14"),$=Q("1OyB"),M=Q("vuIU"),K=Q("Ji7U"),I=Q("LK+K"),D=Q("q1tI"),j=Q("VTBJ"),N=Q("rePB"),_=Q("Zm9Q"),k=Q("Kwbf"),d=Q("c+Xe"),f=Q("m+aA"),T=Q("bdgK"),m=new Map;function p(Le){Le.forEach(function(Ae){var ke,De=Ae.target;(ke=m.get(De))===null||ke===void 0||ke.forEach(function(ve){return ve(De)})})}var b=new T.default(p),o=null,i=null;function s(Le,Ae){m.has(Le)||(m.set(Le,new Set),b.observe(Le)),m.get(Le).add(Ae)}function l(Le,Ae){m.has(Le)&&(m.get(Le).delete(Ae),m.get(Le).size||(b.unobserve(Le),m.delete(Le)))}var E=function(Le){Object(K.a)(ke,Le);var Ae=Object(I.a)(ke);function ke(){return Object($.a)(this,ke),Ae.apply(this,arguments)}return Object(M.a)(ke,[{key:"render",value:function(){return this.props.children}}]),ke}(D.Component),g=D.createContext(null);function v(Le){var Ae=Le.children,ke=Le.onBatchResize,De=D.useRef(0),ve=D.useRef([]),ue=D.useContext(g),Me=D.useCallback(function(Qe,He,rt){De.current+=1;var oe=De.current;ve.current.push({size:Qe,element:He,data:rt}),Promise.resolve().then(function(){oe===De.current&&(ke==null||ke(ve.current),ve.current=[])}),ue==null||ue(Qe,He,rt)},[ke,ue]);return D.createElement(g.Provider,{value:Me},Ae)}function O(Le){var Ae=Le.children,ke=Le.disabled,De=D.useRef(null),ve=D.useRef(null),ue=D.useContext(g),Me=D.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Qe=D.isValidElement(Ae)&&Object(d.c)(Ae),He=Qe?Ae.ref:null,rt=D.useMemo(function(){return Object(d.a)(He,De)},[He,De]),oe=D.useRef(Le);oe.current=Le;var de=D.useCallback(function(xe){var Re=oe.current,Ie=Re.onResize,Ne=Re.data,Ge=xe.getBoundingClientRect(),ze=Ge.width,ut=Ge.height,Ke=xe.offsetWidth,Be=xe.offsetHeight,Xe=Math.floor(ze),tt=Math.floor(ut);if(Me.current.width!==Xe||Me.current.height!==tt||Me.current.offsetWidth!==Ke||Me.current.offsetHeight!==Be){var Ze={width:Xe,height:tt,offsetWidth:Ke,offsetHeight:Be};Me.current=Ze;var it=Ke===Math.round(ze)?ze:Ke,we=Be===Math.round(ut)?ut:Be,Ye=Object(j.a)(Object(j.a)({},Ze),{},{offsetWidth:it,offsetHeight:we});ue==null||ue(Ye,xe,Ne),Ie&&Promise.resolve().then(function(){Ie(Ye,xe)})}},[]);return D.useEffect(function(){var xe=Object(f.a)(De.current)||Object(f.a)(ve.current);return xe&&!ke&&s(xe,de),function(){return l(xe,de)}},[De.current,ke]),D.createElement(E,{ref:ve},Qe?D.cloneElement(Ae,{ref:rt}):Ae)}var w="rc-observer-key";function C(Le){var Ae=Le.children,ke=Object(_.a)(Ae);return ke.map(function(De,ve){var ue=(De==null?void 0:De.key)||"".concat(w,"-").concat(ve);return D.createElement(O,Object(ne.a)({},Le,{key:ue}),De)})}C.Collection=v;var y=C,c=Q("bT9E"),u=Q("TSYQ"),L=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
|
|
`,A=["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"],P={},W;function V(Le){var Ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ke=Le.getAttribute("id")||Le.getAttribute("data-reactid")||Le.getAttribute("name");if(Ae&&P[ke])return P[ke];var De=window.getComputedStyle(Le),ve=De.getPropertyValue("box-sizing")||De.getPropertyValue("-moz-box-sizing")||De.getPropertyValue("-webkit-box-sizing"),ue=parseFloat(De.getPropertyValue("padding-bottom"))+parseFloat(De.getPropertyValue("padding-top")),Me=parseFloat(De.getPropertyValue("border-bottom-width"))+parseFloat(De.getPropertyValue("border-top-width")),Qe=A.map(function(rt){return"".concat(rt,":").concat(De.getPropertyValue(rt))}).join(";"),He={sizingStyle:Qe,paddingSize:ue,borderSize:Me,boxSizing:ve};return Ae&&ke&&(P[ke]=He),He}function Z(Le){var Ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ke=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,De=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;W||(W=document.createElement("textarea"),W.setAttribute("tab-index","-1"),W.setAttribute("aria-hidden","true"),document.body.appendChild(W)),Le.getAttribute("wrap")?W.setAttribute("wrap",Le.getAttribute("wrap")):W.removeAttribute("wrap");var ve=V(Le,Ae),ue=ve.paddingSize,Me=ve.borderSize,Qe=ve.boxSizing,He=ve.sizingStyle;W.setAttribute("style","".concat(He,";").concat(S)),W.value=Le.value||Le.placeholder||"";var rt=Number.MIN_SAFE_INTEGER,oe=Number.MAX_SAFE_INTEGER,de=W.scrollHeight,xe;if(Qe==="border-box"?de+=Me:Qe==="content-box"&&(de-=ue),ke!==null||De!==null){W.value=" ";var Re=W.scrollHeight-ue;ke!==null&&(rt=Re*ke,Qe==="border-box"&&(rt=rt+ue+Me),de=Math.max(rt,de)),De!==null&&(oe=Re*De,Qe==="border-box"&&(oe=oe+ue+Me),xe=de>oe?"":"hidden",de=Math.min(oe,de))}return{height:de,minHeight:rt,maxHeight:oe,overflowY:xe,resize:"none"}}var z=Q("Gytx"),F=Q.n(z),te;(function(Le){Le[Le.NONE=0]="NONE",Le[Le.RESIZING=1]="RESIZING",Le[Le.RESIZED=2]="RESIZED"})(te||(te={}));var ie=function(Le){Object(K.a)(ke,Le);var Ae=Object(I.a)(ke);function ke(De){var ve;return Object($.a)(this,ke),ve=Ae.call(this,De),ve.nextFrameActionId=void 0,ve.resizeFrameId=void 0,ve.textArea=void 0,ve.saveTextArea=function(ue){ve.textArea=ue},ve.handleResize=function(ue){var Me=ve.state.resizeStatus,Qe=ve.props,He=Qe.autoSize,rt=Qe.onResize;if(Me!==te.NONE)return;typeof rt=="function"&&rt(ue),He&&ve.resizeOnNextFrame()},ve.resizeOnNextFrame=function(){cancelAnimationFrame(ve.nextFrameActionId),ve.nextFrameActionId=requestAnimationFrame(ve.resizeTextarea)},ve.resizeTextarea=function(){var ue=ve.props.autoSize;if(!ue||!ve.textArea)return;var Me=ue.minRows,Qe=ue.maxRows,He=Z(ve.textArea,!1,Me,Qe);ve.setState({textareaStyles:He,resizeStatus:te.RESIZING},function(){cancelAnimationFrame(ve.resizeFrameId),ve.resizeFrameId=requestAnimationFrame(function(){ve.setState({resizeStatus:te.RESIZED},function(){ve.resizeFrameId=requestAnimationFrame(function(){ve.setState({resizeStatus:te.NONE}),ve.fixFirefoxAutoScroll()})})})})},ve.renderTextArea=function(){var ue=ve.props,Me=ue.prefixCls,Qe=Me===void 0?"rc-textarea":Me,He=ue.autoSize,rt=ue.onResize,oe=ue.className,de=ue.disabled,xe=ve.state,Re=xe.textareaStyles,Ie=xe.resizeStatus,Ne=Object(c.a)(ve.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ge=L()(Qe,oe,Object(N.a)({},"".concat(Qe,"-disabled"),de));"value"in Ne&&(Ne.value=Ne.value||"");var ze=Object(j.a)(Object(j.a)(Object(j.a)({},ve.props.style),Re),Ie===te.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return D.createElement(y,{onResize:ve.handleResize,disabled:!(He||rt)},D.createElement("textarea",Object(ne.a)({},Ne,{className:Ge,style:ze,ref:ve.saveTextArea})))},ve.state={textareaStyles:{},resizeStatus:te.NONE},ve}return Object(M.a)(ke,[{key:"componentDidUpdate",value:function(ve){(ve.value!==this.props.value||!F()(ve.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 ve=this.textArea.selectionStart,ue=this.textArea.selectionEnd;this.textArea.setSelectionRange(ve,ue)}}catch(Me){}}},{key:"render",value:function(){return this.renderTextArea()}}]),ke}(D.Component),fe=ie,ye=function(Le){Object(K.a)(ke,Le);var Ae=Object(I.a)(ke);function ke(De){var ve;Object($.a)(this,ke),ve=Ae.call(this,De),ve.resizableTextArea=void 0,ve.focus=function(){ve.resizableTextArea.textArea.focus()},ve.saveTextArea=function(Me){ve.resizableTextArea=Me},ve.handleChange=function(Me){var Qe=ve.props.onChange;ve.setValue(Me.target.value,function(){ve.resizableTextArea.resizeTextarea()}),Qe&&Qe(Me)},ve.handleKeyDown=function(Me){var Qe=ve.props,He=Qe.onPressEnter,rt=Qe.onKeyDown;Me.keyCode===13&&He&&He(Me),rt&&rt(Me)};var ue=typeof De.value=="undefined"||De.value===null?De.defaultValue:De.value;return ve.state={value:ue},ve}return Object(M.a)(ke,[{key:"setValue",value:function(ve,ue){"value"in this.props||this.setState({value:ve},ue)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return D.createElement(fe,Object(ne.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ve){return"value"in ve?{value:ve.value}:null}}]),ke}(D.Component),_e=Ee.default=ye},ZW9T:function(yt,Ee,Q){"use strict";Q.d(Ee,"a",function(){return y});var ne=Q("k1fw"),$=Q("oBTY"),M=Q("9og8"),K=Q("miYZ"),I=Q("tsqr"),D=Q("rAM+"),j=Q("tJVT"),N=Q("PpiC"),_=Q("WmNS"),k=Q.n(_),d=Q("q1tI"),f=Q.n(d),T=Q("bdgK");function m(c,u,L,S,A){var P=u.getWordUntilPosition(L),W={startLineNumber:L.lineNumber,endLineNumber:L.lineNumber,startColumn:P.startColumn,endColumn:P.endColumn},V=S.map(function(Z){return{label:Z,kind:c.languages.CompletionItemKind.Keyword,insertText:Z,insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:W}});return A.map(function(Z){V.push(Object(ne.a)(Object(ne.a)({},Z),{},{range:W}))}),V}var p=function(c){var u={label:"ifelse",kind:c.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`),insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet},L=["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(W,V){var Z=m(c,W,V,L,[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(W,V){var Z=[{label:"print",kind:c.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
`),insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet}],z=m(c,W,V,S,Z);return{suggestions:z}}});var A=["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(W,V){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}],z=m(c,W,V,A,Z);return{suggestions:z}}})},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 E(){}var g=!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 O(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],u=c;if(Array.isArray(c)){for(var L=0;L<c.length;L++){var S=v[c[L]];if(S)return S}return u[0]}return v[u]||u}var w=null,C=Ee.b=function(c){var u=c.width,L=u===void 0?"100%":u,S=c.height,A=S===void 0?"100%":S,P=c.value,W=c.language,V=W===void 0?"javascript":W,Z=c.style,z=Z===void 0?{}:Z,F=c.options,te=F===void 0?{}:F,ie=c.overrideServices,fe=ie===void 0?{}:ie,ye=c.theme,_e=ye===void 0?"vs-dark":ye,Le=c.onEditBlur,Ae=c.onSave,ke=c.autoHeight,De=ke===void 0?!1:ke,ve=c.forbidCopy,ue=ve===void 0?!1:ve,Me=c.onChange,Qe=Me===void 0?E:Me,He=c.editorDidMount,rt=He===void 0?E:He,oe=c.onFocus,de=oe===void 0?E:oe,xe=c.onBreakPoint,Re=xe===void 0?E:xe,Ie=c.breakPointValue,Ne=Ie===void 0?[]:Ie,Ge=c.filename,ze=Ge===void 0?"educoder.txt":Ge,ut=c.errorLine,Ke=c.errorContent,Be=Ke===void 0?"":Ke,Xe=c.highlightLine,tt=c.openBreakPoint,Ze=tt===void 0?!1:tt,it=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"]),we=Object(d.useRef)(),Ye=Object(d.useRef)({}),at=Object(d.useRef)(),Oe=Object(d.useRef)(),je=Object(d.useRef)([]),ge=Object(d.useRef)(!1),he=Object(d.useRef)(),ce=Object(d.useState)(!1),re=Object(j.a)(ce,2),q=re[0],ae=re[1];function le(){var bt;return we.current&&(bt=new T.default(function(ht){var Ct=Object(D.a)(ht),$t;try{for(Ct.s();!($t=Ct.n()).done;){var rr=$t.value;(rr.target.offsetHeight>0||rr.target.offsetWidth>0)&&Ye.current.instance.layout()}}catch(nr){Ct.e(nr)}finally{Ct.f()}}),bt.observe(we.current)),bt}function Te(){I.b.warn({content:decodeURIComponent(b),key:"monaco-editor-tip"})}var be=function(){var ht=Ye.current.instance;if(P!=null&&ht&&q){var Ct=ht.getModel();Ct&&P!==Ct.getValue()&&(g=!0,Ct.setValue(P),ht.layout(),g=!1)}};Object(d.useEffect)(function(){try{var bt,ht=Ye.current.instance;Oe.current&&clearTimeout(Oe.current),Oe.current=setTimeout(function(){be()},500),ht==null||((bt=ht.updateOptions)===null||bt===void 0)||bt.call(ht,{lineNumbersMinChars:Math.max(Math.floor(Math.log10(P.split(/\r\n|\r|\n/g).length))+3,5)})}catch(Ct){debugger}},[P,q,Ye.current]),Object(d.useEffect)(function(){try{if(ut&&Ye.current&&Ye.current.instance){var bt=Ye.current.instance;bt.changeViewZones(function(Ct){var $t=document.createElement("div");$t.style.padding="10px 20px",$t.style.width="calc(100% - 20px)",$t.className="my-error-line-wrp",$t.innerHTML=Be,Ct.addZone({afterLineNumber:ut||11,heightInLines:3,domNode:$t})});var ht={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}};bt.addOverlayWidget(ht),bt.revealPositionInCenter({lineNumber:20,column:1})}}catch(Ct){debugger}},[ut,Ye.current,q]),Object(d.useEffect)(function(){var bt;if((bt=Ye.current)!==null&&bt!==void 0&&bt.instance&&q&&Ze){var ht=Ye.current.instance,Ct=ht.getModel();if(!Ct)return;var $t=function(){var ft=[],Ft=[],Jt=Ct.getAllDecorations(),qt=Object(D.a)(Jt),ar;try{for(qt.s();!(ar=qt.n()).done;){var H=ar.value;if(H.options.className==="highlighted-line"){var h;ft.push(H==null||((h=H.range)===null||h===void 0)?void 0:h.startLineNumber),Ft.push(H==null?void 0:H.id)}}}catch(B){qt.e(B)}finally{qt.f()}Ct.deltaDecorations(Ft,[]);var x=Ct.getLineCount();!!Xe&&Xe<=x&&(ht.deltaDecorations([],[{range:new w.Range(Xe,1,Xe,Ct.getLineMaxColumn(Xe)),options:{isWholeLine:!0,className:"highlighted-line"}}]),ht.revealLineInCenter(Xe))};$t();var rr=function(){var ft=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,Ft=[],Jt=[],qt=Ct.getAllDecorations(),ar=Object(D.a)(qt),H;try{for(ar.s();!(H=ar.n()).done;){var h=H.value;if(h.options.linesDecorationsClassName==="breakpoints"){var x;Ft.push(h==null||((x=h.range)===null||x===void 0)?void 0:x.startLineNumber),Jt.push(h==null?void 0:h.id)}}}catch(B){ar.e(B)}finally{ar.f()}if(ft)return{lines:Ft,ids:Jt};Re(Ft)},nr=function(){var Ue=Object(M.a)(k.a.mark(function ft(Ft){var Jt;return k.a.wrap(function(ar){for(;;)switch(ar.prev=ar.next){case 0:return Jt={range:new w.Range(Ft,1,Ft,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints"}},ar.next=3,Ct.deltaDecorations([],[Jt]);case 3:rr();case 4:case"end":return ar.stop()}},ft)}));return function(Ft){return Ue.apply(this,arguments)}}(),dt=function(){var Ue=Object(M.a)(k.a.mark(function ft(Ft){var Jt,qt,ar,H,h;return k.a.wrap(function(B){for(;;)switch(B.prev=B.next){case 0:Jt=[],qt=ht.getLineDecorations(Ft),ar=Object(D.a)(qt);try{for(ar.s();!(H=ar.n()).done;)h=H.value,h.options.linesDecorationsClassName==="breakpoints"&&Jt.push(h.id)}catch(X){ar.e(X)}finally{ar.f()}return B.next=6,Ct.deltaDecorations(Jt,[]);case 6:rr();case 7:case"end":return B.stop()}},ft)}));return function(Ft){return Ue.apply(this,arguments)}}(),lt=function(ft){var Ft=ht.getLineDecorations(ft),Jt=Object(D.a)(Ft),qt;try{for(Jt.s();!(qt=Jt.n()).done;){var ar=qt.value;if(ar.options.linesDecorationsClassName==="breakpoints")return!0}}catch(H){Jt.e(H)}finally{Jt.f()}return!1};if(!Object(i.isEqual)(Ne,rr(!0).lines)){Ct.deltaDecorations(rr(!0).ids,[]);var ir=Ne.map(function(Ue){return{range:new w.Range(Ue,1,Ue,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints"}}});Ct.deltaDecorations([],ir)}var Ht=ht.onDidChangeModelContent(function(Ue){var ft=ht.getPosition();if(ft){var Ft=ft.lineNumber;Ct.getLineContent(Ft).trim()===""?dt(Ft):lt(Ft)&&(dt(Ft),nr(Ft))}}),Ut=ht.onMouseDown(function(Ue){var ft,Ft,Jt;if(Ue.target.detail&&(ft=Ue.target)!==null&&ft!==void 0&&(Ft=ft.element)!==null&&Ft!==void 0&&(Jt=Ft.className)!==null&&Jt!==void 0&&Jt.includes("line-numbers")){var qt=Ue.target.position.lineNumber;if(Ct.getLineContent(qt).trim()==="")return;lt(qt)?dt(qt):nr(qt)}}),Pt=function(ft){var Ft={range:new w.Range(ft,1,ft,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-fake"}};je.current=ht.deltaDecorations(je.current,[Ft])},Gt=function(){je.current=ht.deltaDecorations(je.current,[])},Er=ht.onMouseMove(function(Ue){var ft,Ft,Jt;if(Gt(),Ue.target.detail&&(ft=Ue.target)!==null&&ft!==void 0&&(Ft=ft.element)!==null&&Ft!==void 0&&(Jt=Ft.className)!==null&&Jt!==void 0&&Jt.includes("line-numbers")){var qt=Ue.target.position.lineNumber;if(Ct.getLineContent(qt).trim()==="")return;Pt(qt)}}),rn=ht.onMouseLeave(function(){Gt()});return function(){Ht.dispose(),Ut.dispose(),Er.dispose(),rn.dispose()}}},[Ye.current,q,Ne,Xe,Ze]);function Fe(){var bt=Ye.current.instance;if(bt){var ht=bt.getSelection(),Ct=Ye.current.pastePos||{},$t=new w.Range(Ct.startLineNumber||ht.endLineNumber,Ct.startColumn||ht.endColumn,Ct.endLineNumber||ht.endLineNumber,Ct.endColumn||ht.endColumn);setTimeout(function(){bt.executeEdits("",[{range:$t,text:""}])},300)}}function Je(bt){(window.navigator.platform.match("Mac")?bt.metaKey:bt.ctrlKey)&&bt.keyCode==83&&(bt.preventDefault(),Ae())}var pt=function(){if(De&&Ye.current.instance){var ht=Ye.current.instance.getContentHeight();cr(ht<A?A:ht)}else cr(A)};function ct(bt){var ht=document.createEvent("MouseEvents");ht.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),bt.dispatchEvent(ht)}var At=function(ht){var Ct=ht.keyCode,$t=ht.ctrlKey,rr=ht.metaKey,nr=ht.target,dt=ht.type;return(dt==="paste"||(Ct===67||Ct===86)&&(rr||$t))&&nr.nodeName==="TEXTAREA"&&(Te(),ht.preventDefault()),!1};function wt(bt,ht){var Ct=window.URL||window.webkitURL||window,$t=new Blob([ht]),rr=document.createElementNS("http://www.w3.org/1999/xhtml","a");rr.href=Ct.createObjectURL($t),rr.download=bt,ct(rr)}Object(d.useEffect)(function(){pt()},[pt]),Object(d.useEffect)(function(){we.current&&!q&&Q.e(27).then(Q.t.bind(null,"M/lh",7)).then(function(bt){try{w=bt,Ye.current.instance=w.editor.create(we.current,{value:P,language:O(V),theme:_e,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0},fe);var ht=Ye.current.instance,Ct=o.c._menuItems,$t=Object($.a)(Ct).find(function(nr){return nr[0]._debugName=="EditorContext"});if(rt(ht,w),setTimeout(function(){pt(),Ye.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){wt(ze||"educoder.txt",ht.getValue())}}),ht.getDomNode().addEventListener("input",function(){at.current.autoFormat&&ht.getAction("editor.action.formatDocument").run()})},500),Ye.current.subscription=ht.onDidChangeModelContent(function(nr){debugger;ge.current?clearTimeout(he.current):(pt(),Qe(ht.getValue(),nr)),he.current=setTimeout(function(){ge.current=!1},500)}),window.Monaco||p(w,O(V)),ue&&(we.current.classList.add("noCopyPaste"),window.removeEventListener("keydown",At),window.removeEventListener("paste",At),window.addEventListener("keydown",At),window.addEventListener("paste",At)),window.Monaco=w,Le&&ht.onDidBlurEditorWidget(function(){Le(ht.getValue())}),de&&ht.onDidFocusEditorText(function(){de(ht.getValue())}),ue)try{window.addEventListener("paste",Fe)}catch(nr){}var rr=le();return ae(!0),function(){var nr=Ye.current.instance;nr.dispose();var dt=nr.getModel();dt&&dt.dispose(),Ye.current.subscription&&Ye.current.subscription.dispose(),ue&&window.removeEventListener("paste",Fe),rr.unobserve(we.current)}}catch(nr){debugger}})},[]),Object(d.useEffect)(function(){var bt=Ye.current.instance;if(bt&&q)return document.addEventListener("keydown",Je,!1),function(){document.removeEventListener("keydown",Je)}},[Ae,q]),Object(d.useEffect)(function(){var bt=Ye.current.instance;if(bt&&q){var ht=O(V);w.editor.setModelLanguage(bt.getModel(),ht)}},[V,q]),Object(d.useEffect)(function(){var bt=Ye.current.instance;bt&&q&&w.editor.setTheme(_e)},[_e,q]),Object(d.useEffect)(function(){var bt=Ye.current.instance;at.current=te,bt&&q&&(bt.updateOptions(Object(ne.a)({},te)),setTimeout(function(){bt.getModel().updateOptions(Object(ne.a)({},te))},200))},[JSON.stringify(te),q]),Object(d.useEffect)(function(){var bt=Ye.current.instance;bt&&q&&bt.layout()},[L,A,q]);var qe=Object(d.useState)(l(L)),Mt=Object(j.a)(qe,2),St=Mt[0],It=Mt[1],kt=Object(d.useState)(l(A)),Dt=Object(j.a)(kt,2),Ar=Dt[0],cr=Dt[1],Et=Object(ne.a)(Object(ne.a)({},z),{},{width:St,height:Ar});return f.a.createElement("div",{className:"my-monaco-editor",ref:we,style:Et})};function y(c){var u=c.width,L=u===void 0?"100%":u,S=c.height,A=S===void 0?"100%":S,P=c.original,W=c.modified,V=c.language,Z=c.options,z=Z===void 0?{}:Z,F=Object(d.useRef)(),te=Object(d.useState)(null),ie=Object(j.a)(te,2),fe=ie[0],ye=ie[1];function _e(De){var ve;return F.current&&(ve=new T.default(function(ue){var Me=Object(D.a)(ue),Qe;try{for(Me.s();!(Qe=Me.n()).done;){var He=Qe.value;(He.target.offsetHeight>0||He.target.offsetWidth>0)&&De.layout()}}catch(rt){Me.e(rt)}finally{Me.f()}}),ve.observe(F.current)),ve}Object(d.useEffect)(function(){return F.current&&Q.e(27).then(Q.t.bind(null,"M/lh",7)).then(function(De){w=De;var ve=w.editor.createDiffEditor(F.current,Object(ne.a)(Object(ne.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},z),{},{wordWrap:!0}));ye(ve);var ue=_e(ve);return function(){ve.dispose();var Me=ve.getModel();Me&&Me.dispose(),ue.unobserve(F.current)}}),function(){window.removeEventListener("keydown",checkPaste),window.removeEventListener("paste",checkPaste)}},[]),Object(d.useEffect)(function(){fe&&fe.setModel({original:w.editor.createModel(P,V),modified:w.editor.createModel(W,V)})},[P,W,V,fe]);var Le=l(L),Ae=l(A),ke={width:Le,height:Ae};return f.a.createElement("div",{className:"my-diff-editor",ref:F,style:ke})}},ZpRC:function(yt,Ee,Q){"use strict";function ne(d){return typeof d=="object"&&d!=null&&d.nodeType===1}function $(d,f){return(!f||d!=="hidden")&&d!=="visible"&&d!=="clip"}function M(d,f){if(d.clientHeight<d.scrollHeight||d.clientWidth<d.scrollWidth){var T=getComputedStyle(d,null);return $(T.overflowY,f)||$(T.overflowX,f)||function(m){var p=function(b){if(!b.ownerDocument||!b.ownerDocument.defaultView)return null;try{return b.ownerDocument.defaultView.frameElement}catch(o){return null}}(m);return!!p&&(p.clientHeight<m.scrollHeight||p.clientWidth<m.scrollWidth)}(d)}return!1}function K(d,f,T,m,p,b,o,i){return b<d&&o>f||b>d&&o<f?0:b<=d&&i<=T||o>=f&&i>=T?b-d-m:o>f&&i<T||b<d&&i>T?o-f+p:0}var I=function(d,f){var T=window,m=f.scrollMode,p=f.block,b=f.inline,o=f.boundary,i=f.skipOverflowHiddenElements,s=typeof o=="function"?o:function(Re){return Re!==o};if(!ne(d))throw new TypeError("Invalid target");for(var l=document.scrollingElement||document.documentElement,E=[],g=d;ne(g)&&s(g);){if((g=g.parentElement)===l){E.push(g);break}g!=null&&g===document.body&&M(g)&&!M(document.documentElement)||g!=null&&M(g,i)&&E.push(g)}for(var v=T.visualViewport?T.visualViewport.width:innerWidth,O=T.visualViewport?T.visualViewport.height:innerHeight,w=window.scrollX||pageXOffset,C=window.scrollY||pageYOffset,y=d.getBoundingClientRect(),c=y.height,u=y.width,L=y.top,S=y.right,A=y.bottom,P=y.left,W=p==="start"||p==="nearest"?L:p==="end"?A:L+c/2,V=b==="center"?P+u/2:b==="end"?S:P,Z=[],z=0;z<E.length;z++){var F=E[z],te=F.getBoundingClientRect(),ie=te.height,fe=te.width,ye=te.top,_e=te.right,Le=te.bottom,Ae=te.left;if(m==="if-needed"&&L>=0&&P>=0&&A<=O&&S<=v&&L>=ye&&A<=Le&&P>=Ae&&S<=_e)return Z;var ke=getComputedStyle(F),De=parseInt(ke.borderLeftWidth,10),ve=parseInt(ke.borderTopWidth,10),ue=parseInt(ke.borderRightWidth,10),Me=parseInt(ke.borderBottomWidth,10),Qe=0,He=0,rt="offsetWidth"in F?F.offsetWidth-F.clientWidth-De-ue:0,oe="offsetHeight"in F?F.offsetHeight-F.clientHeight-ve-Me:0;if(l===F)Qe=p==="start"?W:p==="end"?W-O:p==="nearest"?K(C,C+O,O,ve,Me,C+W,C+W+c,c):W-O/2,He=b==="start"?V:b==="center"?V-v/2:b==="end"?V-v:K(w,w+v,v,De,ue,w+V,w+V+u,u),Qe=Math.max(0,Qe+C),He=Math.max(0,He+w);else{Qe=p==="start"?W-ye-ve:p==="end"?W-Le+Me+oe:p==="nearest"?K(ye,Le,ie,ve,Me+oe,W,W+c,c):W-(ye+ie/2)+oe/2,He=b==="start"?V-Ae-De:b==="center"?V-(Ae+fe/2)+rt/2:b==="end"?V-_e+ue+rt:K(Ae,_e,fe,De,ue+rt,V,V+u,u);var de=F.scrollLeft,xe=F.scrollTop;W+=xe-(Qe=Math.max(0,Math.min(xe+Qe,F.scrollHeight-ie+oe))),V+=de-(He=Math.max(0,Math.min(de+He,F.scrollWidth-fe+rt)))}Z.push({el:F,top:Qe,left:He})}return Z};function D(d){return d===Object(d)&&Object.keys(d).length!==0}function j(d,f){f===void 0&&(f="auto");var T="scrollBehavior"in document.body.style;d.forEach(function(m){var p=m.el,b=m.top,o=m.left;p.scroll&&T?p.scroll({top:b,left:o,behavior:f}):(p.scrollTop=b,p.scrollLeft=o)})}function N(d){return d===!1?{block:"end",inline:"nearest"}:D(d)?d:{block:"start",inline:"nearest"}}function _(d,f){var T=!d.ownerDocument.documentElement.contains(d);if(D(f)&&typeof f.behavior=="function")return f.behavior(T?[]:I(d,f));if(T)return;var m=N(f);return j(I(d,m),m.behavior)}var k=Ee.a=_},bT9E:function(yt,Ee,Q){"use strict";Q.d(Ee,"a",function(){return $});var ne=Q("VTBJ");function $(M,K){var I=Object(ne.a)({},M);return Array.isArray(K)&&K.forEach(function(D){delete I[D]}),I}},c5Ni:function(yt,Ee,Q){},dejd:function(yt,Ee,Q){},dmUQ:function(yt,Ee,Q){"use strict";var ne=Q("Ff2n"),$=Q("rePB"),M=Q("1OyB"),K=Q("vuIU"),I=Q("Ji7U"),D=Q("md7G"),j=Q("foSv"),N=Q("q1tI"),_=Q.n(N),k=Q("TSYQ"),d=Q.n(k),f=Q("4IlW");function T(c,u){var L=Object.keys(c);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(c);u&&(S=S.filter(function(A){return Object.getOwnPropertyDescriptor(c,A).enumerable})),L.push.apply(L,S)}return L}function m(c){for(var u=1;u<arguments.length;u++){var L=arguments[u]!=null?arguments[u]:{};u%2?T(Object(L),!0).forEach(function(S){Object($.a)(c,S,L[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(c,Object.getOwnPropertyDescriptors(L)):T(Object(L)).forEach(function(S){Object.defineProperty(c,S,Object.getOwnPropertyDescriptor(L,S))})}return c}function p(c){var u=b();return function(){var S=Object(j.a)(c),A;if(u){var P=Object(j.a)(this).constructor;A=Reflect.construct(S,arguments,P)}else A=S.apply(this,arguments);return Object(D.a)(this,A)}}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,E=600,g=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,v=function(u){return u!=null},O=function(u,L){return L===u||typeof L=="number"&&typeof u=="number"&&isNaN(L)&&isNaN(u)},w=function(c){Object(I.a)(L,c);var u=p(L);function L(S){var A;Object(M.a)(this,L),A=u.call(this,S),A.onKeyDown=function(V){var Z=A.props,z=Z.onKeyDown,F=Z.onPressEnter;if(V.keyCode===f.a.UP){var te=A.getRatio(V);A.up(V,te,null),A.stop()}else if(V.keyCode===f.a.DOWN){var ie=A.getRatio(V);A.down(V,ie,null),A.stop()}else V.keyCode===f.a.ENTER&&F&&F(V);if(A.recordCursorPosition(),A.lastKeyCode=V.keyCode,z){for(var fe=arguments.length,ye=new Array(fe>1?fe-1:0),_e=1;_e<fe;_e++)ye[_e-1]=arguments[_e];z.apply(void 0,[V].concat(ye))}},A.onKeyUp=function(V){var Z=A.props.onKeyUp;if(A.stop(),A.recordCursorPosition(),Z){for(var z=arguments.length,F=new Array(z>1?z-1:0),te=1;te<z;te++)F[te-1]=arguments[te];Z.apply(void 0,[V].concat(F))}},A.onChange=function(V){var Z=A.props.onChange;A.state.focused&&(A.inputting=!0),A.rawInput=A.props.parser(A.getValueFromEvent(V)),A.setState({inputValue:A.rawInput}),Z(A.toNumber(A.rawInput))},A.onMouseUp=function(){var V=A.props.onMouseUp;A.recordCursorPosition(),V&&V.apply(void 0,arguments)},A.onFocus=function(){var V;A.setState({focused:!0}),(V=A.props).onFocus.apply(V,arguments)},A.onBlur=function(){var V=A.props.onBlur;A.inputting=!1,A.setState({focused:!1});var Z=A.getCurrentValidValue(A.state.inputValue),z=A.setValue(Z,o);if(V){var F=A.input.value,te=A.getInputDisplayValue({focus:!1,value:z});A.input.value=te&&Number(te),V.apply(void 0,arguments),A.input.value=F}},A.getRatio=function(V){var Z=1;return V.metaKey||V.ctrlKey?Z=.1:V.shiftKey&&(Z=10),Z},A.getFullNum=function(V){return isNaN(V)?V:/e/i.test(String(V))?Number(V).toFixed(18).replace(/\.?0+$/,""):V},A.getPrecision=function(V){if(v(A.props.precision))return A.props.precision;var Z=String(V);if(Z.indexOf("e-")>=0)return parseInt(Z.slice(Z.indexOf("e-")+2),10);var z=0;return Z.indexOf(".")>=0&&(z=Z.length-Z.indexOf(".")-1),z},A.getInputDisplayValue=function(V){var Z=V||A.state,z=Z.focused,F=Z.inputValue,te=Z.value,ie;z?ie=F:ie=A.toPrecisionAsStep(te),ie==null&&(ie="");var fe=A.formatWrapper(ie);return v(A.props.decimalSeparator)&&(fe=fe.toString().replace(".",A.props.decimalSeparator)),fe},A.recordCursorPosition=function(){try{A.cursorStart=A.input.selectionStart,A.cursorEnd=A.input.selectionEnd,A.currentValue=A.input.value,A.cursorBefore=A.input.value.substring(0,A.cursorStart),A.cursorAfter=A.input.value.substring(A.cursorEnd)}catch(V){}},A.restoreByAfter=function(V){if(V===void 0)return!1;var Z=A.input.value,z=Z.lastIndexOf(V);if(z===-1)return!1;var F=A.cursorBefore.length;return A.lastKeyCode===f.a.DELETE&&A.cursorBefore.charAt(F-1)===V[0]?(A.fixCaret(F,F),!0):z+V.length===Z.length?(A.fixCaret(z,z),!0):!1},A.partRestoreByAfter=function(V){return V===void 0?!1:Array.prototype.some.call(V,function(Z,z){var F=V.substring(z);return A.restoreByAfter(F)})},A.isNotCompleteNumber=function(V){return isNaN(V)||V===""||V===null||V&&V.toString().indexOf(".")===V.toString().length-1},A.stop=function(){A.autoStepTimer&&clearTimeout(A.autoStepTimer)},A.down=function(V,Z,z){A.pressingUpOrDown=!0,A.step("down",V,Z,z)},A.up=function(V,Z,z){A.pressingUpOrDown=!0,A.step("up",V,Z,z)},A.saveInput=function(V){A.input=V};var P=S.value;P===void 0&&(P=S.defaultValue),A.state={focused:S.autoFocus};var W=A.getValidValue(A.toNumber(P));return A.state=m(m({},A.state),{},{inputValue:A.toPrecisionAsStep(W),value:W}),A}return Object(K.a)(L,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(A){var P=this.props,W=P.value,V=P.onChange,Z=P.max,z=P.min,F=this.state.focused;if(A){if(!O(A.value,W)||!O(A.max,Z)||!O(A.min,z)){var te=F?W:this.getValidValue(W),ie;this.pressingUpOrDown?ie=te:this.inputting?ie=this.rawInput:ie=this.toPrecisionAsStep(te),this.setState({value:te,inputValue:ie})}var fe="value"in this.props?W:this.state.value;"max"in this.props&&A.max!==Z&&typeof fe=="number"&&fe>Z&&V&&V(Z),"min"in this.props&&A.min!==z&&typeof fe=="number"&&fe<z&&V&&V(z)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var ye=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===f.a.BACKSPACE?ye=this.cursorStart-1:this.lastKeyCode===f.a.DELETE&&(ye=this.cursorStart):ye=this.input.value.length,this.fixCaret(ye,ye)}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(_e){}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(A){var P=A;return P===""?P="":this.isNotCompleteNumber(parseFloat(P))?P=this.state.value:P=this.getValidValue(P),this.toNumber(P)}},{key:"getValueFromEvent",value:function(A){var P=A.target.value.trim().replace(/。/g,".");return v(this.props.decimalSeparator)&&(P=P.replace(this.props.decimalSeparator,".")),P}},{key:"getValidValue",value:function(A){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,W=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,V=parseFloat(A);return isNaN(V)?A:(V<P&&(V=P),V>W&&(V=W),V)}},{key:"setValue",value:function(A,P){var W=this.props.precision,V=this.isNotCompleteNumber(parseFloat(A))?null:parseFloat(A),Z=this.state.value,z=Z===void 0?null:Z,F=this.state.inputValue,te=F===void 0?null:F,ie=typeof V=="number"?V.toFixed(W):"".concat(V),fe=V!==z||ie!=="".concat(te);return"value"in this.props?(te=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:te},P)):this.setState({value:V,inputValue:this.toPrecisionAsStep(A)},P),fe&&this.props.onChange(V),V}},{key:"getMaxPrecision",value:function(A){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,W=this.props,V=W.precision,Z=W.step;if(v(V))return V;var z=this.getPrecision(P),F=this.getPrecision(Z),te=this.getPrecision(A);return A?Math.max(te,z+F):z+F}},{key:"getPrecisionFactor",value:function(A){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,W=this.getMaxPrecision(A,P);return Math.pow(10,W)}},{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(A){return this.props.formatter?this.props.formatter(A):A}},{key:"toPrecisionAsStep",value:function(A){if(this.isNotCompleteNumber(A)||A==="")return A;var P=Math.abs(this.getMaxPrecision(A));return isNaN(P)?A.toString():Number(A).toFixed(P)}},{key:"toNumber",value:function(A){var P=this.props.precision,W=this.state.focused,V=A&&A.length>16&&W;return this.isNotCompleteNumber(A)||V?A:v(P)?Math.round(A*Math.pow(10,P))/Math.pow(10,P):Number(A)}},{key:"upStep",value:function(A,P){var W=this.props.step,V=this.getPrecisionFactor(A,P),Z=Math.abs(this.getMaxPrecision(A,P)),z=((V*A+V*W*P)/V).toFixed(Z);return this.toNumber(z)}},{key:"downStep",value:function(A,P){var W=this.props.step,V=this.getPrecisionFactor(A,P),Z=Math.abs(this.getMaxPrecision(A,P)),z=((V*A-V*W*P)/V).toFixed(Z);return this.toNumber(z)}},{key:"step",value:function(A,P){var W=this,V=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,Z=arguments.length>3?arguments[3]:void 0;this.stop(),P&&(P.persist(),P.preventDefault());var z=this.props;if(z.disabled)return;var F=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(F))return;var te=this["".concat(A,"Step")](F,V),ie=te>z.max||te<z.min;if(te>z.max?te=z.max:te<z.min&&(te=z.min),this.setValue(te,null),this.setState({focused:!0},function(){W.pressingUpOrDown=!1}),ie)return;this.autoStepTimer=setTimeout(function(){W[A](P,V,!0)},Z?l:E)}},{key:"fixCaret",value:function(A,P){if(A===void 0||P===void 0||!this.input||!this.input.value)return;try{var W=this.input.selectionStart,V=this.input.selectionEnd;(A!==W||P!==V)&&this.input.setSelectionRange(A,P)}catch(Z){}}},{key:"render",value:function(){var A,P=this.props,W=P.prefixCls,V=P.disabled,Z=P.readOnly,z=P.useTouch,F=P.autoComplete,te=P.upHandler,ie=P.downHandler,fe=P.className,ye=P.max,_e=P.min,Le=P.style,Ae=P.title,ke=P.onMouseEnter,De=P.onMouseLeave,ve=P.onMouseOver,ue=P.onMouseOut,Me=P.required,Qe=P.onClick,He=P.tabIndex,rt=P.type,oe=P.placeholder,de=P.id,xe=P.inputMode,Re=P.pattern,Ie=P.step,Ne=P.maxLength,Ge=P.autoFocus,ze=P.name,ut=P.onPaste,Ke=P.onInput,Be=Object(ne.a)(P,["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"]),Xe=this.state,tt=Xe.value,Ze=Xe.focused,it=d()(W,(A={},Object($.a)(A,fe,!!fe),Object($.a)(A,"".concat(W,"-disabled"),V),Object($.a)(A,"".concat(W,"-focused"),Ze),A)),we={};Object.keys(Be).forEach(function(le){(le.substr(0,5)==="data-"||le.substr(0,5)==="aria-"||le==="role")&&(we[le]=Be[le])});var Ye=!Z&&!V,at=this.getInputDisplayValue(null),Oe=(tt||tt===0)&&(isNaN(tt)||Number(tt)>=ye),je=(tt||tt===0)&&(isNaN(tt)||Number(tt)<=_e),ge=Oe||V||Z,he=je||V||Z,ce=d()("".concat(W,"-handler"),"".concat(W,"-handler-up"),Object($.a)({},"".concat(W,"-handler-up-disabled"),ge)),re=d()("".concat(W,"-handler"),"".concat(W,"-handler-down"),Object($.a)({},"".concat(W,"-handler-down-disabled"),he)),q=z?{onTouchStart:ge?o:this.up,onTouchEnd:this.stop}:{onMouseDown:ge?o:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},ae=z?{onTouchStart:he?o:this.down,onTouchEnd:this.stop}:{onMouseDown:he?o:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return _.a.createElement("div",{className:it,style:Le,title:Ae,onMouseEnter:ke,onMouseLeave:De,onMouseOver:ve,onMouseOut:ue,onFocus:function(){return null},onBlur:function(){return null}},_.a.createElement("div",{className:"".concat(W,"-handler-wrap")},_.a.createElement("span",Object.assign({unselectable:"on"},q,{role:"button","aria-label":"Increase Value","aria-disabled":ge,className:ce}),te||_.a.createElement("span",{unselectable:"on",className:"".concat(W,"-handler-up-inner"),onClick:i})),_.a.createElement("span",Object.assign({unselectable:"on"},ae,{role:"button","aria-label":"Decrease Value","aria-disabled":he,className:re}),ie||_.a.createElement("span",{unselectable:"on",className:"".concat(W,"-handler-down-inner"),onClick:i}))),_.a.createElement("div",{className:"".concat(W,"-input-wrap")},_.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":_e,"aria-valuemax":ye,"aria-valuenow":tt,required:Me,type:rt,placeholder:oe,onPaste:ut,onClick:Qe,onMouseUp:this.onMouseUp,className:"".concat(W,"-input"),tabIndex:He,autoComplete:F,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Ye?this.onKeyDown:o,onKeyUp:Ye?this.onKeyUp:o,autoFocus:Ge,maxLength:Ne,readOnly:Z,disabled:V,max:ye,min:_e,step:Ie,name:ze,title:Ae,id:de,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(at),pattern:Re,inputMode:xe,onInput:Ke},we))))}}]),L}(_.a.Component);w.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:g,min:-g,step:1,style:{},onChange:o,onKeyDown:o,onPressEnter:o,onFocus:o,onBlur:o,parser:s,required:!1,autoComplete:"off"};var C=w,y=Ee.a=C},fjLI:function(yt,Ee,Q){"use strict";Q.d(Ee,"e",function(){return k}),Q.d(Ee,"a",function(){return d}),Q.d(Ee,"c",function(){return f}),Q.d(Ee,"d",function(){return m}),Q.d(Ee,"b",function(){return p});var ne=Q("8HAY"),$=Q("Cg/j"),M=Q("T8No"),K=Q("nnTU"),I=Q("MI8n"),D=function(){var b=function(o,i){return b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,l){s.__proto__=l}||function(s,l){for(var E in l)l.hasOwnProperty(E)&&(s[E]=l[E])},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)}}(),j=function(b,o,i,s){var l=arguments.length,E=l<3?o:s===null?s=Object.getOwnPropertyDescriptor(o,i):s,g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(b,o,i,s);else for(var v=b.length-1;v>=0;v--)(g=b[v])&&(E=(l<3?g(E):l>3?g(o,i,E):g(o,i))||E);return l>3&&E&&Object.defineProperty(o,i,E),E},N=function(b,o){return function(i,s){o(i,s,b)}},_=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 E=arguments[o],g=0,v=E.length;g<v;g++,l++)s[l]=E[g];return s};function k(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 E=l.indexOf(i);E>=0&&(l.splice(E,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(w){return k(w)}),l=0,E=s;l<E.length;l++){var g=E[l],v=g.command,O=g.alt;i.add(v.id),O&&i.add(O.id)}this._commands.forEach(function(w,C){i.has(C)||o.push({command:w})})},b}()),T=function(b){D(o,b);function o(i,s,l){var E=b.call(this,i,s)||this;return E._commandService=l,E}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,_([this.id],s))},o=j([N(2,K.b)],o),o}(ne.a),m=function(b){D(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}(ne.a),p=function(b){D(o,b);function o(i,s,l,E,g){var v=this;return typeof i.title=="string"?v=b.call(this,i.id,i.title,g)||this:v=b.call(this,i.id,i.title.value,g)||this,v._cssClass=void 0,v._enabled=!i.precondition||E.contextMatchesRules(i.precondition),v._checked=Boolean(i.toggled&&E.contextMatchesRules(i.toggled)),v._options=l||{},v.item=i,v.alt=s?new o(s,void 0,v._options,E,g):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=_(l,[this._options.arg])),this._options.shouldForwardArgs&&(l=_(l,i)),b.prototype.run.apply(this,l)},o=j([N(3,M.c),N(4,K.b)],o),o}(T)},kSUc:function(yt,Ee,Q){},"kaH+":function(yt,Ee,Q){"use strict";var ne=Q("+L6B"),$=Q("2/Rp"),M=Q("tJVT"),K=Q("q1tI"),I=Q.n(K),D=Q("XFxt"),j=Q.n(D),N=Q("dhSg"),_=Q("rLCj"),k=Q("dF/Y"),d=Q("4i/N");Ee.a=function(){var f=Object(K.useState)(""),T=Object(M.a)(f,2),m=T[0],p=T[1],b=Object(K.useState)(0),o=Object(M.a)(b,2),i=o[0],s=o[1],l=Object(K.useRef)("");Object(K.useEffect)(function(){var O=N.a.subscribe("preview-image",function(w){p(w),document.body.style.overflow="hidden"});return O},[]),Object(K.useEffect)(function(){return document.addEventListener("keydown",E),function(){document.removeEventListener("keydown",E)}},[]),Object(K.useEffect)(function(){l.current=m},[m]);function E(O){O.keyCode==27&&l.current&&g()}function g(){document.body.style.overflow="auto",p("")}function v(){s(i+90)}return I.a.createElement(K.Fragment,null,m?I.a.createElement("div",{className:j.a["image-preview-container"]},I.a.createElement("div",{className:j.a["button-group"]},I.a.createElement($.a,{onClick:v},"\u65CB\u8F6C",I.a.createElement(_.a,null)),I.a.createElement($.a,{href:m},"\u4E0B\u8F7D",I.a.createElement(k.a,null)),I.a.createElement($.a,{onClick:g},"\u5173\u95ED",I.a.createElement(d.a,null))),I.a.createElement("div",{className:j.a["preview-wrp-group"]},I.a.createElement("img",{className:j.a["image-preview"],src:m,alt:"\u9884\u89C8\u5927\u56FE",style:{transform:"rotate(".concat(i,"deg)")}}))):null)}},lZu9:function(yt,Ee,Q){(function(ne){ne(Q("VrN/"),Q("1eCo"),Q("8EBN"))})(function(ne){"use strict";ne.defineMode("markdown",function($,M){var K=ne.getMode($,"text/html"),I=K.name=="null";function D(z){if(ne.findModeByName){var F=ne.findModeByName(z);F&&(z=F.mime||F.mimes[0])}var te=ne.getMode($,z);return te.name=="null"?null:te}M.highlightFormatting===void 0&&(M.highlightFormatting=!1),M.maxBlockquoteDepth===void 0&&(M.maxBlockquoteDepth=0),M.taskLists===void 0&&(M.taskLists=!1),M.strikethrough===void 0&&(M.strikethrough=!1),M.emoji===void 0&&(M.emoji=!1),M.fencedCodeBlockHighlighting===void 0&&(M.fencedCodeBlockHighlighting=!0),M.fencedCodeBlockDefaultMode===void 0&&(M.fencedCodeBlockDefaultMode="text/plain"),M.xml===void 0&&(M.xml=!0),M.tokenTypeOverrides===void 0&&(M.tokenTypeOverrides={});var j={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 j)j.hasOwnProperty(N)&&M.tokenTypeOverrides[N]&&(j[N]=M.tokenTypeOverrides[N]);var _=/^([*\-_])(?:\s*\1){2,}\s*$/,k=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,d=/^\[(x| )\](?=\s)/i,f=M.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,T=/^ {0,3}(?:\={1,}|-{2,})\s*$/,m=/^[^#!\[\]*_\\<>` "'(~:]+/,p=/^(~~~+|```+)[ \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(z,F,te){return F.f=F.inline=te,te(z,F)}function l(z,F,te){return F.f=F.block=te,te(z,F)}function E(z){return!z||!/\S/.test(z.string)}function g(z){if(z.linkTitle=!1,z.linkHref=!1,z.linkText=!1,z.em=!1,z.strong=!1,z.strikethrough=!1,z.quote=0,z.indentedCode=!1,z.f==O){var F=I;if(!F){var te=ne.innerMode(K,z.htmlState);F=te.mode.name=="xml"&&te.state.tagStart===null&&!te.state.context&&te.state.tokenize.isInText}F&&(z.f=c,z.block=v,z.htmlState=null)}return z.trailingSpace=0,z.trailingSpaceNewLine=!1,z.prevLine=z.thisLine,z.thisLine={stream:null},null}function v(z,F){var te=z.column()===F.indentation,ie=E(F.prevLine.stream),fe=F.indentedCode,ye=F.prevLine.hr,_e=F.list!==!1,Le=(F.listStack[F.listStack.length-1]||0)+3;F.indentedCode=!1;var Ae=F.indentation;if(F.indentationDiff===null&&(F.indentationDiff=F.indentation,_e)){for(F.list=null;Ae<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=Ae-F.listStack[F.listStack.length-1])}var ke=!ie&&!ye&&!F.prevLine.header&&(!_e||!fe)&&!F.prevLine.fencedCodeEnd,De=(F.list===!1||ye||ie)&&F.indentation<=Le&&z.match(_),ve=null;if(F.indentationDiff>=4&&(fe||F.prevLine.fencedCodeEnd||F.prevLine.header||ie))return z.skipToEnd(),F.indentedCode=!0,j.code;if(z.eatSpace())return null;if(te&&F.indentation<=Le&&(ve=z.match(f))&&ve[1].length<=6)return F.quote=0,F.header=ve[1].length,F.thisLine.header=!0,M.highlightFormatting&&(F.formatting="header"),F.f=F.inline,C(F);if(F.indentation<=Le&&z.eat(">"))return F.quote=te?1:F.quote+1,M.highlightFormatting&&(F.formatting="quote"),z.eatSpace(),C(F);if(!De&&!F.setext&&te&&F.indentation<=Le&&(ve=z.match(k))){var ue=ve[1]?"ol":"ul";return F.indentation=Ae+z.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,M.taskLists&&z.match(d,!1)&&(F.taskList=!0),F.f=F.inline,M.highlightFormatting&&(F.formatting=["list","list-"+ue]),C(F)}else{if(te&&F.indentation<=Le&&(ve=z.match(p,!0)))return F.quote=0,F.fencedEndRE=new RegExp(ve[1]+"+ *$"),F.localMode=M.fencedCodeBlockHighlighting&&D(ve[2]||M.fencedCodeBlockDefaultMode),F.localMode&&(F.localState=ne.startState(F.localMode)),F.f=F.block=w,M.highlightFormatting&&(F.formatting="code-block"),F.code=-1,C(F);if(F.setext||(!ke||!_e)&&!F.quote&&F.list===!1&&!F.code&&!De&&!b.test(z.string)&&(ve=z.lookAhead(1))&&(ve=ve.match(T)))return F.setext?(F.header=F.setext,F.setext=0,z.skipToEnd(),M.highlightFormatting&&(F.formatting="header")):(F.header=ve[0].charAt(0)=="="?1:2,F.setext=F.header),F.thisLine.header=!0,F.f=F.inline,C(F);if(De)return z.skipToEnd(),F.hr=!0,F.thisLine.hr=!0,j.hr;if(z.peek()==="[")return s(z,F,P)}return s(z,F,F.inline)}function O(z,F){var te=K.token(z,F.htmlState);if(!I){var ie=ne.innerMode(K,F.htmlState);(ie.mode.name=="xml"&&ie.state.tagStart===null&&!ie.state.context&&ie.state.tokenize.isInText||F.md_inside&&z.current().indexOf(">")>-1)&&(F.f=c,F.block=v,F.htmlState=null)}return te}function w(z,F){var te=F.listStack[F.listStack.length-1]||0,ie=F.indentation<te,fe=te+3;if(F.fencedEndRE&&F.indentation<=fe&&(ie||z.match(F.fencedEndRE))){M.highlightFormatting&&(F.formatting="code-block");var ye;return ie||(ye=C(F)),F.localMode=F.localState=null,F.block=v,F.f=c,F.fencedEndRE=null,F.code=0,F.thisLine.fencedCodeEnd=!0,ie?l(z,F,F.block):ye}else return F.localMode?F.localMode.token(z,F.localState):(z.skipToEnd(),j.code)}function C(z){var F=[];if(z.formatting){F.push(j.formatting),typeof z.formatting=="string"&&(z.formatting=[z.formatting]);for(var te=0;te<z.formatting.length;te++)F.push(j.formatting+"-"+z.formatting[te]),z.formatting[te]==="header"&&F.push(j.formatting+"-"+z.formatting[te]+"-"+z.header),z.formatting[te]==="quote"&&(!M.maxBlockquoteDepth||M.maxBlockquoteDepth>=z.quote?F.push(j.formatting+"-"+z.formatting[te]+"-"+z.quote):F.push("error"))}if(z.taskOpen)return F.push("meta"),F.length?F.join(" "):null;if(z.taskClosed)return F.push("property"),F.length?F.join(" "):null;if(z.linkHref?F.push(j.linkHref,"url"):(z.strong&&F.push(j.strong),z.em&&F.push(j.em),z.strikethrough&&F.push(j.strikethrough),z.emoji&&F.push(j.emoji),z.linkText&&F.push(j.linkText),z.code&&F.push(j.code),z.image&&F.push(j.image),z.imageAltText&&F.push(j.imageAltText,"link"),z.imageMarker&&F.push(j.imageMarker)),z.header&&F.push(j.header,j.header+"-"+z.header),z.quote&&(F.push(j.quote),!M.maxBlockquoteDepth||M.maxBlockquoteDepth>=z.quote?F.push(j.quote+"-"+z.quote):F.push(j.quote+"-"+M.maxBlockquoteDepth)),z.list!==!1){var ie=(z.listStack.length-1)%3;ie?ie===1?F.push(j.list2):F.push(j.list3):F.push(j.list1)}return z.trailingSpaceNewLine?F.push("trailing-space-new-line"):z.trailingSpace&&F.push("trailing-space-"+(z.trailingSpace%2?"a":"b")),F.length?F.join(" "):null}function y(z,F){return z.match(m,!0)?C(F):void 0}function c(z,F){var te=F.text(z,F);if(typeof te!="undefined")return te;if(F.list)return F.list=null,C(F);if(F.taskList){var ie=z.match(d,!0)[1]===" ";return ie?F.taskOpen=!0:F.taskClosed=!0,M.highlightFormatting&&(F.formatting="task"),F.taskList=!1,C(F)}if(F.taskOpen=!1,F.taskClosed=!1,F.header&&z.match(/^#+$/,!0))return M.highlightFormatting&&(F.formatting="header"),C(F);var fe=z.next();if(F.linkTitle){F.linkTitle=!1;var ye=fe;fe==="("&&(ye=")"),ye=(ye+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var _e="^\\s*(?:[^"+ye+"\\\\]+|\\\\\\\\|\\\\.)"+ye;if(z.match(new RegExp(_e),!0))return j.linkHref}if(fe==="`"){var Le=F.formatting;M.highlightFormatting&&(F.formatting="code"),z.eatWhile("`");var Ae=z.current().length;if(F.code==0&&(!F.quote||Ae==1))return F.code=Ae,C(F);if(Ae==F.code){var ke=C(F);return F.code=0,ke}else return F.formatting=Le,C(F)}else if(F.code)return C(F);if(fe==="\\"&&(z.next(),M.highlightFormatting)){var De=C(F),ve=j.formatting+"-escape";return De?De+" "+ve:ve}if(fe==="!"&&z.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return F.imageMarker=!0,F.image=!0,M.highlightFormatting&&(F.formatting="image"),C(F);if(fe==="["&&F.imageMarker&&z.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return F.imageMarker=!1,F.imageAltText=!0,M.highlightFormatting&&(F.formatting="image"),C(F);if(fe==="]"&&F.imageAltText){M.highlightFormatting&&(F.formatting="image");var De=C(F);return F.imageAltText=!1,F.image=!1,F.inline=F.f=L,De}if(fe==="["&&!F.image)return F.linkText&&z.match(/^.*?\]/)||(F.linkText=!0,M.highlightFormatting&&(F.formatting="link")),C(F);if(fe==="]"&&F.linkText){M.highlightFormatting&&(F.formatting="link");var De=C(F);return F.linkText=!1,F.inline=F.f=z.match(/\(.*?\)| ?\[.*?\]/,!1)?L:c,De}if(fe==="<"&&z.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){F.f=F.inline=u,M.highlightFormatting&&(F.formatting="link");var De=C(F);return De?De+=" ":De="",De+j.linkInline}if(fe==="<"&&z.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){F.f=F.inline=u,M.highlightFormatting&&(F.formatting="link");var De=C(F);return De?De+=" ":De="",De+j.linkEmail}if(M.xml&&fe==="<"&&z.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var ue=z.string.indexOf(">",z.pos);if(ue!=-1){var Me=z.string.substring(z.start,ue);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Me)&&(F.md_inside=!0)}return z.backUp(1),F.htmlState=ne.startState(K),l(z,F,O)}if(M.xml&&fe==="<"&&z.match(/^\/\w*?>/))return F.md_inside=!1,"tag";if(fe==="*"||fe==="_"){for(var Qe=1,He=z.pos==1?" ":z.string.charAt(z.pos-2);Qe<3&&z.eat(fe);)Qe++;var rt=z.peek()||" ",oe=!/\s/.test(rt)&&(!o.test(rt)||/\s/.test(He)||o.test(He)),de=!/\s/.test(He)&&(!o.test(He)||/\s/.test(rt)||o.test(rt)),xe=null,Re=null;if(Qe%2&&(!F.em&&oe&&(fe==="*"||!de||o.test(He))?xe=!0:F.em==fe&&de&&(fe==="*"||!oe||o.test(rt))&&(xe=!1)),Qe>1&&(!F.strong&&oe&&(fe==="*"||!de||o.test(He))?Re=!0:F.strong==fe&&de&&(fe==="*"||!oe||o.test(rt))&&(Re=!1)),Re!=null||xe!=null){M.highlightFormatting&&(F.formatting=xe==null?"strong":Re==null?"em":"strong em"),xe===!0&&(F.em=fe),Re===!0&&(F.strong=fe);var ke=C(F);return xe===!1&&(F.em=!1),Re===!1&&(F.strong=!1),ke}}else if(fe===" "&&(z.eat("*")||z.eat("_"))){if(z.peek()===" ")return C(F);z.backUp(1)}if(M.strikethrough){if(fe==="~"&&z.eatWhile(fe)){if(F.strikethrough){M.highlightFormatting&&(F.formatting="strikethrough");var ke=C(F);return F.strikethrough=!1,ke}else if(z.match(/^[^\s]/,!1))return F.strikethrough=!0,M.highlightFormatting&&(F.formatting="strikethrough"),C(F)}else if(fe===" "&&z.match(/^~~/,!0)){if(z.peek()===" ")return C(F);z.backUp(2)}}if(M.emoji&&fe===":"&&z.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){F.emoji=!0,M.highlightFormatting&&(F.formatting="emoji");var Ie=C(F);return F.emoji=!1,Ie}return fe===" "&&(z.match(/^ +$/,!1)?F.trailingSpace++:F.trailingSpace&&(F.trailingSpaceNewLine=!0)),C(F)}function u(z,F){var te=z.next();if(te===">"){F.f=F.inline=c,M.highlightFormatting&&(F.formatting="link");var ie=C(F);return ie?ie+=" ":ie="",ie+j.linkInline}return z.match(/^[^>]+/,!0),j.linkInline}function L(z,F){if(z.eatSpace())return null;var te=z.next();return te==="("||te==="["?(F.f=F.inline=A(te==="("?")":"]"),M.highlightFormatting&&(F.formatting="link-string"),F.linkHref=!0,C(F)):"error"}var S={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function A(z){return function(F,te){var ie=F.next();if(ie===z){te.f=te.inline=c,M.highlightFormatting&&(te.formatting="link-string");var fe=C(te);return te.linkHref=!1,fe}return F.match(S[z]),te.linkHref=!0,C(te)}}function P(z,F){return z.match(/^([^\]\\]|\\.)*\]:/,!1)?(F.f=W,z.next(),M.highlightFormatting&&(F.formatting="link"),F.linkText=!0,C(F)):s(z,F,c)}function W(z,F){if(z.match(/^\]:/,!0)){F.f=F.inline=V,M.highlightFormatting&&(F.formatting="link");var te=C(F);return F.linkText=!1,te}return z.match(/^([^\]\\]|\\.)+/,!0),j.linkText}function V(z,F){return z.eatSpace()?null:(z.match(/^[^\s]+/,!0),z.peek()===void 0?F.linkTitle=!0:z.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),F.f=F.inline=c,j.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(z){return{f:z.f,prevLine:z.prevLine,thisLine:z.thisLine,block:z.block,htmlState:z.htmlState&&ne.copyState(K,z.htmlState),indentation:z.indentation,localMode:z.localMode,localState:z.localMode?ne.copyState(z.localMode,z.localState):null,inline:z.inline,text:z.text,formatting:!1,linkText:z.linkText,linkTitle:z.linkTitle,linkHref:z.linkHref,code:z.code,em:z.em,strong:z.strong,strikethrough:z.strikethrough,emoji:z.emoji,header:z.header,setext:z.setext,hr:z.hr,taskList:z.taskList,list:z.list,listStack:z.listStack.slice(0),quote:z.quote,indentedCode:z.indentedCode,trailingSpace:z.trailingSpace,trailingSpaceNewLine:z.trailingSpaceNewLine,md_inside:z.md_inside,fencedEndRE:z.fencedEndRE}},token:function(z,F){if(F.formatting=!1,z!=F.thisLine.stream){if(F.header=0,F.hr=!1,z.match(/^\s*$/,!0))return g(F),null;if(F.prevLine=F.thisLine,F.thisLine={stream:z},F.taskList=!1,F.trailingSpace=0,F.trailingSpaceNewLine=!1,!F.localState&&(F.f=F.block,F.f!=O)){var te=z.match(/^\s*/,!0)[0].replace(/\t/g,i).length;if(F.indentation=te,F.indentationDiff=null,te>0)return null}}return F.f(z,F)},innerMode:function(z){return z.block==O?{state:z.htmlState,mode:K}:z.localState?{state:z.localState,mode:z.localMode}:{state:z,mode:Z}},indent:function(z,F,te){return z.block==O&&K.indent?K.indent(z.htmlState,F,te):z.localState&&z.localMode.indent?z.localMode.indent(z.localState,F,te):ne.Pass},blankLine:g,getType:C,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return Z},"xml"),ne.defineMIME("text/markdown","markdown"),ne.defineMIME("text/x-markdown","markdown")})},nnTU:function(yt,Ee,Q){"use strict";Q.d(Ee,"b",function(){return N}),Q.d(Ee,"a",function(){return _});var ne=Q("pmY6"),$=Q("746U"),M=Q("Cg/j"),K=Q("MI8n"),I=Q("24hK"),D=Q("QDVR"),j=function(){for(var k=0,d=0,f=arguments.length;d<f;d++)k+=arguments[d].length;for(var T=Array(k),m=0,d=0;d<f;d++)for(var p=arguments[d],b=0,o=p.length;b<o;b++,m++)T[m]=p[b];return T},N=Object(M.c)("commandService"),_=new(function(){function k(){this._commands=new Map,this._onDidRegisterCommand=new K.a,this.onDidRegisterCommand=this._onDidRegisterCommand.event}return k.prototype.registerCommand=function(d,f){var T=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 m=[],p=0,b=d.description.args;p<b.length;p++){var o=b[p];m.push(o.constraint)}var i=d.handler;d.handler=function(v){for(var O=[],w=1;w<arguments.length;w++)O[w-1]=arguments[w];return Object($.m)(O,m),i.apply(void 0,j([v],O))}}var s=d.id,l=this._commands.get(s);l||(l=new I.a,this._commands.set(s,l));var E=l.unshift(d),g=Object(ne.h)(function(){E();var v=T._commands.get(s);(v==null?void 0:v.isEmpty())&&T._commands.delete(s)});return this._onDidRegisterCommand.fire(s),g},k.prototype.registerCommandAlias=function(d,f){return _.registerCommand(d,function(T){for(var m,p=[],b=1;b<arguments.length;b++)p[b-1]=arguments[b];return(m=T.get(N)).executeCommand.apply(m,j([f],p))})},k.prototype.getCommand=function(d){var f=this._commands.get(d);return!f||f.isEmpty()?void 0:f.iterator().next().value},k.prototype.getCommands=function(){for(var d=new Map,f=0,T=Object(D.d)(this._commands);f<T.length;f++){var m=T[f],p=this.getCommand(m);p&&d.set(m,p)}return d},k}())},osHv:function(yt,Ee,Q){(function(ne){ne(Q("VrN/"))})(function(ne){"use strict";var $=ne.Pos;function M(o,i){return o.line-i.line||o.ch-i.ch}var K="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=K+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",D=new RegExp("<(/?)(["+K+"]["+I+"]*)","g");function j(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 _(o){return o.line>=o.max?void 0:(o.ch=0,o.text=o.cm.getLine(++o.line),!0)}function k(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(_(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(k(o))continue;return}if(!N(o,i+1)){o.ch=i;continue}D.lastIndex=i,o.ch=i;var s=D.exec(o.text);if(s&&s.index==i)return s}}function T(o){for(;;){D.lastIndex=o.ch;var i=D.exec(o.text);if(!i){if(_(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 m(o){for(;;){var i=o.ch?o.text.lastIndexOf(">",o.ch-1):-1;if(i==-1){if(k(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 p(o,i){for(var s=[];;){var l=T(o),E,g=o.line,v=o.ch-(l?l[0].length:0);if(!l||!(E=d(o)))return;if(E=="selfClose")continue;if(l[1]){for(var O=s.length-1;O>=0;--O)if(s[O]==l[2]){s.length=O;break}if(O<0&&(!i||i==l[2]))return{tag:l[2],from:$(g,v),to:$(o.line,o.ch)}}else s.push(l[2])}}function b(o,i){for(var s=[];;){var l=m(o);if(!l)return;if(l=="selfClose"){f(o);continue}var E=o.line,g=o.ch,v=f(o);if(!v)return;if(v[1])s.push(v[2]);else{for(var O=s.length-1;O>=0;--O)if(s[O]==v[2]){s.length=O;break}if(O<0&&(!i||i==v[2]))return{tag:v[2],from:$(o.line,o.ch),to:$(E,g)}}}}ne.registerHelper("fold","xml",function(o,i){for(var s=new j(o,i.line,0);;){var l=T(s);if(!l||s.line!=i.line)return;var E=d(s);if(!E)return;if(!l[1]&&E!="selfClose"){var g=$(s.line,s.ch),v=p(s,l[2]);return v&&M(v.from,g)>0?{from:g,to:v.from}:null}}}),ne.findMatchingTag=function(o,i,s){var l=new j(o,i.line,i.ch,s);if(l.text.indexOf(">")==-1&&l.text.indexOf("<")==-1)return;var E=d(l),g=E&&$(l.line,l.ch),v=E&&f(l);if(!E||!v||M(l,i)>0)return;var O={from:$(l.line,l.ch),to:g,tag:v[2]};return E=="selfClose"?{open:O,close:null,at:"open"}:v[1]?{open:b(l,v[2]),close:O,at:"close"}:(l=new j(o,g.line,g.ch,s),{open:O,close:p(l,v[2]),at:"open"})},ne.findEnclosingTag=function(o,i,s,l){for(var E=new j(o,i.line,i.ch,s);;){var g=b(E,l);if(!g)break;var v=new j(o,i.line,i.ch,s),O=p(v,g.tag);if(O)return{open:g,close:O}}},ne.scanForClosingTag=function(o,i,s,l){var E=new j(o,i.line,i.ch,l?{from:0,to:l}:null);return p(E,s)}})},p5ED:function(yt,Ee,Q){"use strict";var ne=Q("+L6B"),$=Q("2/Rp"),M=Q("5Dmo"),K=Q("3S7+"),I=Q("k1fw"),D=Q("9og8"),j=Q("tJVT"),N=Q("WmNS"),_=Q.n(N),k=Q("q1tI"),d=Q.n(k),f=Q("vHTk"),T=Q.n(f),m=Q("yEEn"),p=Q("ZW9T"),b=Q("1vsH"),o=Q("V0Rq"),i=Q("m3rI");Ee.a=function(s){var l,E,g,v,O,w,C=s.editOffice,y=C===void 0?"view":C,c=s.name,u=s.data,L=s.theme,S=s.type,A=s.filename,P=s.monacoEditor,W=s.className,V=s.style,Z=s.close,z=s.onClose,F=s.hasMask,te=s.disabledDownload,ie=s.onImgDimensions,fe=s.otherData,ye=Object(k.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),_e=Object(j.a)(ye,2),Le=_e[0],Ae=_e[1],ke=Object(k.useState)(""),De=Object(j.a)(ke,2),ve=De[0],ue=De[1],Me=Object(k.useState)(),Qe=Object(j.a)(Me,2),He=Qe[0],rt=Qe[1],oe=window.ENV==="build"?"/react/build":"",de=location.host.startsWith("localhost")?i.a.PROXY_SERVER:i.a.API_SERVER,xe,Re=1024*1024,Ie=10*Re,Ne=Object(k.useRef)();(l=u)!==null&&l!==void 0&&l.startsWith("/api")&&S!=="txt"&&(u=i.a.API_SERVER+u),S==="office"&&(xe=Object(b.P)(u).filesize,xe>Ie&&(S="other")),A&&(P.filename=A),Object(k.useEffect)(function(){var Ke,Be,Xe=(Ke=document.cookie)===null||Ke===void 0||((Be=Ke.replace(/\s/g,""))===null||Be===void 0)?void 0:Be.split(";");Xe==null||Xe.map(function(tt){var Ze=tt.split("=");Ze[0]==="_educoder_session"&&ue(Ze[1])})},[]),Object(k.useEffect)(function(){S==="office"&&Ge()},[S,u]);var Ge=function(){var Ke=Object(D.a)(_.a.mark(function Be(){var Xe,tt,Ze;return _.a.wrap(function(we){for(;;)switch(we.prev=we.next){case 0:return console.log("data:",u),Xe=u,u.startsWith("http")||(Xe=location.origin+Xe),tt=new URL(Xe).pathname.split("/").pop(),we.next=6,Object(o.U)({attachment_id:tt});case 6:Ze=we.sent,rt(Ze);case 8:case"end":return we.stop()}},Be)}));return function(){return Ke.apply(this,arguments)}}(),ze=function(){if(u.startsWith("http")||u.startsWith("blob:")){ut();return}Object(b.x)(A||"educoder",u,A)},ut=function(){Object(b.v)(A||"educoder",decodeURIComponent(u))};return d.a.createElement("div",{style:Object(I.a)({},V||{}),className:"".concat(F&&T.a.bgBlack," ").concat(S?T.a.wrp:"hide")},Z&&d.a.createElement("div",{className:T.a.close,ref:Ne},!!ie&&d.a.createElement(K.a,{title:"\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",getPopupContainer:function(){return Ne.current}},d.a.createElement("span",{onClick:function(){z(),ie()}},d.a.createElement("i",{className:"icon-yulanpizhu"}))),!te&&d.a.createElement(K.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return Ne.current}},d.a.createElement("span",{onClick:ut},d.a.createElement("i",{className:"icon-quxiaozhiding"}))),d.a.createElement(K.a,{title:"\u5173\u95ED",getPopupContainer:function(){return Ne.current}},d.a.createElement("span",{className:"",onClick:z},d.a.createElement("i",{className:"icon-guanbi1"})))),d.a.createElement("div",{className:"".concat(T.a[W]," ").concat(W," ").concat(T.a.monaco," ").concat(S==="txt"?"show":"hide")},S==="txt"&&d.a.createElement(p.b,P)),S==="audio"&&d.a.createElement("audio",{src:"".concat(((E=u)===null||E===void 0?void 0:E.indexOf("http://"))>-1||((g=u)===null||g===void 0?void 0:g.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"&&He&&d.a.createElement("iframe",{src:"".concat(oe,"/office.html?key=").concat(He.key,"&url=").concat(de+He.url,"&callbackUrl=").concat(de+He.callbackUrl,"&fileType=").concat(He.fileType,"&title=").concat(He.title,"&model=").concat(y,"&officeServer=").concat(i.a.OFFICE_SERVER,"&disabledDownload=").concat(!!te)}),(S==="xlsx"||S==="doc"||S==="pptx"||S==="docx")&&d.a.createElement("iframe",{src:"/react/build/office.html?key=".concat(fe.key,"&url=").concat(i.a.API_SERVER+fe.url,"&callbackUrl=").concat(i.a.API_SERVER+fe.callbackUrl,"&fileType=").concat(fe.fileType,"&title=").concat(fe.title,"&model=").concat(fe.model)}),S==="html"&&d.a.createElement("iframe",{src:u+"&disposition=inline"}),S==="pdf"&&d.a.createElement("embed",{className:T.a.embed,src:u}),S==="image"&&d.a.createElement("img",{src:"".concat(((O=u)===null||O===void 0?void 0:O.indexOf("http://"))>-1||((w=u)===null||w===void 0?void 0:w.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:ze},d.a.createElement(m.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),S==="download"&&d.a.createElement($.a,{type:"primary",size:"large",onClick:ze},d.a.createElement(m.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(yt,Ee,Q){},pmY6:function(yt,Ee,Q){"use strict";Q.d(Ee,"g",function(){return I}),Q.d(Ee,"f",function(){return D}),Q.d(Ee,"e",function(){return j}),Q.d(Ee,"h",function(){return N}),Q.d(Ee,"b",function(){return _}),Q.d(Ee,"a",function(){return k}),Q.d(Ee,"d",function(){return d}),Q.d(Ee,"c",function(){return f});var ne=!1,$="__is_disposable_tracked__";function M(T){if(!ne)return;if(T&&T!==k.None)try{T[$]=!0}catch(m){}}function K(T){if(!ne)return T;var m=new Error("Potentially leaked disposable").stack;return setTimeout(function(){T[$]||console.log(m)},3e3),T}function I(T){return typeof T.dispose=="function"&&T.dispose.length===0}function D(T){return Array.isArray(T)?(T.forEach(function(m){m&&(M(m),m.dispose())}),[]):T?(M(T),T.dispose(),T):void 0}function j(){for(var T=[],m=0;m<arguments.length;m++)T[m]=arguments[m];return T.forEach(M),K({dispose:function(){return D(T)}})}function N(T){var m=K({dispose:function(){M(m),T()}});return m}var _=function(){function T(){this._toDispose=new Set,this._isDisposed=!1}return T.prototype.dispose=function(){if(this._isDisposed)return;M(this),this._isDisposed=!0,this.clear()},T.prototype.clear=function(){this._toDispose.forEach(function(m){return m.dispose()}),this._toDispose.clear()},T.prototype.add=function(m){if(!m)return m;if(m===this)throw new Error("Cannot register a disposable on itself!");return M(m),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(m),m},T}(),k=function(){function T(){this._store=new _,K(this)}return T.prototype.dispose=function(){M(this),this._store.dispose()},T.prototype._register=function(m){if(m===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(m)},T.None=Object.freeze({dispose:function(){}}),T}(),d=function(){function T(){this._isDisposed=!1,K(this)}return Object.defineProperty(T.prototype,"value",{get:function(){return this._isDisposed?void 0:this._value},set:function(m){if(this._isDisposed||m===this._value)return;this._value&&this._value.dispose(),m&&M(m),this._value=m},enumerable:!0,configurable:!0}),T.prototype.clear=function(){this.value=void 0},T.prototype.dispose=function(){this._isDisposed=!0,M(this),this._value&&this._value.dispose(),this._value=void 0},T}(),f=function(){function T(m){this.object=m}return T.prototype.dispose=function(){},T}()},"rAM+":function(yt,Ee,Q){"use strict";Q.d(Ee,"a",function(){return $});var ne=Q("Qw5x");function $(M,K){var I;if(typeof Symbol=="undefined"||M[Symbol.iterator]==null){if(Array.isArray(M)||(I=Object(ne.a)(M))||K&&M&&typeof M.length=="number"){I&&(M=I);var D=0,j=function(){};return{s:j,n:function(){return D>=M.length?{done:!0}:{done:!1,value:M[D++]}},e:function(f){throw f},f:j}}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,_=!1,k;return{s:function(){I=M[Symbol.iterator]()},n:function(){var f=I.next();return N=f.done,f},e:function(f){_=!0,k=f},f:function(){try{!N&&I.return!=null&&I.return()}finally{if(_)throw k}}}}},rUJ1:function(yt,Ee){const Q=/[&<>"']/,ne=/[&<>"']/g,$=/[<>"']|&(?!#?\w+;)/,M=/[<>"']|&(?!#?\w+;)/g,K={"&":"&","<":"<",">":">",'"':""","'":"'"},I=w=>K[w];function D(w,C){if(C){if(Q.test(w))return w.replace(ne,I)}else if($.test(w))return w.replace(M,I);return w}const j=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function N(w){return w.replace(j,(C,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 _=/(^|[^\[])\^/g;function k(w,C){w=w.source||w,C=C||"";const y={replace:(c,u)=>(u=u.source||u,u=u.replace(_,"$1"),w=w.replace(c,u),y),getRegex:()=>new RegExp(w,C)};return y}const d=/[^\w:]/g,f=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function T(w,C,y){if(w){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}C&&!f.test(y)&&(y=i(C,y));try{y=encodeURI(y).replace(/%25/g,"%")}catch(c){return null}return y}const m={},p=/^[^:]+:\/*[^/]*$/,b=/^([^:]+:)[\s\S]*$/,o=/^([^:]+:\/*[^/]*)[\s\S]*$/;function i(w,C){m[" "+w]||(p.test(w)?m[" "+w]=w+"/":m[" "+w]=g(w,"/",!0)),w=m[" "+w];const y=w.indexOf(":")===-1;return C.substring(0,2)==="//"?y?C:w.replace(b,"$1")+C:C.charAt(0)==="/"?y?C:w.replace(o,"$1")+C:w+C}const s={exec:function(){}};function l(w){let C=1,y,c;for(;C<arguments.length;C++){y=arguments[C];for(c in y)Object.prototype.hasOwnProperty.call(y,c)&&(w[c]=y[c])}return w}function E(w,C){const y=w.replace(/\|/g,(L,S,A)=>{let P=!1,W=S;for(;--W>=0&&A[W]==="\\";)P=!P;return P?"|":" |"}),c=y.split(/ \|/);let u=0;if(c.length>C)c.splice(C);else for(;c.length<C;)c.push("");for(;u<c.length;u++)c[u]=c[u].trim().replace(/\\\|/g,"|");return c}function g(w,C,y){const c=w.length;if(c===0)return"";let u=0;for(;u<c;){const L=w.charAt(c-u-1);if(L===C&&!y)u++;else if(L!==C&&y)u++;else break}return w.substr(0,c-u)}function v(w,C){if(w.indexOf(C[1])===-1)return-1;const y=w.length;let c=0,u=0;for(;u<y;u++)if(w[u]==="\\")u++;else if(w[u]===C[0])c++;else if(w[u]===C[1]&&(c--,c<0))return u;return-1}function O(w){w&&w.sanitize&&!w.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")}yt.exports={escape:D,unescape:N,edit:k,cleanUrl:T,resolveUrl:i,noopTest:s,merge:l,splitCells:E,rtrim:g,findClosingBracket:v,checkSanitizeDeprecation:O}},smFo:function(yt,Ee,Q){yt.exports={wrap:"wrap___1xSvp",header:"header___1niV1",title:"title____shwY",menu:"menu___2Y-rd",top:"top___1_d5Y",line:"line___1kciD",flexCenter:"flexCenter___3bP7s",like:"like___3lXjz",canLike:"canLike___AuDmL",attachmentName:"attachmentName___2SteY"}},ulZh:function(yt,Ee,Q){typeof window!="undefined"&&function($,M){yt.exports=M()}(this,function(){return function(ne){var $={};function M(K){if($[K])return $[K].exports;var I=$[K]={i:K,l:!1,exports:{}};return ne[K].call(I.exports,I,I.exports,M),I.l=!0,I.exports}return M.m=ne,M.c=$,M.d=function(K,I,D){M.o(K,I)||Object.defineProperty(K,I,{enumerable:!0,get:D})},M.r=function(K){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(K,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(K,"__esModule",{value:!0})},M.t=function(K,I){if(I&1&&(K=M(K)),I&8)return K;if(I&4&&typeof K=="object"&&K&&K.__esModule)return K;var D=Object.create(null);if(M.r(D),Object.defineProperty(D,"default",{enumerable:!0,value:K}),I&2&&typeof K!="string")for(var j in K)M.d(D,j,function(N){return K[N]}.bind(null,j));return D},M.n=function(K){var I=K&&K.__esModule?function(){return K.default}:function(){return K};return M.d(I,"a",I),I},M.o=function(K,I){return Object.prototype.hasOwnProperty.call(K,I)},M.p="/dist/",M(M.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ne,$,M){"use strict";var K=Object.prototype.hasOwnProperty,I="~";function D(){}Object.create&&(D.prototype=Object.create(null),new D().__proto__||(I=!1));function j(d,f,T){this.fn=d,this.context=f,this.once=T||!1}function N(d,f,T,m,p){if(typeof T!="function")throw new TypeError("The listener must be a function");var b=new j(T,m||d,p),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 _(d,f){--d._eventsCount===0?d._events=new D:delete d._events[f]}function k(){this._events=new D,this._eventsCount=0}k.prototype.eventNames=function(){var f=[],T,m;if(this._eventsCount===0)return f;for(m in T=this._events)K.call(T,m)&&f.push(I?m.slice(1):m);return Object.getOwnPropertySymbols?f.concat(Object.getOwnPropertySymbols(T)):f},k.prototype.listeners=function(f){var T=I?I+f:f,m=this._events[T];if(!m)return[];if(m.fn)return[m.fn];for(var p=0,b=m.length,o=new Array(b);p<b;p++)o[p]=m[p].fn;return o},k.prototype.listenerCount=function(f){var T=I?I+f:f,m=this._events[T];return m?m.fn?1:m.length:0},k.prototype.emit=function(f,T,m,p,b,o){var i=I?I+f:f;if(!this._events[i])return!1;var s=this._events[i],l=arguments.length,E,g;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,T),!0;case 3:return s.fn.call(s.context,T,m),!0;case 4:return s.fn.call(s.context,T,m,p),!0;case 5:return s.fn.call(s.context,T,m,p,b),!0;case 6:return s.fn.call(s.context,T,m,p,b,o),!0}for(g=1,E=new Array(l-1);g<l;g++)E[g-1]=arguments[g];s.fn.apply(s.context,E)}else{var v=s.length,O;for(g=0;g<v;g++){s[g].once&&this.removeListener(f,s[g].fn,void 0,!0);switch(l){case 1:s[g].fn.call(s[g].context);break;case 2:s[g].fn.call(s[g].context,T);break;case 3:s[g].fn.call(s[g].context,T,m);break;case 4:s[g].fn.call(s[g].context,T,m,p);break;default:if(!E)for(O=1,E=new Array(l-1);O<l;O++)E[O-1]=arguments[O];s[g].fn.apply(s[g].context,E)}}}return!0},k.prototype.on=function(f,T,m){return N(this,f,T,m,!1)},k.prototype.once=function(f,T,m){return N(this,f,T,m,!0)},k.prototype.removeListener=function(f,T,m,p){var b=I?I+f:f;if(!this._events[b])return this;if(!T)return _(this,b),this;var o=this._events[b];if(o.fn)o.fn===T&&(!p||o.once)&&(!m||o.context===m)&&_(this,b);else{for(var i=0,s=[],l=o.length;i<l;i++)(o[i].fn!==T||p&&!o[i].once||m&&o[i].context!==m)&&s.push(o[i]);s.length?this._events[b]=s.length===1?s[0]:s:_(this,b)}return this},k.prototype.removeAllListeners=function(f){var T;return f?(T=I?I+f:f,this._events[T]&&_(this,T)):(this._events=new D,this._eventsCount=0),this},k.prototype.off=k.prototype.removeListener,k.prototype.addListener=k.prototype.on,k.prefixed=I,k.EventEmitter=k,ne.exports=k},"./node_modules/url-toolkit/src/url-toolkit.js":function(ne,$,M){(function(K){var I=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,D=/^([^\/?#]*)([^]*)$/,j=/(?:\/|^)\.(?=\/)/g,N=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,_={buildAbsoluteURL:function(k,d,f){if(f=f||{},k=k.trim(),d=d.trim(),!d){if(!f.alwaysNormalize)return k;var T=_.parseURL(k);if(!T)throw new Error("Error trying to parse base URL.");return T.path=_.normalizePath(T.path),_.buildURLFromParts(T)}var m=_.parseURL(d);if(!m)throw new Error("Error trying to parse relative URL.");if(m.scheme)return f.alwaysNormalize?(m.path=_.normalizePath(m.path),_.buildURLFromParts(m)):d;var p=_.parseURL(k);if(!p)throw new Error("Error trying to parse base URL.");if(!p.netLoc&&p.path&&p.path[0]!=="/"){var b=D.exec(p.path);p.netLoc=b[1],p.path=b[2]}p.netLoc&&!p.path&&(p.path="/");var o={scheme:p.scheme,netLoc:m.netLoc,path:null,params:m.params,query:m.query,fragment:m.fragment};if(!m.netLoc&&(o.netLoc=p.netLoc,m.path[0]!=="/"))if(!m.path)o.path=p.path,m.params||(o.params=p.params,m.query||(o.query=p.query));else{var i=p.path,s=i.substring(0,i.lastIndexOf("/")+1)+m.path;o.path=_.normalizePath(s)}return o.path===null&&(o.path=f.alwaysNormalize?_.normalizePath(m.path):m.path),_.buildURLFromParts(o)},parseURL:function(k){var d=I.exec(k);return d?{scheme:d[1]||"",netLoc:d[2]||"",path:d[3]||"",params:d[4]||"",query:d[5]||"",fragment:d[6]||""}:null},normalizePath:function(k){for(k=k.split("").reverse().join("").replace(j,"");k.length!==(k=k.replace(N,"")).length;);return k.split("").reverse().join("")},buildURLFromParts:function(k){return k.scheme+k.netLoc+k.path+k.params+k.query+k.fragment}};ne.exports=_})(this)},"./node_modules/webworkify-webpack/index.js":function(ne,$,M){function K(f){var T={};function m(b){if(T[b])return T[b].exports;var o=T[b]={i:b,l:!1,exports:{}};return f[b].call(o.exports,o,o.exports,m),o.l=!0,o.exports}m.m=f,m.c=T,m.i=function(b){return b},m.d=function(b,o,i){m.o(b,o)||Object.defineProperty(b,o,{configurable:!1,enumerable:!0,get:i})},m.r=function(b){Object.defineProperty(b,"__esModule",{value:!0})},m.n=function(b){var o=b&&b.__esModule?function(){return b.default}:function(){return b};return m.d(o,"a",o),o},m.o=function(b,o){return Object.prototype.hasOwnProperty.call(b,o)},m.p="/",m.oe=function(b){throw console.error(b),b};var p=m(m.s=ENTRY_MODULE);return p.default||p}var I="[\\.|\\-|\\+|\\w|/|@]+",D="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+I+").*?\\)";function j(f){return(f+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function N(f){return!isNaN(1*f)}function _(f,T,m){var p={};p[m]=[];var b=T.toString(),o=b.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!o)return p;for(var i=o[1],s=new RegExp("(\\\\n|\\W)"+j(i)+D,"g"),l;l=s.exec(b);){if(l[3]==="dll-reference")continue;p[m].push(l[3])}for(s=new RegExp("\\("+j(i)+'\\("(dll-reference\\s('+I+'))"\\)\\)'+D,"g");l=s.exec(b);)f[l[2]]||(p[m].push(l[1]),f[l[2]]=M(l[1]).m),p[l[2]]=p[l[2]]||[],p[l[2]].push(l[4]);for(var E=Object.keys(p),g=0;g<E.length;g++)for(var v=0;v<p[E[g]].length;v++)N(p[E[g]][v])&&(p[E[g]][v]=1*p[E[g]][v]);return p}function k(f){var T=Object.keys(f);return T.reduce(function(m,p){return m||f[p].length>0},!1)}function d(f,T){for(var m={main:[T]},p={main:[]},b={main:{}};k(m);)for(var o=Object.keys(m),i=0;i<o.length;i++){var s=o[i],l=m[s],E=l.pop();if(b[s]=b[s]||{},b[s][E]||!f[s][E])continue;b[s][E]=!0,p[s]=p[s]||[],p[s].push(E);for(var g=_(f,f[s][E],s),v=Object.keys(g),O=0;O<v.length;O++)m[v[O]]=m[v[O]]||[],m[v[O]]=m[v[O]].concat(g[v[O]])}return p}ne.exports=function(f,T){T=T||{};var m={main:M.m},p=T.all?{main:Object.keys(m.main)}:d(m,f),b="";Object.keys(p).filter(function(E){return E!=="main"}).forEach(function(E){for(var g=0;p[E][g];)g++;p[E].push(g),m[E][g]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",b=b+"var "+E+" = ("+K.toString().replace("ENTRY_MODULE",JSON.stringify(g))+")({"+p[E].map(function(v){return""+JSON.stringify(v)+": "+m[E][v].toString()}).join(",")+`});
|
|
`}),b=b+"new (("+K.toString().replace("ENTRY_MODULE",JSON.stringify(f))+")({"+p.main.map(function(E){return""+JSON.stringify(E)+": "+m.main[E].toString()}).join(",")+"}))(self);";var o=new window.Blob([b],{type:"text/javascript"});if(T.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(ne,$,M){"use strict";M.r($),M.d($,"hlsDefaultConfig",function(){return O}),M.d($,"mergeConfig",function(){return C}),M.d($,"enableStreamingMode",function(){return y});var K=M("./src/controller/abr-controller.ts"),I=M("./src/controller/audio-stream-controller.ts"),D=M("./src/controller/audio-track-controller.ts"),j=M("./src/controller/subtitle-stream-controller.ts"),N=M("./src/controller/subtitle-track-controller.ts"),_=M("./src/controller/buffer-controller.ts"),k=M("./src/controller/timeline-controller.ts"),d=M("./src/controller/cap-level-controller.ts"),f=M("./src/controller/fps-controller.ts"),T=M("./src/controller/eme-controller.ts"),m=M("./src/controller/cmcd-controller.ts"),p=M("./src/utils/xhr-loader.ts"),b=M("./src/utils/fetch-loader.ts"),o=M("./src/utils/cues.ts"),i=M("./src/utils/mediakeys-helper.ts"),s=M("./src/utils/logger.ts");function l(){return l=Object.assign||function(c){for(var u=1;u<arguments.length;u++){var L=arguments[u];for(var S in L)Object.prototype.hasOwnProperty.call(L,S)&&(c[S]=L[S])}return c},l.apply(this,arguments)}function E(c,u){var L=Object.keys(c);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(c);u&&(S=S.filter(function(A){return Object.getOwnPropertyDescriptor(c,A).enumerable})),L.push.apply(L,S)}return L}function g(c){for(var u=1;u<arguments.length;u++){var L=arguments[u]!=null?arguments[u]:{};u%2?E(Object(L),!0).forEach(function(S){v(c,S,L[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(c,Object.getOwnPropertyDescriptors(L)):E(Object(L)).forEach(function(S){Object.defineProperty(c,S,Object.getOwnPropertyDescriptor(L,S))})}return c}function v(c,u,L){return u in c?Object.defineProperty(c,u,{value:L,enumerable:!0,configurable:!0,writable:!0}):c[u]=L,c}var O=g(g({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:p.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:K.default,bufferController:_.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},w()),{},{subtitleStreamController:j.SubtitleStreamController,subtitleTrackController:N.default,timelineController:k.TimelineController,audioStreamController:I.default,audioTrackController:D.default,emeController:T.default,cmcdController:m.default});function w(){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 C(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!==p.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),c.progressive=!1;else{var L=Object(b.fetchSupported)();L&&(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(ne,$,M){"use strict";M.r($);var K=M("./src/polyfills/number.ts"),I=M("./src/utils/ewma-bandwidth-estimator.ts"),D=M("./src/events.ts"),j=M("./src/utils/buffer-helper.ts"),N=M("./src/errors.ts"),_=M("./src/types/loader.ts"),k=M("./src/utils/logger.ts");function d(m,p){for(var b=0;b<p.length;b++){var o=p[b];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(m,o.key,o)}}function f(m,p,b){return p&&d(m.prototype,p),b&&d(m,b),m}var T=function(){function m(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 p=m.prototype;return p.registerListeners=function(){var o=this.hls;o.on(D.Events.FRAG_LOADING,this.onFragLoading,this),o.on(D.Events.FRAG_LOADED,this.onFragLoaded,this),o.on(D.Events.FRAG_BUFFERED,this.onFragBuffered,this),o.on(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.on(D.Events.ERROR,this.onError,this)},p.unregisterListeners=function(){var o=this.hls;o.off(D.Events.FRAG_LOADING,this.onFragLoading,this),o.off(D.Events.FRAG_LOADED,this.onFragLoaded,this),o.off(D.Events.FRAG_BUFFERED,this.onFragBuffered,this),o.off(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.off(D.Events.ERROR,this.onError,this)},p.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},p.onFragLoading=function(o,i){var s=i.frag;if(s.type===_.PlaylistLevelType.MAIN&&!this.timer){var l;this.fragCurrent=s,this.partCurrent=(l=i.part)!=null?l:null,this.timer=self.setInterval(this.onCheck,100)}},p.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)},p._abandonRulesCheck=function(){var o=this.fragCurrent,i=this.partCurrent,s=this.hls,l=s.autoLevelEnabled,E=s.config,g=s.media;if(!o||!g)return;var v=i?i.stats:o.stats,O=i?i.duration:o.duration;if(v.aborted){k.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!l||g.paused||!g.playbackRate||!g.readyState)return;var w=performance.now()-v.loading.start,C=Math.abs(g.playbackRate);if(w<=500*O/C)return;var y=s.levels,c=s.minAutoLevel,u=y[o.level],L=v.total||Math.max(v.loaded,Math.round(O*u.maxBitrate/8)),S=Math.max(1,v.bwEstimate?v.bwEstimate/8:v.loaded*1e3/w),A=(L-v.loaded)/S,P=g.currentTime,W=(j.BufferHelper.bufferInfo(g,P,E.maxBufferHole).end-P)/C;if(W>=2*O/C||A<=W)return;var V=Number.POSITIVE_INFINITY,Z;for(Z=o.level-1;Z>c;Z--){var z=y[Z].maxBitrate;if(V=O*z/(8*.8*S),V<W)break}if(V>=A)return;var F=this.bwEstimator.getEstimate();k.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(K.isFiniteNumber)(F)?(F/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+A.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+V.toFixed(3)+` s
|
|
Time to underbuffer: `+W.toFixed(3)+" s"),s.nextLoadLevel=Z,this.bwEstimator.sample(w,v.loaded),this.clearTimer(),o.loader&&(this.fragCurrent=this.partCurrent=null,o.loader.abort()),s.trigger(D.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:o,part:i,stats:v})},p.onFragLoaded=function(o,i){var s=i.frag,l=i.part;if(s.type===_.PlaylistLevelType.MAIN&&Object(K.isFiniteNumber)(s.sn)){var E=l?l.stats:s.stats,g=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],O=(v.loaded?v.loaded.bytes:0)+E.loaded,w=(v.loaded?v.loaded.duration:0)+g;v.loaded={bytes:O,duration:w},v.realBitrate=Math.round(8*O/w)}if(s.bitrateTest){var C={stats:E,frag:s,part:l,id:s.type};this.onFragBuffered(D.Events.FRAG_BUFFERED,C),s.bitrateTest=!1}}},p.onFragBuffered=function(o,i){var s=i.frag,l=i.part,E=l?l.stats:s.stats;if(E.aborted)return;if(s.type!==_.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var g=E.parsing.end-E.loading.start;this.bwEstimator.sample(g,E.loaded),E.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=g/1e3:this.bitrateTestDelay=0},p.onError=function(o,i){switch(i.details){case N.ErrorDetails.FRAG_LOAD_ERROR:case N.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},p.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},p.getNextABRAutoLevel=function(){var o=this.fragCurrent,i=this.partCurrent,s=this.hls,l=s.maxAutoLevel,E=s.config,g=s.minAutoLevel,v=s.media,O=i?i.duration:o?o.duration:0,w=v?v.currentTime:0,C=v&&v.playbackRate!==0?Math.abs(v.playbackRate):1,y=this.bwEstimator?this.bwEstimator.getEstimate():E.abrEwmaDefaultEstimate,c=(j.BufferHelper.bufferInfo(v,w,E.maxBufferHole).end-w)/C,u=this.findBestLevel(y,g,l,c,E.abrBandWidthFactor,E.abrBandWidthUpFactor);if(u>=0)return u;k.logger.trace((c?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var L=O?Math.min(O,E.maxStarvationDelay):E.maxStarvationDelay,S=E.abrBandWidthFactor,A=E.abrBandWidthUpFactor;if(!c){var P=this.bitrateTestDelay;if(P){var W=O?Math.min(O,E.maxLoadingDelay):E.maxLoadingDelay;L=W-P,k.logger.trace("bitrate test took "+Math.round(1e3*P)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*L)+" ms"),S=A=1}}return u=this.findBestLevel(y,g,l,c+L,S,A),Math.max(u,0)},p.findBestLevel=function(o,i,s,l,E,g){for(var v,O=this.fragCurrent,w=this.partCurrent,C=this.lastLoadedFragLevel,y=this.hls.levels,c=y[C],u=!!(c!=null&&(v=c.details)!==null&&v!==void 0&&v.live),L=c==null?void 0:c.codecSet,S=w?w.duration:O?O.duration:0,A=s;A>=i;A--){var P=y[A];if(!P||L&&P.codecSet!==L)continue;var W=P.details,V=(w?W==null?void 0:W.partTarget:W==null?void 0:W.averagetargetduration)||S,Z=void 0;A<=C?Z=E*o:Z=g*o;var z=y[A].maxBitrate,F=z*V/Z;if(k.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+A+"/"+Math.round(Z)+"/"+z+"/"+V+"/"+l+"/"+F),Z>z&&(!F||u&&!this.bitrateTestDelay||F<l))return A}return-1},f(m,[{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}}]),m}();$.default=T},"./src/controller/audio-stream-controller.ts":function(ne,$,M){"use strict";M.r($);var K=M("./src/polyfills/number.ts"),I=M("./src/controller/base-stream-controller.ts"),D=M("./src/events.ts"),j=M("./src/utils/buffer-helper.ts"),N=M("./src/controller/fragment-tracker.ts"),_=M("./src/types/level.ts"),k=M("./src/types/loader.ts"),d=M("./src/loader/fragment.ts"),f=M("./src/demux/chunk-cache.ts"),T=M("./src/demux/transmuxer-interface.ts"),m=M("./src/types/transmuxer.ts"),p=M("./src/controller/fragment-finders.ts"),b=M("./src/utils/discontinuities.ts"),o=M("./src/errors.ts"),i=M("./src/utils/logger.ts");function s(){return s=Object.assign||function(O){for(var w=1;w<arguments.length;w++){var C=arguments[w];for(var y in C)Object.prototype.hasOwnProperty.call(C,y)&&(O[y]=C[y])}return O},s.apply(this,arguments)}function l(O,w){O.prototype=Object.create(w.prototype),O.prototype.constructor=O,E(O,w)}function E(O,w){return E=Object.setPrototypeOf||function(y,c){return y.__proto__=c,y},E(O,w)}var g=100,v=function(O){l(w,O);function w(y,c){var u;return u=O.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 C=w.prototype;return C.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},C._registerListeners=function(){var c=this.hls;c.on(D.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(D.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),c.on(D.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(D.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),c.on(D.Events.ERROR,this.onError,this),c.on(D.Events.BUFFER_RESET,this.onBufferReset,this),c.on(D.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(D.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(D.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),c.on(D.Events.FRAG_BUFFERED,this.onFragBuffered,this)},C._unregisterListeners=function(){var c=this.hls;c.off(D.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(D.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),c.off(D.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(D.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),c.off(D.Events.ERROR,this.onError,this),c.off(D.Events.BUFFER_RESET,this.onBufferReset,this),c.off(D.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(D.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(D.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),c.off(D.Events.FRAG_BUFFERED,this.onFragBuffered,this)},C.onInitPtsFound=function(c,u){var L=u.frag,S=u.id,A=u.initPTS;if(S==="main"){var P=L.cc;this.initPTS[L.cc]=A,this.log("InitPTS for cc: "+P+" found from main: "+A),this.videoTrackCC=P,this.state===I.State.WAITING_INIT_PTS&&this.tick()}},C.startLoad=function(c){if(!this.levels){this.startPosition=c,this.state=I.State.STOPPED;return}var u=this.lastCurrentTime;this.stopLoad(),this.setInterval(g),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()},C.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_TRACK:{var c,u=this.levels,L=this.trackId,S=u==null||((c=u[L])===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 A,P=performance.now(),W=this.retryDate;(!W||P>=W||(A=this.media)!==null&&A!==void 0&&A.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=I.State.IDLE);break}case I.State.WAITING_INIT_PTS:{var V=this.waitingData;if(V){var Z=V.frag,z=V.part,F=V.cache,te=V.complete;if(this.initPTS[Z.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.FRAG_LOADING;var ie=F.flush(),fe={frag:Z,part:z,payload:ie,networkDetails:null};this._handleFragmentLoadProgress(fe),te&&O.prototype._handleFragmentLoadComplete.call(this,fe)}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 ye=this.getLoadPosition(),_e=j.BufferHelper.bufferInfo(this.mediaBuffer,ye,this.config.maxBufferHole),Le=Object(p.fragmentWithinToleranceTest)(_e.end,this.config.maxFragLookUpTolerance,Z);Le<0&&(i.logger.log("Waiting fragment cc ("+Z.cc+") @ "+Z.start+" cancelled because another fragment at "+_e.end+" is needed"),this.clearWaitingFragment())}}else this.state=I.State.IDLE}}this.onTickEnd()},C.clearWaitingFragment=function(){var c=this.waitingData;c&&(this.fragmentTracker.removeFragment(c.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.IDLE)},C.onTickEnd=function(){var c=this.media;if(!c||!c.readyState)return;var u=this.mediaBuffer?this.mediaBuffer:c,L=u.buffered;!this.loadedmetadata&&L.length&&(this.loadedmetadata=!0),this.lastCurrentTime=c.currentTime},C.doTickIdle=function(){var c,u,L=this.hls,S=this.levels,A=this.media,P=this.trackId,W=L.config;if(!S||!S[P])return;if(!A&&(this.startFragRequested||!W.startFragPrefetch))return;var V=S[P],Z=V.details;if(!Z||Z.live&&this.levelLastLoaded!==P||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,k.PlaylistLevelType.AUDIO));var z=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,k.PlaylistLevelType.AUDIO);if(z===null)return;var F=z.len,te=this.getMaxBufferLength(),ie=this.audioSwitch;if(F>=te&&!ie)return;if(!ie&&this._streamEnded(z,Z)){L.trigger(D.Events.BUFFER_EOS,{type:"audio"}),this.state=I.State.ENDED;return}var fe=Z.fragments,ye=fe[0].start,_e=z.end;if(ie){var Le=this.getLoadPosition();_e=Le,Z.PTSKnown&&Le<ye&&((z.end>ye||z.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),A.currentTime=ye+.05))}var Ae=this.getNextFragment(_e,Z);if(!Ae){this.bufferFlushed=!0;return}((c=Ae.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((u=Ae.decryptdata)!==null&&u!==void 0&&u.key)?this.loadKey(Ae,Z):this.loadFragment(Ae,Z,_e)},C.getMaxBufferLength=function(){var c=O.prototype.getMaxBufferLength.call(this),u=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,k.PlaylistLevelType.MAIN);return u===null?c:Math.max(c,u.len)},C.onMediaDetaching=function(){this.videoBuffer=null,O.prototype.onMediaDetaching.call(this)},C.onAudioTracksUpdated=function(c,u){var L=u.audioTracks;this.resetTransmuxer(),this.levels=L.map(function(S){return new _.Level(S)})},C.onAudioTrackSwitching=function(c,u){var L=!!u.url;this.trackId=u.id;var S=this.fragCurrent;S!=null&&S.loader&&S.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),L?this.setInterval(g):this.resetTransmuxer(),L?(this.audioSwitch=!0,this.state=I.State.IDLE):this.state=I.State.STOPPED,this.tick()},C.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},C.onLevelLoaded=function(c,u){this.mainDetails=u.details},C.onAudioTrackLoaded=function(c,u){var L,S=this.levels,A=u.details,P=u.id;if(!S){this.warn("Audio tracks were reset while loading level "+P);return}this.log("Track "+P+" loaded ["+A.startSN+","+A.endSN+"],duration:"+A.totalduration);var W=S[P],V=0;if(A.live||(L=W.details)!==null&&L!==void 0&&L.live){var Z=this.mainDetails;if(A.fragments[0]||(A.deltaUpdateFailed=!0),A.deltaUpdateFailed||!Z)return;!W.details&&A.hasProgramDateTime&&Z.hasProgramDateTime?(Object(b.alignMediaPlaylistByPDT)(A,Z),V=A.fragments[0].start):V=this.alignPlaylists(A,W.details)}W.details=A,this.levelLastLoaded=P,!this.startFragRequested&&(this.mainDetails||!A.live)&&this.setStartPosition(W.details,V),this.state===I.State.WAITING_TRACK&&!this.waitForCdnTuneIn(A)&&(this.state=I.State.IDLE),this.tick()},C._handleFragmentLoadProgress=function(c){var u,L=c.frag,S=c.part,A=c.payload,P=this.config,W=this.trackId,V=this.levels;if(!V){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+L.sn+" of level "+L.level+" will not be buffered");return}var Z=V[W];console.assert(Z,"Audio track is defined on fragment load progress");var z=Z.details;console.assert(z,"Audio track details are defined on fragment load progress");var F=P.defaultAudioCodec||Z.audioCodec||"mp4a.40.2",te=this.transmuxer;te||(te=this.transmuxer=new T.default(this.hls,k.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ie=this.initPTS[L.cc],fe=(u=L.initSegment)===null||u===void 0?void 0:u.data;if(ie!==void 0){var ye=!1,_e=S?S.index:-1,Le=_e!==-1,Ae=new m.ChunkMetadata(L.level,L.sn,L.stats.chunkCount,A.byteLength,_e,Le);te.push(A,fe,F,"",L,S,z.totalduration,ye,Ae,ie)}else{i.logger.log("Unknown video PTS for cc "+L.cc+", waiting for video PTS before demuxing audio frag "+L.sn+" of ["+z.startSN+" ,"+z.endSN+"],track "+W);var ke=this.waitingData=this.waitingData||{frag:L,part:S,cache:new f.default,complete:!1},De=ke.cache;De.push(new Uint8Array(A)),this.waitingVideoCC=this.videoTrackCC,this.state=I.State.WAITING_INIT_PTS}},C._handleFragmentLoadComplete=function(c){if(this.waitingData){this.waitingData.complete=!0;return}O.prototype._handleFragmentLoadComplete.call(this,c)},C.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},C.onBufferCreated=function(c,u){var L=u.tracks.audio;L&&(this.mediaBuffer=L.buffer),u.tracks.video&&(this.videoBuffer=u.tracks.video.buffer)},C.onFragBuffered=function(c,u){var L=u.frag,S=u.part;if(L.type!==k.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(L)){this.warn("Fragment "+L.sn+(S?" p: "+S.index:"")+" of level "+L.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}L.sn!=="initSegment"&&(this.fragPrevious=L,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(D.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(L,S)},C.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(k.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 L=!0,S=this.getFwdBufferInfo(this.mediaBuffer,k.PlaylistLevelType.AUDIO);S&&S.len>.5&&(L=!this.reduceMaxBufferLength(S.len)),L&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,O.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},C.onBufferFlushed=function(c,u){var L=u.type;L===d.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},C._handleTransmuxComplete=function(c){var u,L="audio",S=this.hls,A=c.remuxResult,P=c.chunkMeta,W=this.getCurrentContext(P);if(!W){this.warn("The loading context changed while buffering fragment "+P.sn+" of level "+P.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(P.level);return}var V=W.frag,Z=W.part,z=A.audio,F=A.text,te=A.id3,ie=A.initSegment;if(this.fragContextChanged(V))return;if(this.state=I.State.PARSING,this.audioSwitch&&z&&this.completeAudioSwitch(),ie!=null&&ie.tracks&&(this._bufferInitSegment(ie.tracks,V,P),S.trigger(D.Events.FRAG_PARSING_INIT_SEGMENT,{frag:V,id:L,tracks:ie.tracks})),z){var fe=z.startPTS,ye=z.endPTS,_e=z.startDTS,Le=z.endDTS;Z&&(Z.elementaryStreams[d.ElementaryStreamTypes.AUDIO]={startPTS:fe,endPTS:ye,startDTS:_e,endDTS:Le}),V.setElementaryStreamInfo(d.ElementaryStreamTypes.AUDIO,fe,ye,_e,Le),this.bufferFragmentData(z,V,Z,P)}if(te!=null&&(u=te.samples)!==null&&u!==void 0&&u.length){var Ae=s({frag:V,id:L},te);S.trigger(D.Events.FRAG_PARSING_METADATA,Ae)}if(F){var ke=s({frag:V,id:L},F);S.trigger(D.Events.FRAG_PARSING_USERDATA,ke)}},C._bufferInitSegment=function(c,u,L){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(D.Events.BUFFER_CODECS,c);var A=S.initSegment;if(A!=null&&A.byteLength){var P={type:"audio",frag:u,part:null,chunkMeta:L,parent:u.type,data:A};this.hls.trigger(D.Events.BUFFER_APPENDING,P)}this.tick()},C.loadFragment=function(c,u,L){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(K.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,O.prototype.loadFragment.call(this,c,u,L)))},C.completeAudioSwitch=function(){var c=this.hls,u=this.media,L=this.trackId;u&&(this.log("Switching audio track : flushing all audio"),O.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,c.trigger(D.Events.AUDIO_TRACK_SWITCHED,{id:L})},w}(I.default);$.default=v},"./src/controller/audio-track-controller.ts":function(ne,$,M){"use strict";M.r($);var K=M("./src/events.ts"),I=M("./src/errors.ts"),D=M("./src/controller/base-playlist-controller.ts"),j=M("./src/types/loader.ts");function N(T,m){for(var p=0;p<m.length;p++){var b=m[p];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(T,b.key,b)}}function _(T,m,p){return m&&N(T.prototype,m),p&&N(T,p),T}function k(T,m){T.prototype=Object.create(m.prototype),T.prototype.constructor=T,d(T,m)}function d(T,m){return d=Object.setPrototypeOf||function(b,o){return b.__proto__=o,b},d(T,m)}var f=function(T){k(m,T);function m(b){var o;return o=T.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 p=m.prototype;return p.registerListeners=function(){var o=this.hls;o.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(K.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(K.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),o.on(K.Events.ERROR,this.onError,this)},p.unregisterListeners=function(){var o=this.hls;o.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(K.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(K.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),o.off(K.Events.ERROR,this.onError,this)},p.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,T.prototype.destroy.call(this)},p.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},p.onManifestParsed=function(o,i){this.tracks=i.audioTracks||[]},p.onAudioTrackLoaded=function(o,i){var s=i.id,l=i.details,E=this.tracksInGroup[s];if(!E){this.warn("Invalid audio track id "+s);return}var g=E.details;E.details=i.details,this.log("audioTrack "+s+" loaded ["+l.startSN+"-"+l.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,i,g))},p.onLevelLoading=function(o,i){this.switchLevel(i.level)},p.onLevelSwitching=function(o,i){this.switchLevel(i.level)},p.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(g){return!s||g.groupId===s});this.selectDefaultTrack&&!l.some(function(g){return g.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=l;var E={audioTracks:l};this.log("Updating audio tracks, "+l.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(K.Events.AUDIO_TRACKS_UPDATED,E),this.selectInitialTrack()}},p.onError=function(o,i){if(T.prototype.onError.call(this,o,i),i.fatal||!i.context)return;i.context.type===j.PlaylistContextType.AUDIO_TRACK&&i.context.id===this.trackId&&i.context.groupId===this.groupId&&this.retryLoadingOrFail(i)},p.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],E=l.id,g=l.groupId,v=g===void 0?"":g,O=l.name,w=l.type,C=l.url;if(this.trackId=o,this.trackName=O,this.selectDefaultTrack=!1,this.hls.trigger(K.Events.AUDIO_TRACK_SWITCHING,{id:E,groupId:v,name:O,type:w,url:C}),l.details&&!l.details.live)return;var y=this.switchParams(l.url,s==null?void 0:s.details);this.loadPlaylist(y)},p.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(K.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},p.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},p.loadPlaylist=function(o){var i=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(i)){var s=i.id,l=i.groupId,E=i.url;if(o)try{E=o.addDirectives(E)}catch(g){this.warn("Could not construct new URL with HLS Delivery Directives: "+g)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(K.Events.AUDIO_TRACK_LOADING,{url:E,id:s,groupId:l,deliveryDirectives:o||null})}},_(m,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1,this.setAudioTrack(o)}}]),m}(D.default);$.default=f},"./src/controller/base-playlist-controller.ts":function(ne,$,M){"use strict";M.r($),M.d($,"default",function(){return _});var K=M("./src/polyfills/number.ts"),I=M("./src/types/level.ts"),D=M("./src/controller/level-helper.ts"),j=M("./src/utils/logger.ts"),N=M("./src/errors.ts"),_=function(){function k(f,T){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=j.logger.log.bind(j.logger,T+":"),this.warn=j.logger.warn.bind(j.logger,T+":"),this.hls=f}var d=k.prototype;return d.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},d.onError=function(T,m){m.fatal&&m.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(T,m){var p=m==null?void 0:m.renditionReports;if(p)for(var b=0;b<p.length;b++){var o=p[b],i=""+o.URI;if(i===T.substr(-i.length)){var s=parseInt(o["LAST-MSN"]),l=parseInt(o["LAST-PART"]);if(m&&this.hls.config.lowLatencyMode){var E=Math.min(m.age-m.partTarget,m.targetduration);l!==void 0&&E>m.partTarget&&(l+=1)}if(Object(K.isFiniteNumber)(s))return new I.HlsUrlParameters(s,Object(K.isFiniteNumber)(l)?l:void 0,I.HlsSkip.No)}}},d.loadPlaylist=function(T){},d.shouldLoadTrack=function(T){return this.canLoad&&T&&!!T.url&&(!T.details||T.details.live)},d.playlistLoaded=function(T,m,p){var b=this,o=m.details,i=m.stats,s=i.loading.end?Math.max(0,self.performance.now()-i.loading.end):0;if(o.advancedDateTime=Date.now()-s,o.live||p!=null&&p.live){if(o.reloaded(p),p&&this.log("live playlist "+T+" "+(o.advanced?"REFRESHED "+o.lastPartSn+"-"+o.lastPartIndex:"MISSED")),p&&o.fragments.length>0&&Object(D.mergeDetails)(p,o),!this.canLoad||!o.live)return;var l,E=void 0,g=void 0;if(o.canBlockReload&&o.endSN&&o.advanced){var v=this.hls.config.lowLatencyMode,O=o.lastPartSn,w=o.endSN,C=o.lastPartIndex,y=C!==-1,c=O===w,u=v?0:C;y?(E=c?w+1:O,g=c?u:C+1):E=w+1;var L=o.age,S=L+o.ageHeader,A=Math.min(S-o.partTarget,o.targetduration*1.5);if(A>0){if(p&&A>p.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+p.tuneInGoal+" to: "+A+" with playlist age: "+o.age),A=0;else{var P=Math.floor(A/o.targetduration);if(E+=P,g!==void 0){var W=Math.round(A%o.targetduration/o.partTarget);g+=W}this.log("CDN Tune-in age: "+o.ageHeader+"s last advanced "+L.toFixed(2)+"s goal: "+A+" skip sn "+P+" to part "+g)}o.tuneInGoal=A}if(l=this.getDeliveryDirectives(o,m.deliveryDirectives,E,g),v||!c){this.loadPlaylist(l);return}}else l=this.getDeliveryDirectives(o,m.deliveryDirectives,E,g);var V=Object(D.computeReloadInterval)(o,i);E!==void 0&&o.canBlockReload&&(V-=o.partTarget||1),this.log("reload live playlist "+T+" in "+Math.round(V)+" ms"),this.timer=self.setTimeout(function(){return b.loadPlaylist(l)},V)}else this.clearTimer()},d.getDeliveryDirectives=function(T,m,p,b){var o=Object(I.getSkipValue)(T,p);return m!=null&&m.skip&&T.deltaUpdateFailed&&(p=m.msn,b=m.part,o=I.HlsSkip.No),new I.HlsUrlParameters(p,b,o)},d.retryLoadingOrFail=function(T){var m=this,p=this.hls.config,b=this.retryCount<p.levelLoadingMaxRetry;if(b){var o;if(this.retryCount++,T.details.indexOf("LoadTimeOut")>-1&&(o=T.context)!==null&&o!==void 0&&o.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+T.details+'"'),this.loadPlaylist();else{var i=Math.min(Math.pow(2,this.retryCount)*p.levelLoadingRetryDelay,p.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return m.loadPlaylist()},i),this.warn("retry playlist loading #"+this.retryCount+" in "+i+' ms after "'+T.details+'"')}}else this.warn('cannot recover from error "'+T.details+'"'),this.clearTimer(),T.fatal=!0;return b},k}()},"./src/controller/base-stream-controller.ts":function(ne,$,M){"use strict";M.r($),M.d($,"State",function(){return w}),M.d($,"default",function(){return C});var K=M("./src/polyfills/number.ts"),I=M("./src/task-loop.ts"),D=M("./src/controller/fragment-tracker.ts"),j=M("./src/utils/buffer-helper.ts"),N=M("./src/utils/logger.ts"),_=M("./src/events.ts"),k=M("./src/errors.ts"),d=M("./src/types/transmuxer.ts"),f=M("./src/utils/mp4-tools.ts"),T=M("./src/utils/discontinuities.ts"),m=M("./src/controller/fragment-finders.ts"),p=M("./src/controller/level-helper.ts"),b=M("./src/loader/fragment-loader.ts"),o=M("./src/crypt/decrypter.ts"),i=M("./src/utils/time-ranges.ts"),s=M("./src/types/loader.ts");function l(y,c){for(var u=0;u<c.length;u++){var L=c[u];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(y,L.key,L)}}function E(y,c,u){return c&&l(y.prototype,c),u&&l(y,u),y}function g(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,O(y,c)}function O(y,c){return O=Object.setPrototypeOf||function(L,S){return L.__proto__=S,L},O(y,c)}var w={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"},C=function(y){v(c,y);function c(L,S,A){var P;return P=y.call(this)||this,P.hls=void 0,P.fragPrevious=null,P.fragCurrent=null,P.fragmentTracker=void 0,P.transmuxer=null,P._state=w.STOPPED,P.media=void 0,P.mediaBuffer=void 0,P.config=void 0,P.bitrateTest=!1,P.lastCurrentTime=0,P.nextLoadPosition=0,P.startPosition=0,P.loadedmetadata=!1,P.fragLoadError=0,P.retryDate=0,P.levels=null,P.fragmentLoader=void 0,P.levelLastLoaded=null,P.startFragRequested=!1,P.decrypter=void 0,P.initPTS=[],P.onvseeking=null,P.onvended=null,P.logPrefix="",P.log=void 0,P.warn=void 0,P.logPrefix=A,P.log=N.logger.log.bind(N.logger,A+":"),P.warn=N.logger.warn.bind(N.logger,A+":"),P.hls=L,P.fragmentLoader=new b.default(L.config),P.fragmentTracker=S,P.config=L.config,P.decrypter=new o.default(L,L.config),L.on(_.Events.KEY_LOADED,P.onKeyLoaded,g(P)),P}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=w.STOPPED},u._streamEnded=function(S,A){var P=this.fragCurrent,W=this.fragmentTracker;if(!A.live&&P&&P.sn===A.endSN&&!S.nextStart){var V=W.getState(P);return V===D.FragmentState.PARTIAL||V===D.FragmentState.OK}return!1},u.onMediaAttached=function(S,A){var P=this.media=this.mediaBuffer=A.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),P.addEventListener("seeking",this.onvseeking),P.addEventListener("ended",this.onvended);var W=this.config;this.levels&&W.autoStartLoad&&this.state===w.STOPPED&&this.startLoad(W.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,A=this.fragCurrent,P=this.media,W=this.mediaBuffer,V=this.state,Z=P?P.currentTime:0,z=j.BufferHelper.bufferInfo(W||P,Z,S.maxBufferHole);if(this.log("media seeking to "+(Object(K.isFiniteNumber)(Z)?Z.toFixed(3):Z)+", state: "+V),V===w.ENDED)this.resetLoadingState();else if(A&&!z.len){var F=S.maxFragLookUpTolerance,te=A.start-F,ie=A.start+A.duration+F,fe=Z>ie;(Z<te||fe)&&(fe&&A.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),A.loader.abort()),this.resetLoadingState())}P&&(this.lastCurrentTime=Z),!this.loadedmetadata&&!z.len&&(this.nextLoadPosition=this.startPosition=Z),this.tickImmediate()},u.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},u.onKeyLoaded=function(S,A){if(this.state!==w.KEY_LOADING||A.frag!==this.fragCurrent||!this.levels)return;this.state=w.IDLE;var P=this.levels[A.frag.level].details;P&&this.loadFragment(A.frag,P,A.frag.start)},u.onHandlerDestroying=function(){this.stopLoad(),y.prototype.onHandlerDestroying.call(this)},u.onHandlerDestroyed=function(){this.state=w.STOPPED,this.hls.off(_.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,A){this.log("Loading key for "+S.sn+" of ["+A.startSN+"-"+A.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+S.level),this.state=w.KEY_LOADING,this.fragCurrent=S,this.hls.trigger(_.Events.KEY_LOADING,{frag:S})},u.loadFragment=function(S,A,P){this._loadFragForPlayback(S,A,P)},u._loadFragForPlayback=function(S,A,P){var W=this,V=function(z){if(W.fragContextChanged(S)){W.warn("Fragment "+S.sn+(z.part?" p: "+z.part.index:"")+" of level "+S.level+" was dropped during download."),W.fragmentTracker.removeFragment(S);return}S.stats.chunkCount++,W._handleFragmentLoadProgress(z)};this._doFragLoad(S,A,P,V).then(function(Z){if(!Z)return;W.fragLoadError=0;var z=W.state;if(W.fragContextChanged(S)){(z===w.FRAG_LOADING||z===w.BACKTRACKING||!W.fragCurrent&&z===w.PARSING)&&(W.fragmentTracker.removeFragment(S),W.state=w.IDLE);return}if("payload"in Z&&(W.log("Loaded fragment "+S.sn+" of level "+S.level),W.hls.trigger(_.Events.FRAG_LOADED,Z),W.state===w.BACKTRACKING)){W.fragmentTracker.backtrack(S,Z),W.resetFragmentLoading(S);return}W._handleFragmentLoadComplete(Z)}).catch(function(Z){W.warn(Z),W.resetFragmentLoading(S)})},u.flushMainBuffer=function(S,A,P){if(P===void 0&&(P=null),!(S-A))return;var W={startOffset:S,endOffset:A,type:P};this.fragLoadError=0,this.hls.trigger(_.Events.BUFFER_FLUSHING,W)},u._loadInitSegment=function(S){var A=this;this._doFragLoad(S).then(function(P){if(!P||A.fragContextChanged(S)||!A.levels)throw new Error("init load aborted");return P}).then(function(P){var W=A.hls,V=P.payload,Z=S.decryptdata;if(V&&V.byteLength>0&&Z&&Z.key&&Z.iv&&Z.method==="AES-128"){var z=self.performance.now();return A.decrypter.webCryptoDecrypt(new Uint8Array(V),Z.key.buffer,Z.iv.buffer).then(function(F){var te=self.performance.now();return W.trigger(_.Events.FRAG_DECRYPTED,{frag:S,payload:F,stats:{tstart:z,tdecrypt:te}}),P.payload=F,P})}return P}).then(function(P){var W=A.fragCurrent,V=A.hls,Z=A.levels;if(!Z)throw new Error("init load aborted, missing levels");var z=Z[S.level].details;console.assert(z,"Level details are defined when init segment is loaded");var F=S.stats;A.state=w.IDLE,A.fragLoadError=0,S.data=new Uint8Array(P.payload),F.parsing.start=F.buffering.start=self.performance.now(),F.parsing.end=F.buffering.end=self.performance.now(),P.frag===W&&V.trigger(_.Events.FRAG_BUFFERED,{stats:F,frag:W,part:null,id:S.type}),A.tick()}).catch(function(P){A.warn(P),A.resetFragmentLoading(S)})},u.fragContextChanged=function(S){var A=this.fragCurrent;return!S||!A||S.level!==A.level||S.sn!==A.sn||S.urlId!==A.urlId},u.fragBufferedComplete=function(S,A){var P=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+S.type+" sn: "+S.sn+(A?" part: "+A.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+S.level+" "+i.default.toString(j.BufferHelper.getBuffered(P))),this.state=w.IDLE,this.tick()},u._handleFragmentLoadComplete=function(S){var A=this.transmuxer;if(!A)return;var P=S.frag,W=S.part,V=S.partsLoaded,Z=!V||V.length===0||V.some(function(F){return!F}),z=new d.ChunkMetadata(P.level,P.sn,P.stats.chunkCount+1,0,W?W.index:-1,!Z);A.flush(z)},u._handleFragmentLoadProgress=function(S){},u._doFragLoad=function(S,A,P,W){var V=this;if(P===void 0&&(P=null),!this.levels)throw new Error("frag load aborted, missing levels");if(P=Math.max(S.start,P||0),this.config.lowLatencyMode&&A){var Z=A.partList;if(Z&&W){P>S.end&&A.fragmentHint&&(S=A.fragmentHint);var z=this.getNextPart(Z,S,P);if(z>-1){var F=Z[z];return this.log("Loading part sn: "+S.sn+" p: "+F.index+" cc: "+S.cc+" of playlist ["+A.startSN+"-"+A.endSN+"] parts [0-"+z+"-"+(Z.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+S.level+", target: "+parseFloat(P.toFixed(3))),this.nextLoadPosition=F.start+F.duration,this.state=w.FRAG_LOADING,this.hls.trigger(_.Events.FRAG_LOADING,{frag:S,part:Z[z],targetBufferTime:P}),this.doFragPartsLoad(S,Z,z,W).catch(function(te){return V.handleFragLoadError(te)})}else if(!S.url||this.loadedEndOfParts(Z,P))return Promise.resolve(null)}}return this.log("Loading fragment "+S.sn+" cc: "+S.cc+" "+(A?"of ["+A.startSN+"-"+A.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+S.level+", target: "+parseFloat(P.toFixed(3))),Object(K.isFiniteNumber)(S.sn)&&!this.bitrateTest&&(this.nextLoadPosition=S.start+S.duration),this.state=w.FRAG_LOADING,this.hls.trigger(_.Events.FRAG_LOADING,{frag:S,targetBufferTime:P}),this.fragmentLoader.load(S,W).catch(function(te){return V.handleFragLoadError(te)})},u.doFragPartsLoad=function(S,A,P,W){var V=this;return new Promise(function(Z,z){var F=[],te=function ie(fe){var ye=A[fe];V.fragmentLoader.loadPart(S,ye,W).then(function(_e){F[ye.index]=_e;var Le=_e.part;V.hls.trigger(_.Events.FRAG_LOADED,_e);var Ae=A[fe+1];if(Ae&&Ae.fragment===S)ie(fe+1);else return Z({frag:S,part:Le,partsLoaded:F})}).catch(z)};te(P)})},u.handleFragLoadError=function(S){var A=S.data;return A&&A.details===k.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(A.frag,A.part):this.hls.trigger(_.Events.ERROR,A),null},u._handleTransmuxerFlush=function(S){var A=this.getCurrentContext(S);if(!A||this.state!==w.PARSING){this.fragCurrent||(this.state=w.IDLE);return}var P=A.frag,W=A.part,V=A.level,Z=self.performance.now();P.stats.parsing.end=Z,W&&(W.stats.parsing.end=Z),this.updateLevelTiming(P,W,V,S.partial)},u.getCurrentContext=function(S){var A=this.levels,P=S.level,W=S.sn,V=S.part;if(!A||!A[P])return this.warn("Levels object was unset while buffering fragment "+W+" of level "+P+". The current chunk will not be buffered."),null;var Z=A[P],z=V>-1?Object(p.getPartWith)(Z,W,V):null,F=z?z.fragment:Object(p.getFragmentWithSN)(Z,W,this.fragCurrent);return F?{frag:F,part:z,level:Z}:null},u.bufferFragmentData=function(S,A,P,W){if(!S||this.state!==w.PARSING)return;var V=S.data1,Z=S.data2,z=V;if(V&&Z&&(z=Object(f.appendUint8Array)(V,Z)),!z||!z.length)return;var F={type:S.type,frag:A,part:P,chunkMeta:W,parent:A.type,data:z};this.hls.trigger(_.Events.BUFFER_APPENDING,F),S.dropped&&S.independent&&!P&&this.flushBufferGap(A)},u.flushBufferGap=function(S){var A=this.media;if(!A)return;if(!j.BufferHelper.isBuffered(A,A.currentTime)){this.flushMainBuffer(0,S.start);return}var P=A.currentTime,W=j.BufferHelper.bufferInfo(A,P,0),V=S.duration,Z=Math.min(this.config.maxFragLookUpTolerance*2,V*.25),z=Math.max(Math.min(S.start-Z,W.end-Z),P+Z);S.start-z>Z&&this.flushMainBuffer(z,S.start)},u.getFwdBufferInfo=function(S,A){var P=this.config,W=this.getLoadPosition();if(!Object(K.isFiniteNumber)(W))return null;var V=j.BufferHelper.bufferInfo(S,W,P.maxBufferHole);if(V.len===0&&V.nextStart!==void 0){var Z=this.fragmentTracker.getBufferedFrag(W,A);if(Z&&V.nextStart<Z.end)return j.BufferHelper.bufferInfo(S,W,Math.max(V.nextStart,P.maxBufferHole))}return V},u.getMaxBufferLength=function(S){var A=this.config,P;return S?P=Math.max(8*A.maxBufferSize/S,A.maxBufferLength):P=A.maxBufferLength,Math.min(P,A.maxMaxBufferLength)},u.reduceMaxBufferLength=function(S){var A=this.config,P=S||A.maxBufferLength;return A.maxMaxBufferLength>=P?(A.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+A.maxMaxBufferLength+"s"),!0):!1},u.getNextFragment=function(S,A){var P,W,V=A.fragments,Z=V.length;if(!Z)return null;var z=this.config,F=V[0].start,te;if(A.live){var ie=z.initialLiveManifestSize;if(Z<ie)return this.warn("Not enough fragments to start playback (have: "+Z+", need: "+ie+")"),null;!A.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(te=this.getInitialLiveFragment(A,V),this.startPosition=te?this.hls.liveSyncPosition||te.start:S)}else S<=F&&(te=V[0]);if(!te){var fe=z.lowLatencyMode?A.partEnd:A.fragmentEnd;te=this.getFragmentAtPosition(S,fe,A)}return(P=te)!==null&&P!==void 0&&P.initSegment&&!((W=te)!==null&&W!==void 0&&W.initSegment.data)&&!this.bitrateTest&&(te=te.initSegment),te},u.getNextPart=function(S,A,P){for(var W=-1,V=!1,Z=!0,z=0,F=S.length;z<F;z++){var te=S[z];if(Z=Z&&!te.independent,W>-1&&P<te.start)break;var ie=te.loaded;!ie&&(V||te.independent||Z)&&te.fragment===A&&(W=z),V=ie}return W},u.loadedEndOfParts=function(S,A){var P=S[S.length-1];return P&&A>P.start&&P.loaded},u.getInitialLiveFragment=function(S,A){var P=this.fragPrevious,W=null;if(P){if(S.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+P.programDateTime),W=Object(m.findFragmentByPDT)(A,P.endProgramDateTime,this.config.maxFragLookUpTolerance)),!W){var V=P.sn+1;if(V>=S.startSN&&V<=S.endSN){var Z=A[V-S.startSN];P.cc===Z.cc&&(W=Z,this.log("Live playlist, switching playlist, load frag with next SN: "+W.sn))}W||(W=Object(m.findFragWithCC)(A,P.cc),W&&this.log("Live playlist, switching playlist, load frag with same CC: "+W.sn))}}else{var z=this.hls.liveSyncPosition;z!==null&&(W=this.getFragmentAtPosition(z,this.bitrateTest?S.fragmentEnd:S.edge,S))}return W},u.getFragmentAtPosition=function(S,A,P){var W=this.config,V=this.fragPrevious,Z=P.fragments,z=P.endSN,F=P.fragmentHint,te=W.maxFragLookUpTolerance,ie=!!(W.lowLatencyMode&&P.partList&&F);ie&&F&&!this.bitrateTest&&(Z=Z.concat(F),z=F.sn);var fe;if(S<A){var ye=S>A-te?0:te;fe=Object(m.findFragmentByPTS)(V,Z,S,ye)}else fe=Z[Z.length-1];if(fe){var _e=fe.sn-P.startSN,Le=V&&fe.level===V.level,Ae=Z[_e+1],ke=this.fragmentTracker.getState(fe);if(ke===D.FragmentState.BACKTRACKED){fe=null;for(var De=_e;Z[De]&&this.fragmentTracker.getState(Z[De])===D.FragmentState.BACKTRACKED;)V?fe=Z[De--]:fe=Z[--De];fe||(fe=Ae)}else V&&fe.sn===V.sn&&!ie&&(Le&&(fe.sn<z&&this.fragmentTracker.getState(Ae)!==D.FragmentState.OK?(this.log("SN "+fe.sn+" just loaded, load next one: "+Ae.sn),fe=Ae):fe=null))}return fe},u.synchronizeToLiveEdge=function(S){var A=this.config,P=this.media;if(!P)return;var W=this.hls.liveSyncPosition,V=P.currentTime,Z=S.fragments[0].start,z=S.edge,F=V>=Z-A.maxFragLookUpTolerance&&V<=z;if(W!==null&&P.duration>W&&(V<W||!F)){var te=A.liveMaxLatencyDuration!==void 0?A.liveMaxLatencyDuration:A.liveMaxLatencyDurationCount*S.targetduration;(!F&&P.readyState<4||V<z-te)&&(this.loadedmetadata||(this.nextLoadPosition=W),P.readyState&&(this.warn("Playback: "+V.toFixed(3)+" is located too far from the end of live sliding playlist: "+z+", reset currentTime to : "+W.toFixed(3)),P.currentTime=W))}},u.alignPlaylists=function(S,A){var P=this.levels,W=this.levelLastLoaded,V=this.fragPrevious,Z=W!==null?P[W]:null,z=S.fragments.length;if(!z)return this.warn("No fragments in live playlist"),0;var F=S.fragments[0].start,te=!A,ie=S.alignedSliding&&Object(K.isFiniteNumber)(F);if(te||!ie&&!F){Object(T.alignStream)(V,Z,S);var fe=S.fragments[0].start;return this.log("Live playlist sliding: "+fe.toFixed(2)+" start-sn: "+(A?A.startSN:"na")+"->"+S.startSN+" prev-sn: "+(V?V.sn:"na")+" fragments: "+z),fe}return F},u.waitForCdnTuneIn=function(S){var A=3;return S.live&&S.canBlockReload&&S.tuneInGoal>Math.max(S.partHoldBack,S.partTarget*A)},u.setStartPosition=function(S,A){var P=this.startPosition;if(P<A&&(P=-1),P===-1||this.lastCurrentTime===-1){var W=S.startTimeOffset;Object(K.isFiniteNumber)(W)?(P=A+W,W<0&&(P+=S.totalduration),P=Math.min(Math.max(A,P),A+S.totalduration),this.log("Start time offset "+W+" found in playlist, adjust startPosition to "+P),this.startPosition=P):S.live?P=this.hls.liveSyncPosition||A:this.startPosition=P=0,this.lastCurrentTime=P}this.nextLoadPosition=P},u.getLoadPosition=function(){var S=this.media,A=0;return this.loadedmetadata&&S?A=S.currentTime:this.nextLoadPosition&&(A=this.nextLoadPosition),A},u.handleFragLoadAborted=function(S,A){this.transmuxer&&S.sn!=="initSegment"&&S.stats.aborted&&(this.warn("Fragment "+S.sn+(A?" part"+A.index:"")+" of level "+S.level+" was aborted"),this.resetFragmentLoading(S))},u.resetFragmentLoading=function(S){(!this.fragCurrent||!this.fragContextChanged(S))&&(this.state=w.IDLE)},u.onFragmentOrKeyLoadError=function(S,A){if(A.fatal)return;var P=A.frag;if(!P||P.type!==S)return;var W=this.fragCurrent;console.assert(W&&P.sn===W.sn&&P.level===W.level&&P.urlId===W.urlId,"Frag load error must match current frag to retry");var V=this.config;if(this.fragLoadError+1<=V.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(P.level))return;var Z=Math.min(Math.pow(2,this.fragLoadError)*V.fragLoadingRetryDelay,V.fragLoadingMaxRetryTimeout);this.warn("Fragment "+P.sn+" of "+S+" "+P.level+" failed to load, retrying in "+Z+"ms"),this.retryDate=self.performance.now()+Z,this.fragLoadError++,this.state=w.FRAG_LOADING_WAITING_RETRY}else A.levelRetry?(S===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=w.IDLE):(N.logger.error(A.details+" reaches max retry, redispatch as fatal ..."),A.fatal=!0,this.hls.stopLoad(),this.state=w.ERROR)},u.afterBufferFlushed=function(S,A,P){if(!S)return;var W=j.BufferHelper.getBuffered(S);this.fragmentTracker.detectEvictedFragments(A,W,P),this.state===w.ENDED&&this.resetLoadingState()},u.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=w.IDLE},u.resetLiveStartWhenNotLoaded=function(S){if(!this.loadedmetadata){this.startFragRequested=!1;var A=this.levels?this.levels[S].details:null;if(A!=null&&A.live)return this.startPosition=-1,this.setStartPosition(A,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},u.updateLevelTiming=function(S,A,P,W){var V=this,Z=P.details;console.assert(!!Z,"level.details must be defined");var z=Object.keys(S.elementaryStreams).reduce(function(F,te){var ie=S.elementaryStreams[te];if(ie){var fe=ie.endPTS-ie.startPTS;if(fe<=0)return V.warn("Could not parse fragment "+S.sn+" "+te+" duration reliably ("+fe+") resetting transmuxer to fallback to playlist timing"),V.resetTransmuxer(),F||!1;var ye=W?0:Object(p.updateFragPTSDTS)(Z,S,ie.startPTS,ie.endPTS,ie.startDTS,ie.endDTS);return V.hls.trigger(_.Events.LEVEL_PTS_UPDATED,{details:Z,level:P,drift:ye,type:te,frag:S,start:ie.startPTS,end:ie.endPTS}),!0}return F},!1);z?(this.state=w.PARSED,this.hls.trigger(_.Events.FRAG_PARSED,{frag:S,part:A})):this.resetLoadingState()},u.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},E(c,[{key:"state",get:function(){return this._state},set:function(S){var A=this._state;A!==S&&(this._state=S,this.log(A+"->"+S))}}]),c}(I.default)},"./src/controller/buffer-controller.ts":function(ne,$,M){"use strict";M.r($),M.d($,"default",function(){return m});var K=M("./src/polyfills/number.ts"),I=M("./src/events.ts"),D=M("./src/utils/logger.ts"),j=M("./src/errors.ts"),N=M("./src/utils/buffer-helper.ts"),_=M("./src/utils/mediasource-helper.ts"),k=M("./src/loader/fragment.ts"),d=M("./src/controller/buffer-operation-queue.ts"),f=Object(_.getMediaSource)(),T=/([ha]vc.)(?:\.[^.,]+)+/,m=function(){function p(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,E=i.mediaSource;D.logger.log("[buffer-controller]: Media source opened"),l&&(i.updateMediaElementDuration(),s.trigger(I.Events.MEDIA_ATTACHED,{media:l})),E&&E.removeEventListener("sourceopen",i._onMediaSourceOpen),i.checkPendingTracks()},this._onMediaSourceClose=function(){D.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){D.logger.log("[buffer-controller]: Media source ended")},this.hls=o,this._initSourceBuffer(),this.registerListeners()}var b=p.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,D.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},b.onMediaAttaching=function(i,s){var l=this.media=s.media;if(l&&f){var E=this.mediaSource=new f;E.addEventListener("sourceopen",this._onMediaSourceOpen),E.addEventListener("sourceended",this._onMediaSourceEnded),E.addEventListener("sourceclose",this._onMediaSourceClose),l.src=self.URL.createObjectURL(E),this._objectUrl=l.src}},b.onMediaDetaching=function(){var i=this.media,s=this.mediaSource,l=this._objectUrl;if(s){if(D.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(E){D.logger.warn("[buffer-controller]: onMediaDetaching: "+E.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()):D.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(E){D.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",E)}}),this._initSourceBuffer()},b.onBufferCodecs=function(i,s){var l=this,E=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(g){if(E){var v=l.tracks[g];if(v&&typeof v.buffer.changeType=="function"){var O=s[g],w=O.codec,C=O.levelCodec,y=O.container,c=(v.levelCodec||v.codec).replace(T,"$1"),u=(C||w).replace(T,"$1");if(c!==u){var L=y+";codecs="+(C||w);l.appendChangeType(g,L)}}}else l.pendingTracks[g]=s[g]}),E)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,E=this.operationQueue,g={execute:function(){var O=l.sourceBuffer[i];O&&(D.logger.log("[buffer-controller]: changing "+i+" sourceBuffer type to "+s),O.changeType(s)),E.shiftAndExecuteNext(i)},onStart:function(){},onComplete:function(){},onError:function(O){D.logger.warn("[buffer-controller]: Failed to change "+i+" SourceBuffer type",O)}};E.append(g,i)},b.onBufferAppending=function(i,s){var l=this,E=this.hls,g=this.operationQueue,v=this.tracks,O=s.data,w=s.type,C=s.frag,y=s.part,c=s.chunkMeta,u=c.buffering[w],L=self.performance.now();u.start=L;var S=C.stats.buffering,A=y?y.stats.buffering:null;S.start===0&&(S.start=L),A&&A.start===0&&(A.start=L);var P=v.audio,W=w==="audio"&&c.id===1&&(P==null?void 0:P.container)==="audio/mpeg",V={execute:function(){if(u.executeStart=self.performance.now(),W){var z=l.sourceBuffer[w];if(z){var F=C.start-z.timestampOffset;Math.abs(F)>=.1&&(D.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+C.start+" (delta: "+F+") sn: "+C.sn+")"),z.timestampOffset=C.start)}}l.appendExecutor(O,w)},onStart:function(){},onComplete:function(){var z=self.performance.now();u.executeEnd=u.end=z,S.first===0&&(S.first=z),A&&A.first===0&&(A.first=z);var F=l.sourceBuffer,te={};for(var ie in F)te[ie]=N.BufferHelper.getBuffered(F[ie]);l.appendError=0,l.hls.trigger(I.Events.BUFFER_APPENDED,{type:w,frag:C,part:y,chunkMeta:c,parent:C.type,timeRanges:te})},onError:function(z){D.logger.error("[buffer-controller]: Error encountered while trying to append to the "+w+" SourceBuffer",z);var F={type:j.ErrorTypes.MEDIA_ERROR,parent:C.type,details:j.ErrorDetails.BUFFER_APPEND_ERROR,err:z,fatal:!1};z.code===DOMException.QUOTA_EXCEEDED_ERR?F.details=j.ErrorDetails.BUFFER_FULL_ERROR:(l.appendError++,F.details=j.ErrorDetails.BUFFER_APPEND_ERROR,l.appendError>E.config.appendErrorMaxRetry&&(D.logger.error("[buffer-controller]: Failed "+E.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),F.fatal=!0)),E.trigger(I.Events.ERROR,F)}};g.append(V,w)},b.onBufferFlushing=function(i,s){var l=this,E=this.operationQueue,g=function(O){return{execute:l.removeExecutor.bind(l,O,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){l.hls.trigger(I.Events.BUFFER_FLUSHED,{type:O})},onError:function(C){D.logger.warn("[buffer-controller]: Failed to remove from "+O+" SourceBuffer",C)}}};s.type?E.append(g(s.type),s.type):this.getSourceBufferTypes().forEach(function(v){E.append(g(v),v)})},b.onFragParsed=function(i,s){var l=this,E=s.frag,g=s.part,v=[],O=g?g.elementaryStreams:E.elementaryStreams;O[k.ElementaryStreamTypes.AUDIOVIDEO]?v.push("audiovideo"):(O[k.ElementaryStreamTypes.AUDIO]&&v.push("audio"),O[k.ElementaryStreamTypes.VIDEO]&&v.push("video"));var w=function(){var y=self.performance.now();E.stats.buffering.end=y,g&&(g.stats.buffering.end=y);var c=g?g.stats:E.stats;l.hls.trigger(I.Events.FRAG_BUFFERED,{frag:E,part:g,stats:c,id:E.type})};v.length===0&&D.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+E.type+" level: "+E.level+" sn: "+E.sn),this.blockBuffers(w,v)},b.onFragChanged=function(i,s){this.flushBackBuffer()},b.onBufferEos=function(i,s){var l=this,E=this.getSourceBufferTypes().reduce(function(g,v){var O=l.sourceBuffer[v];return(!s.type||s.type===v)&&(O&&!O.ended&&(O.ended=!0,D.logger.log("[buffer-controller]: "+v+" sourceBuffer now EOS"))),g&&!!(!O||O.ended)},!0);E&&this.blockBuffers(function(){var g=l.mediaSource;if(!g||g.readyState!=="open")return;g.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,E=this.sourceBuffer;if(!l||s===null)return;var g=this.getSourceBufferTypes();if(!g.length)return;var v=s.live&&i.config.liveBackBufferLength!==null?i.config.liveBackBufferLength:i.config.backBufferLength;if(!Object(K.isFiniteNumber)(v)||v<0)return;var O=l.currentTime,w=s.levelTargetDuration,C=Math.max(v,w),y=Math.floor(O/w)*w-C;g.forEach(function(c){var u=E[c];if(u){var L=N.BufferHelper.getBuffered(u);L.length>0&&y>L.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,E=this.mediaSource,g=i.fragments[0].start+i.totalduration,v=l.duration,O=Object(K.isFiniteNumber)(E.duration)?E.duration:0;i.live&&s.config.liveDurationInfinity?(D.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),E.duration=Infinity,this.updateSeekableRange(i)):(g>O&&g>v||!Object(K.isFiniteNumber)(v))&&(D.logger.log("[buffer-controller]: Updating Media Source duration to "+g.toFixed(3)),E.duration=g)},b.updateSeekableRange=function(i){var s=this.mediaSource,l=i.fragments,E=l.length;if(E&&i.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var g=Math.max(0,l[0].start),v=Math.max(g,g+i.totalduration);s.setLiveSeekableRange(g,v)}},b.checkPendingTracks=function(){var i=this.bufferCodecEventsExpected,s=this.operationQueue,l=this.pendingTracks,E=Object.keys(l).length;if(E&&!i||E===2){this.createSourceBuffers(l),this.pendingTracks={};var g=this.getSourceBufferTypes();if(g.length===0){this.hls.trigger(I.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}g.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 E=0;for(var g in i)if(!s[g]){var v=i[g];if(!v)throw Error("source buffer exists for track "+g+", however track does not");var O=v.levelCodec||v.codec,w=v.container+";codecs="+O;D.logger.log("[buffer-controller]: creating sourceBuffer("+w+")");try{var C=s[g]=l.addSourceBuffer(w),y=g;this.addBufferListener(y,"updatestart",this._onSBUpdateStart),this.addBufferListener(y,"updateend",this._onSBUpdateEnd),this.addBufferListener(y,"error",this._onSBUpdateError),this.tracks[g]={buffer:C,codec:O,container:v.container,levelCodec:v.levelCodec,id:v.id},E++}catch(c){D.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+c.message),this.hls.trigger(I.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:c,mimeType:w})}}E&&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){D.logger.error("[buffer-controller]: "+i+" SourceBuffer error",s),this.hls.trigger(I.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var l=this.operationQueue.current(i);l&&l.onError(s)},b.removeExecutor=function(i,s,l){var E=this.media,g=this.mediaSource,v=this.operationQueue,O=this.sourceBuffer,w=O[i];if(!E||!g||!w){D.logger.warn("[buffer-controller]: Attempting to remove from the "+i+" SourceBuffer, but it does not exist"),v.shiftAndExecuteNext(i);return}var C=Object(K.isFiniteNumber)(E.duration)?E.duration:Infinity,y=Object(K.isFiniteNumber)(g.duration)?g.duration:Infinity,c=Math.max(0,s),u=Math.min(l,C,y);u>c?(D.logger.log("[buffer-controller]: Removing ["+c+","+u+"] from the "+i+" SourceBuffer"),console.assert(!w.updating,i+" sourceBuffer must not be updating"),w.remove(c,u)):v.shiftAndExecuteNext(i)},b.appendExecutor=function(i,s){var l=this.operationQueue,E=this.sourceBuffer,g=E[s];if(!g){D.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),l.shiftAndExecuteNext(s);return}g.ended=!1,console.assert(!g.updating,s+" sourceBuffer must not be updating"),g.appendBuffer(i)},b.blockBuffers=function(i,s){var l=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){D.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(i);return}var E=this.operationQueue,g=s.map(function(v){return E.appendBlocker(v)});Promise.all(g).then(function(){i(),s.forEach(function(v){var O=l.sourceBuffer[v];(!O||!O.updating)&&E.shiftAndExecuteNext(v)})})},b.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},b.addBufferListener=function(i,s,l){var E=this.sourceBuffer[i];if(!E)return;var g=l.bind(this,i);this.listeners[i].push({event:s,listener:g}),E.addEventListener(s,g)},b.removeBufferListeners=function(i){var s=this.sourceBuffer[i];if(!s)return;this.listeners[i].forEach(function(l){s.removeEventListener(l.event,l.listener)})},p}()},"./src/controller/buffer-operation-queue.ts":function(ne,$,M){"use strict";M.r($),M.d($,"default",function(){return I});var K=M("./src/utils/logger.ts"),I=function(){function D(N){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=N}var j=D.prototype;return j.append=function(_,k){var d=this.queues[k];d.push(_),d.length===1&&this.buffers[k]&&this.executeNext(k)},j.insertAbort=function(_,k){var d=this.queues[k];d.unshift(_),this.executeNext(k)},j.appendBlocker=function(_){var k,d=new Promise(function(T){k=T}),f={execute:k,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(f,_),d},j.executeNext=function(_){var k=this.buffers,d=this.queues,f=k[_],T=d[_];if(T.length){var m=T[0];try{m.execute()}catch(p){K.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),m.onError(p),(!f||!f.updating)&&(T.shift(),this.executeNext(_))}}},j.shiftAndExecuteNext=function(_){this.queues[_].shift(),this.executeNext(_)},j.current=function(_){return this.queues[_][0]},D}()},"./src/controller/cap-level-controller.ts":function(ne,$,M){"use strict";M.r($);var K=M("./src/events.ts");function I(N,_){for(var k=0;k<_.length;k++){var d=_[k];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(N,d.key,d)}}function D(N,_,k){return _&&I(N.prototype,_),k&&I(N,k),N}var j=function(){function N(k){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=k,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var _=N.prototype;return _.setStreamController=function(d){this.streamController=d},_.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},_.registerListeners=function(){var d=this.hls;d.on(K.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),d.on(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(K.Events.BUFFER_CODECS,this.onBufferCodecs,this),d.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},_.unregisterListener=function(){var d=this.hls;d.off(K.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),d.off(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(K.Events.BUFFER_CODECS,this.onBufferCodecs,this),d.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},_.onFpsDropLevelCapping=function(d,f){N.isLevelAllowed(f.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(f.droppedLevel)},_.onMediaAttaching=function(d,f){this.media=f.media instanceof HTMLVideoElement?f.media:null},_.onManifestParsed=function(d,f){var T=this.hls;this.restrictedLevels=[],this.firstLevel=f.firstLevel,T.config.capLevelToPlayerSize&&f.video&&this.startCapping()},_.onBufferCodecs=function(d,f){var T=this.hls;T.config.capLevelToPlayerSize&&f.video&&this.startCapping()},_.onMediaDetaching=function(){this.stopCapping()},_.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}}},_.getMaxLevel=function(d){var f=this,T=this.hls.levels;if(!T.length)return-1;var m=T.filter(function(p,b){return N.isLevelAllowed(b,f.restrictedLevels)&&b<=d});return this.clientRect=null,N.getMaxLevelByMediaSize(m,this.mediaWidth,this.mediaHeight)},_.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()},_.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},_.getDimensions=function(){if(this.clientRect)return this.clientRect;var d=this.media,f={width:0,height:0};if(d){var T=d.getBoundingClientRect();f.width=T.width,f.height=T.height,!f.width&&!f.height&&(f.width=T.right-T.left||d.width||0,f.height=T.bottom-T.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,T){if(!d||!d.length)return-1;for(var m=function(s,l){return l?s.width!==l.width||s.height!==l.height:!0},p=d.length-1,b=0;b<d.length;b+=1){var o=d[b];if((o.width>=f||o.height>=T)&&m(o,d[b+1])){p=b;break}}return p},D(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=j},"./src/controller/cmcd-controller.ts":function(ne,$,M){"use strict";M.r($),M.d($,"default",function(){return m});var K=M("./src/events.ts"),I=M("./src/types/cmcd.ts"),D=M("./src/utils/buffer-helper.ts"),j=M("./src/utils/logger.ts");function N(p,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(p,i.key,i)}}function _(p,b,o){return b&&N(p.prototype,b),o&&N(p,o),p}function k(p,b){var o=typeof Symbol!="undefined"&&p[Symbol.iterator]||p["@@iterator"];if(o)return(o=o.call(p)).next.bind(o);if(Array.isArray(p)||(o=d(p))||b&&p&&typeof p.length=="number"){o&&(p=o);var i=0;return function(){return i>=p.length?{done:!0}:{done:!1,value:p[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(p,b){if(!p)return;if(typeof p=="string")return f(p,b);var o=Object.prototype.toString.call(p).slice(8,-1);if(o==="Object"&&p.constructor&&(o=p.constructor.name),o==="Map"||o==="Set")return Array.from(p);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return f(p,b)}function f(p,b){(b==null||b>p.length)&&(b=p.length);for(var o=0,i=new Array(b);o<b;o++)i[o]=p[o];return i}function T(){return T=Object.assign||function(p){for(var b=1;b<arguments.length;b++){var o=arguments[b];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(p[i]=o[i])}return p},T.apply(this,arguments)}var m=function(){function p(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(E){try{i.apply(E,{ot:I.CMCDObjectType.MANIFEST,su:!i.initialized})}catch(g){j.logger.warn("Could not generate manifest CMCD data.",g)}},this.applyFragmentData=function(E){try{var g=E.frag,v=i.hls.levels[g.level],O=i.getObjectType(g),w={d:g.duration*1e3,ot:O};(O===I.CMCDObjectType.VIDEO||O===I.CMCDObjectType.AUDIO||O==I.CMCDObjectType.MUXED)&&(w.br=v.bitrate/1e3,w.tb=i.getTopBandwidth(O),w.bl=i.getBufferLength(O)),i.apply(E,w)}catch(C){j.logger.warn("Could not generate segment CMCD data.",C)}},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||p.uuid(),this.cid=l.contentId,this.useHeaders=l.useHeaders===!0,this.registerListeners())}var b=p.prototype;return b.registerListeners=function(){var i=this.hls;i.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.on(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),i.on(K.Events.BUFFER_CREATED,this.onBufferCreated,this)},b.unregisterListeners=function(){var i=this.hls;i.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.off(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),i.off(K.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,E;this.audioBuffer=(l=s.tracks.audio)===null||l===void 0?void 0:l.buffer,this.videoBuffer=(E=s.tracks.video)===null||E===void 0?void 0:E.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={}),T(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 E=p.toHeaders(s);if(!Object.keys(E).length)return;i.headers||(i.headers={}),T(i.headers,E)}else{var g=p.toQuery(s);if(!g)return;i.url=p.appendQueryToUri(i.url,g)}},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,E=k(l),g;!(g=E()).done;){var v=g.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 E=D.BufferHelper.bufferInfo(l,s.currentTime,this.config.maxBufferHole);return E.len*1e3},b.createPlaylistLoader=function(){var i=this.config.pLoader,s=this.applyPlaylistData,l=i||this.config.loader;return function(){function E(v){this.loader=void 0,this.loader=new l(v)}var g=E.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(O,w,C){s(O),this.loader.load(O,w,C)},_(E,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),E}()},b.createFragmentLoader=function(){var i=this.config.fLoader,s=this.applyFragmentData,l=i||this.config.loader;return function(){function E(v){this.loader=void 0,this.loader=new l(v)}var g=E.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(O,w,C){s(O),this.loader.load(O,w,C)},_(E,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),E}()},p.uuid=function(){var i=URL.createObjectURL(new Blob),s=i.toString();return URL.revokeObjectURL(i),s.substr(s.lastIndexOf("/")+1)},p.serialize=function(i){for(var s=[],l=function(W){return!Number.isNaN(W)&&W!=null&&W!==""&&W!==!1},E=function(W){return Math.round(W)},g=function(W){return E(W/100)*100},v=function(W){return encodeURIComponent(W)},O={br:E,d:E,bl:g,dl:g,mtp:g,nor:v,rtp:g,tb:E},w=Object.keys(i||{}).sort(),C=k(w),y;!(y=C()).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 L=O[c];L&&(u=L(u));var S=typeof u,A=void 0;c==="ot"||c==="sf"||c==="st"?A=c+"="+u:S==="boolean"?A=c:S==="number"?A=c+"="+u:A=c+"="+JSON.stringify(u),s.push(A)}return s.join(",")},p.toHeaders=function(i){for(var s=Object.keys(i),l={},E=["Object","Request","Session","Status"],g=[{},{},{},{}],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},O=0,w=s;O<w.length;O++){var C=w[O],y=v[C]!=null?v[C]:1;g[y][C]=i[C]}for(var c=0;c<g.length;c++){var u=p.serialize(g[c]);u&&(l["CMCD-"+E[c]]=u)}return l},p.toQuery=function(i){return"CMCD="+encodeURIComponent(p.serialize(i))},p.appendQueryToUri=function(i,s){if(!s)return i;var l=i.includes("?")?"&":"?";return""+i+l+s},p}()},"./src/controller/eme-controller.ts":function(ne,$,M){"use strict";M.r($);var K=M("./src/events.ts"),I=M("./src/errors.ts"),D=M("./src/utils/logger.ts"),j=M("./src/utils/mediakeys-helper.ts");function N(m,p){for(var b=0;b<p.length;b++){var o=p[b];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(m,o.key,o)}}function _(m,p,b){return p&&N(m.prototype,p),b&&N(m,b),m}var k=3,d=function(p,b,o){var i={audioCapabilities:[],videoCapabilities:[]};return p.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(p,b,o,i){switch(p){case j.KeySystems.WIDEVINE:return d(b,o,i);default:throw new Error("Unknown key-system: "+p)}},T=function(){function m(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 p=m.prototype;return p.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},p._registerListeners=function(){this.hls.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this)},p._unregisterListeners=function(){this.hls.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this)},p.getLicenseServerUrl=function(o){switch(o){case j.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+o+'"')},p._attemptKeySystemAccess=function(o,i,s){var l=this,E=f(o,i,s,this._drmSystemOptions);D.logger.log("Requesting encrypted media key-system access");var g=this.requestMediaKeySystemAccess(o,E);this.mediaKeysPromise=g.then(function(v){return l._onMediaKeySystemAccessObtained(o,v)}),g.catch(function(v){D.logger.error('Failed to obtain key-system "'+o+'" access:',v)})},p._onMediaKeySystemAccessObtained=function(o,i){var s=this;D.logger.log('Access for key-system "'+o+'" obtained');var l={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:i,mediaKeySystemDomain:o};this._mediaKeysList.push(l);var E=Promise.resolve().then(function(){return i.createMediaKeys()}).then(function(g){return l.mediaKeys=g,D.logger.log('Media-keys created for key-system "'+o+'"'),s._onMediaKeysCreated(),g});return E.catch(function(g){D.logger.error("Failed to create media-keys:",g)}),E},p._onMediaKeysCreated=function(){var o=this;this._mediaKeysList.forEach(function(i){i.mediaKeysSession||(i.mediaKeysSession=i.mediaKeys.createSession(),o._onNewMediaKeySession(i.mediaKeysSession))})},p._onNewMediaKeySession=function(o){var i=this;D.logger.log("New key-system session "+o.sessionId),o.addEventListener("message",function(s){i._onKeySessionMessage(o,s.message)},!1)},p._onKeySessionMessage=function(o,i){D.logger.log("Got EME message event, creating license request"),this._requestLicense(i,function(s){D.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),o.update(s)})},p.onMediaEncrypted=function(o){var i=this;if(D.logger.log('Media is encrypted using "'+o.initDataType+'" init data type'),!this.mediaKeysPromise){D.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(K.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(E){if(!i._media)return;i._attemptSetMediaKeys(E),i._generateRequestWithPreferredKeySession(o.initDataType,o.initData)};this.mediaKeysPromise.then(s).catch(s)},p._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){D.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(K.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}D.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(i.mediaKeys),this._hasSetMediaKeys=!0}},p._generateRequestWithPreferredKeySession=function(o,i){var s=this,l=this._mediaKeysList[0];if(!l){D.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(K.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(l.mediaKeysSessionInitialized){D.logger.warn("Key-Session already initialized but requested again");return}var E=l.mediaKeysSession;if(!E){D.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(K.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!i){D.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(K.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}D.logger.log('Generating key-session request for "'+o+'" init data type'),l.mediaKeysSessionInitialized=!0,E.generateRequest(o,i).then(function(){D.logger.debug("Key-session generation succeeded")}).catch(function(g){D.logger.error("Error generating key-session request:",g),s.hls.trigger(K.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},p._createLicenseXhr=function(o,i,s){var l=new XMLHttpRequest;l.responseType="arraybuffer",l.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,l,o,i,s);var E=this._licenseXhrSetup;if(E)try{E.call(this.hls,l,o),E=void 0}catch(g){D.logger.error(g)}try{l.readyState||l.open("POST",o,!0),E&&E.call(this.hls,l,o)}catch(g){throw new Error("issue setting up KeySystem license XHR "+g)}return l},p._onLicenseRequestReadyStageChange=function(o,i,s,l){switch(o.readyState){case 4:if(o.status===200){this._requestLicenseFailureCount=0,D.logger.log("License request succeeded");var E=o.response,g=this._licenseResponseCallback;if(g)try{E=g.call(this.hls,o,i)}catch(O){D.logger.error(O)}l(E)}else{if(D.logger.error("License Request XHR failed ("+i+"). Status: "+o.status+" ("+o.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>k){this.hls.trigger(K.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var v=k-this._requestLicenseFailureCount+1;D.logger.warn("Retrying license request, "+v+" attempts left"),this._requestLicense(s,l)}break}},p._generateLicenseRequestChallenge=function(o,i){switch(o.mediaKeySystemDomain){case j.KeySystems.WIDEVINE:return i}throw new Error("unsupported key-system: "+o.mediaKeySystemDomain)},p._requestLicense=function(o,i){D.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){D.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(K.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),E=this._createLicenseXhr(l,o,i);D.logger.log("Sending license request to URL: "+l);var g=this._generateLicenseRequestChallenge(s,o);E.send(g)}catch(v){D.logger.error("Failure requesting DRM license: "+v),this.hls.trigger(K.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},p.onMediaAttached=function(o,i){if(!this._emeEnabled)return;var s=i.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},p.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(){})},p.onManifestParsed=function(o,i){if(!this._emeEnabled)return;var s=i.levels.map(function(E){return E.audioCodec}).filter(function(E){return!!E}),l=i.levels.map(function(E){return E.videoCodec}).filter(function(E){return!!E});this._attemptKeySystemAccess(j.KeySystems.WIDEVINE,s,l)},_(m,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),m}();$.default=T},"./src/controller/fps-controller.ts":function(ne,$,M){"use strict";M.r($);var K=M("./src/events.ts"),I=M("./src/utils/logger.ts"),D=function(){function j(_){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=_,this.registerListeners()}var N=j.prototype;return N.setStreamController=function(k){this.streamController=k},N.registerListeners=function(){this.hls.on(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},N.unregisterListeners=function(){this.hls.off(K.Events.MEDIA_ATTACHING,this.onMediaAttaching)},N.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},N.onMediaAttaching=function(k,d){var f=this.hls.config;if(f.capLevelOnFPSDrop){var T=d.media instanceof self.HTMLVideoElement?d.media:null;this.media=T,T&&typeof T.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),f.fpsDroppedMonitoringPeriod)}},N.checkFPS=function(k,d,f){var T=performance.now();if(d){if(this.lastTime){var m=T-this.lastTime,p=f-this.lastDroppedFrames,b=d-this.lastDecodedFrames,o=1e3*p/m,i=this.hls;if(i.trigger(K.Events.FPS_DROP,{currentDropped:p,currentDecoded:b,totalDroppedFrames:f}),o>0&&p>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(K.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:i.currentLevel}),i.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=T,this.lastDroppedFrames=f,this.lastDecodedFrames=d}},N.checkFPSInterval=function(){var k=this.media;if(k)if(this.isVideoPlaybackQualityAvailable){var d=k.getVideoPlaybackQuality();this.checkFPS(k,d.totalVideoFrames,d.droppedVideoFrames)}else this.checkFPS(k,k.webkitDecodedFrameCount,k.webkitDroppedFrameCount)},j}();$.default=D},"./src/controller/fragment-finders.ts":function(ne,$,M){"use strict";M.r($),M.d($,"findFragmentByPDT",function(){return D}),M.d($,"findFragmentByPTS",function(){return j}),M.d($,"fragmentWithinToleranceTest",function(){return N}),M.d($,"pdtWithinToleranceTest",function(){return _}),M.d($,"findFragWithCC",function(){return k});var K=M("./src/polyfills/number.ts"),I=M("./src/utils/binary-search.ts");function D(d,f,T){if(f===null||!Array.isArray(d)||!d.length||!Object(K.isFiniteNumber)(f))return null;var m=d[0].programDateTime;if(f<(m||0))return null;var p=d[d.length-1].endProgramDateTime;if(f>=(p||0))return null;T=T||0;for(var b=0;b<d.length;++b){var o=d[b];if(_(f,T,o))return o}return null}function j(d,f,T,m){T===void 0&&(T=0),m===void 0&&(m=0);var p=null;if(d?p=f[d.sn-f[0].sn+1]||null:T===0&&f[0].start===0&&(p=f[0]),p&&N(T,m,p)===0)return p;var b=I.default.search(f,N.bind(null,T,m));return b||p}function N(d,f,T){d===void 0&&(d=0),f===void 0&&(f=0);var m=Math.min(f,T.duration+(T.deltaPTS?T.deltaPTS:0));return T.start+T.duration-m<=d?1:T.start-m>d&&T.start?-1:0}function _(d,f,T){var m=Math.min(f,T.duration+(T.deltaPTS?T.deltaPTS:0))*1e3,p=T.endProgramDateTime||0;return p-m>d}function k(d,f){return I.default.search(d,function(T){return T.cc<f?1:T.cc>f?-1:0})}},"./src/controller/fragment-tracker.ts":function(ne,$,M){"use strict";M.r($),M.d($,"FragmentState",function(){return D}),M.d($,"FragmentTracker",function(){return j});var K=M("./src/events.ts"),I=M("./src/types/loader.ts"),D;(function(k){k.NOT_LOADED="NOT_LOADED",k.BACKTRACKED="BACKTRACKED",k.APPENDING="APPENDING",k.PARTIAL="PARTIAL",k.OK="OK"})(D||(D={}));var j=function(){function k(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=k.prototype;return d._registerListeners=function(){var T=this.hls;T.on(K.Events.BUFFER_APPENDED,this.onBufferAppended,this),T.on(K.Events.FRAG_BUFFERED,this.onFragBuffered,this),T.on(K.Events.FRAG_LOADED,this.onFragLoaded,this)},d._unregisterListeners=function(){var T=this.hls;T.off(K.Events.BUFFER_APPENDED,this.onBufferAppended,this),T.off(K.Events.FRAG_BUFFERED,this.onFragBuffered,this),T.off(K.Events.FRAG_LOADED,this.onFragLoaded,this)},d.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},d.getAppendedFrag=function(T,m){if(m===I.PlaylistLevelType.MAIN){var p=this.activeFragment,b=this.activeParts;if(!p)return null;if(b)for(var o=b.length;o--;){var i=b[o],s=i?i.end:p.appendedPTS;if(i.start<=T&&s!==void 0&&T<=s)return o>9&&(this.activeParts=b.slice(o-9)),i}else if(p.start<=T&&p.appendedPTS!==void 0&&T<=p.appendedPTS)return p}return this.getBufferedFrag(T,m)},d.getBufferedFrag=function(T,m){for(var p=this.fragments,b=Object.keys(p),o=b.length;o--;){var i=p[b[o]];if((i==null?void 0:i.body.type)===m&&i.buffered){var s=i.body;if(s.start<=T&&T<=s.end)return s}}return null},d.detectEvictedFragments=function(T,m,p){var b=this;Object.keys(this.fragments).forEach(function(o){var i=b.fragments[o];if(!i)return;if(!i.buffered){i.body.type===p&&b.removeFragment(i.body);return}var s=i.range[T];if(!s)return;s.time.some(function(l){var E=!b.isTimeBuffered(l.startPTS,l.endPTS,m);return E&&b.removeFragment(i.body),E})})},d.detectPartialFragments=function(T){var m=this,p=this.timeRanges,b=T.frag,o=T.part;if(!p||b.sn==="initSegment")return;var i=_(b),s=this.fragments[i];if(!s)return;Object.keys(p).forEach(function(l){var E=b.elementaryStreams[l];if(!E)return;var g=p[l],v=o!==null||E.partial===!0;s.range[l]=m.getBufferedTimes(b,o,v,g)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},d.fragBuffered=function(T){var m=_(T),p=this.fragments[m];p&&(p.backtrack=p.loaded=null,p.buffered=!0)},d.getBufferedTimes=function(T,m,p,b){for(var o={time:[],partial:p},i=m?m.start:T.start,s=m?m.end:T.end,l=T.minEndPTS||s,E=T.maxStartPTS||i,g=0;g<b.length;g++){var v=b.start(g)-this.bufferPadding,O=b.end(g)+this.bufferPadding;if(E>=v&&l<=O){o.time.push({startPTS:Math.max(i,b.start(g)),endPTS:Math.min(s,b.end(g))});break}else if(i<O&&s>v)o.partial=!0,o.time.push({startPTS:Math.max(i,b.start(g)),endPTS:Math.min(s,b.end(g))});else if(s<=v)break}return o},d.getPartialFragment=function(T){var m=null,p,b,o,i=0,s=this.bufferPadding,l=this.fragments;return Object.keys(l).forEach(function(E){var g=l[E];if(!g)return;N(g)&&(b=g.body.start-s,o=g.body.end+s,T>=b&&T<=o&&(p=Math.min(T-b,o-T),i<=p&&(m=g.body,i=p)))}),m},d.getState=function(T){var m=_(T),p=this.fragments[m];return p?p.buffered?N(p)?D.PARTIAL:D.OK:p.backtrack?D.BACKTRACKED:D.APPENDING:D.NOT_LOADED},d.backtrack=function(T,m){var p=_(T),b=this.fragments[p];if(!b||b.backtrack)return null;var o=b.backtrack=m||b.loaded;return b.loaded=null,o},d.getBacktrackData=function(T){var m=_(T),p=this.fragments[m];if(p){var b,o=p.backtrack;if(o!=null&&(b=o.payload)!==null&&b!==void 0&&b.byteLength)return o;this.removeFragment(T)}return null},d.isTimeBuffered=function(T,m,p){for(var b,o,i=0;i<p.length;i++){if(b=p.start(i)-this.bufferPadding,o=p.end(i)+this.bufferPadding,T>=b&&m<=o)return!0;if(m<=b)return!1}return!1},d.onFragLoaded=function(T,m){var p=m.frag,b=m.part;if(p.sn==="initSegment"||p.bitrateTest||b)return;var o=_(p);this.fragments[o]={body:p,loaded:m,backtrack:null,buffered:!1,range:Object.create(null)}},d.onBufferAppended=function(T,m){var p=this,b=m.frag,o=m.part,i=m.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 E=i[l];if(p.detectEvictedFragments(l,E),!o)for(var g=0;g<E.length;g++)b.appendedPTS=Math.max(E.end(g),b.appendedPTS||0)})},d.onFragBuffered=function(T,m){this.detectPartialFragments(m)},d.hasFragment=function(T){var m=_(T);return!!this.fragments[m]},d.removeFragmentsInRange=function(T,m,p){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===p&&s.start<m&&s.end>T&&b.removeFragment(s)}})},d.removeFragment=function(T){var m=_(T);T.stats.loaded=0,T.clearElementaryStreamInfo(),delete this.fragments[m]},d.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},k}();function N(k){var d,f;return k.buffered&&(((d=k.range.video)===null||d===void 0?void 0:d.partial)||((f=k.range.audio)===null||f===void 0?void 0:f.partial))}function _(k){return k.type+"_"+k.level+"_"+k.urlId+"_"+k.sn}},"./src/controller/gap-controller.ts":function(ne,$,M){"use strict";M.r($),M.d($,"STALL_MINIMUM_DURATION_MS",function(){return N}),M.d($,"MAX_START_GAP_JUMP",function(){return _}),M.d($,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return k}),M.d($,"SKIP_BUFFER_RANGE_START",function(){return d}),M.d($,"default",function(){return f});var K=M("./src/utils/buffer-helper.ts"),I=M("./src/errors.ts"),D=M("./src/events.ts"),j=M("./src/utils/logger.ts"),N=250,_=2,k=.1,d=.05,f=function(){function T(p,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=p,this.media=b,this.fragmentTracker=o,this.hls=i}var m=T.prototype;return m.destroy=function(){this.hls=this.fragmentTracker=this.media=null},m.poll=function(b){var o=this.config,i=this.media,s=this.stalled,l=i.currentTime,E=i.seeking,g=this.seeking&&!E,v=!this.seeking&&E;if(this.seeking=E,l!==b){if(this.moved=!0,s!==null){if(this.stallReported){var O=self.performance.now()-s;j.logger.warn("playback not stuck anymore @"+l+", after "+Math.round(O)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((v||g)&&(this.stalled=null),i.paused||i.ended||i.playbackRate===0||!K.BufferHelper.getBuffered(i).length)return;var w=K.BufferHelper.bufferInfo(i,l,0),C=w.len>0,y=w.nextStart||0;if(!C&&!y)return;if(E){var c=w.len>_,u=!y||y-l>_&&!this.fragmentTracker.getPartialFragment(l);if(c||u)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var L,S=Math.max(y,w.start||0)-l,A=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,P=A==null||((L=A.details)===null||L===void 0)?void 0:L.live,W=P?A.details.targetduration*2:_;if(S>0&&S<=W){this._trySkipBufferHole(null);return}}var V=self.performance.now();if(s===null){this.stalled=V;return}var Z=V-s;!E&&Z>=N&&this._reportStall(w.len);var z=K.BufferHelper.bufferInfo(i,l,o.maxBufferHole);this._tryFixBufferStall(z,Z)},m._tryFixBufferStall=function(b,o){var i=this.config,s=this.fragmentTracker,l=this.media,E=l.currentTime,g=s.getPartialFragment(E);if(g){var v=this._trySkipBufferHole(g);if(v)return}b.len>i.maxBufferHole&&o>i.highBufferWatchdogPeriod*1e3&&(j.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},m._reportStall=function(b){var o=this.hls,i=this.media,s=this.stallReported;s||(this.stallReported=!0,j.logger.warn("Playback stalling at @"+i.currentTime+" due to low buffer (buffer="+b+")"),o.trigger(D.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:b}))},m._trySkipBufferHole=function(b){for(var o=this.config,i=this.hls,s=this.media,l=s.currentTime,E=0,g=K.BufferHelper.getBuffered(s),v=0;v<g.length;v++){var O=g.start(v);if(l+o.maxBufferHole>=E&&l<O){var w=Math.max(O+d,s.currentTime+k);return j.logger.warn("skipping hole, adjusting currentTime from "+l+" to "+w),this.moved=!0,this.stalled=null,s.currentTime=w,b&&i.trigger(D.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 "+w,frag:b}),w}E=g.end(v)}return 0},m._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 E=s+l*b.nudgeOffset;j.logger.warn("Nudging 'currentTime' from "+s+" to "+E),i.currentTime=E,o.trigger(D.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else j.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+b.nudgeMaxRetry+" nudges"),o.trigger(D.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},T}()},"./src/controller/id3-track-controller.ts":function(ne,$,M){"use strict";M.r($);var K=M("./src/events.ts"),I=M("./src/utils/texttrack-utils.ts"),D=M("./src/demux/id3.ts"),j=.25,N=function(){function _(d){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=d,this._registerListeners()}var k=_.prototype;return k.destroy=function(){this._unregisterListeners()},k._registerListeners=function(){var f=this.hls;f.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.on(K.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),f.on(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},k._unregisterListeners=function(){var f=this.hls;f.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.off(K.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),f.off(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},k.onMediaAttached=function(f,T){this.media=T.media},k.onMediaDetaching=function(){if(!this.id3Track)return;Object(I.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},k.getID3Track=function(f){if(!this.media)return;for(var T=0;T<f.length;T++){var m=f[T];if(m.kind==="metadata"&&m.label==="id3")return Object(I.sendAddTrackEvent)(m,this.media),m}return this.media.addTextTrack("metadata","id3")},k.onFragParsingMetadata=function(f,T){if(!this.media)return;var m=T.frag,p=T.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<p.length;o++){var i=D.getID3Frames(p[o].data);if(i){var s=p[o].pts,l=o<p.length-1?p[o+1].pts:m.end,E=l-s;E<=0&&(l=s+j);for(var g=0;g<i.length;g++){var v=i[g];if(!D.isTimeStampFrame(v)){var O=new b(s,l,"");O.value=v,this.id3Track.addCue(O)}}}}},k.onBufferFlushing=function(f,T){var m=T.startOffset,p=T.endOffset,b=T.type;if(!b||b==="audio"){var o=this.id3Track;o&&Object(I.removeCuesInRange)(o,m,p)}},_}();$.default=N},"./src/controller/latency-controller.ts":function(ne,$,M){"use strict";M.r($),M.d($,"default",function(){return _});var K=M("./src/errors.ts"),I=M("./src/events.ts"),D=M("./src/utils/logger.ts");function j(k,d){for(var f=0;f<d.length;f++){var T=d[f];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(k,T.key,T)}}function N(k,d,f){return d&&j(k.prototype,d),f&&j(k,f),k}var _=function(){function k(f){var T=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 T.timeupdate()},this.hls=f,this.config=f.config,this.registerListeners()}var d=k.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(T,m){this.media=m.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(T,m){var p=m.details;this.levelDetails=p,p.advanced&&this.timeupdate(),!p.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},d.onError=function(T,m){if(m.details!==K.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,D.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},d.timeupdate=function(){var T=this.media,m=this.levelDetails;if(!T||!m)return;this.currentTime=T.currentTime;var p=this.computeLatency();if(p===null)return;this._latency=p;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=p-s,E=Math.min(this.maxLatency,s+m.targetduration),g=l<E;if(m.live&&g&&l>.05&&this.forwardBufferLength>1){var v=Math.min(2,Math.max(1,i)),O=Math.round(2/(1+Math.exp(-.75*l-this.edgeStalled))*20)/20;T.playbackRate=Math.min(v,Math.max(1,O))}else T.playbackRate!==1&&T.playbackRate!==0&&(T.playbackRate=1)},d.estimateLiveEdge=function(){var T=this.levelDetails;return T===null?null:T.edge+T.age},d.computeLatency=function(){var T=this.estimateLiveEdge();return T===null?null:T-this.currentTime},N(k,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var T=this.config,m=this.levelDetails;return T.liveMaxLatencyDuration!==void 0?T.liveMaxLatencyDuration:m?T.liveMaxLatencyDurationCount*m.targetduration:0}},{key:"targetLatency",get:function(){var T=this.levelDetails;if(T===null)return null;var m=T.holdBack,p=T.partHoldBack,b=T.targetduration,o=this.config,i=o.liveSyncDuration,s=o.liveSyncDurationCount,l=o.lowLatencyMode,E=this.hls.userConfig,g=l&&p||m;(E.liveSyncDuration||E.liveSyncDurationCount||g===0)&&(g=i!==void 0?i:s*b);var v=b,O=1;return g+Math.min(this.stallCount*O,v)}},{key:"liveSyncPosition",get:function(){var T=this.estimateLiveEdge(),m=this.targetLatency,p=this.levelDetails;if(T===null||m===null||p===null)return null;var b=p.edge,o=T-m-this.edgeStalled,i=b-p.totalduration,s=b-(this.config.lowLatencyMode&&p.partTarget||p.targetduration);return Math.min(Math.max(i,o),s)}},{key:"drift",get:function(){var T=this.levelDetails;return T===null?1:T.drift}},{key:"edgeStalled",get:function(){var T=this.levelDetails;if(T===null)return 0;var m=(this.config.lowLatencyMode&&T.partTarget||T.targetduration)*3;return Math.max(T.age-m,0)}},{key:"forwardBufferLength",get:function(){var T=this.media,m=this.levelDetails;if(!T||!m)return 0;var p=T.buffered.length;return p?T.buffered.end(p-1):m.edge-this.currentTime}}]),k}()},"./src/controller/level-controller.ts":function(ne,$,M){"use strict";M.r($),M.d($,"default",function(){return o});var K=M("./src/types/level.ts"),I=M("./src/events.ts"),D=M("./src/errors.ts"),j=M("./src/utils/codecs.ts"),N=M("./src/controller/level-helper.ts"),_=M("./src/controller/base-playlist-controller.ts"),k=M("./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 E in l)Object.prototype.hasOwnProperty.call(l,E)&&(i[E]=l[E])}return i},d.apply(this,arguments)}function f(i,s){for(var l=0;l<s.length;l++){var E=s[l];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(i,E.key,E)}}function T(i,s,l){return s&&f(i.prototype,s),l&&f(i,l),i}function m(i,s){i.prototype=Object.create(s.prototype),i.prototype.constructor=i,p(i,s)}function p(i,s){return p=Object.setPrototypeOf||function(E,g){return E.__proto__=g,E},p(i,s)}var b=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),o=function(i){m(s,i);function s(E){var g;return g=i.call(this,E,"[level-controller]")||this,g._levels=[],g._firstLevel=-1,g._startLevel=void 0,g.currentLevelIndex=-1,g.manualLevelIndex=-1,g.onParsedComplete=void 0,g._registerListeners(),g}var l=s.prototype;return l._registerListeners=function(){var g=this.hls;g.on(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.on(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),g.on(I.Events.ERROR,this.onError,this)},l._unregisterListeners=function(){var g=this.hls;g.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.off(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),g.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 g=this._levels;g.forEach(function(v){v.loadError=0}),i.prototype.startLoad.call(this)},l.onManifestLoaded=function(g,v){var O=[],w=[],C=[],y,c={},u,L=!1,S=!1,A=!1;if(v.levels.forEach(function(Z){var z=Z.attrs;L=L||!!(Z.width&&Z.height),S=S||!!Z.videoCodec,A=A||!!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 K.Level(Z),c[F]=u,O.push(u)),z&&(z.AUDIO&&Object(N.addGroupId)(u,"audio",z.AUDIO),z.SUBTITLES&&Object(N.addGroupId)(u,"text",z.SUBTITLES))}),(L||S)&&A&&(O=O.filter(function(Z){var z=Z.videoCodec,F=Z.width,te=Z.height;return!!z||!!(F&&te)})),O=O.filter(function(Z){var z=Z.audioCodec,F=Z.videoCodec;return(!z||Object(j.isCodecSupportedInMp4)(z,"audio"))&&(!F||Object(j.isCodecSupportedInMp4)(F,"video"))}),v.audioTracks&&(w=v.audioTracks.filter(function(Z){return!Z.audioCodec||Object(j.isCodecSupportedInMp4)(Z.audioCodec,"audio")}),Object(N.assignTrackIdsByGroup)(w)),v.subtitles&&(C=v.subtitles,Object(N.assignTrackIdsByGroup)(C)),O.length>0){y=O[0].bitrate,O.sort(function(Z,z){return Z.bitrate-z.bitrate}),this._levels=O;for(var P=0;P<O.length;P++)if(O[P].bitrate===y){this._firstLevel=P,this.log("manifest loaded, "+O.length+" level(s) found, first bitrate: "+y);break}var W=A&&!S,V={levels:O,audioTracks:w,subtitleTracks:C,firstLevel:this._firstLevel,stats:v.stats,audio:A,video:S,altAudio:!W&&w.some(function(Z){return!!Z.url})};this.hls.trigger(I.Events.MANIFEST_PARSED,V),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(I.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:v.url,reason:"no level with compatible codecs found in manifest"})},l.onError=function(g,v){if(i.prototype.onError.call(this,g,v),v.fatal)return;var O=v.context,w=this._levels[this.currentLevelIndex];if(O&&(O.type===k.PlaylistContextType.AUDIO_TRACK&&w.audioGroupIds&&O.groupId===w.audioGroupIds[w.urlId]||O.type===k.PlaylistContextType.SUBTITLE_TRACK&&w.textGroupIds&&O.groupId===w.textGroupIds[w.urlId])){this.redundantFailover(this.currentLevelIndex);return}var C=!1,y=!0,c;switch(v.details){case D.ErrorDetails.FRAG_LOAD_ERROR:case D.ErrorDetails.FRAG_LOAD_TIMEOUT:case D.ErrorDetails.KEY_LOAD_ERROR:case D.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 D.ErrorDetails.LEVEL_LOAD_ERROR:case D.ErrorDetails.LEVEL_LOAD_TIMEOUT:O&&(O.deliveryDirectives&&(y=!1),c=O.level),C=!0;break;case D.ErrorDetails.REMUX_ALLOC_ERROR:c=v.level,C=!0;break}c!==void 0&&this.recoverLevel(v,c,C,y)},l.recoverLevel=function(g,v,O,w){var C=g.details,y=this._levels[v];if(y.loadError++,O){var c=this.retryLoadingOrFail(g);if(c)g.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(w){var u=y.url.length;if(u>1&&y.loadError<u)g.levelRetry=!0,this.redundantFailover(v);else if(this.manualLevelIndex===-1){var L=v===0?this._levels.length-1:v-1;this.currentLevelIndex!==L&&this._levels[L].loadError===0&&(this.warn(C+": switch to "+L),g.levelRetry=!0,this.hls.nextAutoLevel=L)}}},l.redundantFailover=function(g){var v=this._levels[g],O=v.url.length;if(O>1){var w=(v.urlId+1)%O;this.warn("Switching to redundant URL-id "+w),this._levels.forEach(function(C){C.urlId=w}),this.level=g}},l.onFragLoaded=function(g,v){var O=v.frag;if(O!==void 0&&O.type===k.PlaylistLevelType.MAIN){var w=this._levels[O.level];w!==void 0&&(w.fragmentError=0,w.loadError=0)}},l.onLevelLoaded=function(g,v){var O,w=v.level,C=v.details,y=this._levels[w];if(!y){var c;this.warn("Invalid level index "+w),(c=v.deliveryDirectives)!==null&&c!==void 0&&c.skip&&(C.deltaUpdateFailed=!0);return}w===this.currentLevelIndex?(y.fragmentError===0&&(y.loadError=0,this.retryCount=0),this.playlistLoaded(w,v,y.details)):(O=v.deliveryDirectives)!==null&&O!==void 0&&O.skip&&(C.deltaUpdateFailed=!0)},l.onAudioTrackSwitched=function(g,v){var O=this.hls.levels[this.currentLevelIndex];if(!O)return;if(O.audioGroupIds){for(var w=-1,C=this.hls.audioTracks[v.id].groupId,y=0;y<O.audioGroupIds.length;y++)if(O.audioGroupIds[y]===C){w=y;break}w!==O.urlId&&(O.urlId=w,this.startLoad())}},l.loadPlaylist=function(g){var v=this.currentLevelIndex,O=this._levels[v];if(this.canLoad&&O&&O.url.length>0){var w=O.urlId,C=O.url[w];if(g)try{C=g.addDirectives(C)}catch(y){this.warn("Could not construct new URL with HLS Delivery Directives: "+y)}this.log("Attempt loading level index "+v+(g?" at sn "+g.msn+" part "+g.part:"")+" with URL-id "+w+" "+C),this.clearTimer(),this.hls.trigger(I.Events.LEVEL_LOADING,{url:C,level:v,id:w,deliveryDirectives:g||null})}},l.removeLevel=function(g,v){var O=function(y,c){return c!==v},w=this._levels.filter(function(C,y){return y!==g?!0:C.url.length>1&&v!==void 0?(C.url=C.url.filter(O),C.audioGroupIds&&(C.audioGroupIds=C.audioGroupIds.filter(O)),C.textGroupIds&&(C.textGroupIds=C.textGroupIds.filter(O)),C.urlId=0,!0):!1}).map(function(C,y){var c=C.details;return c!=null&&c.fragments&&c.fragments.forEach(function(u){u.level=y}),C});this._levels=w,this.hls.trigger(I.Events.LEVELS_UPDATED,{levels:w})},T(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(g){var v,O=this._levels;if(O.length===0)return;if(this.currentLevelIndex===g&&(v=O[g])!==null&&v!==void 0&&v.details)return;if(g<0||g>=O.length){var w=g<0;if(this.hls.trigger(I.Events.ERROR,{type:D.ErrorTypes.OTHER_ERROR,details:D.ErrorDetails.LEVEL_SWITCH_ERROR,level:g,fatal:w,reason:"invalid level idx"}),w)return;g=Math.min(g,O.length-1)}this.clearTimer();var C=this.currentLevelIndex,y=O[C],c=O[g];this.log("switching to level "+g+" from "+C),this.currentLevelIndex=g;var u=d({},c,{level:g,maxBitrate:c.maxBitrate,uri:c.uri,urlId:c.urlId});delete u._urlId,this.hls.trigger(I.Events.LEVEL_SWITCHING,u);var L=c.details;if(!L||L.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(g){this.manualLevelIndex=g,this._startLevel===void 0&&(this._startLevel=g),g!==-1&&(this.level=g)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(g){this._firstLevel=g}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var g=this.hls.config.startLevel;return g!==void 0?g:this._firstLevel}else return this._startLevel},set:function(g){this._startLevel=g}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(g){this.level=g,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=g)}}]),s}(_.default)},"./src/controller/level-helper.ts":function(ne,$,M){"use strict";M.r($),M.d($,"addGroupId",function(){return D}),M.d($,"assignTrackIdsByGroup",function(){return j}),M.d($,"updatePTS",function(){return N}),M.d($,"updateFragPTSDTS",function(){return k}),M.d($,"mergeDetails",function(){return d}),M.d($,"mapPartIntersection",function(){return f}),M.d($,"mapFragmentIntersection",function(){return T}),M.d($,"adjustSliding",function(){return m}),M.d($,"addSliding",function(){return p}),M.d($,"computeReloadInterval",function(){return b}),M.d($,"getFragmentWithSN",function(){return o}),M.d($,"getPartWith",function(){return i});var K=M("./src/polyfills/number.ts"),I=M("./src/utils/logger.ts");function D(s,l,E){switch(l){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(E);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(E);break}}function j(s){var l={};s.forEach(function(E){var g=E.groupId||"";E.id=l[g]=l[g]||0,l[g]++})}function N(s,l,E){var g=s[l],v=s[E];_(g,v)}function _(s,l){var E=l.startPTS;if(Object(K.isFiniteNumber)(E)){var g=0,v;l.sn>s.sn?(g=E-s.start,v=s):(g=s.start-E,v=l),v.duration!==g&&(v.duration=g)}else if(l.sn>s.sn){var O=s.cc===l.cc;O&&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 k(s,l,E,g,v,O){var w=g-E;w<=0&&(I.logger.warn("Fragment should have a positive duration",l),g=E+l.duration,O=v+l.duration);var C=E,y=g,c=l.startPTS,u=l.endPTS;if(Object(K.isFiniteNumber)(c)){var L=Math.abs(c-E);Object(K.isFiniteNumber)(l.deltaPTS)?l.deltaPTS=Math.max(L,l.deltaPTS):l.deltaPTS=L,C=Math.max(E,c),E=Math.min(E,c),v=Math.min(v,l.startDTS),y=Math.min(g,u),g=Math.max(g,u),O=Math.max(O,l.endDTS)}l.duration=g-E;var S=E-l.start;l.appendedPTS=g,l.start=l.startPTS=E,l.maxStartPTS=C,l.startDTS=v,l.endPTS=g,l.minEndPTS=y,l.endDTS=O;var A=l.sn;if(!s||A<s.startSN||A>s.endSN)return 0;var P,W=A-s.startSN,V=s.fragments;for(V[W]=l,P=W;P>0;P--)_(V[P],V[P-1]);for(P=W;P<V.length-1;P++)_(V[P],V[P+1]);return s.fragmentHint&&_(V[V.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,S}function d(s,l){for(var E=null,g=s.fragments,v=g.length-1;v>=0;v--){var O=g[v].initSegment;if(O){E=O;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var w=0,C;if(T(s,l,function(P,W){P.relurl&&(w=P.cc-W.cc),Object(K.isFiniteNumber)(P.startPTS)&&Object(K.isFiniteNumber)(P.endPTS)&&(W.start=W.startPTS=P.startPTS,W.startDTS=P.startDTS,W.appendedPTS=P.appendedPTS,W.maxStartPTS=P.maxStartPTS,W.endPTS=P.endPTS,W.endDTS=P.endDTS,W.minEndPTS=P.minEndPTS,W.duration=P.endPTS-P.startPTS,W.duration&&(C=W),l.PTSKnown=l.alignedSliding=!0),W.elementaryStreams=P.elementaryStreams,W.loader=P.loader,W.stats=P.stats,W.urlId=P.urlId,P.initSegment&&(W.initSegment=P.initSegment,E=P.initSegment)}),E){var y=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments;y.forEach(function(P){var W;(!P.initSegment||P.initSegment.relurl===((W=E)===null||W===void 0?void 0:W.relurl))&&(P.initSegment=E)})}if(l.skippedSegments&&(l.deltaUpdateFailed=l.fragments.some(function(P){return!P}),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(w){I.logger.warn("discontinuity sliding from playlist, take drift into account");for(var L=0;L<u.length;L++)u[L].cc+=w}l.skippedSegments&&(l.startCC=l.fragments[0].cc),f(s.partList,l.partList,function(P,W){W.elementaryStreams=P.elementaryStreams,W.stats=P.stats}),C?k(l,C,C.startPTS,C.endPTS,C.startDTS,C.endDTS):m(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 A=l.edge;l.driftStart||(l.driftStartTime=S,l.driftStart=A),l.driftEndTime=S,l.driftEnd=A}else l.driftEndTime=s.driftEndTime,l.driftEnd=s.driftEnd,l.advancedDateTime=s.advancedDateTime}function f(s,l,E){if(s&&l)for(var g=0,v=0,O=s.length;v<=O;v++){var w=s[v],C=l[v+g];w&&C&&w.index===C.index&&w.fragment.sn===C.fragment.sn?E(w,C):g--}}function T(s,l,E){for(var g=l.skippedSegments,v=Math.max(s.startSN,l.startSN)-l.startSN,O=(s.fragmentHint?1:0)+(g?l.endSN:Math.min(s.endSN,l.endSN))-l.startSN,w=l.startSN-s.startSN,C=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,y=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,c=v;c<=O;c++){var u=y[w+c],L=C[c];g&&!L&&c<g&&(L=l.fragments[c]=u),u&&L&&E(u,L)}}function m(s,l){var E=l.startSN+l.skippedSegments-s.startSN,g=s.fragments;if(E<0||E>=g.length)return;p(l,g[E].start)}function p(s,l){if(l){for(var E=s.fragments,g=s.skippedSegments;g<E.length;g++)E[g].start+=l;s.fragmentHint&&(s.fragmentHint.start+=l)}}function b(s,l){var E=1e3*s.levelTargetDuration,g=E/2,v=s.age,O=v>0&&v<E*3,w=l.loading.end-l.loading.start,C,y=s.availabilityDelay;if(s.updated===!1)if(O){var c=333*s.misses;C=Math.max(Math.min(g,w*2),c),s.availabilityDelay=(s.availabilityDelay||0)+C}else C=g;else O?(y=Math.min(y||E/2,v),s.availabilityDelay=y,C=y+E-v):C=E-w;return Math.round(C)}function o(s,l,E){if(!s||!s.details)return null;var g=s.details,v=g.fragments[l-g.startSN];return v||(v=g.fragmentHint,v&&v.sn===l?v:l<g.startSN&&E&&E.sn===l?E:null)}function i(s,l,E){if(!s||!s.details)return null;var g=s.details.partList;if(g)for(var v=g.length;v--;){var O=g[v];if(O.index===E&&O.fragment.sn===l)return O}return null}},"./src/controller/stream-controller.ts":function(ne,$,M){"use strict";M.r($),M.d($,"default",function(){return g});var K=M("./src/polyfills/number.ts"),I=M("./src/controller/base-stream-controller.ts"),D=M("./src/is-supported.ts"),j=M("./src/events.ts"),N=M("./src/utils/buffer-helper.ts"),_=M("./src/controller/fragment-tracker.ts"),k=M("./src/types/loader.ts"),d=M("./src/loader/fragment.ts"),f=M("./src/demux/transmuxer-interface.ts"),T=M("./src/types/transmuxer.ts"),m=M("./src/controller/gap-controller.ts"),p=M("./src/errors.ts"),b=M("./src/utils/logger.ts");function o(v,O){for(var w=0;w<O.length;w++){var C=O[w];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(v,C.key,C)}}function i(v,O,w){return O&&o(v.prototype,O),w&&o(v,w),v}function s(v,O){v.prototype=Object.create(O.prototype),v.prototype.constructor=v,l(v,O)}function l(v,O){return l=Object.setPrototypeOf||function(C,y){return C.__proto__=y,C},l(v,O)}var E=100,g=function(v){s(O,v);function O(C,y){var c;return c=v.call(this,C,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 w=O.prototype;return w._registerListeners=function(){var y=this.hls;y.on(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),y.on(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),y.on(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),y.on(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.on(j.Events.LEVEL_LOADING,this.onLevelLoading,this),y.on(j.Events.LEVEL_LOADED,this.onLevelLoaded,this),y.on(j.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),y.on(j.Events.ERROR,this.onError,this),y.on(j.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),y.on(j.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),y.on(j.Events.BUFFER_CREATED,this.onBufferCreated,this),y.on(j.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),y.on(j.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),y.on(j.Events.FRAG_BUFFERED,this.onFragBuffered,this)},w._unregisterListeners=function(){var y=this.hls;y.off(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),y.off(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),y.off(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),y.off(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.off(j.Events.LEVEL_LOADED,this.onLevelLoaded,this),y.off(j.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),y.off(j.Events.ERROR,this.onError,this),y.off(j.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),y.off(j.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),y.off(j.Events.BUFFER_CREATED,this.onBufferCreated,this),y.off(j.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),y.off(j.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),y.off(j.Events.FRAG_BUFFERED,this.onFragBuffered,this)},w.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},w.startLoad=function(y){if(this.levels){var c=this.lastCurrentTime,u=this.hls;if(this.stopLoad(),this.setInterval(E),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var L=u.startLevel;L===-1&&(u.config.testBandwidth?(L=0,this.bitrateTest=!0):L=u.nextAutoLevel),this.level=u.nextLoadLevel=L,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},w.stopLoad=function(){this._forceStartLoad=!1,v.prototype.stopLoad.call(this)},w.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,L=c==null||((y=c[u])===null||y===void 0)?void 0:y.details;if(L&&(!L.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(L))break;this.state=I.State.IDLE;break}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var S,A=self.performance.now(),P=this.retryDate;(!P||A>=P||(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()},w.onTickEnd=function(){v.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},w.doTickIdle=function(){var y,c,u=this.hls,L=this.levelLastLoaded,S=this.levels,A=this.media,P=u.config,W=u.nextLoadLevel;if(L===null||!A&&(this.startFragRequested||!P.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!S||!S[W])return;var V=S[W];this.level=u.nextLoadLevel=W;var Z=V.details;if(!Z||this.state===I.State.WAITING_LEVEL||Z.live&&this.levelLastLoaded!==W){this.state=I.State.WAITING_LEVEL;return}var z=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:A,k.PlaylistLevelType.MAIN);if(z===null)return;var F=z.len,te=this.getMaxBufferLength(V.maxBitrate);if(F>=te)return;if(this._streamEnded(z,Z)){var ie={};this.altAudio&&(ie.type="video"),this.hls.trigger(j.Events.BUFFER_EOS,ie),this.state=I.State.ENDED;return}var fe=z.end,ye=this.getNextFragment(fe,Z);if(this.couldBacktrack&&!this.fragPrevious&&ye&&ye.sn!=="initSegment"){var _e=ye.sn-Z.startSN;_e>1&&(ye=Z.fragments[_e-1],this.fragmentTracker.removeFragment(ye))}if(ye&&this.fragmentTracker.getState(ye)===_.FragmentState.OK&&this.nextLoadPosition>fe){var Le=this.audioOnly&&!this.altAudio?d.ElementaryStreamTypes.AUDIO:d.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(A,Le,k.PlaylistLevelType.MAIN),ye=this.getNextFragment(this.nextLoadPosition,Z)}if(!ye)return;ye.initSegment&&!ye.initSegment.data&&!this.bitrateTest&&(ye=ye.initSegment),((y=ye.decryptdata)===null||y===void 0?void 0:y.keyFormat)==="identity"&&!((c=ye.decryptdata)!==null&&c!==void 0&&c.key)?this.loadKey(ye,Z):this.loadFragment(ye,Z,fe)},w.loadFragment=function(y,c,u){var L,S=this.fragmentTracker.getState(y);if(this.fragCurrent=y,S===_.FragmentState.BACKTRACKED){var A=this.fragmentTracker.getBacktrackData(y);if(A){this._handleFragmentLoadProgress(A),this._handleFragmentLoadComplete(A);return}else S=_.FragmentState.NOT_LOADED}S===_.FragmentState.NOT_LOADED||S===_.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===_.FragmentState.APPENDING?this.reduceMaxBufferLength(y.duration)&&this.fragmentTracker.removeFragment(y):((L=this.media)===null||L===void 0?void 0:L.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},w.getAppendedFrag=function(y){var c=this.fragmentTracker.getAppendedFrag(y,k.PlaylistLevelType.MAIN);return c&&"fragment"in c?c.fragment:c},w.getBufferedFrag=function(y){return this.fragmentTracker.getBufferedFrag(y,k.PlaylistLevelType.MAIN)},w.followingBufferedFrag=function(y){return y?this.getBufferedFrag(y.end+.5):null},w.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},w.nextLevelSwitch=function(){var y=this.levels,c=this.media;if(c!=null&&c.readyState){var u,L=this.getAppendedFrag(c.currentTime);if(L&&L.start>1&&this.flushMainBuffer(0,L.start-1),!c.paused&&y){var S=this.hls.nextLoadLevel,A=y[S],P=this.fragLastKbps;P&&this.fragCurrent?u=this.fragCurrent.duration*A.maxBitrate/(1e3*P)+1:u=0}else u=0;var W=this.getBufferedFrag(c.currentTime+u);if(W){var V=this.followingBufferedFrag(W);if(V){this.abortCurrentFrag();var Z=V.maxStartPTS?V.maxStartPTS:V.start,z=V.duration,F=Math.max(W.end,Z+Math.min(Math.max(z-this.config.maxFragLookUpTolerance,z*.5),z*.75));this.flushMainBuffer(F,Number.POSITIVE_INFINITY)}}}},w.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()},w.flushMainBuffer=function(y,c){v.prototype.flushMainBuffer.call(this,y,c,this.altAudio?"video":null)},w.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 m.default(this.config,u,this.fragmentTracker,this.hls)},w.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)},w.onMediaPlaying=function(){this.tick()},w.onMediaSeeked=function(){var y=this.media,c=y?y.currentTime:null;Object(K.isFiniteNumber)(c)&&this.log("Media seeked to "+c.toFixed(3)),this.tick()},w.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(j.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},w.onManifestParsed=function(y,c){var u=!1,L=!1,S;c.levels.forEach(function(A){S=A.audioCodec,S&&(S.indexOf("mp4a.40.2")!==-1&&(u=!0),S.indexOf("mp4a.40.5")!==-1&&(L=!0))}),this.audioCodecSwitch=u&&L&&!Object(D.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},w.onLevelLoading=function(y,c){var u=this.levels;if(!u||this.state!==I.State.IDLE)return;var L=u[c.level];(!L.details||L.details.live&&this.levelLastLoaded!==c.level||this.waitForCdnTuneIn(L.details))&&(this.state=I.State.WAITING_LEVEL)},w.onLevelLoaded=function(y,c){var u,L=this.levels,S=c.level,A=c.details,P=A.totalduration;if(!L){this.warn("Levels were reset while loading level "+S);return}this.log("Level "+S+" loaded ["+A.startSN+","+A.endSN+"], cc ["+A.startCC+", "+A.endCC+"] duration:"+P);var W=this.fragCurrent;W&&(this.state===I.State.FRAG_LOADING||this.state===I.State.FRAG_LOADING_WAITING_RETRY)&&(W.level!==c.level&&W.loader&&(this.state=I.State.IDLE,W.loader.abort()));var V=L[S],Z=0;if(A.live||(u=V.details)!==null&&u!==void 0&&u.live){if(A.fragments[0]||(A.deltaUpdateFailed=!0),A.deltaUpdateFailed)return;Z=this.alignPlaylists(A,V.details)}if(V.details=A,this.levelLastLoaded=S,this.hls.trigger(j.Events.LEVEL_UPDATED,{details:A,level:S}),this.state===I.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(A))return;this.state=I.State.IDLE}this.startFragRequested?A.live&&this.synchronizeToLiveEdge(A):this.setStartPosition(A,Z),this.tick()},w._handleFragmentLoadProgress=function(y){var c,u=y.frag,L=y.part,S=y.payload,A=this.levels;if(!A){this.warn("Levels were reset while fragment load was in progress. Fragment "+u.sn+" of level "+u.level+" will not be buffered");return}var P=A[u.level],W=P.details;if(!W){this.warn("Dropping fragment "+u.sn+" of level "+u.level+" after level details were reset");return}var V=P.videoCodec,Z=W.PTSKnown||!W.live,z=(c=u.initSegment)===null||c===void 0?void 0:c.data,F=this._getAudioCodec(P),te=this.transmuxer=this.transmuxer||new f.default(this.hls,k.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ie=L?L.index:-1,fe=ie!==-1,ye=new T.ChunkMetadata(u.level,u.sn,u.stats.chunkCount,S.byteLength,ie,fe),_e=this.initPTS[u.cc];te.push(S,z,F,V,u,L,W.totalduration,Z,ye,_e)},w.onAudioTrackSwitching=function(y,c){var u=this.altAudio,L=!!c.url,S=c.id;if(!L){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var A=this.fragCurrent;A!=null&&A.loader&&(this.log("Switching to main audio track, cancel main fragment load"),A.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var P=this.hls;u&&P.trigger(j.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),P.trigger(j.Events.AUDIO_TRACK_SWITCHED,{id:S})}},w.onAudioTrackSwitched=function(y,c){var u=c.id,L=!!this.hls.audioTracks[u].url;if(L){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=L,this.tick()},w.onBufferCreated=function(y,c){var u=c.tracks,L,S,A=!1;for(var P in u){var W=u[P];if(W.id==="main"){if(S=P,L=W,P==="video"){var V=u[P];V&&(this.videoBuffer=V.buffer)}}else A=!0}A&&L?(this.log("Alternate track found, use "+S+".buffered to schedule main fragment loading"),this.mediaBuffer=L.buffer):this.mediaBuffer=this.media},w.onFragBuffered=function(y,c){var u=c.frag,L=c.part;if(u&&u.type!==k.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(u)){this.warn("Fragment "+u.sn+(L?" p: "+L.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=L?L.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,L)},w.onError=function(y,c){switch(c.details){case p.ErrorDetails.FRAG_LOAD_ERROR:case p.ErrorDetails.FRAG_LOAD_TIMEOUT:case p.ErrorDetails.KEY_LOAD_ERROR:case p.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(k.PlaylistLevelType.MAIN,c);break;case p.ErrorDetails.LEVEL_LOAD_ERROR:case p.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 p.ErrorDetails.BUFFER_FULL_ERROR:if(c.parent==="main"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var u=!0,L=this.getFwdBufferInfo(this.media,k.PlaylistLevelType.MAIN);L&&L.len>.5&&(u=!this.reduceMaxBufferLength(L.len)),u&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},w.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},w.onFragLoadEmergencyAborted=function(){this.state=I.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},w.onBufferFlushed=function(y,c){var u=c.type;if(u!==d.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var L=(u===d.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(L,u,k.PlaylistLevelType.MAIN)}},w.onLevelsUpdated=function(y,c){this.levels=c.levels},w.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},w.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 L=N.BufferHelper.getBuffered(y),S=L.length?L.start(0):0,A=S-u;A>0&&(A<this.config.maxBufferHole||A<this.config.maxFragLookUpTolerance)&&(b.logger.log("adjusting start position by "+A+" to match buffer start"),u+=A,this.startPosition=u),this.log("seek to target start position "+u+" from current time "+c),y.currentTime=u}},w._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},w._loadBitrateTestFrag=function(y){var c=this;this._doFragLoad(y).then(function(u){var L=c.hls;if(!u||L.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(),L.trigger(j.Events.FRAG_LOADED,u)})},w._handleTransmuxComplete=function(y){var c,u="main",L=this.hls,S=y.remuxResult,A=y.chunkMeta,P=this.getCurrentContext(A);if(!P){this.warn("The loading context changed while buffering fragment "+A.sn+" of level "+A.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(A.level);return}var W=P.frag,V=P.part,Z=P.level,z=S.video,F=S.text,te=S.id3,ie=S.initSegment,fe=this.altAudio?void 0:S.audio;if(this.fragContextChanged(W))return;if(this.state=I.State.PARSING,ie){ie.tracks&&(this._bufferInitSegment(Z,ie.tracks,W,A),L.trigger(j.Events.FRAG_PARSING_INIT_SEGMENT,{frag:W,id:u,tracks:ie.tracks}));var ye=ie.initPTS,_e=ie.timescale;Object(K.isFiniteNumber)(ye)&&(this.initPTS[W.cc]=ye,L.trigger(j.Events.INIT_PTS_FOUND,{frag:W,id:u,initPTS:ye,timescale:_e}))}if(z&&S.independent!==!1){if(Z.details){var Le=z.startPTS,Ae=z.endPTS,ke=z.startDTS,De=z.endDTS;if(V)V.elementaryStreams[z.type]={startPTS:Le,endPTS:Ae,startDTS:ke,endDTS:De};else if(z.firstKeyFrame&&z.independent&&(this.couldBacktrack=!0),z.dropped&&z.independent){var ve=this.getLoadPosition()+this.config.maxBufferHole;if(ve<Le){this.backtrack(W);return}W.setElementaryStreamInfo(z.type,W.start,Ae,W.start,De,!0)}W.setElementaryStreamInfo(z.type,Le,Ae,ke,De),this.bufferFragmentData(z,W,V,A)}}else if(S.independent===!1){this.backtrack(W);return}if(fe){var ue=fe.startPTS,Me=fe.endPTS,Qe=fe.startDTS,He=fe.endDTS;V&&(V.elementaryStreams[d.ElementaryStreamTypes.AUDIO]={startPTS:ue,endPTS:Me,startDTS:Qe,endDTS:He}),W.setElementaryStreamInfo(d.ElementaryStreamTypes.AUDIO,ue,Me,Qe,He),this.bufferFragmentData(fe,W,V,A)}if(te!=null&&(c=te.samples)!==null&&c!==void 0&&c.length){var rt={frag:W,id:u,samples:te.samples};L.trigger(j.Events.FRAG_PARSING_METADATA,rt)}if(F){var oe={frag:W,id:u,samples:F.samples};L.trigger(j.Events.FRAG_PARSING_USERDATA,oe)}},w._bufferInitSegment=function(y,c,u,L){var S=this;if(this.state!==I.State.PARSING)return;this.audioOnly=!!c.audio&&!c.video,this.altAudio&&!this.audioOnly&&delete c.audio;var A=c.audio,P=c.video,W=c.audiovideo;if(A){var V=y.audioCodec,Z=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(V&&(V.indexOf("mp4a.40.5")!==-1?V="mp4a.40.2":V="mp4a.40.5"),A.metadata.channelCount!==1&&Z.indexOf("firefox")===-1&&(V="mp4a.40.5")),Z.indexOf("android")!==-1&&A.container!=="audio/mpeg"&&(V="mp4a.40.2",this.log("Android: force audio codec to "+V)),y.audioCodec&&y.audioCodec!==V&&this.log('Swapping manifest audio codec "'+y.audioCodec+'" for "'+V+'"'),A.levelCodec=V,A.id="main",this.log("Init audio buffer, container:"+A.container+", codecs[selected/level/parsed]=["+(V||"")+"/"+(y.audioCodec||"")+"/"+A.codec+"]")}P&&(P.levelCodec=y.videoCodec,P.id="main",this.log("Init video buffer, container:"+P.container+", codecs[level/parsed]=["+(y.videoCodec||"")+"/"+P.codec+"]")),W&&this.log("Init audiovideo buffer, container:"+W.container+", codecs[level/parsed]=["+(y.attrs.CODECS||"")+"/"+W.codec+"]"),this.hls.trigger(j.Events.BUFFER_CODECS,c),Object.keys(c).forEach(function(z){var F=c[z],te=F.initSegment;te!=null&&te.byteLength&&S.hls.trigger(j.Events.BUFFER_APPENDING,{type:z,data:te,frag:u,part:null,chunkMeta:L,parent:u.type})}),this.tick()},w.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},w.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 L=this.fragPlaying,S=c.level;(!L||c.sn!==L.sn||L.level!==S||c.urlId!==L.urlId)&&(this.hls.trigger(j.Events.FRAG_CHANGED,{frag:c}),(!L||L.level!==S)&&this.hls.trigger(j.Events.LEVEL_SWITCHED,{level:S}),this.fragPlaying=c)}}},i(O,[{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}}]),O}(I.default)},"./src/controller/subtitle-stream-controller.ts":function(ne,$,M){"use strict";M.r($),M.d($,"SubtitleStreamController",function(){return s});var K=M("./src/events.ts"),I=M("./src/utils/logger.ts"),D=M("./src/utils/buffer-helper.ts"),j=M("./src/controller/fragment-finders.ts"),N=M("./src/utils/discontinuities.ts"),_=M("./src/controller/level-helper.ts"),k=M("./src/controller/fragment-tracker.ts"),d=M("./src/controller/base-stream-controller.ts"),f=M("./src/types/loader.ts"),T=M("./src/types/level.ts");function m(l,E){for(var g=0;g<E.length;g++){var v=E[g];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(l,v.key,v)}}function p(l,E,g){return E&&m(l.prototype,E),g&&m(l,g),l}function b(l,E){l.prototype=Object.create(E.prototype),l.prototype.constructor=l,o(l,E)}function o(l,E){return o=Object.setPrototypeOf||function(v,O){return v.__proto__=O,v},o(l,E)}var i=500,s=function(l){b(E,l);function E(v,O){var w;return w=l.call(this,v,O,"[subtitle-stream-controller]")||this,w.levels=[],w.currentTrackId=-1,w.tracksBuffered=[],w.mainDetails=null,w._registerListeners(),w}var g=E.prototype;return g.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},g._registerListeners=function(){var O=this.hls;O.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),O.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),O.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),O.on(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),O.on(K.Events.ERROR,this.onError,this),O.on(K.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),O.on(K.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),O.on(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),O.on(K.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),O.on(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},g._unregisterListeners=function(){var O=this.hls;O.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),O.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),O.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),O.off(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),O.off(K.Events.ERROR,this.onError,this),O.off(K.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),O.off(K.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),O.off(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),O.off(K.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),O.off(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},g.startLoad=function(){this.stopLoad(),this.state=d.State.IDLE,this.setInterval(i),this.tick()},g.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},g.onLevelLoaded=function(O,w){this.mainDetails=w.details},g.onSubtitleFragProcessed=function(O,w){var C=w.frag,y=w.success;if(this.fragPrevious=C,this.state=d.State.IDLE,!y)return;var c=this.tracksBuffered[this.currentTrackId];if(!c)return;for(var u,L=C.start,S=0;S<c.length;S++)if(L>=c[S].start&&L<=c[S].end){u=c[S];break}var A=C.start+C.duration;u?u.end=A:(u={start:L,end:A},c.push(u)),this.fragmentTracker.fragBuffered(C)},g.onBufferFlushing=function(O,w){var C=w.startOffset,y=w.endOffset;if(C===0&&y!==Number.POSITIVE_INFINITY){var c=this.currentTrackId,u=this.levels;if(!u.length||!u[c]||!u[c].details)return;var L=u[c].details,S=L.targetduration,A=y-S;if(A<=0)return;w.endOffsetSubtitles=Math.max(0,A),this.tracksBuffered.forEach(function(P){for(var W=0;W<P.length;){if(P[W].end<=A){P.shift();continue}else if(P[W].start<A)P[W].start=A;else break;W++}}),this.fragmentTracker.removeFragmentsInRange(C,A,f.PlaylistLevelType.SUBTITLE)}},g.onError=function(O,w){var C,y=w.frag;if(!y||y.type!==f.PlaylistLevelType.SUBTITLE)return;(C=this.fragCurrent)!==null&&C!==void 0&&C.loader&&this.fragCurrent.loader.abort(),this.state=d.State.IDLE},g.onSubtitleTracksUpdated=function(O,w){var C=this,y=w.subtitleTracks;this.tracksBuffered=[],this.levels=y.map(function(c){return new T.Level(c)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(c){C.tracksBuffered[c.id]=[]}),this.mediaBuffer=null},g.onSubtitleTrackSwitch=function(O,w){if(this.currentTrackId=w.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var C=this.levels[this.currentTrackId];C!=null&&C.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,C&&this.setInterval(i)},g.onSubtitleTrackLoaded=function(O,w){var C,y=w.details,c=w.id,u=this.currentTrackId,L=this.levels;if(!L.length)return;var S=L[u];if(c>=L.length||c!==u||!S)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,y.live||(C=S.details)!==null&&C!==void 0&&C.live){var A=this.mainDetails;if(y.deltaUpdateFailed||!A)return;var P=A.fragments[0];if(!S.details)y.hasProgramDateTime&&A.hasProgramDateTime?Object(N.alignMediaPlaylistByPDT)(y,A):P&&Object(_.addSliding)(y,P.start);else{var W=this.alignPlaylists(y,S.details);W===0&&P&&Object(_.addSliding)(y,P.start)}}if(S.details=y,this.levelLastLoaded=c,this.tick(),y.live&&!this.fragCurrent&&this.media&&this.state===d.State.IDLE){var V=Object(j.findFragmentByPTS)(null,y.fragments,this.media.currentTime,0);V||(this.warn("Subtitle playlist not aligned with playback"),S.details=void 0)}},g._handleFragmentLoadComplete=function(O){var w=O.frag,C=O.payload,y=w.decryptdata,c=this.hls;if(this.fragContextChanged(w))return;if(C&&C.byteLength>0&&y&&y.key&&y.iv&&y.method==="AES-128"){var u=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(C),y.key.buffer,y.iv.buffer).then(function(L){var S=performance.now();c.trigger(K.Events.FRAG_DECRYPTED,{frag:w,payload:L,stats:{tstart:u,tdecrypt:S}})})}},g.doTick=function(){if(!this.media){this.state=d.State.IDLE;return}if(this.state===d.State.IDLE){var O,w=this.currentTrackId,C=this.levels;if(!C.length||!C[w]||!C[w].details)return;var y=C[w].details,c=y.targetduration,u=this.config,L=this.media,S=D.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,L.currentTime-c,u.maxBufferHole),A=S.end,P=S.len,W=this.getMaxBufferLength()+c;if(P>W)return;console.assert(y,"Subtitle track details are defined on idle subtitle stream controller tick");var V=y.fragments,Z=V.length,z=y.edge,F,te=this.fragPrevious;if(A<z){var ie=u.maxFragLookUpTolerance;te&&y.hasProgramDateTime&&(F=Object(j.findFragmentByPDT)(V,te.endProgramDateTime,ie)),F||(F=Object(j.findFragmentByPTS)(te,V,A,ie),!F&&te&&te.start<V[0].start&&(F=V[0]))}else F=V[Z-1];(O=F)!==null&&O!==void 0&&O.encrypted?(I.logger.log("Loading key for "+F.sn),this.state=d.State.KEY_LOADING,this.hls.trigger(K.Events.KEY_LOADING,{frag:F})):F&&this.fragmentTracker.getState(F)===k.FragmentState.NOT_LOADED&&this.loadFragment(F,y,A)}},g.loadFragment=function(O,w,C){this.fragCurrent=O,l.prototype.loadFragment.call(this,O,w,C)},p(E,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),E}(d.default)},"./src/controller/subtitle-track-controller.ts":function(ne,$,M){"use strict";M.r($);var K=M("./src/events.ts"),I=M("./src/utils/texttrack-utils.ts"),D=M("./src/controller/base-playlist-controller.ts"),j=M("./src/types/loader.ts");function N(m,p){for(var b=0;b<p.length;b++){var o=p[b];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(m,o.key,o)}}function _(m,p,b){return p&&N(m.prototype,p),b&&N(m,b),m}function k(m,p){m.prototype=Object.create(p.prototype),m.prototype.constructor=m,d(m,p)}function d(m,p){return d=Object.setPrototypeOf||function(o,i){return o.__proto__=i,o},d(m,p)}var f=function(m){k(p,m);function p(o){var i;return i=m.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=p.prototype;return b.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,m.prototype.destroy.call(this)},b.registerListeners=function(){var i=this.hls;i.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.on(K.Events.LEVEL_LOADING,this.onLevelLoading,this),i.on(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),i.on(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),i.on(K.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){var i=this.hls;i.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.off(K.Events.LEVEL_LOADING,this.onLevelLoading,this),i.off(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),i.off(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),i.off(K.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=T(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,E=s.details,g=this.trackId,v=this.tracksInGroup[g];if(!v){this.warn("Invalid subtitle track id "+l);return}var O=v.details;v.details=s.details,this.log("subtitle track "+l+" loaded ["+E.startSN+"-"+E.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,s,O))},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 E=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,g=this.tracks.filter(function(w){return!l||w.groupId===l});this.tracksInGroup=g;var v=this.findTrackId(E==null?void 0:E.name)||this.findTrackId();this.groupId=l;var O={subtitleTracks:g};this.log("Updating subtitle tracks, "+g.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(K.Events.SUBTITLE_TRACKS_UPDATED,O),v!==-1&&this.setSubtitleTrack(v,E)}},b.findTrackId=function(i){for(var s=this.tracksInGroup,l=0;l<s.length;l++){var E=s[l];if((!this.selectDefaultTrack||E.default)&&(!i||i===E.name))return E.id}return-1},b.onError=function(i,s){if(m.prototype.onError.call(this,i,s),s.fatal||!s.context)return;s.context.type===j.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,E=s.groupId,g=s.url;if(i)try{g=i.addDirectives(g)}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(K.Events.SUBTITLE_TRACK_LOADING,{url:g,id:l,groupId:E,deliveryDirectives:i||null})}},b.toggleTrackModes=function(i){var s=this,l=this.media,E=this.subtitleDisplay,g=this.trackId;if(!l)return;var v=T(l.textTracks),O=v.filter(function(y){return y.groupId===s.groupId});if(i===-1)[].slice.call(v).forEach(function(y){y.mode="disabled"});else{var w=O[g];w&&(w.mode="disabled")}var C=O[i];C&&(C.mode=E?"showing":"hidden")},b.setSubtitleTrack=function(i,s){var l,E=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=i;return}if(this.trackId!==i&&this.toggleTrackModes(i),this.trackId===i&&(i===-1||(l=E[i])!==null&&l!==void 0&&l.details)||i<-1||i>=E.length)return;this.clearTimer();var g=E[i];if(this.log("Switching to subtitle track "+i),this.trackId=i,g){var v=g.id,O=g.groupId,w=O===void 0?"":O,C=g.name,y=g.type,c=g.url;this.hls.trigger(K.Events.SUBTITLE_TRACK_SWITCH,{id:v,groupId:w,name:C,type:y,url:c});var u=this.switchParams(g.url,s==null?void 0:s.details);this.loadPlaylist(u)}else this.hls.trigger(K.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=T(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,[{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)}}]),p}(D.default);function T(m){for(var p=[],b=0;b<m.length;b++){var o=m[b];o.kind==="subtitles"&&o.label&&p.push(m[b])}return p}$.default=f},"./src/controller/timeline-controller.ts":function(ne,$,M){"use strict";M.r($),M.d($,"TimelineController",function(){return T});var K=M("./src/polyfills/number.ts"),I=M("./src/events.ts"),D=M("./src/utils/cea-608-parser.ts"),j=M("./src/utils/output-filter.ts"),N=M("./src/utils/webvtt-parser.ts"),_=M("./src/utils/texttrack-utils.ts"),k=M("./src/utils/imsc1-ttml-parser.ts"),d=M("./src/types/loader.ts"),f=M("./src/utils/logger.ts"),T=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 j.default(this,"textTrack1"),E=new j.default(this,"textTrack2"),g=new j.default(this,"textTrack3"),v=new j.default(this,"textTrack4");this.cea608Parser1=new D.default(1,l,E),this.cea608Parser2=new D.default(3,g,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,E,g,v,O){for(var w=!1,C=O.length;C--;){var y=O[C],c=p(y[0],y[1],E,g);if(c>=0&&(y[0]=Math.min(y[0],E),y[1]=Math.max(y[1],g),w=!0,c/(g-E)>.5))return}if(w||O.push([E,g]),this.config.renderTextTracksNatively){var u=this.captionsTracks[l];this.Cues.newCue(u,E,g,v)}else{var L=this.Cues.newCue(null,E,g,v);this.hls.trigger(I.Events.CUES_PARSED,{type:"captions",cues:L,track:l})}},i.onInitPtsFound=function(l,E){var g=this,v=E.frag,O=E.id,w=E.initPTS,C=E.timescale,y=this.unparsedVttFrags;O==="main"&&(this.initPTS[v.cc]=w,this.timescale[v.cc]=C),y.length&&(this.unparsedVttFrags=[],y.forEach(function(c){g.onFragLoaded(I.Events.FRAG_LOADED,c)}))},i.getExistingTrack=function(l){var E=this.media;if(E)for(var g=0;g<E.textTracks.length;g++){var v=E.textTracks[g];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 E=this.captionsProperties,g=this.captionsTracks,v=this.media,O=E[l],w=O.label,C=O.languageCode,y=this.getExistingTrack(l);if(y)g[l]=y,Object(_.clearCurrentCues)(g[l]),Object(_.sendAddTrackEvent)(g[l],v);else{var c=this.createTextTrack("captions",w,C);c&&(c[l]=!0,g[l]=c)}},i.createNonNativeTrack=function(l){if(this.nonNativeCaptionsTracks[l])return;var E=this.captionsProperties[l];if(!E)return;var g=E.label,v={_id:l,label:g,kind:"captions",default:E.media?!!E.media.default:!1,closedCaptions:E.media};this.nonNativeCaptionsTracks[l]=v,this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[v]})},i.createTextTrack=function(l,E,g){var v=this.media;return v?v.addTextTrack(l,E,g):void 0},i.onMediaAttaching=function(l,E){this.media=E.media,this._cleanTracks()},i.onMediaDetaching=function(){var l=this.captionsTracks;Object.keys(l).forEach(function(E){Object(_.clearCurrentCues)(l[E]),delete l[E]}),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 E=l.textTracks;if(E)for(var g=0;g<E.length;g++)Object(_.clearCurrentCues)(E[g])},i.onSubtitleTracksUpdated=function(l,E){var g=this;this.textTracks=[];var v=E.subtitleTracks||[],O=v.some(function(c){return c.textCodec===k.IMSC1_CODEC});if(this.config.enableWebVTT||O&&this.config.enableIMSC1){var w=this.tracks&&v&&this.tracks.length===v.length;if(this.tracks=v||[],this.config.renderTextTracksNatively){var C=this.media?this.media.textTracks:[];this.tracks.forEach(function(c,u){var L;if(u<C.length){for(var S=null,A=0;A<C.length;A++)if(m(C[A],c)){S=C[A];break}S&&(L=S)}L?Object(_.clearCurrentCues)(L):(L=g.createTextTrack("subtitles",c.name,c.lang),L&&(L.mode="disabled")),L&&(L.groupId=c.groupId,g.textTracks.push(L))})}else if(!w&&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,E){var g=this;this.config.enableCEA708Captions&&E.captions&&E.captions.forEach(function(v){var O=/(?:CC|SERVICE)([1-4])/.exec(v.instreamId);if(!O)return;var w="textTrack"+O[1],C=g.captionsProperties[w];if(!C)return;C.label=v.name,v.lang&&(C.languageCode=v.lang),C.media=v})},i.onFragLoading=function(l,E){var g=this.cea608Parser1,v=this.cea608Parser2,O=this.lastSn,w=this.lastPartIndex;if(!this.enabled||!(g&&v))return;if(E.frag.type===d.PlaylistLevelType.MAIN){var C,y,c=E.frag.sn,u=(C=E==null||((y=E.part)===null||y===void 0)?void 0:y.index)!=null?C:-1;c===O+1||c===O&&u===w+1||(g.reset(),v.reset()),this.lastSn=c,this.lastPartIndex=u}},i.onFragLoaded=function(l,E){var g=E.frag,v=E.payload,O=this.initPTS,w=this.unparsedVttFrags;if(g.type===d.PlaylistLevelType.SUBTITLE)if(v.byteLength){if(!Object(K.isFiniteNumber)(O[g.cc])){w.push(E),O.length&&this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Missing initial subtitle PTS")});return}var C=g.decryptdata;if(C==null||C.key==null||C.method!=="AES-128"){var y=this.tracks[g.level],c=this.vttCCs;c[g.cc]||(c[g.cc]={start:g.start,prevCC:this.prevCC,new:!0},this.prevCC=g.cc),y&&y.textCodec===k.IMSC1_CODEC?this._parseIMSC1(g,v):this._parseVTTs(g,v,c)}}else this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Empty subtitle payload")})},i._parseIMSC1=function(l,E){var g=this,v=this.hls;Object(k.parseIMSC1)(E,this.initPTS[l.cc],this.timescale[l.cc],function(O){g._appendCues(O,l.level),v.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(O){f.logger.log("Failed to parse IMSC1: "+O),v.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:O})})},i._parseVTTs=function(l,E,g){var v=this,O=this.hls;Object(N.parseWebVTT)(E,this.initPTS[l.cc],this.timescale[l.cc],g,l.cc,l.start,function(w){v._appendCues(w,l.level),O.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(w){v._fallbackToIMSC1(l,E),f.logger.log("Failed to parse VTT cue: "+w),O.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:w})})},i._fallbackToIMSC1=function(l,E){var g=this,v=this.tracks[l.level];v.textCodec||Object(k.parseIMSC1)(E,this.initPTS[l.cc],this.timescale[l.cc],function(){v.textCodec=k.IMSC1_CODEC,g._parseIMSC1(l,E)},function(){v.textCodec="wvtt"})},i._appendCues=function(l,E){var g=this.hls;if(this.config.renderTextTracksNatively){var v=this.textTracks[E];if(v.mode==="disabled")return;l.forEach(function(C){return Object(_.addCueToTrack)(v,C)})}else{var O=this.tracks[E],w=O.default?"default":"subtitles"+E;g.trigger(I.Events.CUES_PARSED,{type:"subtitles",cues:l,track:w})}},i.onFragDecrypted=function(l,E){var g=E.frag;if(g.type===d.PlaylistLevelType.SUBTITLE){if(!Object(K.isFiniteNumber)(this.initPTS[g.cc])){this.unparsedVttFrags.push(E);return}this.onFragLoaded(I.Events.FRAG_LOADED,E)}},i.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},i.onFragParsingUserdata=function(l,E){var g=this.cea608Parser1,v=this.cea608Parser2;if(!this.enabled||!(g&&v))return;for(var O=0;O<E.samples.length;O++){var w=E.samples[O].bytes;if(w){var C=this.extractCea608Data(w);g.addData(E.samples[O].pts,C[0]),v.addData(E.samples[O].pts,C[1])}}},i.onBufferFlushing=function(l,E){var g=E.startOffset,v=E.endOffset,O=E.endOffsetSubtitles,w=E.type,C=this.media;if(!C||C.currentTime<v)return;if(!w||w==="video"){var y=this.captionsTracks;Object.keys(y).forEach(function(u){return Object(_.removeCuesInRange)(y[u],g,v)})}if(this.config.renderTextTracksNatively&&(g===0&&O!==void 0)){var c=this.textTracks;Object.keys(c).forEach(function(u){return Object(_.removeCuesInRange)(c[u],g,O)})}},i.extractCea608Data=function(l){for(var E=l[0]&31,g=2,v=[[],[]],O=0;O<E;O++){var w=l[g++],C=127&l[g++],y=127&l[g++],c=(4&w)!==0,u=3&w;if(C===0&&y===0)continue;c&&((u===0||u===1)&&(v[u].push(C),v[u].push(y)))}return v},o}();function m(o,i){return o&&o.label===i.name&&!(o.textTrack1||o.textTrack2)}function p(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(ne,$,M){"use strict";M.r($),M.d($,"default",function(){return K});var K=function(){function I(j,N){this.subtle=void 0,this.aesIV=void 0,this.subtle=j,this.aesIV=N}var D=I.prototype;return D.decrypt=function(N,_){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},_,N)},I}()},"./src/crypt/aes-decryptor.ts":function(ne,$,M){"use strict";M.r($),M.d($,"removePadding",function(){return I}),M.d($,"default",function(){return D});var K=M("./src/utils/typed-array.ts");function I(j){var N=j.byteLength,_=N&&new DataView(j.buffer).getUint8(N-1);return _?Object(K.sliceUint8)(j,0,N-_):j}var D=function(){function j(){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=j.prototype;return N.uint8ArrayToUint32Array_=function(k){for(var d=new DataView(k),f=new Uint32Array(4),T=0;T<4;T++)f[T]=d.getUint32(T*4);return f},N.initTable=function(){var k=this.sBox,d=this.invSBox,f=this.subMix,T=f[0],m=f[1],p=f[2],b=f[3],o=this.invSubMix,i=o[0],s=o[1],l=o[2],E=o[3],g=new Uint32Array(256),v=0,O=0,w=0;for(w=0;w<256;w++)w<128?g[w]=w<<1:g[w]=w<<1^283;for(w=0;w<256;w++){var C=O^O<<1^O<<2^O<<3^O<<4;C=C>>>8^C&255^99,k[v]=C,d[C]=v;var y=g[v],c=g[y],u=g[c],L=g[C]*257^C*16843008;T[v]=L<<24|L>>>8,m[v]=L<<16|L>>>16,p[v]=L<<8|L>>>24,b[v]=L,L=u*16843009^c*65537^y*257^v*16843008,i[C]=L<<24|L>>>8,s[C]=L<<16|L>>>16,l[C]=L<<8|L>>>24,E[C]=L,v?(v=y^g[g[g[u^y]]],O^=g[g[O]]):v=O=1}},N.expandKey=function(k){for(var d=this.uint8ArrayToUint32Array_(k),f=!0,T=0;T<d.length&&f;)f=d[T]===this.key[T],T++;if(f)return;this.key=d;var m=this.keySize=d.length;if(m!==4&&m!==6&&m!==8)throw new Error("Invalid aes key size="+m);var p=this.ksRows=(m+6+1)*4,b,o,i=this.keySchedule=new Uint32Array(p),s=this.invKeySchedule=new Uint32Array(p),l=this.sBox,E=this.rcon,g=this.invSubMix,v=g[0],O=g[1],w=g[2],C=g[3],y,c;for(b=0;b<p;b++){if(b<m){y=i[b]=d[b];continue}c=y,b%m===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^=E[b/m|0]<<24):m>6&&b%m===4&&(c=l[c>>>24]<<24|l[c>>>16&255]<<16|l[c>>>8&255]<<8|l[c&255]),i[b]=y=(i[b-m]^c)>>>0}for(o=0;o<p;o++)b=p-o,o&3?c=i[b]:c=i[b-4],o<4||b<=4?s[o]=c:s[o]=v[l[c>>>24]]^O[l[c>>>16&255]]^w[l[c>>>8&255]]^C[l[c&255]],s[o]=s[o]>>>0},N.networkToHostOrderSwap=function(k){return k<<24|(k&65280)<<8|(k&16711680)>>8|k>>>24},N.decrypt=function(k,d,f){for(var T=this.keySize+6,m=this.invKeySchedule,p=this.invSBox,b=this.invSubMix,o=b[0],i=b[1],s=b[2],l=b[3],E=this.uint8ArrayToUint32Array_(f),g=E[0],v=E[1],O=E[2],w=E[3],C=new Int32Array(k),y=new Int32Array(C.length),c,u,L,S,A,P,W,V,Z,z,F,te,ie,fe,ye=this.networkToHostOrderSwap;d<C.length;){for(Z=ye(C[d]),z=ye(C[d+1]),F=ye(C[d+2]),te=ye(C[d+3]),A=Z^m[0],P=te^m[1],W=F^m[2],V=z^m[3],ie=4,fe=1;fe<T;fe++)c=o[A>>>24]^i[P>>16&255]^s[W>>8&255]^l[V&255]^m[ie],u=o[P>>>24]^i[W>>16&255]^s[V>>8&255]^l[A&255]^m[ie+1],L=o[W>>>24]^i[V>>16&255]^s[A>>8&255]^l[P&255]^m[ie+2],S=o[V>>>24]^i[A>>16&255]^s[P>>8&255]^l[W&255]^m[ie+3],A=c,P=u,W=L,V=S,ie=ie+4;c=p[A>>>24]<<24^p[P>>16&255]<<16^p[W>>8&255]<<8^p[V&255]^m[ie],u=p[P>>>24]<<24^p[W>>16&255]<<16^p[V>>8&255]<<8^p[A&255]^m[ie+1],L=p[W>>>24]<<24^p[V>>16&255]<<16^p[A>>8&255]<<8^p[P&255]^m[ie+2],S=p[V>>>24]<<24^p[A>>16&255]<<16^p[P>>8&255]<<8^p[W&255]^m[ie+3],y[d]=ye(c^g),y[d+1]=ye(S^v),y[d+2]=ye(L^O),y[d+3]=ye(u^w),g=Z,v=z,O=F,w=te,d=d+4}return y.buffer},j}()},"./src/crypt/decrypter.ts":function(ne,$,M){"use strict";M.r($),M.d($,"default",function(){return d});var K=M("./src/crypt/aes-crypto.ts"),I=M("./src/crypt/fast-aes-key.ts"),D=M("./src/crypt/aes-decryptor.ts"),j=M("./src/utils/logger.ts"),N=M("./src/utils/mp4-tools.ts"),_=M("./src/utils/typed-array.ts"),k=16,d=function(){function f(m,p,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=m,this.config=p,this.removePKCS7Padding=s,s)try{var l=self.crypto;l&&(this.subtle=l.subtle||l.webkitSubtle)}catch(E){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var T=f.prototype;return T.destroy=function(){this.observer=null},T.isSync=function(){return this.config.enableSoftwareAES},T.flush=function(){var p=this.currentResult;if(!p){this.reset();return}var b=new Uint8Array(p);return this.reset(),this.removePKCS7Padding?Object(D.removePadding)(b):b},T.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},T.decrypt=function(p,b,o,i){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(p),b,o);var s=this.flush();s&&i(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(p),b,o).then(i)},T.softwareDecrypt=function(p,b,o){var i=this.currentIV,s=this.currentResult,l=this.remainderData;this.logOnce("JS AES decrypt"),l&&(p=Object(N.appendUint8Array)(l,p),this.remainderData=null);var E=this.getValidChunk(p);if(!E.length)return null;i&&(o=i);var g=this.softwareDecrypter;g||(g=this.softwareDecrypter=new D.default),g.expandKey(b);var v=s;return this.currentResult=g.decrypt(E.buffer,0,o),this.currentIV=Object(_.sliceUint8)(E,-16).buffer,v||null},T.webCryptoDecrypt=function(p,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 E=new K.default(s,o);return E.decrypt(p.buffer,l)}).catch(function(l){return i.onWebCryptoError(l,p,b,o)})},T.onWebCryptoError=function(p,b,o,i){return j.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",p),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(b,o,i)},T.getValidChunk=function(p){var b=p,o=p.length-p.length%k;return o!==p.length&&(b=Object(_.sliceUint8)(p,0,o),this.remainderData=Object(_.sliceUint8)(p,o)),b},T.logOnce=function(p){if(!this.logEnabled)return;j.logger.log("[decrypter.ts]: "+p),this.logEnabled=!1},f}()},"./src/crypt/fast-aes-key.ts":function(ne,$,M){"use strict";M.r($),M.d($,"default",function(){return K});var K=function(){function I(j,N){this.subtle=void 0,this.key=void 0,this.subtle=j,this.key=N}var D=I.prototype;return D.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},I}()},"./src/demux/aacdemuxer.ts":function(ne,$,M){"use strict";M.r($);var K=M("./src/demux/base-audio-demuxer.ts"),I=M("./src/demux/adts.ts"),D=M("./src/utils/logger.ts"),j=M("./src/demux/id3.ts");function N(d,f){d.prototype=Object.create(f.prototype),d.prototype.constructor=d,_(d,f)}function _(d,f){return _=Object.setPrototypeOf||function(m,p){return m.__proto__=p,m},_(d,f)}var k=function(d){N(f,d);function f(m,p){var b;return b=d.call(this)||this,b.observer=void 0,b.config=void 0,b.observer=m,b.config=p,b}var T=f.prototype;return T.resetInitSegment=function(p,b,o){d.prototype.resetInitSegment.call(this,p,b,o),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:p,duration:o,inputTimeScale:9e4,dropped:0}},f.probe=function(p){if(!p)return!1;for(var b=j.getID3Data(p,0)||[],o=b.length,i=p.length;o<i;o++)if(I.probe(p,o))return D.logger.log("ADTS sync word found !"),!0;return!1},T.canParse=function(p,b){return I.canParse(p,b)},T.appendFrame=function(p,b,o){I.initTrackConfig(p,this.observer,b,o,p.manifestCodec);var i=I.appendFrame(p,b,o,this.initPTS,this.frameIndex);if(i&&i.missing===0)return i},f}(K.default);k.minProbeByteLength=9,$.default=k},"./src/demux/adts.ts":function(ne,$,M){"use strict";M.r($),M.d($,"getAudioConfig",function(){return j}),M.d($,"isHeaderPattern",function(){return N}),M.d($,"getHeaderLength",function(){return _}),M.d($,"getFullFrameLength",function(){return k}),M.d($,"canGetFrameLength",function(){return d}),M.d($,"isHeader",function(){return f}),M.d($,"canParse",function(){return T}),M.d($,"probe",function(){return m}),M.d($,"initTrackConfig",function(){return p}),M.d($,"getFrameDuration",function(){return b}),M.d($,"parseFrameHeader",function(){return o}),M.d($,"appendFrame",function(){return i});var K=M("./src/utils/logger.ts"),I=M("./src/errors.ts"),D=M("./src/events.ts");function j(s,l,E,g){var v,O,w,C,y=navigator.userAgent.toLowerCase(),c=g,u=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];v=((l[E+2]&192)>>>6)+1;var L=(l[E+2]&60)>>>2;if(L>u.length-1){s.trigger(D.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+L});return}return w=(l[E+2]&1)<<2,w|=(l[E+3]&192)>>>6,K.logger.log("manifest codec:"+g+", ADTS type:"+v+", samplingIndex:"+L),/firefox/i.test(y)?L>=6?(v=5,C=new Array(4),O=L-3):(v=2,C=new Array(2),O=L):y.indexOf("android")!==-1?(v=2,C=new Array(2),O=L):(v=5,C=new Array(4),g&&(g.indexOf("mp4a.40.29")!==-1||g.indexOf("mp4a.40.5")!==-1)||!g&&L>=6?O=L-3:((g&&g.indexOf("mp4a.40.2")!==-1&&(L>=6&&w===1||/vivaldi/i.test(y))||!g&&w===1)&&(v=2,C=new Array(2)),O=L)),C[0]=v<<3,C[0]|=(L&14)>>1,C[1]|=(L&1)<<7,C[1]|=w<<3,v===5&&(C[1]|=(O&14)>>1,C[2]=(O&1)<<7,C[2]|=2<<2,C[3]=0),{config:C,samplerate:u[L],channelCount:w,codec:"mp4a.40."+v,manifestCodec:c}}function N(s,l){return s[l]===255&&(s[l+1]&246)===240}function _(s,l){return s[l+1]&1?7:9}function k(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 T(s,l){return d(s,l)&&N(s,l)&&k(s,l)<=s.length-l}function m(s,l){if(f(s,l)){var E=_(s,l);if(l+E>=s.length)return!1;var g=k(s,l);if(g<=E)return!1;var v=l+g;return v===s.length||f(s,v)}return!1}function p(s,l,E,g,v){if(!s.samplerate){var O=j(l,E,g,v);if(!O)return;s.config=O.config,s.samplerate=O.samplerate,s.channelCount=O.channelCount,s.codec=O.codec,s.manifestCodec=O.manifestCodec,K.logger.log("parsed codec:"+s.codec+", rate:"+O.samplerate+", channels:"+O.channelCount)}}function b(s){return 1024*9e4/s}function o(s,l,E,g,v){var O=_(s,l),w=k(s,l);if(w-=O,w>0){var C=E+g*v;return{headerLength:O,frameLength:w,stamp:C}}}function i(s,l,E,g,v){var O=b(s.samplerate),w=o(l,E,g,v,O);if(w){var C=w.frameLength,y=w.headerLength,c=w.stamp,u=y+C,L=Math.max(0,E+u-l.length),S;L?(S=new Uint8Array(u-y),S.set(l.subarray(E+y,l.length),0)):S=l.subarray(E+y,E+u);var A={unit:S,pts:c};return L||s.samples.push(A),{sample:A,length:u,missing:L}}}},"./src/demux/base-audio-demuxer.ts":function(ne,$,M){"use strict";M.r($),M.d($,"initPTSFn",function(){return k});var K=M("./src/polyfills/number.ts"),I=M("./src/demux/id3.ts"),D=M("./src/demux/dummy-demuxed-track.ts"),j=M("./src/utils/mp4-tools.ts"),N=M("./src/utils/typed-array.ts"),_=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(m,p,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(m,p){return!1},f.appendFrame=function(m,p,b){},f.demux=function(m,p){this.cachedData&&(m=Object(j.appendUint8Array)(this.cachedData,m),this.cachedData=null);var b=I.getID3Data(m,0),o=b?b.length:0,i,s,l=this._audioTrack,E=this._id3Track,g=b?I.getTimeStamp(b):void 0,v=m.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=k(g,p)),b&&b.length>0&&E.samples.push({pts:this.initPTS,dts:this.initPTS,data:b}),s=this.initPTS;o<v;){if(this.canParse(m,o)){var O=this.appendFrame(l,m,o);O?(this.frameIndex++,s=O.sample.pts,o+=O.length,i=o):o=v}else I.canParse(m,o)?(b=I.getID3Data(m,o),E.samples.push({pts:s,dts:s,data:b}),o+=b.length,i=o):o++;if(o===v&&i!==v){var w=Object(N.sliceUint8)(m,i);this.cachedData?this.cachedData=Object(j.appendUint8Array)(this.cachedData,w):this.cachedData=w}}return{audioTrack:l,avcTrack:Object(D.dummyTrack)(),id3Track:E,textTrack:Object(D.dummyTrack)()}},f.demuxSampleAes=function(m,p,b){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},f.flush=function(m){var p=this.cachedData;return p&&(this.cachedData=null,this.demux(p,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(D.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(D.dummyTrack)()}},f.destroy=function(){},d}(),k=function(f,T){return Object(K.isFiniteNumber)(f)?f*90:T*9e4};$.default=_},"./src/demux/chunk-cache.ts":function(ne,$,M){"use strict";M.r($),M.d($,"default",function(){return K});var K=function(){function D(){this.chunks=[],this.dataLength=0}var j=D.prototype;return j.push=function(_){this.chunks.push(_),this.dataLength+=_.length},j.flush=function(){var _=this.chunks,k=this.dataLength,d;if(_.length)_.length===1?d=_[0]:d=I(_,k);else return new Uint8Array(0);return this.reset(),d},j.reset=function(){this.chunks.length=0,this.dataLength=0},D}();function I(D,j){for(var N=new Uint8Array(j),_=0,k=0;k<D.length;k++){var d=D[k];N.set(d,_),_+=d.length}return N}},"./src/demux/dummy-demuxed-track.ts":function(ne,$,M){"use strict";M.r($),M.d($,"dummyTrack",function(){return K});function K(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ne,$,M){"use strict";M.r($);var K=M("./src/utils/logger.ts"),I=function(){function D(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 j=D.prototype;return j.loadWord=function(){var _=this.data,k=this.bytesAvailable,d=_.byteLength-k,f=new Uint8Array(4),T=Math.min(4,k);if(T===0)throw new Error("no bytes available");f.set(_.subarray(d,d+T)),this.word=new DataView(f.buffer).getUint32(0),this.bitsAvailable=T*8,this.bytesAvailable-=T},j.skipBits=function(_){var k;this.bitsAvailable>_?(this.word<<=_,this.bitsAvailable-=_):(_-=this.bitsAvailable,k=_>>3,_-=k>>3,this.bytesAvailable-=k,this.loadWord(),this.word<<=_,this.bitsAvailable-=_)},j.readBits=function(_){var k=Math.min(this.bitsAvailable,_),d=this.word>>>32-k;return _>32&&K.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=k,this.bitsAvailable>0?this.word<<=k:this.bytesAvailable>0&&this.loadWord(),k=_-k,k>0&&this.bitsAvailable?d<<k|this.readBits(k):d},j.skipLZ=function(){var _;for(_=0;_<this.bitsAvailable;++_)if((this.word&2147483648>>>_)!==0)return this.word<<=_,this.bitsAvailable-=_,_;return this.loadWord(),_+this.skipLZ()},j.skipUEG=function(){this.skipBits(1+this.skipLZ())},j.skipEG=function(){this.skipBits(1+this.skipLZ())},j.readUEG=function(){var _=this.skipLZ();return this.readBits(_+1)-1},j.readEG=function(){var _=this.readUEG();return 1&_?1+_>>>1:-1*(_>>>1)},j.readBoolean=function(){return this.readBits(1)===1},j.readUByte=function(){return this.readBits(8)},j.readUShort=function(){return this.readBits(16)},j.readUInt=function(){return this.readBits(32)},j.skipScalingList=function(_){for(var k=8,d=8,f,T=0;T<_;T++)d!==0&&(f=this.readEG(),d=(k+f+256)%256),k=d===0?k:d},j.readSPS=function(){var _=0,k=0,d=0,f=0,T,m,p,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),E=this.skipEG.bind(this),g=this.skipUEG.bind(this),v=this.skipScalingList.bind(this);b();var O=b();if(o(5),l(3),b(),g(),O===100||O===110||O===122||O===244||O===44||O===83||O===86||O===118||O===128){var w=i();if(w===3&&l(1),g(),g(),l(1),s())for(m=w!==3?8:12,p=0;p<m;p++)s()&&(p<6?v(16):v(64))}g();var C=i();if(C===0)i();else if(C===1)for(l(1),E(),E(),T=i(),p=0;p<T;p++)E();g(),l(1);var y=i(),c=i(),u=o(1);u===0&&l(1),l(1),s()&&(_=i(),k=i(),d=i(),f=i());var L=[1,1];if(s()&&s()){var S=b();switch(S){case 1:L=[1,1];break;case 2:L=[12,11];break;case 3:L=[10,11];break;case 4:L=[16,11];break;case 5:L=[40,33];break;case 6:L=[24,11];break;case 7:L=[20,11];break;case 8:L=[32,11];break;case 9:L=[80,33];break;case 10:L=[18,11];break;case 11:L=[15,11];break;case 12:L=[64,33];break;case 13:L=[160,99];break;case 14:L=[4,3];break;case 15:L=[3,2];break;case 16:L=[2,1];break;case 255:{L=[b()<<8|b(),b()<<8|b()];break}}}return{width:Math.ceil((y+1)*16-_*2-k*2),height:(2-u)*(c+1)*16-(u?2:4)*(d+f),pixelRatio:L}},j.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},D}();$.default=I},"./src/demux/id3.ts":function(ne,$,M){"use strict";M.r($),M.d($,"isHeader",function(){return K}),M.d($,"isFooter",function(){return I}),M.d($,"getID3Data",function(){return D}),M.d($,"canParse",function(){return N}),M.d($,"getTimeStamp",function(){return _}),M.d($,"isTimeStampFrame",function(){return k}),M.d($,"getID3Frames",function(){return f}),M.d($,"decodeFrame",function(){return T}),M.d($,"utf8ArrayToStr",function(){return i}),M.d($,"testables",function(){return s});var K=function(v,O){return O+10<=v.length&&(v[O]===73&&v[O+1]===68&&v[O+2]===51&&(v[O+3]<255&&v[O+4]<255&&(v[O+6]<128&&v[O+7]<128&&v[O+8]<128&&v[O+9]<128)))},I=function(v,O){return O+10<=v.length&&(v[O]===51&&v[O+1]===68&&v[O+2]===73&&(v[O+3]<255&&v[O+4]<255&&(v[O+6]<128&&v[O+7]<128&&v[O+8]<128&&v[O+9]<128)))},D=function(v,O){for(var w=O,C=0;K(v,O);){C+=10;var y=j(v,O+6);C+=y,I(v,O+10)&&(C+=10),O+=C}return C>0?v.subarray(w,w+C):void 0},j=function(v,O){var w=0;return w=(v[O]&127)<<21,w|=(v[O+1]&127)<<14,w|=(v[O+2]&127)<<7,w|=v[O+3]&127,w},N=function(v,O){return K(v,O)&&j(v,O+6)+10<=v.length-O},_=function(v){for(var O=f(v),w=0;w<O.length;w++){var C=O[w];if(k(C))return o(C)}return},k=function(v){return v&&v.key==="PRIV"&&v.info==="com.apple.streaming.transportStreamTimestamp"},d=function(v){var O=String.fromCharCode(v[0],v[1],v[2],v[3]),w=j(v,4),C=10;return{type:O,size:w,data:v.subarray(C,C+w)}},f=function(v){for(var O=0,w=[];K(v,O);){var C=j(v,O+6);O+=10;for(var y=O+C;O+8<y;){var c=d(v.subarray(O)),u=T(c);u&&w.push(u),O+=c.size+10}I(v,O)&&(O+=10)}return w},T=function(v){return v.type==="PRIV"?m(v):v.type[0]==="W"?b(v):p(v)},m=function(v){if(v.size<2)return;var O=i(v.data,!0),w=new Uint8Array(v.data.subarray(O.length+1));return{key:v.type,info:O,data:w.buffer}},p=function(v){if(v.size<2)return;if(v.type==="TXXX"){var O=1,w=i(v.data.subarray(O),!0);O+=w.length+1;var C=i(v.data.subarray(O));return{key:v.type,info:w,data:C}}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 O=1,w=i(v.data.subarray(O),!0);O+=w.length+1;var C=i(v.data.subarray(O));return{key:v.type,info:w,data:C}}var y=i(v.data);return{key:v.type,data:y}},o=function(v){if(v.data.byteLength===8){var O=new Uint8Array(v.data),w=O[3]&1,C=(O[4]<<23)+(O[5]<<15)+(O[6]<<7)+O[7];return C/=45,w&&(C+=4772185884e-2),Math.round(C)}return},i=function(v,O){O===void 0&&(O=!1);var w=E();if(w){var C=w.decode(v);if(O){var y=C.indexOf("\0");return y!==-1?C.substring(0,y):C}return C.replace(/\0/g,"")}for(var c=v.length,u,L,S,A="",P=0;P<c;){if(u=v[P++],u===0&&O)return A;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:A+=String.fromCharCode(u);break;case 12:case 13:L=v[P++],A+=String.fromCharCode((u&31)<<6|L&63);break;case 14:L=v[P++],S=v[P++],A+=String.fromCharCode((u&15)<<12|(L&63)<<6|(S&63)<<0);break;default:}}return A},s={decodeTextFrame:p},l;function E(){return!l&&typeof self.TextDecoder!="undefined"&&(l=new self.TextDecoder("utf-8")),l}},"./src/demux/mp3demuxer.ts":function(ne,$,M){"use strict";M.r($);var K=M("./src/demux/base-audio-demuxer.ts"),I=M("./src/demux/id3.ts"),D=M("./src/utils/logger.ts"),j=M("./src/demux/mpegaudio.ts");function N(d,f){d.prototype=Object.create(f.prototype),d.prototype.constructor=d,_(d,f)}function _(d,f){return _=Object.setPrototypeOf||function(m,p){return m.__proto__=p,m},_(d,f)}var k=function(d){N(f,d);function f(){return d.apply(this,arguments)||this}var T=f.prototype;return T.resetInitSegment=function(p,b,o){d.prototype.resetInitSegment.call(this,p,b,o),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:p,duration:o,inputTimeScale:9e4,dropped:0}},f.probe=function(p){if(!p)return!1;for(var b=I.getID3Data(p,0)||[],o=b.length,i=p.length;o<i;o++)if(j.probe(p,o))return D.logger.log("MPEG Audio sync word found !"),!0;return!1},T.canParse=function(p,b){return j.canParse(p,b)},T.appendFrame=function(p,b,o){return this.initPTS===null?void 0:j.appendFrame(p,b,o,this.initPTS,this.frameIndex)},f}(K.default);k.minProbeByteLength=4,$.default=k},"./src/demux/mp4demuxer.ts":function(ne,$,M){"use strict";M.r($);var K=M("./src/utils/mp4-tools.ts"),I=M("./src/demux/dummy-demuxed-track.ts"),D=function(){function j(_,k){this.remainderData=null,this.config=void 0,this.config=k}var N=j.prototype;return N.resetTimeStamp=function(){},N.resetInitSegment=function(){},N.resetContiguity=function(){},j.probe=function(k){return Object(K.findBox)({data:k,start:0,end:Math.min(k.length,16384)},["moof"]).length>0},N.demux=function(k){var d=k,f=Object(I.dummyTrack)();if(this.config.progressive){this.remainderData&&(d=Object(K.appendUint8Array)(this.remainderData,k));var T=Object(K.segmentValidRange)(d);this.remainderData=T.remainder,f.samples=T.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 k=Object(I.dummyTrack)();return k.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(I.dummyTrack)(),avcTrack:k,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},N.demuxSampleAes=function(k,d,f){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},N.destroy=function(){},j}();D.minProbeByteLength=1024,$.default=D},"./src/demux/mpegaudio.ts":function(ne,$,M){"use strict";M.r($),M.d($,"appendFrame",function(){return _}),M.d($,"parseHeader",function(){return k}),M.d($,"isHeaderPattern",function(){return d}),M.d($,"isHeader",function(){return f}),M.d($,"canParse",function(){return T}),M.d($,"probe",function(){return m});var K=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],D=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],j=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],N=[0,1,1,4];function _(p,b,o,i,s){if(o+24>b.length)return;var l=k(b,o);if(l&&o+l.frameLength<=b.length){var E=l.samplesPerFrame*9e4/l.sampleRate,g=i+s*E,v={unit:b.subarray(o,o+l.frameLength),pts:g,dts:g};return p.config=[],p.channelCount=l.channelCount,p.samplerate=l.sampleRate,p.samples.push(v),{sample:v,length:l.frameLength,missing:0}}}function k(p,b){var o=p[b+1]>>3&3,i=p[b+1]>>1&3,s=p[b+2]>>4&15,l=p[b+2]>>2&3;if(o!==1&&s!==0&&s!==15&&l!==3){var E=p[b+2]>>1&1,g=p[b+3]>>6,v=o===3?3-i:i===3?3:4,O=I[v*14+s-1]*1e3,w=o===3?0:o===2?1:2,C=D[w*3+l],y=g===3?1:2,c=j[o][i],u=N[i],L=c*8*u,S=Math.floor(c*O/C+E)*u;if(K===null){var A=navigator.userAgent||"",P=A.match(/Chrome\/(\d+)/i);K=P?parseInt(P[1]):0}var W=!!K&&K<=87;return W&&i===2&&O>=224e3&&g===0&&(p[b+3]=p[b+3]|128),{sampleRate:C,channelCount:y,frameLength:S,samplesPerFrame:L}}}function d(p,b){return p[b]===255&&(p[b+1]&224)===224&&(p[b+1]&6)!==0}function f(p,b){return b+1<p.length&&d(p,b)}function T(p,b){var o=4;return d(p,b)&&o<=p.length-b}function m(p,b){if(b+1<p.length&&d(p,b)){var o=4,i=k(p,b),s=o;i!=null&&i.frameLength&&(s=i.frameLength);var l=b+s;return l===p.length||f(p,l)}return!1}},"./src/demux/sample-aes.ts":function(ne,$,M){"use strict";M.r($);var K=M("./src/crypt/decrypter.ts"),I=M("./src/demux/tsdemuxer.ts"),D=function(){function j(_,k,d){this.keyData=void 0,this.decrypter=void 0,this.keyData=d,this.decrypter=new K.default(_,k,{removePKCS7Padding:!1})}var N=j.prototype;return N.decryptBuffer=function(k,d){this.decrypter.decrypt(k,this.keyData.key.buffer,this.keyData.iv.buffer,d)},N.decryptAacSample=function(k,d,f,T){var m=k[d].unit,p=m.subarray(16,m.length-m.length%16),b=p.buffer.slice(p.byteOffset,p.byteOffset+p.length),o=this;this.decryptBuffer(b,function(i){var s=new Uint8Array(i);m.set(s,16),T||o.decryptAacSamples(k,d+1,f)})},N.decryptAacSamples=function(k,d,f){for(;;d++){if(d>=k.length){f();return}if(k[d].unit.length<32)continue;var T=this.decrypter.isSync();if(this.decryptAacSample(k,d,f,T),!T)return}},N.getAvcEncryptedData=function(k){for(var d=Math.floor((k.length-48)/160)*16+16,f=new Int8Array(d),T=0,m=32;m<=k.length-16;m+=160,T+=16)f.set(k.subarray(m,m+16),T);return f},N.getAvcDecryptedUnit=function(k,d){for(var f=new Uint8Array(d),T=0,m=32;m<=k.length-16;m+=160,T+=16)k.set(f.subarray(T,T+16),m);return k},N.decryptAvcSample=function(k,d,f,T,m,p){var b=Object(I.discardEPB)(m.data),o=this.getAvcEncryptedData(b),i=this;this.decryptBuffer(o.buffer,function(s){m.data=i.getAvcDecryptedUnit(b,s),p||i.decryptAvcSamples(k,d,f+1,T)})},N.decryptAvcSamples=function(k,d,f,T){if(k instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;d++,f=0){if(d>=k.length){T();return}for(var m=k[d].units;!(f>=m.length);f++){var p=m[f];if(p.data.length<=48||p.type!==1&&p.type!==5)continue;var b=this.decrypter.isSync();if(this.decryptAvcSample(k,d,f,T,p,b),!b)return}}},j}();$.default=D},"./src/demux/transmuxer-interface.ts":function(ne,$,M){"use strict";M.r($),M.d($,"default",function(){return m});var K=M("./node_modules/webworkify-webpack/index.js"),I=M.n(K),D=M("./src/events.ts"),j=M("./src/demux/transmuxer.ts"),N=M("./src/utils/logger.ts"),_=M("./src/errors.ts"),k=M("./src/utils/mediasource-helper.ts"),d=M("./node_modules/eventemitter3/index.js"),f=M.n(d),T=Object(k.getMediaSource)()||{isTypeSupported:function(){return!1}},m=function(){function p(o,i,s,l){var E=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 g=o.config,v=function(c,u){u=u||{},u.frag=E.frag,u.id=E.id,o.trigger(c,u)};this.observer=new d.EventEmitter,this.observer.on(D.Events.FRAG_DECRYPTED,v),this.observer.on(D.Events.ERROR,v);var O={mp4:T.isTypeSupported("video/mp4"),mpeg:T.isTypeSupported("audio/mpeg"),mp3:T.isTypeSupported('audio/mp4; codecs="mp3"')},w=navigator.vendor;if(g.enableWorker&&typeof Worker!="undefined"){N.logger.log("demuxing in webworker");var C;try{C=this.worker=K("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),C.addEventListener("message",this.onwmsg),C.onerror=function(y){o.trigger(D.Events.ERROR,{type:_.ErrorTypes.OTHER_ERROR,details:_.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(y.message+" ("+y.filename+":"+y.lineno+")")})},C.postMessage({cmd:"init",typeSupported:O,vendor:w,id:i,config:JSON.stringify(g)})}catch(y){N.logger.warn("Error in worker:",y),N.logger.error("Error while initializing DemuxerWorker, fallback to inline"),C&&self.URL.revokeObjectURL(C.objectURL),this.transmuxer=new j.default(this.observer,O,g,w,i),this.worker=null}}else this.transmuxer=new j.default(this.observer,O,g,w,i)}var b=p.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,E,g,v,O,w,C,y){var c=this;C.transmuxing.start=self.performance.now();var u=this.transmuxer,L=this.worker,S=v?v.start:g.start,A=g.decryptdata,P=this.frag,W=!(P&&g.cc===P.cc),V=!(P&&C.level===P.level),Z=P?C.sn-P.sn:-1,z=this.part?C.part-this.part.index:1,F=!V&&(Z===1||Z===0&&z===1),te=self.performance.now();(V||Z||g.stats.parsing.start===0)&&(g.stats.parsing.start=te),v&&(z||!F)&&(v.stats.parsing.start=te);var ie=new j.TransmuxState(W,F,w,V,S);if(!F||W){N.logger.log("[transmuxer-interface, "+g.type+"]: Starting new transmux session for sn: "+C.sn+" p: "+C.part+" level: "+C.level+" id: "+C.id+`
|
|
discontinuity: `+W+`
|
|
trackSwitch: `+V+`
|
|
contiguous: `+F+`
|
|
accurateTimeOffset: `+w+`
|
|
timeOffset: `+S);var fe=new j.TransmuxConfig(l,E,s,O,y);this.configureTransmuxer(fe)}if(this.frag=g,this.part=v,L)L.postMessage({cmd:"demux",data:i,decryptdata:A,chunkMeta:C,state:ie},i instanceof ArrayBuffer?[i]:[]);else if(u){var ye=u.push(i,A,C,ie);Object(j.isPromise)(ye)?ye.then(function(_e){c.handleTransmuxComplete(_e)}):this.handleTransmuxComplete(ye)}},b.flush=function(i){var s=this;i.transmuxing.start=self.performance.now();var l=this.transmuxer,E=this.worker;if(E)E.postMessage({cmd:"flush",chunkMeta:i});else if(l){var g=l.flush(i);Object(j.isPromise)(g)?g.then(function(v){s.handleFlushResult(v,i)}):this.handleFlushResult(g,i)}},b.handleFlushResult=function(i,s){var l=this;i.forEach(function(E){l.handleTransmuxComplete(E)}),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)},p}()},"./src/demux/transmuxer-worker.ts":function(ne,$,M){"use strict";M.r($),M.d($,"default",function(){return _});var K=M("./src/demux/transmuxer.ts"),I=M("./src/events.ts"),D=M("./src/utils/logger.ts"),j=M("./node_modules/eventemitter3/index.js"),N=M.n(j);function _(m){var p=new j.EventEmitter,b=function(i,s){m.postMessage({event:i,data:s})};p.on(I.Events.FRAG_DECRYPTED,b),p.on(I.Events.ERROR,b),m.addEventListener("message",function(o){var i=o.data;switch(i.cmd){case"init":{var s=JSON.parse(i.config);m.transmuxer=new K.default(p,i.typeSupported,s,i.vendor,i.id),Object(D.enableLogs)(s.debug),b("init",null);break}case"configure":{m.transmuxer.configure(i.config);break}case"demux":{var l=m.transmuxer.push(i.data,i.decryptdata,i.chunkMeta,i.state);Object(K.isPromise)(l)?l.then(function(v){k(m,v)}):k(m,l);break}case"flush":{var E=i.chunkMeta,g=m.transmuxer.flush(E);Object(K.isPromise)(g)?g.then(function(v){f(m,v,E)}):f(m,g,E);break}default:break}})}function k(m,p){if(T(p.remuxResult))return;var b=[],o=p.remuxResult,i=o.audio,s=o.video;i&&d(b,i),s&&d(b,s),m.postMessage({event:"transmuxComplete",data:p},b)}function d(m,p){p.data1&&m.push(p.data1.buffer),p.data2&&m.push(p.data2.buffer)}function f(m,p,b){p.forEach(function(o){k(m,o)}),m.postMessage({event:"flush",data:b})}function T(m){return!m.audio&&!m.video&&!m.text&&!m.id3&&!m.initSegment}},"./src/demux/transmuxer.ts":function(ne,$,M){"use strict";M.r($),M.d($,"default",function(){return s}),M.d($,"isPromise",function(){return g}),M.d($,"TransmuxConfig",function(){return v}),M.d($,"TransmuxState",function(){return O});var K=M("./src/events.ts"),I=M("./src/errors.ts"),D=M("./src/crypt/decrypter.ts"),j=M("./src/demux/aacdemuxer.ts"),N=M("./src/demux/mp4demuxer.ts"),_=M("./src/demux/tsdemuxer.ts"),k=M("./src/demux/mp3demuxer.ts"),d=M("./src/remux/mp4-remuxer.ts"),f=M("./src/remux/passthrough-remuxer.ts"),T=M("./src/demux/chunk-cache.ts"),m=M("./src/utils/mp4-tools.ts"),p=M("./src/utils/logger.ts"),b;try{b=self.performance.now.bind(self.performance)}catch(w){p.logger.debug("Unable to use Performance API on this environment"),b=self.Date.now}var o=[{demux:_.default,remux:d.default},{demux:N.default,remux:f.default},{demux:j.default,remux:d.default},{demux:k.default,remux:d.default}],i=1024;o.forEach(function(w){var C=w.demux;i=Math.max(i,C.minProbeByteLength)});var s=function(){function w(y,c,u,L,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 T.default,this.observer=y,this.typeSupported=c,this.config=u,this.vendor=L,this.id=S}var C=w.prototype;return C.configure=function(c){this.transmuxConfig=c,this.decrypter&&this.decrypter.reset()},C.push=function(c,u,L,S){var A=this,P=L.transmuxing;P.executeStart=b();var W=new Uint8Array(c),V=this.cache,Z=this.config,z=this.currentTransmuxState,F=this.transmuxConfig;S&&(this.currentTransmuxState=S);var te=l(W,u);if(te&&te.method==="AES-128"){var ie=this.getDecrypter();if(Z.enableSoftwareAES){var fe=ie.softwareDecrypt(W,te.key.buffer,te.iv.buffer);if(!fe)return P.executeEnd=b(),E(L);W=new Uint8Array(fe)}else return this.decryptionPromise=ie.webCryptoDecrypt(W,te.key.buffer,te.iv.buffer).then(function(xe){var Re=A.push(xe,null,L);return A.decryptionPromise=null,Re}),this.decryptionPromise}var ye=S||z,_e=ye.contiguous,Le=ye.discontinuity,Ae=ye.trackSwitch,ke=ye.accurateTimeOffset,De=ye.timeOffset,ve=F.audioCodec,ue=F.videoCodec,Me=F.defaultInitPts,Qe=F.duration,He=F.initSegmentData;if((Le||Ae)&&this.resetInitSegment(He,ve,ue,Qe),Le&&this.resetInitialTimestamp(Me),_e||this.resetContiguity(),this.needsProbing(W,Le,Ae)){if(V.dataLength){var rt=V.flush();W=Object(m.appendUint8Array)(rt,W)}this.configureTransmuxer(W,F)}var oe=this.transmux(W,te,De,ke,L),de=this.currentTransmuxState;return de.contiguous=!0,de.discontinuity=!1,de.trackSwitch=!1,P.executeEnd=b(),oe},C.flush=function(c){var u=this,L=c.transmuxing;L.executeStart=b();var S=this.decrypter,A=this.cache,P=this.currentTransmuxState,W=this.decryptionPromise;if(W)return W.then(function(){return u.flush(c)});var V=[],Z=P.timeOffset;if(S){var z=S.flush();z&&V.push(this.push(z,null,c))}var F=A.dataLength;A.reset();var te=this.demuxer,ie=this.remuxer;if(!te||!ie)return F>=i&&this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),L.executeEnd=b(),[E(c)];var fe=te.flush(Z);return g(fe)?fe.then(function(ye){return u.flushRemux(V,ye,c),V}):(this.flushRemux(V,fe,c),V)},C.flushRemux=function(c,u,L){var S=u.audioTrack,A=u.avcTrack,P=u.id3Track,W=u.textTrack,V=this.currentTransmuxState,Z=V.accurateTimeOffset,z=V.timeOffset;p.logger.log("[transmuxer.ts]: Flushed fragment "+L.sn+(L.part>-1?" p: "+L.part:"")+" of level "+L.level);var F=this.remuxer.remux(S,A,P,W,z,Z,!0,this.id);c.push({remuxResult:F,chunkMeta:L}),L.transmuxing.executeEnd=b()},C.resetInitialTimestamp=function(c){var u=this.demuxer,L=this.remuxer;if(!u||!L)return;u.resetTimeStamp(c),L.resetTimeStamp(c)},C.resetContiguity=function(){var c=this.demuxer,u=this.remuxer;if(!c||!u)return;c.resetContiguity(),u.resetNextTimestamp()},C.resetInitSegment=function(c,u,L,S){var A=this.demuxer,P=this.remuxer;if(!A||!P)return;A.resetInitSegment(u,L,S),P.resetInitSegment(c,u,L)},C.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},C.transmux=function(c,u,L,S,A){var P;return u&&u.method==="SAMPLE-AES"?P=this.transmuxSampleAes(c,u,L,S,A):P=this.transmuxUnencrypted(c,L,S,A),P},C.transmuxUnencrypted=function(c,u,L,S){var A=this.demuxer.demux(c,u,!1,!this.config.progressive),P=A.audioTrack,W=A.avcTrack,V=A.id3Track,Z=A.textTrack,z=this.remuxer.remux(P,W,V,Z,u,L,!1,this.id);return{remuxResult:z,chunkMeta:S}},C.transmuxSampleAes=function(c,u,L,S,A){var P=this;return this.demuxer.demuxSampleAes(c,u,L).then(function(W){var V=P.remuxer.remux(W.audioTrack,W.avcTrack,W.id3Track,W.textTrack,L,S,!1,P.id);return{remuxResult:V,chunkMeta:A}})},C.configureTransmuxer=function(c,u){for(var L=this.config,S=this.observer,A=this.typeSupported,P=this.vendor,W=u.audioCodec,V=u.defaultInitPts,Z=u.duration,z=u.initSegmentData,F=u.videoCodec,te,ie=0,fe=o.length;ie<fe;ie++)if(o[ie].demux.probe(c)){te=o[ie];break}te||(p.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),te={demux:N.default,remux:f.default});var ye=this.demuxer,_e=this.remuxer,Le=te.remux,Ae=te.demux;(!_e||!(_e instanceof Le))&&(this.remuxer=new Le(S,L,A,P)),(!ye||!(ye instanceof Ae))&&(this.demuxer=new Ae(S,L,A),this.probe=Ae.probe),this.resetInitSegment(z,W,F,Z),this.resetInitialTimestamp(V)},C.needsProbing=function(c,u,L){return!this.demuxer||!this.remuxer||u||L},C.getDecrypter=function(){var c=this.decrypter;return c||(c=this.decrypter=new D.default(this.observer,this.config)),c},w}();function l(w,C){var y=null;return w.byteLength>0&&C!=null&&C.key!=null&&C.iv!==null&&C.method!=null&&(y=C),y}var E=function(C){return{remuxResult:{},chunkMeta:C}};function g(w){return"then"in w&&w.then instanceof Function}var v=function(C,y,c,u,L){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=C,this.videoCodec=y,this.initSegmentData=c,this.duration=u,this.defaultInitPts=L},O=function(C,y,c,u,L){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=C,this.contiguous=y,this.accurateTimeOffset=c,this.trackSwitch=u,this.timeOffset=L}},"./src/demux/tsdemuxer.ts":function(ne,$,M){"use strict";M.r($),M.d($,"discardEPB",function(){return E});var K=M("./src/demux/adts.ts"),I=M("./src/demux/mpegaudio.ts"),D=M("./src/demux/exp-golomb.ts"),j=M("./src/demux/id3.ts"),N=M("./src/demux/sample-aes.ts"),_=M("./src/events.ts"),k=M("./src/utils/mp4-tools.ts"),d=M("./src/utils/logger.ts"),f=M("./src/errors.ts"),T={video:1,audio:2,id3:3,text:4},m=function(){function g(O,w,C){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=O,this.config=w,this.typeSupported=C}g.probe=function(w){var C=g.syncOffset(w);return C<0?!1:(C&&d.logger.warn("MPEG2-TS detected but first sync word found @ offset "+C+", junk ahead ?"),!0)},g.syncOffset=function(w){for(var C=Math.min(1e3,w.length-3*188),y=0;y<C;){if(w[y]===71&&w[y+188]===71&&w[y+2*188]===71)return y;y++}return-1},g.createTrack=function(w,C){return{container:w==="video"||w==="audio"?"video/mp2t":void 0,type:w,id:T[w],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:w==="audio"?C:void 0}};var v=g.prototype;return v.resetInitSegment=function(w,C,y){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=g.createTrack("video",y),this._audioTrack=g.createTrack("audio",y),this._id3Track=g.createTrack("id3",y),this._txtTrack=g.createTrack("text",y),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=w,this.videoCodec=C,this._duration=y},v.resetTimeStamp=function(){},v.resetContiguity=function(){var w=this._audioTrack,C=this._avcTrack,y=this._id3Track;w&&(w.pesData=null),C&&(C.pesData=null),y&&(y.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},v.demux=function(w,C,y,c){y===void 0&&(y=!1),c===void 0&&(c=!1),y||(this.sampleAes=null);var u,L=this._avcTrack,S=this._audioTrack,A=this._id3Track,P=L.pid,W=L.pesData,V=S.pid,Z=A.pid,z=S.pesData,F=A.pesData,te=!1,ie=this.pmtParsed,fe=this._pmtId,ye=w.length;if(this.remainderData&&(w=Object(k.appendUint8Array)(this.remainderData,w),ye=w.length,this.remainderData=null),ye<188&&!c)return this.remainderData=w,{audioTrack:S,avcTrack:L,id3Track:A,textTrack:this._txtTrack};var _e=Math.max(0,g.syncOffset(w));ye-=(ye+_e)%188,ye<w.byteLength&&!c&&(this.remainderData=new Uint8Array(w.buffer,ye,w.buffer.byteLength-ye));for(var Le=_e;Le<ye;Le+=188)if(w[Le]===71){var Ae=!!(w[Le+1]&64),ke=((w[Le+1]&31)<<8)+w[Le+2],De=(w[Le+3]&48)>>4,ve=void 0;if(De>1){if(ve=Le+5+w[Le+4],ve===Le+188)continue}else ve=Le+4;switch(ke){case P:Ae&&(W&&(u=i(W))&&this.parseAVCPES(u,!1),W={data:[],size:0}),W&&(W.data.push(w.subarray(ve,Le+188)),W.size+=Le+188-ve);break;case V:Ae&&(z&&(u=i(z))&&(S.isAAC?this.parseAACPES(u):this.parseMPEGPES(u)),z={data:[],size:0}),z&&(z.data.push(w.subarray(ve,Le+188)),z.size+=Le+188-ve);break;case Z:Ae&&(F&&(u=i(F))&&this.parseID3PES(u),F={data:[],size:0}),F&&(F.data.push(w.subarray(ve,Le+188)),F.size+=Le+188-ve);break;case 0:Ae&&(ve+=w[ve]+1),fe=this._pmtId=b(w,ve);break;case fe:{Ae&&(ve+=w[ve]+1);var ue=o(w,ve,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,y);P=ue.avc,P>0&&(L.pid=P),V=ue.audio,V>0&&(S.pid=V,S.isAAC=ue.isAAC),Z=ue.id3,Z>0&&(A.pid=Z),te&&!ie&&(d.logger.log("reparse from beginning"),te=!1,Le=_e-188),ie=this.pmtParsed=!0;break}case 17:case 8191:break;default:te=!0;break}}else this.observer.emit(_.Events.ERROR,_.Events.ERROR,{type:f.ErrorTypes.MEDIA_ERROR,details:f.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});L.pesData=W,S.pesData=z,A.pesData=F;var Me={audioTrack:S,avcTrack:L,id3Track:A,textTrack:this._txtTrack};return c&&this.extractRemainingSamples(Me),Me},v.flush=function(){var w=this.remainderData;this.remainderData=null;var C;return w?C=this.demux(w,-1,!1,!0):C={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(C),this.sampleAes?this.decrypt(C,this.sampleAes):C},v.extractRemainingSamples=function(w){var C=w.audioTrack,y=w.avcTrack,c=w.id3Track,u=y.pesData,L=C.pesData,S=c.pesData,A;u&&(A=i(u))?(this.parseAVCPES(A,!0),y.pesData=null):y.pesData=u,L&&(A=i(L))?(C.isAAC?this.parseAACPES(A):this.parseMPEGPES(A),C.pesData=null):(L!=null&&L.size&&d.logger.log("last AAC PES packet truncated,might overlap between fragments"),C.pesData=L),S&&(A=i(S))?(this.parseID3PES(A),c.pesData=null):c.pesData=S},v.demuxSampleAes=function(w,C,y){var c=this.demux(w,y,!0,!this.config.progressive),u=this.sampleAes=new N.default(this.observer,this.config,C);return this.decrypt(c,u)},v.decrypt=function(w,C){return new Promise(function(y){var c=w.audioTrack,u=w.avcTrack;c.samples&&c.isAAC?C.decryptAacSamples(c.samples,0,function(){u.samples?C.decryptAvcSamples(u.samples,0,0,function(){y(w)}):y(w)}):u.samples&&C.decryptAvcSamples(u.samples,0,0,function(){y(w)})})},v.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},v.parseAVCPES=function(w,C){var y=this,c=this._avcTrack,u=this.parseAVCNALu(w.data),L=!1,S=this.avcSample,A,P=!1;w.data=null,S&&u.length&&!c.audFound&&(s(S,c),S=this.avcSample=p(!1,w.pts,w.dts,"")),u.forEach(function(W){switch(W.type){case 1:{A=!0,S||(S=y.avcSample=p(!0,w.pts,w.dts,"")),L&&(S.debug+="NDR "),S.frame=!0;var V=W.data;if(P&&V.length>4){var Z=new D.default(V).readSliceType();(Z===2||Z===4||Z===7||Z===9)&&(S.key=!0)}break}case 5:A=!0,S||(S=y.avcSample=p(!0,w.pts,w.dts,"")),L&&(S.debug+="IDR "),S.key=!0,S.frame=!0;break;case 6:{A=!0,L&&S&&(S.debug+="SEI ");var z=new D.default(E(W.data));z.readUByte();for(var F=0,te=0,ie=!1,fe=0;!ie&&z.bytesAvailable>1;){F=0;do fe=z.readUByte(),F+=fe;while(fe===255);te=0;do fe=z.readUByte(),te+=fe;while(fe===255);if(F===4&&z.bytesAvailable!==0){ie=!0;var ye=z.readUByte();if(ye===181){var _e=z.readUShort();if(_e===49){var Le=z.readUInt();if(Le===1195456820){var Ae=z.readUByte();if(Ae===3){for(var ke=z.readUByte(),De=z.readUByte(),ve=31&ke,ue=[ke,De],Me=0;Me<ve;Me++)ue.push(z.readUByte()),ue.push(z.readUByte()),ue.push(z.readUByte());l(y._txtTrack.samples,{type:3,pts:w.pts,bytes:ue})}}}}}else if(F===5&&z.bytesAvailable!==0){if(ie=!0,te>16){for(var Qe=[],He=0;He<16;He++)Qe.push(z.readUByte().toString(16)),(He===3||He===5||He===7||He===9)&&Qe.push("-");for(var rt=te-16,oe=new Uint8Array(rt),de=0;de<rt;de++)oe[de]=z.readUByte();l(y._txtTrack.samples,{pts:w.pts,payloadType:F,uuid:Qe.join(""),userData:Object(j.utf8ArrayToStr)(oe),userDataBytes:oe})}}else if(te<z.bytesAvailable)for(var xe=0;xe<te;xe++)z.readUByte()}break}case 7:if(A=!0,P=!0,L&&S&&(S.debug+="SPS "),!c.sps){var Re=new D.default(W.data),Ie=Re.readSPS();c.width=Ie.width,c.height=Ie.height,c.pixelRatio=Ie.pixelRatio,c.sps=[W.data],c.duration=y._duration;for(var Ne=W.data.subarray(1,4),Ge="avc1.",ze=0;ze<3;ze++){var ut=Ne[ze].toString(16);ut.length<2&&(ut="0"+ut),Ge+=ut}c.codec=Ge}break;case 8:A=!0,L&&S&&(S.debug+="PPS "),c.pps||(c.pps=[W.data]);break;case 9:A=!1,c.audFound=!0,S&&s(S,c),S=y.avcSample=p(!1,w.pts,w.dts,L?"AUD ":"");break;case 12:A=!1;break;default:A=!1,S&&(S.debug+="unknown NAL "+W.type+" ");break}if(S&&A){var Ke=S.units;Ke.push(W)}}),C&&S&&(s(S,c),this.avcSample=null)},v.getLastNalUnit=function(){var w,C=this.avcSample,y;if(!C||C.units.length===0){var c=this._avcTrack.samples;C=c[c.length-1]}if((w=C)!==null&&w!==void 0&&w.units){var u=C.units;y=u[u.length-1]}return y},v.parseAVCNALu=function(w){var C=w.byteLength,y=this._avcTrack,c=y.naluState||0,u=c,L=[],S=0,A,P,W,V=-1,Z=0;for(c===-1&&(V=0,Z=w[0]&31,c=0,S=1);S<C;){if(A=w[S++],!c){c=A?0:1;continue}if(c===1){c=A?0:2;continue}if(!A)c=3;else if(A===1){if(V>=0){var z={data:w.subarray(V,S-c-1),type:Z};L.push(z)}else{var F=this.getLastNalUnit();if(F&&(u&&S<=4-u&&(F.state&&(F.data=F.data.subarray(0,F.data.byteLength-u))),P=S-c-1,P>0)){var te=new Uint8Array(F.data.byteLength+P);te.set(F.data,0),te.set(w.subarray(0,P),F.data.byteLength),F.data=te,F.state=0}}S<C?(W=w[S]&31,V=S,Z=W,c=0):c=-1}else c=0}if(V>=0&&c>=0){var ie={data:w.subarray(V,C),type:Z,state:c};L.push(ie)}if(L.length===0){var fe=this.getLastNalUnit();if(fe){var ye=new Uint8Array(fe.data.byteLength+w.byteLength);ye.set(fe.data,0),ye.set(w,fe.data.byteLength),fe.data=ye}}return y.naluState=c,L},v.parseAACPES=function(w){var C=0,y=this._audioTrack,c=this.aacOverFlow,u=w.data;if(c){this.aacOverFlow=null;var L=c.sample.unit.byteLength,S=Math.min(c.missing,L),A=L-S;c.sample.unit.set(u.subarray(0,S),A),y.samples.push(c.sample),C=c.missing}var P,W;for(P=C,W=u.length;P<W-1&&!K.isHeader(u,P);P++);if(P!==C){var V,Z;if(P<W-1?(V="AAC PES did not start with ADTS header,offset:"+P,Z=!1):(V="no ADTS header found in AAC PES",Z=!0),d.logger.warn("parsing error:"+V),this.observer.emit(_.Events.ERROR,_.Events.ERROR,{type:f.ErrorTypes.MEDIA_ERROR,details:f.ErrorDetails.FRAG_PARSING_ERROR,fatal:Z,reason:V}),Z)return}K.initTrackConfig(y,this.observer,u,P,this.audioCodec);var z;if(w.pts!==void 0)z=w.pts;else if(c){var F=K.getFrameDuration(y.samplerate);z=c.sample.pts+F}else{d.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var te=0;P<W;)if(K.isHeader(u,P)){if(P+5<W){var ie=K.appendFrame(y,u,P,z,te);if(ie)if(ie.missing)this.aacOverFlow=ie;else{P+=ie.length,te++;continue}}break}else P++},v.parseMPEGPES=function(w){var C=w.data,y=C.length,c=0,u=0,L=w.pts;if(L===void 0){d.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;u<y;)if(I.isHeader(C,u)){var S=I.appendFrame(this._audioTrack,C,u,L,c);if(S)u+=S.length,c++;else break}else u++},v.parseID3PES=function(w){if(w.pts===void 0){d.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(w)},g}();m.minProbeByteLength=188;function p(g,v,O,w){return{key:g,frame:!1,pts:v,dts:O,units:[],debug:w,length:0}}function b(g,v){return(g[v+10]&31)<<8|g[v+11]}function o(g,v,O,w){var C={audio:-1,avc:-1,id3:-1,isAAC:!0},y=(g[v+1]&15)<<8|g[v+2],c=v+3+y-4,u=(g[v+10]&15)<<8|g[v+11];for(v+=12+u;v<c;){var L=(g[v+1]&31)<<8|g[v+2];switch(g[v]){case 207:if(!w){d.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:C.audio===-1&&(C.audio=L);break;case 21:C.id3===-1&&(C.id3=L);break;case 219:if(!w){d.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:C.avc===-1&&(C.avc=L);break;case 3:case 4:O?C.audio===-1&&(C.audio=L,C.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+=((g[v+3]&15)<<8|g[v+4])+5}return C}function i(g){var v=0,O,w,C,y,c,u=g.data;if(!g||g.size===0)return null;for(;u[0].length<19&&u.length>1;){var L=new Uint8Array(u[0].length+u[1].length);L.set(u[0]),L.set(u[1],u[0].length),u[0]=L,u.splice(1,1)}O=u[0];var S=(O[0]<<16)+(O[1]<<8)+O[2];if(S===1){if(w=(O[4]<<8)+O[5],w&&w>g.size-6)return null;var A=O[7];A&192&&(y=(O[9]&14)*536870912+(O[10]&255)*4194304+(O[11]&254)*16384+(O[12]&255)*128+(O[13]&254)/2,A&64?(c=(O[14]&14)*536870912+(O[15]&255)*4194304+(O[16]&254)*16384+(O[17]&255)*128+(O[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),C=O[8];var P=C+9;if(g.size<=P)return null;g.size-=P;for(var W=new Uint8Array(g.size),V=0,Z=u.length;V<Z;V++){O=u[V];var z=O.byteLength;if(P)if(P>z){P-=z;continue}else O=O.subarray(P),z-=P,P=0;W.set(O,v),v+=z}return w&&(w-=C+3),{data:W,pts:y,dts:c,len:w}}return null}function s(g,v){if(g.units.length&&g.frame){if(g.pts===void 0){var O=v.samples,w=O.length;if(w){var C=O[w-1];g.pts=C.pts,g.dts=C.dts}else{v.dropped++;return}}v.samples.push(g)}g.debug.length&&d.logger.log(g.pts+"/"+g.dts+":"+g.debug)}function l(g,v){var O=g.length;if(O>0){if(v.pts>=g[O-1].pts)g.push(v);else for(var w=O-1;w>=0;w--)if(v.pts<g[w].pts){g.splice(w,0,v);break}}else g.push(v)}function E(g){for(var v=g.byteLength,O=[],w=1;w<v-2;)g[w]===0&&g[w+1]===0&&g[w+2]===3?(O.push(w+2),w+=2):w++;if(O.length===0)return g;var C=v-O.length,y=new Uint8Array(C),c=0;for(w=0;w<C;c++,w++)c===O[0]&&(c++,O.shift()),y[w]=g[c];return y}$.default=m},"./src/errors.ts":function(ne,$,M){"use strict";M.r($),M.d($,"ErrorTypes",function(){return K}),M.d($,"ErrorDetails",function(){return I});var K;(function(D){D.NETWORK_ERROR="networkError",D.MEDIA_ERROR="mediaError",D.KEY_SYSTEM_ERROR="keySystemError",D.MUX_ERROR="muxError",D.OTHER_ERROR="otherError"})(K||(K={}));var I;(function(D){D.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",D.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",D.KEY_SYSTEM_NO_SESSION="keySystemNoSession",D.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",D.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",D.MANIFEST_LOAD_ERROR="manifestLoadError",D.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",D.MANIFEST_PARSING_ERROR="manifestParsingError",D.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",D.LEVEL_EMPTY_ERROR="levelEmptyError",D.LEVEL_LOAD_ERROR="levelLoadError",D.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",D.LEVEL_SWITCH_ERROR="levelSwitchError",D.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",D.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",D.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",D.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",D.FRAG_LOAD_ERROR="fragLoadError",D.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",D.FRAG_DECRYPT_ERROR="fragDecryptError",D.FRAG_PARSING_ERROR="fragParsingError",D.REMUX_ALLOC_ERROR="remuxAllocError",D.KEY_LOAD_ERROR="keyLoadError",D.KEY_LOAD_TIMEOUT="keyLoadTimeOut",D.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",D.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",D.BUFFER_APPEND_ERROR="bufferAppendError",D.BUFFER_APPENDING_ERROR="bufferAppendingError",D.BUFFER_STALLED_ERROR="bufferStalledError",D.BUFFER_FULL_ERROR="bufferFullError",D.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",D.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",D.INTERNAL_EXCEPTION="internalException",D.INTERNAL_ABORTED="aborted",D.UNKNOWN="unknown"})(I||(I={}))},"./src/events.ts":function(ne,$,M){"use strict";M.r($),M.d($,"Events",function(){return K});var K;(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"})(K||(K={}))},"./src/hls.ts":function(ne,$,M){"use strict";M.r($),M.d($,"default",function(){return g});var K=M("./node_modules/url-toolkit/src/url-toolkit.js"),I=M.n(K),D=M("./src/loader/playlist-loader.ts"),j=M("./src/loader/key-loader.ts"),N=M("./src/controller/id3-track-controller.ts"),_=M("./src/controller/latency-controller.ts"),k=M("./src/controller/level-controller.ts"),d=M("./src/controller/fragment-tracker.ts"),f=M("./src/controller/stream-controller.ts"),T=M("./src/is-supported.ts"),m=M("./src/utils/logger.ts"),p=M("./src/config.ts"),b=M("./node_modules/eventemitter3/index.js"),o=M.n(b),i=M("./src/events.ts"),s=M("./src/errors.ts");function l(v,O){for(var w=0;w<O.length;w++){var C=O[w];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(v,C.key,C)}}function E(v,O,w){return O&&l(v.prototype,O),w&&l(v,w),v}var g=function(){v.isSupported=function(){return Object(T.isSupported)()};function v(w){w===void 0&&(w={}),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 C=this.config=Object(p.mergeConfig)(v.DefaultConfig,w);this.userConfig=w,Object(m.enableLogs)(C.debug),this._autoLevelCapping=-1,C.progressive&&Object(p.enableStreamingMode)(C);var y=C.abrController,c=C.bufferController,u=C.capLevelController,L=C.fpsController,S=this.abrController=new y(this),A=this.bufferController=new c(this),P=this.capLevelController=new u(this),W=new L(this),V=new D.default(this),Z=new j.default(this),z=new N.default(this),F=this.levelController=new k.default(this),te=new d.FragmentTracker(this),ie=this.streamController=new f.default(this,te);P.setStreamController(ie),W.setStreamController(ie);var fe=[F,ie];this.networkControllers=fe;var ye=[V,Z,S,A,P,W,z,te];this.audioTrackController=this.createController(C.audioTrackController,null,fe),this.createController(C.audioStreamController,te,fe),this.subtitleTrackController=this.createController(C.subtitleTrackController,null,fe),this.createController(C.subtitleStreamController,te,fe),this.createController(C.timelineController,null,ye),this.emeController=this.createController(C.emeController,null,ye),this.cmcdController=this.createController(C.cmcdController,null,ye),this.latencyController=this.createController(_.default,null,ye),this.coreComponents=ye}var O=v.prototype;return O.createController=function(C,y,c){if(C){var u=y?new C(this,y):new C(this);return c&&c.push(u),u}return null},O.on=function(C,y,c){c===void 0&&(c=this),this._emitter.on(C,y,c)},O.once=function(C,y,c){c===void 0&&(c=this),this._emitter.once(C,y,c)},O.removeAllListeners=function(C){this._emitter.removeAllListeners(C)},O.off=function(C,y,c,u){c===void 0&&(c=this),this._emitter.off(C,y,c,u)},O.listeners=function(C){return this._emitter.listeners(C)},O.emit=function(C,y,c){return this._emitter.emit(C,y,c)},O.trigger=function(C,y){if(this.config.debug)return this.emit(C,C,y);try{return this.emit(C,C,y)}catch(c){m.logger.error("An internal error happened while handling event "+C+'. 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:C,error:c})}return!1},O.listenerCount=function(C){return this._emitter.listenerCount(C)},O.destroy=function(){m.logger.log("destroy"),this.trigger(i.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(C){return C.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(C){return C.destroy()}),this.coreComponents.length=0},O.attachMedia=function(C){m.logger.log("attachMedia"),this._media=C,this.trigger(i.Events.MEDIA_ATTACHING,{media:C})},O.detachMedia=function(){m.logger.log("detachMedia"),this.trigger(i.Events.MEDIA_DETACHING,void 0),this._media=null},O.loadSource=function(C){this.stopLoad();var y=this.media,c=this.url,u=this.url=K.buildAbsoluteURL(self.location.href,C,{alwaysNormalize:!0});m.logger.log("loadSource:"+u),y&&c&&c!==u&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(y)),this.trigger(i.Events.MANIFEST_LOADING,{url:C})},O.startLoad=function(C){C===void 0&&(C=-1),m.logger.log("startLoad("+C+")"),this.networkControllers.forEach(function(y){y.startLoad(C)})},O.stopLoad=function(){m.logger.log("stopLoad"),this.networkControllers.forEach(function(C){C.stopLoad()})},O.swapAudioCodec=function(){m.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},O.recoverMediaError=function(){m.logger.log("recoverMediaError");var C=this._media;this.detachMedia(),C&&this.attachMedia(C)},O.removeLevel=function(C,y){y===void 0&&(y=0),this.levelController.removeLevel(C,y)},E(v,[{key:"levels",get:function(){var C=this.levelController.levels;return C||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(C){m.logger.log("set currentLevel:"+C),this.loadLevel=C,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(C){m.logger.log("set nextLevel:"+C),this.levelController.manualLevel=C,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(C){m.logger.log("set loadLevel:"+C),this.levelController.manualLevel=C}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(C){this.levelController.nextLoadLevel=C}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(C){m.logger.log("set firstLevel:"+C),this.levelController.firstLevel=C}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(C){m.logger.log("set startLevel:"+C),C!==-1&&(C=Math.max(C,this.minAutoLevel)),this.levelController.startLevel=C}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(C){var y=!!C;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(C){this._autoLevelCapping!==C&&(m.logger.log("set autoLevelCapping:"+C),this._autoLevelCapping=C)}},{key:"bandwidthEstimate",get:function(){var C=this.abrController.bwEstimator;return C?C.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var C=this.levels,y=this.config.minAutoBitrate;if(!C)return 0;for(var c=C.length,u=0;u<c;u++)if(C[u].maxBitrate>y)return u;return 0}},{key:"maxAutoLevel",get:function(){var C=this.levels,y=this.autoLevelCapping,c;return y===-1&&C&&C.length?c=C.length-1:c=y,c}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(C){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,C)}},{key:"audioTracks",get:function(){var C=this.audioTrackController;return C?C.audioTracks:[]}},{key:"audioTrack",get:function(){var C=this.audioTrackController;return C?C.audioTrack:-1},set:function(C){var y=this.audioTrackController;y&&(y.audioTrack=C)}},{key:"subtitleTracks",get:function(){var C=this.subtitleTrackController;return C?C.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var C=this.subtitleTrackController;return C?C.subtitleTrack:-1},set:function(C){var y=this.subtitleTrackController;y&&(y.subtitleTrack=C)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var C=this.subtitleTrackController;return C?C.subtitleDisplay:!1},set:function(C){var y=this.subtitleTrackController;y&&(y.subtitleDisplay=C)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(C){this.config.lowLatencyMode=C}},{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:p.hlsDefaultConfig},set:function(C){v.defaultConfig=C}}]),v}();g.defaultConfig=void 0},"./src/is-supported.ts":function(ne,$,M){"use strict";M.r($),M.d($,"isSupported",function(){return D}),M.d($,"changeTypeSupported",function(){return j});var K=M("./src/utils/mediasource-helper.ts");function I(){return self.SourceBuffer||self.WebKitSourceBuffer}function D(){var N=Object(K.getMediaSource)();if(!N)return!1;var _=I(),k=N&&typeof N.isTypeSupported=="function"&&N.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),d=!_||_.prototype&&typeof _.prototype.appendBuffer=="function"&&typeof _.prototype.remove=="function";return!!k&&!!d}function j(){var N,_=I();return typeof(_==null||((N=_.prototype)===null||N===void 0)?void 0:N.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ne,$,M){"use strict";M.r($),M.d($,"default",function(){return m}),M.d($,"LoadError",function(){return b});var K=M("./src/polyfills/number.ts"),I=M("./src/errors.ts");function D(o,i){o.prototype=Object.create(i.prototype),o.prototype.constructor=o,d(o,i)}function j(o){var i=typeof Map=="function"?new Map:void 0;return j=function(l){if(l===null||!k(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,E)}function E(){return N(l,arguments,f(this).constructor)}return E.prototype=Object.create(l.prototype,{constructor:{value:E,enumerable:!1,writable:!0,configurable:!0}}),d(E,l)},j(o)}function N(o,i,s){return _()?N=Reflect.construct:N=function(E,g,v){var O=[null];O.push.apply(O,g);var w=Function.bind.apply(E,O),C=new w;return v&&d(C,v.prototype),C},N.apply(null,arguments)}function _(){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 k(o){return Function.toString.call(o).indexOf("[native code]")!==-1}function d(o,i){return d=Object.setPrototypeOf||function(l,E){return l.__proto__=E,l},d(o,i)}function f(o){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},f(o)}var T=Math.pow(2,17),m=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,E){var g=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 O=this.config,w=O.fLoader,C=O.loader;return new Promise(function(y,c){g.loader&&g.loader.destroy();var u=g.loader=l.loader=w?new w(O):new C(O),L=p(l),S={timeout:O.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:O.fragLoadingMaxRetryTimeout,highWaterMark:T};l.stats=u.stats,u.load(L,S,{onSuccess:function(P,W,V,Z){g.resetLoader(l,u),y({frag:l,part:null,payload:P.data,networkDetails:Z})},onError:function(P,W,V){g.resetLoader(l,u),c(new b({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,response:P,networkDetails:V}))},onAbort:function(P,W,V){g.resetLoader(l,u),c(new b({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,networkDetails:V}))},onTimeout:function(P,W,V){g.resetLoader(l,u),c(new b({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,networkDetails:V}))},onProgress:function(P,W,V,Z){E&&E({frag:l,part:null,payload:V,networkDetails:Z})}})})},i.loadPart=function(l,E,g){var v=this;this.abort();var O=this.config,w=O.fLoader,C=O.loader;return new Promise(function(y,c){v.loader&&v.loader.destroy();var u=v.loader=l.loader=w?new w(O):new C(O),L=p(l,E),S={timeout:O.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:O.fragLoadingMaxRetryTimeout,highWaterMark:T};E.stats=u.stats,u.load(L,S,{onSuccess:function(P,W,V,Z){v.resetLoader(l,u),v.updateStatsFromPart(l,E);var z={frag:l,part:E,payload:P.data,networkDetails:Z};g(z),y(z)},onError:function(P,W,V){v.resetLoader(l,u),c(new b({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,part:E,response:P,networkDetails:V}))},onAbort:function(P,W,V){l.stats.aborted=E.stats.aborted,v.resetLoader(l,u),c(new b({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,part:E,networkDetails:V}))},onTimeout:function(P,W,V){v.resetLoader(l,u),c(new b({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,part:E,networkDetails:V}))}})})},i.updateStatsFromPart=function(l,E){var g=l.stats,v=E.stats,O=v.total;if(g.loaded+=v.loaded,O){var w=Math.round(l.duration/E.duration),C=Math.min(Math.round(g.loaded/O),w),y=w-C,c=y*Math.round(g.loaded/C);g.total=g.loaded+c}else g.total=Math.max(g.loaded,g.total);var u=g.loading,L=v.loading;u.start?u.first+=L.first-L.start:(u.start=L.start,u.first=L.first),u.end=L.end},i.resetLoader=function(l,E){l.loader=null,this.loader===E&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),E.destroy()},o}();function p(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},E=s.byteRangeStartOffset,g=s.byteRangeEndOffset;return Object(K.isFiniteNumber)(E)&&Object(K.isFiniteNumber)(g)&&(l.rangeStart=E,l.rangeEnd=g),l}var b=function(o){D(i,o);function i(s){for(var l,E=arguments.length,g=new Array(E>1?E-1:0),v=1;v<E;v++)g[v-1]=arguments[v];return l=o.call.apply(o,[this].concat(g))||this,l.data=void 0,l.data=s,l}return i}(j(Error))},"./src/loader/fragment.ts":function(ne,$,M){"use strict";M.r($),M.d($,"ElementaryStreamTypes",function(){return m}),M.d($,"BaseSegment",function(){return p}),M.d($,"Fragment",function(){return b}),M.d($,"Part",function(){return o});var K=M("./src/polyfills/number.ts"),I=M("./node_modules/url-toolkit/src/url-toolkit.js"),D=M.n(I),j=M("./src/utils/logger.ts"),N=M("./src/loader/level-key.ts"),_=M("./src/loader/load-stats.ts");function k(i,s){i.prototype=Object.create(s.prototype),i.prototype.constructor=i,d(i,s)}function d(i,s){return d=Object.setPrototypeOf||function(E,g){return E.__proto__=g,E},d(i,s)}function f(i,s){for(var l=0;l<s.length;l++){var E=s[l];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(i,E.key,E)}}function T(i,s,l){return s&&f(i.prototype,s),l&&f(i,l),i}var m;(function(i){i.AUDIO="audio",i.VIDEO="video",i.AUDIOVIDEO="audiovideo"})(m||(m={}));var p=function(){function i(l){var E;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(E={},E[m.AUDIO]=null,E[m.VIDEO]=null,E[m.AUDIOVIDEO]=null,E),this.baseurl=l}var s=i.prototype;return s.setByteRange=function(E,g){var v=E.split("@",2),O=[];v.length===1?O[0]=g?g.byteRangeEndOffset:0:O[0]=parseInt(v[1]),O[1]=parseInt(v[0])+O[0],this._byteRange=O},T(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(E){this._url=E}}]),i}(),b=function(i){k(s,i);function s(E,g){var v;return v=i.call(this,g)||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 _.LoadStats,v.urlId=0,v.data=void 0,v.bitrateTest=!1,v.title=null,v.initSegment=null,v.type=E,v}var l=s.prototype;return l.createInitializationVector=function(g){for(var v=new Uint8Array(16),O=12;O<16;O++)v[O]=g>>8*(15-O)&255;return v},l.setDecryptDataFromLevelKey=function(g,v){var O=g;return(g==null?void 0:g.method)==="AES-128"&&g.uri&&!g.iv&&(O=N.LevelKey.fromURI(g.uri),O.method=g.method,O.iv=this.createInitializationVector(v),O.keyFormat="identity"),O},l.setElementaryStreamInfo=function(g,v,O,w,C,y){y===void 0&&(y=!1);var c=this.elementaryStreams,u=c[g];if(!u){c[g]={startPTS:v,endPTS:O,startDTS:w,endDTS:C,partial:y};return}u.startPTS=Math.min(u.startPTS,v),u.endPTS=Math.max(u.endPTS,O),u.startDTS=Math.min(u.startDTS,w),u.endDTS=Math.max(u.endDTS,C)},l.clearElementaryStreamInfo=function(){var g=this.elementaryStreams;g[m.AUDIO]=null,g[m.VIDEO]=null,g[m.AUDIOVIDEO]=null},T(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var g=this.sn;typeof g!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&j.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),g=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,g)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(K.isFiniteNumber)(this.programDateTime))return null;var g=Object(K.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+g*1e3}},{key:"encrypted",get:function(){var g;return!!((g=this.decryptdata)!==null&&g!==void 0&&g.keyFormat&&this.decryptdata.uri)}}]),s}(p),o=function(i){k(s,i);function s(l,E,g,v,O){var w;w=i.call(this,g)||this,w.fragOffset=0,w.duration=0,w.gap=!1,w.independent=!1,w.relurl=void 0,w.fragment=void 0,w.index=void 0,w.stats=new _.LoadStats,w.duration=l.decimalFloatingPoint("DURATION"),w.gap=l.bool("GAP"),w.independent=l.bool("INDEPENDENT"),w.relurl=l.enumeratedString("URI"),w.fragment=E,w.index=v;var C=l.enumeratedString("BYTERANGE");return C&&w.setByteRange(C,O),O&&(w.fragOffset=O.fragOffset+O.duration),w}return T(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 E=this.elementaryStreams;return!!(E.audio||E.video||E.audiovideo)}}]),s}(p)},"./src/loader/key-loader.ts":function(ne,$,M){"use strict";M.r($),M.d($,"default",function(){return j});var K=M("./src/events.ts"),I=M("./src/errors.ts"),D=M("./src/utils/logger.ts"),j=function(){function N(k){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=k,this._registerListeners()}var _=N.prototype;return _._registerListeners=function(){this.hls.on(K.Events.KEY_LOADING,this.onKeyLoading,this)},_._unregisterListeners=function(){this.hls.off(K.Events.KEY_LOADING,this.onKeyLoading)},_.destroy=function(){this._unregisterListeners();for(var d in this.loaders){var f=this.loaders[d];f&&f.destroy()}this.loaders={}},_.onKeyLoading=function(d,f){var T=f.frag,m=T.type,p=this.loaders[m];if(!T.decryptdata){D.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var b=T.decryptdata.uri;if(b!==this.decrypturl||this.decryptkey===null){var o=this.hls.config;if(p&&(D.logger.warn("abort previous key loader for type:"+m),p.abort()),!b){D.logger.warn("key uri is falsy");return}var i=o.loader,s=T.loader=this.loaders[m]=new i(o);this.decrypturl=b,this.decryptkey=null;var l={url:b,frag:T,responseType:"arraybuffer"},E={timeout:o.fragLoadingTimeOut,maxRetry:0,retryDelay:o.fragLoadingRetryDelay,maxRetryDelay:o.fragLoadingMaxRetryTimeout,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(l,E,g)}else this.decryptkey&&(T.decryptdata.key=this.decryptkey,this.hls.trigger(K.Events.KEY_LOADED,{frag:T}))},_.loadsuccess=function(d,f,T){var m=T.frag;if(!m.decryptdata){D.logger.error("after key load, decryptdata unset");return}this.decryptkey=m.decryptdata.key=new Uint8Array(d.data),m.loader=null,delete this.loaders[m.type],this.hls.trigger(K.Events.KEY_LOADED,{frag:m})},_.loaderror=function(d,f){var T=f.frag,m=T.loader;m&&m.abort(),delete this.loaders[T.type],this.hls.trigger(K.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:T,response:d})},_.loadtimeout=function(d,f){var T=f.frag,m=T.loader;m&&m.abort(),delete this.loaders[T.type],this.hls.trigger(K.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:T})},N}()},"./src/loader/level-details.ts":function(ne,$,M){"use strict";M.r($),M.d($,"LevelDetails",function(){return N});var K=M("./src/polyfills/number.ts");function I(_,k){for(var d=0;d<k.length;d++){var f=k[d];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(_,f.key,f)}}function D(_,k,d){return k&&I(_.prototype,k),d&&I(_,d),_}var j=10,N=function(){function _(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 k=_.prototype;return k.reloaded=function(f){if(!f){this.advanced=!0,this.updated=!0;return}var T=this.lastPartSn-f.lastPartSn,m=this.lastPartIndex-f.lastPartIndex;this.updated=this.endSN!==f.endSN||!!m||!!T,this.advanced=this.endSN>f.endSN||T>0||T===0&&m>0,this.updated||this.advanced?this.misses=Math.floor(f.misses*.6):this.misses=f.misses+1,this.availabilityDelay=f.availabilityDelay},D(_,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(K.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||j}},{key:"drift",get:function(){var f=this.driftEndTime-this.driftStartTime;if(f>0){var T=this.driftEnd-this.driftStart;return T*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}}]),_}()},"./src/loader/level-key.ts":function(ne,$,M){"use strict";M.r($),M.d($,"LevelKey",function(){return N});var K=M("./node_modules/url-toolkit/src/url-toolkit.js"),I=M.n(K);function D(_,k){for(var d=0;d<k.length;d++){var f=k[d];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(_,f.key,f)}}function j(_,k,d){return k&&D(_.prototype,k),d&&D(_,d),_}var N=function(){_.fromURL=function(d,f){return new _(d,f)},_.fromURI=function(d){return new _(d)};function _(k,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(K.buildAbsoluteURL)(k,d,{alwaysNormalize:!0}):this._uri=k}return j(_,[{key:"uri",get:function(){return this._uri}}]),_}()},"./src/loader/load-stats.ts":function(ne,$,M){"use strict";M.r($),M.d($,"LoadStats",function(){return K});var K=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(ne,$,M){"use strict";M.r($),M.d($,"default",function(){return s});var K=M("./src/polyfills/number.ts"),I=M("./node_modules/url-toolkit/src/url-toolkit.js"),D=M.n(I),j=M("./src/loader/fragment.ts"),N=M("./src/loader/level-details.ts"),_=M("./src/loader/level-key.ts"),k=M("./src/utils/attr-list.ts"),d=M("./src/utils/logger.ts"),f=M("./src/utils/codecs.ts"),T=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,m=/#EXT-X-MEDIA:(.*)/g,p=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(O){var w,C;return o.test((w=(C=I.parseURL(O))===null||C===void 0?void 0:C.path)!=null?w:"")}var s=function(){function O(){}return O.findGroup=function(C,y){for(var c=0;c<C.length;c++){var u=C[c];if(u.id===y)return u}},O.convertAVC1ToAVCOTI=function(C){var y=C.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 C},O.resolve=function(C,y){return I.buildAbsoluteURL(y,C,{alwaysNormalize:!0})},O.parseMasterPlaylist=function(C,y){var c=[],u={},L=!1;T.lastIndex=0;for(var S;(S=T.exec(C))!=null;)if(S[1]){var A=new k.AttrList(S[1]),P={attrs:A,bitrate:A.decimalInteger("AVERAGE-BANDWIDTH")||A.decimalInteger("BANDWIDTH"),name:A.NAME,url:O.resolve(S[2],y)},W=A.decimalResolution("RESOLUTION");W&&(P.width=W.width,P.height=W.height),l((A.CODECS||"").split(/[ ,]+/).filter(function(Z){return Z}),P),P.videoCodec&&P.videoCodec.indexOf("avc1")!==-1&&(P.videoCodec=O.convertAVC1ToAVCOTI(P.videoCodec)),c.push(P)}else if(S[3]){var V=new k.AttrList(S[3]);V["DATA-ID"]&&(L=!0,u[V["DATA-ID"]]=V)}return{levels:c,sessionData:L?u:null}},O.parseMasterPlaylistMedia=function(C,y,c,u){u===void 0&&(u=[]);var L,S=[],A=0;for(m.lastIndex=0;(L=m.exec(C))!==null;){var P=new k.AttrList(L[1]);if(P.TYPE===c){var W={attrs:P,bitrate:0,id:A++,groupId:P["GROUP-ID"],instreamId:P["INSTREAM-ID"],name:P.NAME||P.LANGUAGE||"",type:c,default:P.bool("DEFAULT"),autoselect:P.bool("AUTOSELECT"),forced:P.bool("FORCED"),lang:P.LANGUAGE,url:P.URI?O.resolve(P.URI,y):""};if(u.length){var V=O.findGroup(u,W.groupId)||u[0];E(W,V,"audioCodec"),E(W,V,"textCodec")}S.push(W)}}return S},O.parseLevelPlaylist=function(C,y,c,u,L){var S=new N.LevelDetails(y),A=S.fragments,P=null,W=0,V=0,Z=0,z=0,F=null,te=new j.Fragment(u,y),ie,fe,ye,_e=-1,Le=!1;for(p.lastIndex=0,S.m3u8=C;(ie=p.exec(C))!==null;){Le&&(Le=!1,te=new j.Fragment(u,y),te.start=Z,te.sn=W,te.cc=z,te.level=c,P&&(te.initSegment=P,te.rawProgramDateTime=P.rawProgramDateTime));var Ae=ie[1];if(Ae){te.duration=parseFloat(Ae);var ke=(" "+ie[2]).slice(1);te.title=ke||null,te.tagList.push(ke?["INF",Ae,ke]:["INF",Ae])}else if(ie[3])Object(K.isFiniteNumber)(te.duration)&&(te.start=Z,ye&&(te.levelkey=ye),te.sn=W,te.level=c,te.cc=z,te.urlId=L,A.push(te),te.relurl=(" "+ie[3]).slice(1),v(te,F),F=te,Z+=te.duration,W++,V=0,Le=!0);else if(ie[4]){var De=(" "+ie[4]).slice(1);F?te.setByteRange(De,F):te.setByteRange(De)}else if(ie[5])te.rawProgramDateTime=(" "+ie[5]).slice(1),te.tagList.push(["PROGRAM-DATE-TIME",te.rawProgramDateTime]),_e===-1&&(_e=A.length);else{if(ie=ie[0].match(b),!ie){d.logger.warn("No matches on slow regex match for level playlist!");continue}for(fe=1;fe<ie.length&&!(typeof ie[fe]!="undefined");fe++);var ve=(" "+ie[fe]).slice(1),ue=(" "+ie[fe+1]).slice(1),Me=ie[fe+2]?(" "+ie[fe+2]).slice(1):"";switch(ve){case"PLAYLIST-TYPE":S.type=ue.toUpperCase();break;case"MEDIA-SEQUENCE":W=S.startSN=parseInt(ue);break;case"SKIP":{var Qe=new k.AttrList(ue),He=Qe.decimalInteger("SKIPPED-SEGMENTS");if(Object(K.isFiniteNumber)(He)){S.skippedSegments=He;for(var rt=He;rt--;)A.unshift(null);W+=He}var oe=Qe.enumeratedString("RECENTLY-REMOVED-DATERANGES");oe&&(S.recentlyRemovedDateranges=oe.split(" "));break}case"TARGETDURATION":S.targetduration=parseFloat(ue);break;case"VERSION":S.version=parseInt(ue);break;case"EXTM3U":break;case"ENDLIST":S.live=!1;break;case"#":(ue||Me)&&te.tagList.push(Me?[ue,Me]:[ue]);break;case"DIS":z++;case"GAP":te.tagList.push([ve]);break;case"BITRATE":te.tagList.push([ve,ue]);break;case"DISCONTINUITY-SEQ":z=parseInt(ue);break;case"KEY":{var de,xe=new k.AttrList(ue),Re=xe.enumeratedString("METHOD"),Ie=xe.URI,Ne=xe.hexadecimalInteger("IV"),Ge=xe.enumeratedString("KEYFORMATVERSIONS"),ze=xe.enumeratedString("KEYID"),ut=(de=xe.enumeratedString("KEYFORMAT"))!=null?de:"identity",Ke=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ke.indexOf(ut)>-1){d.logger.warn("Keyformat "+ut+" is not supported from the manifest");continue}else if(ut!=="identity")continue;Re&&(ye=_.LevelKey.fromURL(y,Ie),Ie&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Re)>=0&&(ye.method=Re,ye.keyFormat=ut,ze&&(ye.keyID=ze),Ge&&(ye.keyFormatVersions=Ge),ye.iv=Ne));break}case"START":{var Be=new k.AttrList(ue),Xe=Be.decimalFloatingPoint("TIME-OFFSET");Object(K.isFiniteNumber)(Xe)&&(S.startTimeOffset=Xe);break}case"MAP":{var tt=new k.AttrList(ue);te.relurl=tt.URI,tt.BYTERANGE&&te.setByteRange(tt.BYTERANGE),te.level=c,te.sn="initSegment",ye&&(te.levelkey=ye),te.initSegment=null,P=te,Le=!0;break}case"SERVER-CONTROL":{var Ze=new k.AttrList(ue);S.canBlockReload=Ze.bool("CAN-BLOCK-RELOAD"),S.canSkipUntil=Ze.optionalFloat("CAN-SKIP-UNTIL",0),S.canSkipDateRanges=S.canSkipUntil>0&&Ze.bool("CAN-SKIP-DATERANGES"),S.partHoldBack=Ze.optionalFloat("PART-HOLD-BACK",0),S.holdBack=Ze.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var it=new k.AttrList(ue);S.partTarget=it.decimalFloatingPoint("PART-TARGET");break}case"PART":{var we=S.partList;we||(we=S.partList=[]);var Ye=V>0?we[we.length-1]:void 0,at=V++,Oe=new j.Part(new k.AttrList(ue),te,y,at,Ye);we.push(Oe),te.duration+=Oe.duration;break}case"PRELOAD-HINT":{var je=new k.AttrList(ue);S.preloadHint=je;break}case"RENDITION-REPORT":{var ge=new k.AttrList(ue);S.renditionReports=S.renditionReports||[],S.renditionReports.push(ge);break}default:d.logger.warn("line parsed but not handled: "+ie);break}}}F&&!F.relurl?(A.pop(),Z-=F.duration,S.partList&&(S.fragmentHint=F)):S.partList&&(v(te,F),te.cc=z,S.fragmentHint=te);var he=A.length,ce=A[0],re=A[he-1];if(Z+=S.skippedSegments*S.targetduration,Z>0&&he&&re){S.averagetargetduration=Z/he;var q=re.sn;S.endSN=q!=="initSegment"?q:0,ce&&(S.startCC=ce.cc,ce.initSegment||S.fragments.every(function(ae){return ae.relurl&&i(ae.relurl)})&&(d.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),te=new j.Fragment(u,y),te.relurl=re.relurl,te.level=c,te.sn="initSegment",ce.initSegment=te,S.needSidxRanges=!0))}else S.endSN=0,S.startCC=0;return S.fragmentHint&&(Z+=S.fragmentHint.duration),S.totalduration=Z,S.endCC=z,_e>0&&g(A,_e),S},O}();function l(O,w){["video","audio","text"].forEach(function(C){var y=O.filter(function(u){return Object(f.isCodecType)(u,C)});if(y.length){var c=y.filter(function(u){return u.lastIndexOf("avc1",0)===0||u.lastIndexOf("mp4a",0)===0});w[C+"Codec"]=c.length>0?c[0]:y[0],O=O.filter(function(u){return y.indexOf(u)===-1})}}),w.unknownCodecs=O}function E(O,w,C){var y=w[C];y&&(O[C]=y)}function g(O,w){for(var C=O[w],y=w;y--;){var c=O[y];if(!c)return;c.programDateTime=C.programDateTime-c.duration*1e3,C=c}}function v(O,w){O.rawProgramDateTime?O.programDateTime=Date.parse(O.rawProgramDateTime):w!=null&&w.programDateTime&&(O.programDateTime=w.endProgramDateTime),Object(K.isFiniteNumber)(O.programDateTime)||(O.programDateTime=null,O.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ne,$,M){"use strict";M.r($);var K=M("./src/polyfills/number.ts"),I=M("./src/events.ts"),D=M("./src/errors.ts"),j=M("./src/utils/logger.ts"),N=M("./src/utils/mp4-tools.ts"),_=M("./src/loader/m3u8-parser.ts"),k=M("./src/types/loader.ts"),d=M("./src/utils/attr-list.ts");function f(p){var b=p.type;switch(b){case k.PlaylistContextType.AUDIO_TRACK:return k.PlaylistLevelType.AUDIO;case k.PlaylistContextType.SUBTITLE_TRACK:return k.PlaylistLevelType.SUBTITLE;default:return k.PlaylistLevelType.MAIN}}function T(p,b){var o=p.url;return(o===void 0||o.indexOf("data:")===0)&&(o=b.url),o}var m=function(){function p(o){this.hls=void 0,this.loaders=Object.create(null),this.hls=o,this.registerListeners()}var b=p.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,E=s.loader,g=l||E,v=new g(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:k.PlaylistContextType.MANIFEST,url:l,deliveryDirectives:null})},b.onLevelLoading=function(i,s){var l=s.id,E=s.level,g=s.url,v=s.deliveryDirectives;this.load({id:l,groupId:null,level:E,responseType:"text",type:k.PlaylistContextType.LEVEL,url:g,deliveryDirectives:v})},b.onAudioTrackLoading=function(i,s){var l=s.id,E=s.groupId,g=s.url,v=s.deliveryDirectives;this.load({id:l,groupId:E,level:null,responseType:"text",type:k.PlaylistContextType.AUDIO_TRACK,url:g,deliveryDirectives:v})},b.onSubtitleTrackLoading=function(i,s){var l=s.id,E=s.groupId,g=s.url,v=s.deliveryDirectives;this.load({id:l,groupId:E,level:null,responseType:"text",type:k.PlaylistContextType.SUBTITLE_TRACK,url:g,deliveryDirectives:v})},b.load=function(i){var s,l=this.hls.config,E=this.getInternalLoader(i);if(E){var g=E.context;if(g&&g.url===i.url){j.logger.trace("[playlist-loader]: playlist request ongoing");return}j.logger.log("[playlist-loader]: aborting previous loader for type: "+i.type),E.abort()}var v,O,w,C;switch(i.type){case k.PlaylistContextType.MANIFEST:v=l.manifestLoadingMaxRetry,O=l.manifestLoadingTimeOut,w=l.manifestLoadingRetryDelay,C=l.manifestLoadingMaxRetryTimeout;break;case k.PlaylistContextType.LEVEL:case k.PlaylistContextType.AUDIO_TRACK:case k.PlaylistContextType.SUBTITLE_TRACK:v=0,O=l.levelLoadingTimeOut;break;default:v=l.levelLoadingMaxRetry,O=l.levelLoadingTimeOut,w=l.levelLoadingRetryDelay,C=l.levelLoadingMaxRetryTimeout;break}if(E=this.createInternalLoader(i),(s=i.deliveryDirectives)!==null&&s!==void 0&&s.part){var y;if(i.type===k.PlaylistContextType.LEVEL&&i.level!==null?y=this.hls.levels[i.level].details:i.type===k.PlaylistContextType.AUDIO_TRACK&&i.id!==null?y=this.hls.audioTracks[i.id].details:i.type===k.PlaylistContextType.SUBTITLE_TRACK&&i.id!==null&&(y=this.hls.subtitleTracks[i.id].details),y){var c=y.partTarget,u=y.targetduration;c&&u&&(O=Math.min(Math.max(c*3,u*.8)*1e3,O))}}var L={timeout:O,maxRetry:v,retryDelay:w,maxRetryDelay:C,highWaterMark:0},S={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};E.load(i,L,S)},b.loadsuccess=function(i,s,l,E){if(E===void 0&&(E=null),l.isSidxRequest){this.handleSidxRequest(i,l),this.handlePlaylistLoaded(i,s,l,E);return}this.resetInternalLoader(l.type);var g=i.data;if(g.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(i,l,"no EXTM3U delimiter",E);return}s.parsing.start=performance.now(),g.indexOf("#EXTINF:")>0||g.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(i,s,l,E):this.handleMasterPlaylist(i,s,l,E)},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,E){var g=this.hls,v=i.data,O=T(i,l),w=_.default.parseMasterPlaylist(v,O),C=w.levels,y=w.sessionData;if(!C.length){this.handleManifestParsingError(i,l,"no level found in manifest",E);return}var c=C.map(function(W){return{id:W.attrs.AUDIO,audioCodec:W.audioCodec}}),u=C.map(function(W){return{id:W.attrs.SUBTITLES,textCodec:W.textCodec}}),L=_.default.parseMasterPlaylistMedia(v,O,"AUDIO",c),S=_.default.parseMasterPlaylistMedia(v,O,"SUBTITLES",u),A=_.default.parseMasterPlaylistMedia(v,O,"CLOSED-CAPTIONS");if(L.length){var P=L.some(function(W){return!W.url});!P&&C[0].audioCodec&&!C[0].attrs.AUDIO&&(j.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),L.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new d.AttrList({}),bitrate:0,url:""}))}g.trigger(I.Events.MANIFEST_LOADED,{levels:C,audioTracks:L,subtitles:S,captions:A,url:O,stats:s,networkDetails:E,sessionData:y})},b.handleTrackOrLevelPlaylist=function(i,s,l,E){var g=this.hls,v=l.id,O=l.level,w=l.type,C=T(i,l),y=Object(K.isFiniteNumber)(v)?v:0,c=Object(K.isFiniteNumber)(O)?O:y,u=f(l),L=_.default.parseLevelPlaylist(i.data,C,c,u,y);if(!L.fragments.length){g.trigger(I.Events.ERROR,{type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:C,reason:"no fragments found in level",level:typeof l.level=="number"?l.level:void 0});return}if(w===k.PlaylistContextType.MANIFEST){var S={attrs:new d.AttrList({}),bitrate:0,details:L,name:"",url:C};g.trigger(I.Events.MANIFEST_LOADED,{levels:[S],audioTracks:[],url:C,stats:s,networkDetails:E,sessionData:null})}if(s.parsing.end=performance.now(),L.needSidxRanges){var A,P=(A=L.fragments[0].initSegment)===null||A===void 0?void 0:A.url;this.load({url:P,isSidxRequest:!0,type:w,level:O,levelDetails:L,id:v,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}l.levelDetails=L,this.handlePlaylistLoaded(i,s,l,E)},b.handleSidxRequest=function(i,s){var l=Object(N.parseSegmentIndex)(new Uint8Array(i.data));if(!l)return;var E=l.references,g=s.levelDetails;E.forEach(function(v,O){var w=v.info,C=g.fragments[O];C.byteRange.length===0&&C.setByteRange(String(1+w.end-w.start)+"@"+String(w.start)),C.initSegment&&C.initSegment.setByteRange(String(l.moovEndOffset)+"@0")})},b.handleManifestParsingError=function(i,s,l,E){this.hls.trigger(I.Events.ERROR,{type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===k.PlaylistContextType.MANIFEST,url:i.url,reason:l,response:i,context:s,networkDetails:E})},b.handleNetworkError=function(i,s,l,E){l===void 0&&(l=!1),j.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 g=D.ErrorDetails.UNKNOWN,v=!1,O=this.getInternalLoader(i);switch(i.type){case k.PlaylistContextType.MANIFEST:g=l?D.ErrorDetails.MANIFEST_LOAD_TIMEOUT:D.ErrorDetails.MANIFEST_LOAD_ERROR,v=!0;break;case k.PlaylistContextType.LEVEL:g=l?D.ErrorDetails.LEVEL_LOAD_TIMEOUT:D.ErrorDetails.LEVEL_LOAD_ERROR,v=!1;break;case k.PlaylistContextType.AUDIO_TRACK:g=l?D.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:D.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,v=!1;break;case k.PlaylistContextType.SUBTITLE_TRACK:g=l?D.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:D.ErrorDetails.SUBTITLE_LOAD_ERROR,v=!1;break}O&&this.resetInternalLoader(i.type);var w={type:D.ErrorTypes.NETWORK_ERROR,details:g,fatal:v,url:i.url,loader:O,context:i,networkDetails:s};E&&(w.response=E),this.hls.trigger(I.Events.ERROR,w)},b.handlePlaylistLoaded=function(i,s,l,E){var g=l.type,v=l.level,O=l.id,w=l.groupId,C=l.loader,y=l.levelDetails,c=l.deliveryDirectives;if(!(y!=null&&y.targetduration)){this.handleManifestParsingError(i,l,"invalid target duration",E);return}if(!C)return;y.live&&(C.getCacheAge&&(y.ageHeader=C.getCacheAge()||0),(!C.getCacheAge||isNaN(y.ageHeader))&&(y.ageHeader=0));switch(g){case k.PlaylistContextType.MANIFEST:case k.PlaylistContextType.LEVEL:this.hls.trigger(I.Events.LEVEL_LOADED,{details:y,level:v||0,id:O||0,stats:s,networkDetails:E,deliveryDirectives:c});break;case k.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(I.Events.AUDIO_TRACK_LOADED,{details:y,id:O||0,groupId:w||"",stats:s,networkDetails:E,deliveryDirectives:c});break;case k.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(I.Events.SUBTITLE_TRACK_LOADED,{details:y,id:O||0,groupId:w||"",stats:s,networkDetails:E,deliveryDirectives:c});break}},p}();$.default=m},"./src/polyfills/number.ts":function(ne,$,M){"use strict";M.r($),M.d($,"isFiniteNumber",function(){return K}),M.d($,"MAX_SAFE_INTEGER",function(){return I});var K=Number.isFinite||function(D){return typeof D=="number"&&isFinite(D)},I=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ne,$,M){"use strict";M.r($);var K=function(){function I(){}return I.getSilentFrame=function(j,N){switch(j){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=K},"./src/remux/mp4-generator.ts":function(ne,$,M){"use strict";M.r($);var K=Math.pow(2,32)-1,I=function(){function D(){}return D.init=function(){D.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 D.types)D.types.hasOwnProperty(N)&&(D.types[N]=[N.charCodeAt(0),N.charCodeAt(1),N.charCodeAt(2),N.charCodeAt(3)]);var _=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]),k=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]);D.HDLR_TYPES={video:_,audio:k};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]);D.STTS=D.STSC=D.STCO=f,D.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),D.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),D.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),D.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var T=new Uint8Array([105,115,111,109]),m=new Uint8Array([97,118,99,49]),p=new Uint8Array([0,0,0,1]);D.FTYP=D.box(D.types.ftyp,T,p,T,m),D.DINF=D.box(D.types.dinf,D.box(D.types.dref,d))},D.box=function(N){for(var _=8,k=arguments.length,d=new Array(k>1?k-1:0),f=1;f<k;f++)d[f-1]=arguments[f];for(var T=d.length,m=T;T--;)_+=d[T].byteLength;var p=new Uint8Array(_);for(p[0]=_>>24&255,p[1]=_>>16&255,p[2]=_>>8&255,p[3]=_&255,p.set(N,4),T=0,_=8;T<m;T++)p.set(d[T],_),_+=d[T].byteLength;return p},D.hdlr=function(N){return D.box(D.types.hdlr,D.HDLR_TYPES[N])},D.mdat=function(N){return D.box(D.types.mdat,N)},D.mdhd=function(N,_){_*=N;var k=Math.floor(_/(K+1)),d=Math.floor(_%(K+1));return D.box(D.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,k>>24,k>>16&255,k>>8&255,k&255,d>>24,d>>16&255,d>>8&255,d&255,85,196,0,0]))},D.mdia=function(N){return D.box(D.types.mdia,D.mdhd(N.timescale,N.duration),D.hdlr(N.type),D.minf(N))},D.mfhd=function(N){return D.box(D.types.mfhd,new Uint8Array([0,0,0,0,N>>24,N>>16&255,N>>8&255,N&255]))},D.minf=function(N){return N.type==="audio"?D.box(D.types.minf,D.box(D.types.smhd,D.SMHD),D.DINF,D.stbl(N)):D.box(D.types.minf,D.box(D.types.vmhd,D.VMHD),D.DINF,D.stbl(N))},D.moof=function(N,_,k){return D.box(D.types.moof,D.mfhd(N),D.traf(k,_))},D.moov=function(N){for(var _=N.length,k=[];_--;)k[_]=D.trak(N[_]);return D.box.apply(null,[D.types.moov,D.mvhd(N[0].timescale,N[0].duration)].concat(k).concat(D.mvex(N)))},D.mvex=function(N){for(var _=N.length,k=[];_--;)k[_]=D.trex(N[_]);return D.box.apply(null,[D.types.mvex].concat(k))},D.mvhd=function(N,_){_*=N;var k=Math.floor(_/(K+1)),d=Math.floor(_%(K+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,k>>24,k>>16&255,k>>8&255,k&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 D.box(D.types.mvhd,f)},D.sdtp=function(N){var _=N.samples||[],k=new Uint8Array(4+_.length),d,f;for(d=0;d<_.length;d++)f=_[d].flags,k[d+4]=f.dependsOn<<4|f.isDependedOn<<2|f.hasRedundancy;return D.box(D.types.sdtp,k)},D.stbl=function(N){return D.box(D.types.stbl,D.stsd(N),D.box(D.types.stts,D.STTS),D.box(D.types.stsc,D.STSC),D.box(D.types.stsz,D.STSZ),D.box(D.types.stco,D.STCO))},D.avc1=function(N){var _=[],k=[],d,f,T;for(d=0;d<N.sps.length;d++)f=N.sps[d],T=f.byteLength,_.push(T>>>8&255),_.push(T&255),_=_.concat(Array.prototype.slice.call(f));for(d=0;d<N.pps.length;d++)f=N.pps[d],T=f.byteLength,k.push(T>>>8&255),k.push(T&255),k=k.concat(Array.prototype.slice.call(f));var m=D.box(D.types.avcC,new Uint8Array([1,_[3],_[4],_[5],252|3,224|N.sps.length].concat(_).concat([N.pps.length]).concat(k))),p=N.width,b=N.height,o=N.pixelRatio[0],i=N.pixelRatio[1];return D.box(D.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,p>>8&255,p&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]),m,D.box(D.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),D.box(D.types.pasp,new Uint8Array([o>>24,o>>16&255,o>>8&255,o&255,i>>24,i>>16&255,i>>8&255,i&255])))},D.esds=function(N){var _=N.config.length;return new Uint8Array([0,0,0,0,3,23+_,0,1,0,4,15+_,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([_]).concat(N.config).concat([6,1,2]))},D.mp4a=function(N){var _=N.samplerate;return D.box(D.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,_>>8&255,_&255,0,0]),D.box(D.types.esds,D.esds(N)))},D.mp3=function(N){var _=N.samplerate;return D.box(D.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,_>>8&255,_&255,0,0]))},D.stsd=function(N){return N.type==="audio"?!N.isAAC&&N.codec==="mp3"?D.box(D.types.stsd,D.STSD,D.mp3(N)):D.box(D.types.stsd,D.STSD,D.mp4a(N)):D.box(D.types.stsd,D.STSD,D.avc1(N))},D.tkhd=function(N){var _=N.id,k=N.duration*N.timescale,d=N.width,f=N.height,T=Math.floor(k/(K+1)),m=Math.floor(k%(K+1));return D.box(D.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,_>>24&255,_>>16&255,_>>8&255,_&255,0,0,0,0,T>>24,T>>16&255,T>>8&255,T&255,m>>24,m>>16&255,m>>8&255,m&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]))},D.traf=function(N,_){var k=D.sdtp(N),d=N.id,f=Math.floor(_/(K+1)),T=Math.floor(_%(K+1));return D.box(D.types.traf,D.box(D.types.tfhd,new Uint8Array([0,0,0,0,d>>24,d>>16&255,d>>8&255,d&255])),D.box(D.types.tfdt,new Uint8Array([1,0,0,0,f>>24,f>>16&255,f>>8&255,f&255,T>>24,T>>16&255,T>>8&255,T&255])),D.trun(N,k.length+16+20+8+16+8+8),k)},D.trak=function(N){return N.duration=N.duration||4294967295,D.box(D.types.trak,D.tkhd(N),D.mdia(N))},D.trex=function(N){var _=N.id;return D.box(D.types.trex,new Uint8Array([0,0,0,0,_>>24,_>>16&255,_>>8&255,_&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},D.trun=function(N,_){var k=N.samples||[],d=k.length,f=12+16*d,T=new Uint8Array(f),m,p,b,o,i,s;for(_+=8+f,T.set([0,0,15,1,d>>>24&255,d>>>16&255,d>>>8&255,d&255,_>>>24&255,_>>>16&255,_>>>8&255,_&255],0),m=0;m<d;m++)p=k[m],b=p.duration,o=p.size,i=p.flags,s=p.cts,T.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*m);return D.box(D.types.trun,T)},D.initSegment=function(N){D.types||D.init();var _=D.moov(N),k=new Uint8Array(D.FTYP.byteLength+_.byteLength);return k.set(D.FTYP),k.set(_,D.FTYP.byteLength),k},D}();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(ne,$,M){"use strict";M.r($),M.d($,"default",function(){return s}),M.d($,"normalizePts",function(){return l});var K=M("./src/polyfills/number.ts"),I=M("./src/remux/aac-helper.ts"),D=M("./src/remux/mp4-generator.ts"),j=M("./src/events.ts"),N=M("./src/errors.ts"),_=M("./src/utils/logger.ts"),k=M("./src/types/loader.ts"),d=M("./src/utils/timescale-conversion.ts");function f(){return f=Object.assign||function(O){for(var w=1;w<arguments.length;w++){var C=arguments[w];for(var y in C)Object.prototype.hasOwnProperty.call(C,y)&&(O[y]=C[y])}return O},f.apply(this,arguments)}var T=10*1e3,m=1024,p=1152,b=null,o=null,i=!1,s=function(){function O(C,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=C,this.config=y,this.typeSupported=c,this.ISGenerated=!1,b===null){var L=navigator.userAgent||"",S=L.match(/Chrome\/(\d+)/i);b=S?parseInt(S[1]):0}if(o===null){var A=navigator.userAgent.match(/Safari\/(\d+)/i);o=A?parseInt(A[1]):0}i=!!b&&b<75||!!o&&o<600}var w=O.prototype;return w.destroy=function(){},w.resetTimeStamp=function(y){_.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=y},w.resetNextTimestamp=function(){_.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},w.resetInitSegment=function(){_.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},w.getVideoStartPts=function(y){var c=!1,u=y.reduce(function(L,S){var A=S.pts-L;return A<-4294967296?(c=!0,l(L,S.pts)):A>0?L:S.pts},y[0].pts);return c&&_.logger.debug("PTS rollover detected"),u},w.remux=function(y,c,u,L,S,A,P,W){var V,Z,z,F,te,ie,fe=S,ye=S,_e=y.pid>-1,Le=c.pid>-1,Ae=c.samples.length,ke=y.samples.length>0,De=Ae>1,ve=(!_e||ke)&&(!Le||De)||this.ISGenerated||P;if(ve){this.ISGenerated||(z=this.generateIS(y,c,S));var ue=this.isVideoContiguous,Me=-1;if(De&&(Me=E(c.samples),!ue&&this.config.forceKeyFrameOnDiscontinuity))if(ie=!0,Me>0){_.logger.warn("[mp4-remuxer]: Dropped "+Me+" out of "+Ae+" video samples due to a missing keyframe");var Qe=this.getVideoStartPts(c.samples);c.samples=c.samples.slice(Me),c.dropped+=Me,ye+=(c.samples[0].pts-Qe)/(c.timescale||9e4)}else Me===-1&&(_.logger.warn("[mp4-remuxer]: No keyframe found out of "+Ae+" video samples"),ie=!1);if(this.ISGenerated){if(ke&&De){var He=this.getVideoStartPts(c.samples),rt=l(y.samples[0].pts,He)-He,oe=rt/c.inputTimeScale;fe+=Math.max(0,oe),ye+=Math.max(0,-oe)}if(ke){if(y.samplerate||(_.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),z=this.generateIS(y,c,S)),Z=this.remuxAudio(y,fe,this.isAudioContiguous,A,Le||De||W===k.PlaylistLevelType.AUDIO?ye:void 0),De){var de=Z?Z.endPTS-Z.startPTS:0;c.inputTimeScale||(_.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),z=this.generateIS(y,c,S)),V=this.remuxVideo(c,ye,ue,de)}}else De&&(V=this.remuxVideo(c,ye,ue,0));V&&(V.firstKeyFrame=Me,V.independent=Me!==-1)}}return this.ISGenerated&&(u.samples.length&&(te=this.remuxID3(u,S)),L.samples.length&&(F=this.remuxText(L,S))),{audio:Z,video:V,initSegment:z,independent:ie,text:F,id3:te}},w.generateIS=function(y,c,u){var L=y.samples,S=c.samples,A=this.typeSupported,P={},W=!Object(K.isFiniteNumber)(this._initPTS),V="audio/mp4",Z,z,F;if(W&&(Z=z=Infinity),y.config&&L.length&&(y.timescale=y.samplerate,y.isAAC||(A.mpeg?(V="audio/mpeg",y.codec=""):A.mp3&&(y.codec="mp3")),P.audio={id:"audio",container:V,codec:y.codec,initSegment:!y.isAAC&&A.mpeg?new Uint8Array(0):D.default.initSegment([y]),metadata:{channelCount:y.channelCount}},W&&(F=y.inputTimeScale,Z=z=L[0].pts-Math.round(F*u))),c.sps&&c.pps&&S.length&&(c.timescale=c.inputTimeScale,P.video={id:"main",container:"video/mp4",codec:c.codec,initSegment:D.default.initSegment([c]),metadata:{width:c.width,height:c.height}},W)){F=c.inputTimeScale;var te=this.getVideoStartPts(S),ie=Math.round(F*u);z=Math.min(z,l(S[0].dts,te)-ie),Z=Math.min(Z,te-ie)}if(Object.keys(P).length)return this.ISGenerated=!0,W&&(this._initPTS=Z,this._initDTS=z),{tracks:P,initPTS:Z,timescale:F}},w.remuxVideo=function(y,c,u,L){var S=y.inputTimeScale,A=y.samples,P=[],W=A.length,V=this._initPTS,Z=this.nextAvcDts,z=8,F,te,ie,fe=Number.POSITIVE_INFINITY,ye=Number.NEGATIVE_INFINITY,_e=0,Le=!1;if(!u||Z===null){var Ae=c*S,ke=A[0].pts-l(A[0].dts,A[0].pts);Z=Ae-ke}for(var De=0;De<W;De++){var ve=A[De];if(ve.pts=l(ve.pts-V,Z),ve.dts=l(ve.dts-V,Z),ve.dts>ve.pts){var ue=9e4*.2;_e=Math.max(Math.min(_e,ve.pts-ve.dts),-1*ue)}ve.dts<A[De>0?De-1:De].dts&&(Le=!0)}Le&&A.sort(function(At,wt){var qe=At.dts-wt.dts,Mt=At.pts-wt.pts;return qe||Mt}),te=A[0].dts,ie=A[A.length-1].dts;var Me=Math.round((ie-te)/(W-1));if(_e<0){if(_e<Me*-2){_.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(d.toMsFromMpegTsClock)(-Me,!0)+" ms");for(var Qe=_e,He=0;He<W;He++)A[He].dts=Qe=Math.max(Qe,A[He].pts-Me),A[He].pts=Math.max(Qe,A[He].pts)}else{_.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(d.toMsFromMpegTsClock)(_e,!0)+" ms to overcome this issue");for(var rt=0;rt<W;rt++)A[rt].dts=A[rt].dts+_e}te=A[0].dts}if(u){var oe=te-Z,de=oe>Me,xe=oe<-1;if(de||xe){de?_.logger.warn("AVC: "+Object(d.toMsFromMpegTsClock)(oe,!0)+" ms ("+oe+"dts) hole between fragments detected, filling it"):_.logger.warn("AVC: "+Object(d.toMsFromMpegTsClock)(-oe,!0)+" ms ("+oe+"dts) overlapping between fragments detected"),te=Z;var Re=A[0].pts-oe;A[0].dts=te,A[0].pts=Re,_.logger.log("Video: First PTS/DTS adjusted: "+Object(d.toMsFromMpegTsClock)(Re,!0)+"/"+Object(d.toMsFromMpegTsClock)(te,!0)+", delta: "+Object(d.toMsFromMpegTsClock)(oe,!0)+" ms")}}i&&(te=Math.max(0,te));for(var Ie=0,Ne=0,Ge=0;Ge<W;Ge++){for(var ze=A[Ge],ut=ze.units,Ke=ut.length,Be=0,Xe=0;Xe<Ke;Xe++)Be+=ut[Xe].data.length;Ne+=Be,Ie+=Ke,ze.length=Be,ze.dts=Math.max(ze.dts,te),ze.pts=Math.max(ze.pts,ze.dts,0),fe=Math.min(ze.pts,fe),ye=Math.max(ze.pts,ye)}ie=A[W-1].dts;var tt=Ne+4*Ie+8,Ze;try{Ze=new Uint8Array(tt)}catch(At){this.observer.emit(j.Events.ERROR,j.Events.ERROR,{type:N.ErrorTypes.MUX_ERROR,details:N.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:tt,reason:"fail allocating video mdat "+tt});return}var it=new DataView(Ze.buffer);it.setUint32(0,tt),Ze.set(D.default.types.mdat,4);for(var we=0;we<W;we++){for(var Ye=A[we],at=Ye.units,Oe=0,je=0,ge=at.length;je<ge;je++){var he=at[je],ce=he.data,re=he.data.byteLength;it.setUint32(z,re),z+=4,Ze.set(ce,z),z+=re,Oe+=4+re}if(we<W-1)F=A[we+1].dts-Ye.dts;else{var q=this.config,ae=Ye.dts-A[we>0?we-1:we].dts;if(q.stretchShortVideoTrack&&this.nextAudioPts!==null){var le=Math.floor(q.maxBufferHole*S),Te=(L?fe+L*S:this.nextAudioPts)-Ye.pts;Te>le?(F=Te-ae,F<0&&(F=ae),_.logger.log("[mp4-remuxer]: It is approximately "+Te/90+" ms to the next segment; using duration "+F/90+" ms for the last video frame.")):F=ae}else F=ae}var be=Math.round(Ye.pts-Ye.dts);P.push(new g(Ye.key,F,Oe,be))}if(P.length&&b&&b<70){var Fe=P[0].flags;Fe.dependsOn=2,Fe.isNonSync=0}console.assert(F!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=Z=ie+F,this.isVideoContiguous=!0;var Je=D.default.moof(y.sequenceNumber++,te,f({},y,{samples:P})),pt="video",ct={data1:Je,data2:Ze,startPTS:fe/S,endPTS:(ye+F)/S,startDTS:te/S,endDTS:Z/S,type:pt,hasAudio:!1,hasVideo:!0,nb:P.length,dropped:y.dropped};return y.samples=[],y.dropped=0,console.assert(Ze.length,"MDAT length must not be zero"),ct},w.remuxAudio=function(y,c,u,L,S){var A=y.inputTimeScale,P=y.samplerate?y.samplerate:A,W=A/P,V=y.isAAC?m:p,Z=V*W,z=this._initPTS,F=!y.isAAC&&this.typeSupported.mpeg,te=[],ie=y.samples,fe=F?0:8,ye=this.nextAudioPts||-1,_e=c*A;if(this.isAudioContiguous=u=u||ie.length&&ye>0&&(L&&Math.abs(_e-ye)<9e3||Math.abs(l(ie[0].pts-z,_e)-ye)<20*Z),ie.forEach(function(ce){ce.pts=l(ce.pts-z,_e)}),!u||ye<0){if(ie=ie.filter(function(ce){return ce.pts>=0}),!ie.length)return;S===0?ye=0:L?ye=Math.max(0,_e):ye=ie[0].pts}if(y.isAAC)for(var Le=S!==void 0,Ae=this.config.maxAudioFramesDrift,ke=0,De=ye;ke<ie.length;ke++){var ve=ie[ke],ue=ve.pts,Me=ue-De,Qe=Math.abs(1e3*Me/A);if(Me<=-Ae*Z&&Le)ke===0&&(_.logger.warn("Audio frame @ "+(ue/A).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Me/A)+" ms."),this.nextAudioPts=ye=De=ue);else if(Me>=Ae*Z&&Qe<T&&Le){var He=Math.round(Me/Z);De=ue-He*Z,De<0&&(He--,De+=Z),ke===0&&(this.nextAudioPts=ye=De),_.logger.warn("[mp4-remuxer]: Injecting "+He+" audio frame @ "+(De/A).toFixed(3)+"s due to "+Math.round(1e3*Me/A)+" ms gap.");for(var rt=0;rt<He;rt++){var oe=Math.max(De,0),de=I.default.getSilentFrame(y.manifestCodec||y.codec,y.channelCount);de||(_.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),de=ve.unit.subarray()),ie.splice(ke,0,{unit:de,pts:oe}),De+=Z,ke++}}ve.pts=De,De+=Z}for(var xe=null,Re=null,Ie,Ne=0,Ge=ie.length;Ge--;)Ne+=ie[Ge].unit.byteLength;for(var ze=0,ut=ie.length;ze<ut;ze++){var Ke=ie[ze],Be=Ke.unit,Xe=Ke.pts;if(Re!==null){var tt=te[ze-1];tt.duration=Math.round((Xe-Re)/W)}else if(u&&y.isAAC&&(Xe=ye),xe=Xe,Ne>0){Ne+=fe;try{Ie=new Uint8Array(Ne)}catch(ce){this.observer.emit(j.Events.ERROR,j.Events.ERROR,{type:N.ErrorTypes.MUX_ERROR,details:N.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ne,reason:"fail allocating audio mdat "+Ne});return}if(!F){var Ze=new DataView(Ie.buffer);Ze.setUint32(0,Ne),Ie.set(D.default.types.mdat,4)}}else return;Ie.set(Be,fe);var it=Be.byteLength;fe+=it,te.push(new g(!0,V,it,0)),Re=Xe}var we=te.length;if(!we)return;var Ye=te[te.length-1];this.nextAudioPts=ye=Re+W*Ye.duration;var at=F?new Uint8Array(0):D.default.moof(y.sequenceNumber++,xe/W,f({},y,{samples:te}));y.samples=[];var Oe=xe/A,je=ye/A,ge="audio",he={data1:at,data2:Ie,startPTS:Oe,endPTS:je,startDTS:Oe,endDTS:je,type:ge,hasAudio:!0,hasVideo:!1,nb:we};return this.isAudioContiguous=!0,console.assert(Ie.length,"MDAT length must not be zero"),he},w.remuxEmptyAudio=function(y,c,u,L){var S=y.inputTimeScale,A=y.samplerate?y.samplerate:S,P=S/A,W=this.nextAudioPts,V=(W!==null?W:L.startDTS*S)+this._initDTS,Z=L.endDTS*S+this._initDTS,z=P*m,F=Math.ceil((Z-V)/z),te=I.default.getSilentFrame(y.manifestCodec||y.codec,y.channelCount);if(_.logger.warn("[mp4-remuxer]: remux empty Audio"),!te){_.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ie=[],fe=0;fe<F;fe++){var ye=V+fe*z;ie.push({unit:te,pts:ye,dts:ye})}return y.samples=ie,this.remuxAudio(y,c,u,!1)},w.remuxID3=function(y,c){var u=y.samples.length;if(!u)return;for(var L=y.inputTimeScale,S=this._initPTS,A=this._initDTS,P=0;P<u;P++){var W=y.samples[P];W.pts=l(W.pts-S,c*L)/L,W.dts=l(W.dts-A,c*L)/L}var V=y.samples;return y.samples=[],{samples:V}},w.remuxText=function(y,c){var u=y.samples.length;if(!u)return;for(var L=y.inputTimeScale,S=this._initPTS,A=0;A<u;A++){var P=y.samples[A];P.pts=l(P.pts-S,c*L)/L}y.samples.sort(function(V,Z){return V.pts-Z.pts});var W=y.samples;return y.samples=[],{samples:W}},O}();function l(O,w){var C;if(w===null)return O;for(w<O?C=-8589934592:C=8589934592;Math.abs(O-w)>4294967296;)O+=C;return O}function E(O){for(var w=0;w<O.length;w++)if(O[w].key)return w;return-1}var g=function(w,C,y,c){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=C,this.size=y,this.cts=c,this.flags=new v(w)},v=function(w){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=w?2:1,this.isNonSync=w?0:1}},"./src/remux/passthrough-remuxer.ts":function(ne,$,M){"use strict";M.r($);var K=M("./src/polyfills/number.ts"),I=M("./src/utils/mp4-tools.ts"),D=M("./src/loader/fragment.ts"),j=M("./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(m){this.initPTS=m,this.lastEndDTS=null},f.resetNextTimestamp=function(){this.lastEndDTS=null},f.resetInitSegment=function(m,p,b){this.audioCodec=p,this.videoCodec=b,this.generateInitSegment(m),this.emitInitSegment=!0},f.generateInitSegment=function(m){var p=this.audioCodec,b=this.videoCodec;if(!m||!m.byteLength){this.initTracks=void 0,this.initData=void 0;return}var o=this.initData=Object(I.parseInitSegment)(m);p||(p=k(o.audio,D.ElementaryStreamTypes.AUDIO)),b||(b=k(o.video,D.ElementaryStreamTypes.VIDEO));var i={};o.audio&&o.video?i.audiovideo={container:"video/mp4",codec:p+","+b,initSegment:m,id:"main"}:o.audio?i.audio={container:"audio/mp4",codec:p,initSegment:m,id:"audio"}:o.video?i.video={container:"video/mp4",codec:b,initSegment:m,id:"main"}:j.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=i},f.remux=function(m,p,b,o,i){var s=this.initPTS,l=this.lastEndDTS,E={audio:void 0,video:void 0,text:o,id3:b,initSegment:void 0};Object(K.isFiniteNumber)(l)||(l=this.lastEndDTS=i||0);var g=p.samples;if(!g||!g.length)return E;var v={initPTS:void 0,timescale:1},O=this.initData;if((!O||!O.length)&&(this.generateInitSegment(g),O=this.initData),!O||!O.length)return j.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),E;this.emitInitSegment&&(v.tracks=this.initTracks,this.emitInitSegment=!1),Object(K.isFiniteNumber)(s)||(this.initPTS=v.initPTS=s=_(O,g,l));var w=Object(I.getDuration)(g,O),C=l,y=w+C;Object(I.offsetStartDTS)(O,g,s),w>0?this.lastEndDTS=y:(j.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var c=!!O.audio,u=!!O.video,L="";c&&(L+="audio"),u&&(L+="video");var S={data1:g,startPTS:C,startDTS:C,endPTS:y,endDTS:y,type:L,hasAudio:c,hasVideo:u,nb:1,dropped:0};return E.audio=S.type==="audio"?S:void 0,E.video=S.type!=="audio"?S:void 0,E.text=o,E.id3=b,E.initSegment=v,E},d}(),_=function(f,T,m){return Object(I.getStartDTS)(f,T)-m};function k(d,f){var T=d==null?void 0:d.codec;return T&&T.length>4?T:T==="hvc1"?"hvc1.1.c.L120.90":T==="av01"?"av01.0.04M.08":T==="avc1"||f===D.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}$.default=N},"./src/task-loop.ts":function(ne,$,M){"use strict";M.r($),M.d($,"default",function(){return K});var K=function(){function I(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var D=I.prototype;return D.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},D.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},D.onHandlerDestroyed=function(){},D.hasInterval=function(){return!!this._tickInterval},D.hasNextTick=function(){return!!this._tickTimer},D.setInterval=function(N){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,N),!0)},D.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},D.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},D.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},D.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},D.doTick=function(){},I}()},"./src/types/cmcd.ts":function(ne,$,M){"use strict";M.r($),M.d($,"CMCDVersion",function(){return K}),M.d($,"CMCDObjectType",function(){return I}),M.d($,"CMCDStreamingFormat",function(){return D}),M.d($,"CMCDStreamType",function(){return j});var K=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 D;(function(N){N.DASH="d",N.HLS="h",N.SMOOTH="s",N.OTHER="o"})(D||(D={}));var j;(function(N){N.VOD="v",N.LIVE="l"})(j||(j={}))},"./src/types/level.ts":function(ne,$,M){"use strict";M.r($),M.d($,"HlsSkip",function(){return D}),M.d($,"getSkipValue",function(){return j}),M.d($,"HlsUrlParameters",function(){return N}),M.d($,"Level",function(){return _});function K(k,d){for(var f=0;f<d.length;f++){var T=d[f];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(k,T.key,T)}}function I(k,d,f){return d&&K(k.prototype,d),f&&K(k,f),k}var D;(function(k){k.No="",k.Yes="YES",k.v2="v2"})(D||(D={}));function j(k,d){var f=k.canSkipUntil,T=k.canSkipDateRanges,m=k.endSN,p=d!==void 0?d-m:0;return f&&p<f?T?D.v2:D.Yes:D.No}var N=function(){function k(f,T,m){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=f,this.part=T,this.skip=m}var d=k.prototype;return d.addDirectives=function(T){var m=new self.URL(T);return this.msn!==void 0&&m.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&m.searchParams.set("_HLS_part",this.part.toString()),this.skip&&m.searchParams.set("_HLS_skip",this.skip),m.toString()},k}(),_=function(){function k(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(k,[{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 T=f%this.url.length;this._urlId!==T&&(this.details=void 0,this._urlId=T)}}]),k}()},"./src/types/loader.ts":function(ne,$,M){"use strict";M.r($),M.d($,"PlaylistContextType",function(){return K}),M.d($,"PlaylistLevelType",function(){return I});var K;(function(D){D.MANIFEST="manifest",D.LEVEL="level",D.AUDIO_TRACK="audioTrack",D.SUBTITLE_TRACK="subtitleTrack"})(K||(K={}));var I;(function(D){D.MAIN="main",D.AUDIO="audio",D.SUBTITLE="subtitle"})(I||(I={}))},"./src/types/transmuxer.ts":function(ne,$,M){"use strict";M.r($),M.d($,"ChunkMetadata",function(){return K});var K=function(j,N,_,k,d,f){k===void 0&&(k=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=j,this.sn=N,this.id=_,this.size=k,this.part=d,this.partial=f};function I(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ne,$,M){"use strict";M.r($),M.d($,"AttrList",function(){return D});var K=/^(\d+)x(\d+)$/,I=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,D=function(){function j(_){typeof _=="string"&&(_=j.parseAttrList(_));for(var k in _)_.hasOwnProperty(k)&&(this[k]=_[k])}var N=j.prototype;return N.decimalInteger=function(k){var d=parseInt(this[k],10);return d>Number.MAX_SAFE_INTEGER?Infinity:d},N.hexadecimalInteger=function(k){if(this[k]){var d=(this[k]||"0x").slice(2);d=(d.length&1?"0":"")+d;for(var f=new Uint8Array(d.length/2),T=0;T<d.length/2;T++)f[T]=parseInt(d.slice(T*2,T*2+2),16);return f}else return null},N.hexadecimalIntegerAsNumber=function(k){var d=parseInt(this[k],16);return d>Number.MAX_SAFE_INTEGER?Infinity:d},N.decimalFloatingPoint=function(k){return parseFloat(this[k])},N.optionalFloat=function(k,d){var f=this[k];return f?parseFloat(f):d},N.enumeratedString=function(k){return this[k]},N.bool=function(k){return this[k]==="YES"},N.decimalResolution=function(k){var d=K.exec(this[k]);return d===null?void 0:{width:parseInt(d[1],10),height:parseInt(d[2],10)}},j.parseAttrList=function(k){var d,f={},T='"';for(I.lastIndex=0;(d=I.exec(k))!==null;){var m=d[2];m.indexOf(T)===0&&m.lastIndexOf(T)===m.length-1&&(m=m.slice(1,-1)),f[d[1]]=m}return f},j}()},"./src/utils/binary-search.ts":function(ne,$,M){"use strict";M.r($);var K={search:function(D,j){for(var N=0,_=D.length-1,k=null,d=null;N<=_;){k=(N+_)/2|0,d=D[k];var f=j(d);if(f>0)N=k+1;else if(f<0)_=k-1;else return d}return null}};$.default=K},"./src/utils/buffer-helper.ts":function(ne,$,M){"use strict";M.r($),M.d($,"BufferHelper",function(){return D});var K=M("./src/utils/logger.ts"),I={length:0,start:function(){return 0},end:function(){return 0}},D=function(){function j(){}return j.isBuffered=function(_,k){try{if(_){for(var d=j.getBuffered(_),f=0;f<d.length;f++)if(k>=d.start(f)&&k<=d.end(f))return!0}}catch(T){}return!1},j.bufferInfo=function(_,k,d){try{if(_){var f=j.getBuffered(_),T=[],m;for(m=0;m<f.length;m++)T.push({start:f.start(m),end:f.end(m)});return this.bufferedInfo(T,k,d)}}catch(p){}return{len:0,start:k,end:k,nextStart:void 0}},j.bufferedInfo=function(_,k,d){k=Math.max(0,k),_.sort(function(v,O){var w=v.start-O.start;return w||O.end-v.end});var f=[];if(d)for(var T=0;T<_.length;T++){var m=f.length;if(m){var p=f[m-1].end;_[T].start-p<d?_[T].end>p&&(f[m-1].end=_[T].end):f.push(_[T])}else f.push(_[T])}else f=_;for(var b=0,o,i=k,s=k,l=0;l<f.length;l++){var E=f[l].start,g=f[l].end;if(k+d>=E&&k<g)i=E,s=g,b=s-k;else if(k+d<E){o=E;break}}return{len:b,start:i||0,end:s||0,nextStart:o}},j.getBuffered=function(_){try{return _.buffered}catch(k){return K.logger.log("failed to get media.buffered",k),I}},j}()},"./src/utils/cea-608-parser.ts":function(ne,$,M){"use strict";M.r($),M.d($,"Row",function(){return s}),M.d($,"CaptionScreen",function(){return l});var K=M("./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},D=function(y){var c=y;return I.hasOwnProperty(y)&&(c=I[y]),String.fromCharCode(c)},j=15,N=100,_={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},k={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},T=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],m;(function(C){C[C.ERROR=0]="ERROR",C[C.TEXT=1]="TEXT",C[C.WARNING=2]="WARNING",C[C.INFO=2]="INFO",C[C.DEBUG=3]="DEBUG",C[C.DATA=3]="DATA"})(m||(m={}));var p=function(){function C(){this.time=null,this.verboseLevel=m.ERROR}var y=C.prototype;return y.log=function(u,L){this.verboseLevel>=u&&K.logger.log(this.time+" ["+u+"] "+L)},C}(),b=function(y){for(var c=[],u=0;u<y.length;u++)c.push(y[u].toString(16));return c},o=function(){function C(c,u,L,S,A){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=L||!1,this.background=S||"black",this.flash=A||!1}var y=C.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 L=["foreground","underline","italics","background","flash"],S=0;S<L.length;S++){var A=L[S];u.hasOwnProperty(A)&&(this[A]=u[A])}},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},C}(),i=function(){function C(c,u,L,S,A,P){this.uchar=void 0,this.penState=void 0,this.uchar=c||" ",this.penState=new o(u,L,S,A,P)}var y=C.prototype;return y.reset=function(){this.uchar=" ",this.penState.reset()},y.setChar=function(u,L){this.uchar=u,this.penState.copy(L)},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()},C}(),s=function(){function C(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=C.prototype;return y.equals=function(u){for(var L=!0,S=0;S<N;S++)if(!this.chars[S].equals(u.chars[S])){L=!1;break}return L},y.copy=function(u){for(var L=0;L<N;L++)this.chars[L].copy(u.chars[L])},y.isEmpty=function(){for(var u=!0,L=0;L<N;L++)if(!this.chars[L].isEmpty()){u=!1;break}return u},y.setCursor=function(u){this.pos!==u&&(this.pos=u),this.pos<0?(this.logger.log(m.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>N&&(this.logger.log(m.DEBUG,"Too large cursor position "+this.pos),this.pos=N)},y.moveCursor=function(u){var L=this.pos+u;if(u>1)for(var S=this.pos+1;S<L+1;S++)this.chars[S].setPenState(this.currPenState);this.setCursor(L)},y.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},y.insertChar=function(u){u>=144&&this.backSpace();var L=D(u);if(this.pos>=N){this.logger.log(m.ERROR,"Cannot insert "+u.toString(16)+" ("+L+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(L,this.currPenState),this.moveCursor(1)},y.clearFromPos=function(u){var L;for(L=u;L<N;L++)this.chars[L].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=[],L=!0,S=0;S<N;S++){var A=this.chars[S].uchar;A!==" "&&(L=!1),u.push(A)}return L?"":u.join("")},y.setPenStyles=function(u){this.currPenState.setStyles(u);var L=this.chars[this.pos];L.setPenState(this.currPenState)},C}(),l=function(){function C(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<j;u++)this.rows.push(new s(c));this.logger=c,this.currRow=j-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var y=C.prototype;return y.reset=function(){for(var u=0;u<j;u++)this.rows[u].clear();this.currRow=j-1},y.equals=function(u){for(var L=!0,S=0;S<j;S++)if(!this.rows[S].equals(u.rows[S])){L=!1;break}return L},y.copy=function(u){for(var L=0;L<j;L++)this.rows[L].copy(u.rows[L])},y.isEmpty=function(){for(var u=!0,L=0;L<j;L++)if(!this.rows[L].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 L=this.rows[this.currRow];L.insertChar(u)},y.setPen=function(u){var L=this.rows[this.currRow];L.setPenStyles(u)},y.moveCursor=function(u){var L=this.rows[this.currRow];L.moveCursor(u)},y.setCursor=function(u){this.logger.log(m.INFO,"setCursor: "+u);var L=this.rows[this.currRow];L.setCursor(u)},y.setPAC=function(u){this.logger.log(m.INFO,"pacData = "+JSON.stringify(u));var L=u.row-1;if(this.nrRollUpRows&&L<this.nrRollUpRows-1&&(L=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==L){for(var S=0;S<j;S++)this.rows[S].clear();var A=this.currRow+1-this.nrRollUpRows,P=this.lastOutputScreen;if(P){var W=P.rows[A].cueStartTime,V=this.logger.time;if(W&&V!==null&&W<V)for(var Z=0;Z<this.nrRollUpRows;Z++)this.rows[L-this.nrRollUpRows+Z+1].copy(P.rows[A+Z])}}this.currRow=L;var z=this.rows[this.currRow];if(u.indent!==null){var F=u.indent,te=Math.max(F-1,0);z.setCursor(u.indent),u.color=z.chars[te].penState.foreground}var ie={foreground:u.color,underline:u.underline,italics:u.italics,background:"black",flash:!1};this.setPen(ie)},y.setBkgData=function(u){this.logger.log(m.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(m.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(m.TEXT,this.getDisplayText());var u=this.currRow+1-this.nrRollUpRows,L=this.rows.splice(u,1)[0];L.clear(),this.rows.splice(this.currRow,0,L),this.logger.log(m.INFO,"Rolling up")},y.getDisplayText=function(u){u=u||!1;for(var L=[],S="",A=-1,P=0;P<j;P++){var W=this.rows[P].getTextString();W&&(A=P+1,u?L.push("Row "+A+": '"+W+"'"):L.push(W.trim()))}return L.length>0&&(u?S="["+L.join(" | ")+"]":S=L.join(`
|
|
`)),S},y.getTextAndFormat=function(){return this.rows},C}(),E=function(){function C(c,u,L){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(L),this.nonDisplayedMemory=new l(L),this.lastOutputScreen=new l(L),this.currRollUpRow=this.displayedMemory.rows[j-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=L}var y=C.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[j-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(m.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 L=0;L<u.length;L++)this.writeScreen.insertChar(u[L]);var S=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(m.INFO,S+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(m.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},y.ccRCL=function(){this.logger.log(m.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},y.ccBS=function(){if(this.logger.log(m.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(m.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},y.ccRU=function(u){this.logger.log(m.INFO,"RU("+u+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(u)},y.ccFON=function(){this.logger.log(m.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},y.ccRDC=function(){this.logger.log(m.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},y.ccTR=function(){this.logger.log(m.INFO,"TR"),this.setMode("MODE_TEXT")},y.ccRTD=function(){this.logger.log(m.INFO,"RTD"),this.setMode("MODE_TEXT")},y.ccEDM=function(){this.logger.log(m.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},y.ccCR=function(){this.logger.log(m.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},y.ccENM=function(){this.logger.log(m.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},y.ccEOC=function(){if(this.logger.log(m.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(m.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},y.ccTO=function(u){this.logger.log(m.INFO,"TO("+u+") - Tab Offset"),this.writeScreen.moveCursor(u)},y.ccMIDROW=function(u){var L={flash:!1};if(L.underline=u%2===1,L.italics=u>=46,L.italics)L.foreground="white";else{var S=Math.floor(u/2)-16,A=["white","green","blue","cyan","red","yellow","magenta"];L.foreground=A[S]}this.logger.log(m.INFO,"MIDROW: "+JSON.stringify(L)),this.writeScreen.setPen(L)},y.outputDataUpdate=function(u){u===void 0&&(u=!1);var L=this.logger.time;if(L===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=L:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,L,this.lastOutputScreen),u&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:L),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))},C}(),g=function(){function C(c,u,L){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var S=new p;this.channels=[null,new E(c,u,S),new E(c+1,L,S)],this.cmdHistory=w(),this.logger=S}var y=C.prototype;return y.getHandler=function(u){return this.channels[u].getHandler()},y.setHandler=function(u,L){this.channels[u].setHandler(L)},y.addData=function(u,L){var S,A,P,W=!1;this.logger.time=u;for(var V=0;V<L.length;V+=2){if(A=L[V]&127,P=L[V+1]&127,A===0&&P===0)continue;if(this.logger.log(m.DATA,"["+b([L[V],L[V+1]])+"] -> ("+b([A,P])+")"),S=this.parseCmd(A,P),S||(S=this.parseMidrow(A,P)),S||(S=this.parsePAC(A,P)),S||(S=this.parseBackgroundAttributes(A,P)),!S&&(W=this.parseChars(A,P),W)){var Z=this.currentChannel;if(Z&&Z>0){var z=this.channels[Z];z.insertChars(W)}else this.logger.log(m.WARNING,"No channel found yet. TEXT-MODE?")}!S&&!W&&this.logger.log(m.WARNING,"Couldn't parse cleaned data "+b([A,P])+" orig: "+b([L[V],L[V+1]]))}},y.parseCmd=function(u,L){var S=this.cmdHistory,A=(u===20||u===28||u===21||u===29)&&L>=32&&L<=47,P=(u===23||u===31)&&L>=33&&L<=35;if(!(A||P))return!1;if(O(u,L,S))return v(null,null,S),this.logger.log(m.DEBUG,"Repeated command ("+b([u,L])+") is dropped"),!0;var W=u===20||u===21||u===23?1:2,V=this.channels[W];return u===20||u===21||u===28||u===29?L===32?V.ccRCL():L===33?V.ccBS():L===34?V.ccAOF():L===35?V.ccAON():L===36?V.ccDER():L===37?V.ccRU(2):L===38?V.ccRU(3):L===39?V.ccRU(4):L===40?V.ccFON():L===41?V.ccRDC():L===42?V.ccTR():L===43?V.ccRTD():L===44?V.ccEDM():L===45?V.ccCR():L===46?V.ccENM():L===47&&V.ccEOC():V.ccTO(L-32),v(u,L,S),this.currentChannel=W,!0},y.parseMidrow=function(u,L){var S=0;if((u===17||u===25)&&L>=32&&L<=47){if(u===17?S=1:S=2,S!==this.currentChannel)return this.logger.log(m.ERROR,"Mismatch channel in midrow parsing"),!1;var A=this.channels[S];return A?(A.ccMIDROW(L),this.logger.log(m.DEBUG,"MIDROW ("+b([u,L])+")"),!0):!1}return!1},y.parsePAC=function(u,L){var S,A=this.cmdHistory,P=(u>=17&&u<=23||u>=25&&u<=31)&&L>=64&&L<=127,W=(u===16||u===24)&&L>=64&&L<=95;if(!(P||W))return!1;if(O(u,L,A))return v(null,null,A),!0;var V=u<=23?1:2;L>=64&&L<=95?S=V===1?_[u]:d[u]:S=V===1?k[u]:f[u];var Z=this.channels[V];return Z?(Z.setPAC(this.interpretPAC(S,L)),v(u,L,A),this.currentChannel=V,!0):!1},y.interpretPAC=function(u,L){var S,A={color:null,italics:!1,indent:null,underline:!1,row:u};return L>95?S=L-96:S=L-64,A.underline=(S&1)===1,S<=13?A.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(S/2)]:S<=15?(A.italics=!0,A.color="white"):A.indent=Math.floor((S-16)/2)*4,A},y.parseChars=function(u,L){var S,A=null,P=null;if(u>=25?(S=2,P=u-8):(S=1,P=u),P>=17&&P<=19){var W;P===17?W=L+80:P===18?W=L+112:W=L+144,this.logger.log(m.INFO,"Special char '"+D(W)+"' in channel "+S),A=[W]}else u>=32&&u<=127&&(A=L===0?[u]:[u,L]);if(A){var V=b(A);this.logger.log(m.DEBUG,"Char codes = "+V.join(",")),v(u,L,this.cmdHistory)}return A},y.parseBackgroundAttributes=function(u,L){var S=(u===16||u===24)&&L>=32&&L<=47,A=(u===23||u===31)&&L>=45&&L<=47;if(!(S||A))return!1;var P,W={};u===16||u===24?(P=Math.floor((L-32)/2),W.background=T[P],L%2===1&&(W.background=W.background+"_semi")):L===45?W.background="transparent":(W.foreground="black",L===47&&(W.underline=!0));var V=u<=23?1:2,Z=this.channels[V];return Z.setBkgData(W),v(u,L,this.cmdHistory),!0},y.reset=function(){for(var u=0;u<Object.keys(this.channels).length;u++){var L=this.channels[u];L&&L.reset()}this.cmdHistory=w()},y.cueSplitAtTime=function(u){for(var L=0;L<this.channels.length;L++){var S=this.channels[L];S&&S.cueSplitAtTime(u)}},C}();function v(C,y,c){c.a=C,c.b=y}function O(C,y,c){return c.a===C&&c.b===y}function w(){return{a:null,b:null}}$.default=g},"./src/utils/codecs.ts":function(ne,$,M){"use strict";M.r($),M.d($,"isCodecType",function(){return I}),M.d($,"isCodecSupportedInMp4",function(){return D});var K={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(j,N){var _=K[N];return!!_&&_[j.slice(0,4)]===!0}function D(j,N){return MediaSource.isTypeSupported((N||"video")+'/mp4;codecs="'+j+'"')}},"./src/utils/cues.ts":function(ne,$,M){"use strict";M.r($);var K=M("./src/utils/vttparser.ts"),I=M("./src/utils/webvtt-parser.ts"),D=M("./src/utils/texttrack-utils.ts"),j=/\s/,N={newCue:function(k,d,f,T){for(var m=[],p,b,o,i,s,l=self.VTTCue||self.TextTrackCue,E=0;E<T.rows.length;E++)if(p=T.rows[E],o=!0,i=0,s="",!p.isEmpty()){for(var g=0;g<p.chars.length;g++)j.test(p.chars[g].uchar)&&o?i++:(s+=p.chars[g].uchar,o=!1);p.cueStartTime=d,d===f&&(f+=1e-4),i>=16?i--:i++;var v=Object(K.fixLineBreaks)(s.trim()),O=Object(I.generateCueId)(d,f,v);(!k||!k.cues||!k.cues.getCueById(O))&&(b=new l(d,f,v),b.id=O,b.line=E+1,b.align="left",b.position=10+Math.min(80,Math.floor(i*8/32)*10),m.push(b))}return k&&m.length&&(m.sort(function(w,C){return w.line==="auto"||C.line==="auto"?0:w.line>8&&C.line>8?C.line-w.line:w.line-C.line}),m.forEach(function(w){return Object(D.addCueToTrack)(k,w)})),m}};$.default=N},"./src/utils/discontinuities.ts":function(ne,$,M){"use strict";M.r($),M.d($,"findFirstFragWithCC",function(){return j}),M.d($,"shouldAlignOnDiscontinuities",function(){return N}),M.d($,"findDiscontinuousReferenceFrag",function(){return _}),M.d($,"adjustSlidingStart",function(){return d}),M.d($,"alignStream",function(){return f}),M.d($,"alignPDT",function(){return m}),M.d($,"alignFragmentByPDTDelta",function(){return p}),M.d($,"alignMediaPlaylistByPDT",function(){return b});var K=M("./src/polyfills/number.ts"),I=M("./src/utils/logger.ts"),D=M("./src/controller/level-helper.ts");function j(o,i){for(var s=null,l=0,E=o.length;l<E;l++){var g=o[l];if(g&&g.cc===i){s=g;break}}return s}function N(o,i,s){return!!(i.details&&(s.endCC>s.startCC||o&&o.cc<s.startCC))}function _(o,i){var s=o.fragments,l=i.fragments;if(!l.length||!s.length){I.logger.log("No fragments to align");return}var E=j(s,l[0].cc);if(!E||E&&!E.startPTS){I.logger.log("No frag in previous level to align on");return}return E}function k(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,E=s.length;l<E;l++)k(s[l],o);i.fragmentHint&&k(i.fragmentHint,o),i.alignedSliding=!0}function f(o,i,s){if(!i)return;T(o,s,i),!s.alignedSliding&&i.details&&m(s,i.details),!s.alignedSliding&&i.details&&!s.skippedSegments&&Object(D.adjustSliding)(i.details,s)}function T(o,i,s){if(N(o,s,i)){var l=_(s.details,i);l&&Object(K.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 m(o,i){if(!i.fragments.length||!o.hasProgramDateTime||!i.hasProgramDateTime)return;var s=i.fragments[0].programDateTime,l=o.fragments[0].programDateTime,E=(l-s)/1e3+i.fragments[0].start;E&&Object(K.isFiniteNumber)(E)&&(I.logger.log("Adjusting PTS using programDateTime delta "+(l-s)+"ms, sliding:"+E.toFixed(3)+" "+o.url+" "),d(E,o))}function p(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,E=s-l*1e3;o.fragments.forEach(function(g){p(g,E)}),o.fragmentHint&&p(o.fragmentHint,E),o.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ne,$,M){"use strict";M.r($);var K=M("./src/utils/ewma.ts"),I=function(){function D(N,_,k){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=k,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new K.default(N),this.fast_=new K.default(_)}var j=D.prototype;return j.update=function(_,k){var d=this.slow_,f=this.fast_;this.slow_.halfLife!==_&&(this.slow_=new K.default(_,d.getEstimate(),d.getTotalWeight())),this.fast_.halfLife!==k&&(this.fast_=new K.default(k,f.getEstimate(),f.getTotalWeight()))},j.sample=function(_,k){_=Math.max(_,this.minDelayMs_);var d=8*k,f=_/1e3,T=d/f;this.fast_.sample(f,T),this.slow_.sample(f,T)},j.canEstimate=function(){var _=this.fast_;return _&&_.getTotalWeight()>=this.minWeight_},j.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},j.destroy=function(){},D}();$.default=I},"./src/utils/ewma.ts":function(ne,$,M){"use strict";M.r($);var K=function(){function I(j,N,_){N===void 0&&(N=0),_===void 0&&(_=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=j,this.alpha_=j?Math.exp(Math.log(.5)/j):0,this.estimate_=N,this.totalWeight_=_}var D=I.prototype;return D.sample=function(N,_){var k=Math.pow(this.alpha_,N);this.estimate_=_*(1-k)+k*this.estimate_,this.totalWeight_+=N},D.getTotalWeight=function(){return this.totalWeight_},D.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=K},"./src/utils/fetch-loader.ts":function(ne,$,M){"use strict";M.r($),M.d($,"fetchSupported",function(){return p});var K=M("./src/polyfills/number.ts"),I=M("./src/loader/load-stats.ts"),D=M("./src/demux/chunk-cache.ts");function j(l,E){l.prototype=Object.create(E.prototype),l.prototype.constructor=l,f(l,E)}function N(l){var E=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 E!="undefined"){if(E.has(v))return E.get(v);E.set(v,O)}function O(){return _(v,arguments,T(this).constructor)}return O.prototype=Object.create(v.prototype,{constructor:{value:O,enumerable:!1,writable:!0,configurable:!0}}),f(O,v)},N(l)}function _(l,E,g){return k()?_=Reflect.construct:_=function(O,w,C){var y=[null];y.push.apply(y,w);var c=Function.bind.apply(O,y),u=new c;return C&&f(u,C.prototype),u},_.apply(null,arguments)}function k(){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,E){return f=Object.setPrototypeOf||function(v,O){return v.__proto__=O,v},f(l,E)}function T(l){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(g){return g.__proto__||Object.getPrototypeOf(g)},T(l)}function m(){return m=Object.assign||function(l){for(var E=1;E<arguments.length;E++){var g=arguments[E];for(var v in g)Object.prototype.hasOwnProperty.call(g,v)&&(l[v]=g[v])}return l},m.apply(this,arguments)}function p(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(l){}return!1}var b=function(){function l(g){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=g.fetchSetup||i,this.controller=new self.AbortController,this.stats=new I.LoadStats}var E=l.prototype;return E.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},E.abortInternal=function(){var v=this.response;(!v||!v.ok)&&(this.stats.aborted=!0,this.controller.abort())},E.abort=function(){var v;this.abortInternal(),(v=this.callbacks)!==null&&v!==void 0&&v.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},E.load=function(v,O,w){var C=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=w.onProgress,L=v.responseType==="arraybuffer",S=L?"byteLength":"length";this.context=v,this.config=O,this.callbacks=w,this.request=this.fetchSetup(v,c),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){C.abortInternal(),w.onTimeout(y,v,C.response)},O.timeout),self.fetch(this.request).then(function(A){if(C.response=C.loader=A,!A.ok){var P=A.status,W=A.statusText;throw new s(W||"fetch, bad network response",P,A)}return y.loading.first=Math.max(self.performance.now(),y.loading.start),y.total=parseInt(A.headers.get("Content-Length")||"0"),u&&Object(K.isFiniteNumber)(O.highWaterMark)?C.loadProgressively(A,y,v,O.highWaterMark,u):L?A.arrayBuffer():A.text()}).then(function(A){var P=C.response;self.clearTimeout(C.requestTimeout),y.loading.end=Math.max(self.performance.now(),y.loading.first),y.loaded=y.total=A[S];var W={url:P.url,data:A};u&&!Object(K.isFiniteNumber)(O.highWaterMark)&&u(y,v,A,P),w.onSuccess(W,y,v,P)}).catch(function(A){if(self.clearTimeout(C.requestTimeout),y.aborted)return;var P=A.code||0;w.onError({code:P,text:A.message},v,A.details)})},E.getCacheAge=function(){var v=null;if(this.response){var O=this.response.headers.get("age");v=O?parseFloat(O):null}return v},E.loadProgressively=function(v,O,w,C,y){C===void 0&&(C=0);var c=new D.default,u=v.body.getReader(),L=function S(){return u.read().then(function(A){if(A.done)return c.dataLength&&y(O,w,c.flush(),v),Promise.resolve(new ArrayBuffer(0));var P=A.value,W=P.length;return O.loaded+=W,W<C||c.dataLength?(c.push(P),c.dataLength>=C&&y(O,w,c.flush(),v)):y(O,w,P,v),S()}).catch(function(){return Promise.reject()})};return L()},l}();function o(l,E){var g={method:"GET",mode:"cors",credentials:"same-origin",signal:E,headers:new self.Headers(m({},l.headers))};return l.rangeEnd&&g.headers.set("Range","bytes="+l.rangeStart+"-"+String(l.rangeEnd-1)),g}function i(l,E){return new self.Request(l.url,E)}var s=function(l){j(E,l);function E(g,v,O){var w;return w=l.call(this,g)||this,w.code=void 0,w.details=void 0,w.code=v,w.details=O,w}return E}(N(Error));$.default=b},"./src/utils/imsc1-ttml-parser.ts":function(ne,$,M){"use strict";M.r($),M.d($,"IMSC1_CODEC",function(){return d}),M.d($,"parseIMSC1",function(){return p});var K=M("./src/utils/mp4-tools.ts"),I=M("./src/utils/vttparser.ts"),D=M("./src/utils/vttcue.ts"),j=M("./src/demux/id3.ts"),N=M("./src/utils/timescale-conversion.ts"),_=M("./src/utils/webvtt-parser.ts");function k(){return k=Object.assign||function(C){for(var y=1;y<arguments.length;y++){var c=arguments[y];for(var u in c)Object.prototype.hasOwnProperty.call(c,u)&&(C[u]=c[u])}return C},k.apply(this,arguments)}var d="stpp.ttml.im1t",f=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,T=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,m={left:"start",center:"center",right:"end",start:"start",end:"end"};function p(C,y,c,u,L){var S=Object(K.findBox)(new Uint8Array(C),["mdat"]);if(S.length===0){L(new Error("Could not parse IMSC1 mdat"));return}var A=S[0],P=Object(j.utf8ArrayToStr)(new Uint8Array(C,A.start,A.end-A.start)),W=Object(N.toTimescaleFromScale)(y,1,c);try{u(b(P,W))}catch(V){L(V)}}function b(C,y){var c=new DOMParser,u=c.parseFromString(C,"text/xml"),L=u.getElementsByTagName("tt")[0];if(!L)throw new Error("Invalid ttml");var S={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},A=Object.keys(S).reduce(function(z,F){return z[F]=L.getAttribute("ttp:"+F)||S[F],z},{}),P=L.getAttribute("xml:space")!=="preserve",W=i(o(L,"styling","style")),V=i(o(L,"layout","region")),Z=o(L,"body","[begin]");return[].map.call(Z,function(z){var F=s(z,P);if(!F||!z.hasAttribute("begin"))return null;var te=v(z.getAttribute("begin"),A),ie=v(z.getAttribute("dur"),A),fe=v(z.getAttribute("end"),A);if(te===null)throw g(z);if(fe===null){if(ie===null)throw g(z);fe=te+ie}var ye=new D.default(te-y,fe-y,F);ye.id=Object(_.generateCueId)(ye.startTime,ye.endTime,ye.text);var _e=V[z.getAttribute("region")],Le=W[z.getAttribute("style")];ye.position=10,ye.size=80;var Ae=l(_e,Le),ke=Ae.textAlign;if(ke){var De=m[ke];De&&(ye.lineAlign=De),ye.align=ke}return k(ye,Ae),ye}).filter(function(z){return z!==null})}function o(C,y,c){var u=C.getElementsByTagName(y)[0];return u?[].slice.call(u.querySelectorAll(c)):[]}function i(C){return C.reduce(function(y,c){var u=c.getAttribute("xml:id");return u&&(y[u]=c),y},{})}function s(C,y){return[].slice.call(C.childNodes).reduce(function(c,u,L){var S;return u.nodeName==="br"&&L?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(C,y){var c="http://www.w3.org/ns/ttml#styling",u=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return u.reduce(function(L,S){var A=E(y,c,S)||E(C,c,S);return A&&(L[S]=A),L},{})}function E(C,y,c){return C.hasAttributeNS(y,c)?C.getAttributeNS(y,c):null}function g(C){return new Error("Could not parse ttml timestamp "+C)}function v(C,y){if(!C)return null;var c=Object(I.parseTimeStamp)(C);return c===null&&(f.test(C)?c=O(C,y):T.test(C)&&(c=w(C,y))),c}function O(C,y){var c=f.exec(C),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 w(C,y){var c=T.exec(C),u=Number(c[1]),L=c[2];switch(L){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(ne,$,M){"use strict";M.r($),M.d($,"enableLogs",function(){return _}),M.d($,"logger",function(){return k});var K=function(){},I={trace:K,debug:K,log:K,warn:K,info:K,error:K},D=I;function j(d){var f=self.console[d];return f?f.bind(self.console,"["+d+"] >"):K}function N(d){for(var f=arguments.length,T=new Array(f>1?f-1:0),m=1;m<f;m++)T[m-1]=arguments[m];T.forEach(function(p){D[p]=d[p]?d[p].bind(d):j(p)})}function _(d){if(self.console&&d===!0||typeof d=="object"){N(d,"debug","log","info","warn","error");try{D.log()}catch(f){D=I}}else D=I}var k=D},"./src/utils/mediakeys-helper.ts":function(ne,$,M){"use strict";M.r($),M.d($,"KeySystems",function(){return K}),M.d($,"requestMediaKeySystemAccess",function(){return I});var K;(function(D){D.WIDEVINE="com.widevine.alpha",D.PLAYREADY="com.microsoft.playready"})(K||(K={}));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(ne,$,M){"use strict";M.r($),M.d($,"getMediaSource",function(){return K});function K(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ne,$,M){"use strict";M.r($),M.d($,"bin2str",function(){return N}),M.d($,"readUint16",function(){return _}),M.d($,"readUint32",function(){return k}),M.d($,"writeUint32",function(){return d}),M.d($,"findBox",function(){return f}),M.d($,"parseSegmentIndex",function(){return T}),M.d($,"parseInitSegment",function(){return m}),M.d($,"getStartDTS",function(){return p}),M.d($,"getDuration",function(){return b}),M.d($,"computeRawDurationFromSamples",function(){return o}),M.d($,"offsetStartDTS",function(){return i}),M.d($,"segmentValidRange",function(){return s}),M.d($,"appendUint8Array",function(){return l});var K=M("./src/utils/typed-array.ts"),I=M("./src/loader/fragment.ts"),D=Math.pow(2,32)-1,j=[].push;function N(E){return String.fromCharCode.apply(null,E)}function _(E,g){"data"in E&&(g+=E.start,E=E.data);var v=E[g]<<8|E[g+1];return v<0?65536+v:v}function k(E,g){"data"in E&&(g+=E.start,E=E.data);var v=E[g]<<24|E[g+1]<<16|E[g+2]<<8|E[g+3];return v<0?4294967296+v:v}function d(E,g,v){"data"in E&&(g+=E.start,E=E.data),E[g]=v>>24,E[g+1]=v>>16&255,E[g+2]=v>>8&255,E[g+3]=v&255}function f(E,g){var v=[];if(!g.length)return v;var O,w,C;"data"in E?(O=E.data,w=E.start,C=E.end):(O=E,w=0,C=O.byteLength);for(var y=w;y<C;){var c=k(O,y),u=N(O.subarray(y+4,y+8)),L=c>1?y+c:C;if(u===g[0])if(g.length===1)v.push({data:O,start:y+8,end:L});else{var S=f({data:O,start:y+8,end:L},g.slice(1));S.length&&j.apply(v,S)}y=L}return v}function T(E){var g=f(E,["moov"]),v=g[0],O=v?v.end:null,w=f(E,["sidx"]);if(!w||!w[0])return null;var C=[],y=w[0],c=y.data[0],u=c===0?8:16,L=k(y,u);u+=4;var S=0,A=0;c===0?u+=8:u+=16,u+=2;var P=y.end+A,W=_(y,u);u+=2;for(var V=0;V<W;V++){var Z=u,z=k(y,Z);Z+=4;var F=z&2147483647,te=(z&2147483648)>>>31;if(te===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ie=k(y,Z);Z+=4,C.push({referenceSize:F,subsegmentDuration:ie,info:{duration:ie/L,start:P,end:P+F-1}}),P+=F,Z+=4,u=Z}return{earliestPresentationTime:S,timescale:L,version:c,referencesCount:W,references:C,moovEndOffset:O}}function m(E){for(var g=[],v=f(E,["moov","trak"]),O=0;O<v.length;O++){var w=v[O],C=f(w,["tkhd"])[0];if(C){var y=C.data[C.start],c=y===0?12:20,u=k(C,c),L=f(w,["mdia","mdhd"])[0];if(L){y=L.data[L.start],c=y===0?12:20;var S=k(L,c),A=f(w,["mdia","hdlr"])[0];if(A){var P=N(A.data.subarray(A.start+8,A.start+12)),W={soun:I.ElementaryStreamTypes.AUDIO,vide:I.ElementaryStreamTypes.VIDEO}[P];if(W){var V=f(w,["mdia","minf","stbl","stsd"])[0],Z=void 0;V&&(Z=N(V.data.subarray(V.start+12,V.start+16))),g[u]={timescale:S,type:W},g[W]={timescale:S,id:u,codec:Z}}}}}}var z=f(E,["moov","mvex","trex"]);return z.forEach(function(F){var te=k(F,4),ie=g[te];ie&&(ie.default={duration:k(F,12),flags:k(F,20)})}),g}function p(E,g){return f(g,["moof","traf"]).reduce(function(v,O){var w=f(O,["tfdt"])[0],C=w.data[w.start],y=f(O,["tfhd"]).reduce(function(c,u){var L=k(u,4),S=E[L];if(S){var A=k(w,4);C===1&&(A*=Math.pow(2,32),A+=k(w,8));var P=S.timescale||9e4,W=A/P;if(isFinite(W)&&(c===null||W<c))return W}return c},null);return y!==null&&isFinite(y)&&(v===null||y<v)?y:v},null)||0}function b(E,g){for(var v=0,O=0,w=0,C=f(E,["moof","traf"]),y=0;y<C.length;y++){var c=C[y],u=f(c,["tfhd"])[0],L=k(u,4),S=g[L];if(!S)continue;var A=S.default,P=k(u,0)|(A==null?void 0:A.flags),W=A==null?void 0:A.duration;P&8&&(P&2?W=k(u,12):W=k(u,8));for(var V=S.timescale||9e4,Z=f(c,["trun"]),z=0;z<Z.length;z++){if(W){var F=k(Z[z],4);v=W*F}else v=o(Z[z]);S.type===I.ElementaryStreamTypes.VIDEO?O+=v/V:S.type===I.ElementaryStreamTypes.AUDIO&&(w+=v/V)}}if(O===0&&w===0){var te=T(E);if(te!=null&&te.references)return te.references.reduce(function(ie,fe){return ie+fe.info.duration||0},0)}return O||w}function o(E){var g=k(E,0),v=8;g&1&&(v+=4),g&4&&(v+=4);for(var O=0,w=k(E,4),C=0;C<w;C++){if(g&256){var y=k(E,v);O+=y,v+=4}g&512&&(v+=4),g&1024&&(v+=4),g&2048&&(v+=4)}return O}function i(E,g,v){f(g,["moof","traf"]).forEach(function(O){f(O,["tfhd"]).forEach(function(w){var C=k(w,4),y=E[C];if(!y)return;var c=y.timescale||9e4;f(O,["tfdt"]).forEach(function(u){var L=u.data[u.start],S=k(u,4);if(L===0)d(u,4,S-v*c);else{S*=Math.pow(2,32),S+=k(u,8),S-=v*c,S=Math.max(S,0);var A=Math.floor(S/(D+1)),P=Math.floor(S%(D+1));d(u,4,A),d(u,8,P)}})})})}function s(E){var g={valid:null,remainder:null},v=f(E,["moof"]);if(v){if(v.length<2)return g.remainder=E,g}else return g;var O=v[v.length-1];return g.valid=Object(K.sliceUint8)(E,0,O.start-8),g.remainder=Object(K.sliceUint8)(E,O.start-8),g}function l(E,g){var v=new Uint8Array(E.length+g.length);return v.set(E),v.set(g,E.length),v}},"./src/utils/output-filter.ts":function(ne,$,M){"use strict";M.r($),M.d($,"default",function(){return K});var K=function(){function I(j,N){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=j,this.trackName=N}var D=I.prototype;return D.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},D.newCue=function(N,_,k){(this.startTime===null||this.startTime>N)&&(this.startTime=N),this.endTime=_,this.screen=k,this.timelineController.createCaptionsTrack(this.trackName)},D.reset=function(){this.cueRanges=[]},I}()},"./src/utils/texttrack-utils.ts":function(ne,$,M){"use strict";M.r($),M.d($,"sendAddTrackEvent",function(){return I}),M.d($,"addCueToTrack",function(){return D}),M.d($,"clearCurrentCues",function(){return j}),M.d($,"removeCuesInRange",function(){return N}),M.d($,"getCuesInRange",function(){return k});var K=M("./src/utils/logger.ts");function I(d,f){var T;try{T=new Event("addtrack")}catch(m){T=document.createEvent("Event"),T.initEvent("addtrack",!1,!1)}T.track=d,f.dispatchEvent(T)}function D(d,f){var T=d.mode;if(T==="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(p){K.logger.debug("[texttrack-utils]: "+p);var m=new self.TextTrackCue(f.startTime,f.endTime,f.text);m.id=f.id,d.addCue(m)}T==="disabled"&&(d.mode=T)}function j(d){var f=d.mode;if(f==="disabled"&&(d.mode="hidden"),d.cues)for(var T=d.cues.length;T--;)d.removeCue(d.cues[T]);f==="disabled"&&(d.mode=f)}function N(d,f,T){var m=d.mode;if(m==="disabled"&&(d.mode="hidden"),d.cues&&d.cues.length>0)for(var p=k(d.cues,f,T),b=0;b<p.length;b++)d.removeCue(p[b]);m==="disabled"&&(d.mode=m)}function _(d,f){if(f<d[0].startTime)return 0;var T=d.length-1;if(f>d[T].endTime)return-1;for(var m=0,p=T;m<=p;){var b=Math.floor((p+m)/2);if(f<d[b].startTime)p=b-1;else if(f>d[b].startTime&&m<T)m=b+1;else return b}return d[m].startTime-f<f-d[p].startTime?m:p}function k(d,f,T){var m=[],p=_(d,f);if(p>-1)for(var b=p,o=d.length;b<o;b++){var i=d[b];if(i.startTime>=f&&i.endTime<=T)m.push(i);else if(i.startTime>T)return m}return m}},"./src/utils/time-ranges.ts":function(ne,$,M){"use strict";M.r($);var K={toString:function(D){for(var j="",N=D.length,_=0;_<N;_++)j+="["+D.start(_).toFixed(3)+","+D.end(_).toFixed(3)+"]";return j}};$.default=K},"./src/utils/timescale-conversion.ts":function(ne,$,M){"use strict";M.r($),M.d($,"toTimescaleFromBase",function(){return I}),M.d($,"toTimescaleFromScale",function(){return D}),M.d($,"toMsFromMpegTsClock",function(){return j}),M.d($,"toMpegTsClockFromTimescale",function(){return N});var K=9e4;function I(_,k,d,f){d===void 0&&(d=1),f===void 0&&(f=!1);var T=_*k*d;return f?Math.round(T):T}function D(_,k,d,f){return d===void 0&&(d=1),f===void 0&&(f=!1),I(_,k,1/d,f)}function j(_,k){return k===void 0&&(k=!1),I(_,1e3,1/K,k)}function N(_,k){return k===void 0&&(k=1),I(_,K,1/k)}},"./src/utils/typed-array.ts":function(ne,$,M){"use strict";M.r($),M.d($,"sliceUint8",function(){return K});function K(I,D,j){return Uint8Array.prototype.slice?I.slice(D,j):new Uint8Array(Array.prototype.slice.call(I,D,j))}},"./src/utils/vttcue.ts":function(ne,$,M){"use strict";M.r($),$.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var K=["","lr","rl"],I=["start","middle","end","left","right"];function D(d,f){if(typeof f!="string")return!1;if(!Array.isArray(d))return!1;var T=f.toLowerCase();return~d.indexOf(T)?T:!1}function j(d){return D(K,d)}function N(d){return D(I,d)}function _(d){for(var f=arguments.length,T=new Array(f>1?f-1:0),m=1;m<f;m++)T[m-1]=arguments[m];for(var p=1;p<arguments.length;p++){var b=arguments[p];for(var o in b)d[o]=b[o]}return d}function k(d,f,T){var m=this,p={enumerable:!0};m.hasBeenReset=!1;var b="",o=!1,i=d,s=f,l=T,E=null,g="",v=!0,O="auto",w="start",C=50,y="middle",c=50,u="middle";Object.defineProperty(m,"id",_({},p,{get:function(){return b},set:function(S){b=""+S}})),Object.defineProperty(m,"pauseOnExit",_({},p,{get:function(){return o},set:function(S){o=!!S}})),Object.defineProperty(m,"startTime",_({},p,{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(m,"endTime",_({},p,{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(m,"text",_({},p,{get:function(){return l},set:function(S){l=""+S,this.hasBeenReset=!0}})),Object.defineProperty(m,"region",_({},p,{get:function(){return E},set:function(S){E=S,this.hasBeenReset=!0}})),Object.defineProperty(m,"vertical",_({},p,{get:function(){return g},set:function(S){var A=j(S);if(A===!1)throw new SyntaxError("An invalid or illegal string was specified.");g=A,this.hasBeenReset=!0}})),Object.defineProperty(m,"snapToLines",_({},p,{get:function(){return v},set:function(S){v=!!S,this.hasBeenReset=!0}})),Object.defineProperty(m,"line",_({},p,{get:function(){return O},set:function(S){if(typeof S!="number"&&S!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");O=S,this.hasBeenReset=!0}})),Object.defineProperty(m,"lineAlign",_({},p,{get:function(){return w},set:function(S){var A=N(S);if(!A)throw new SyntaxError("An invalid or illegal string was specified.");w=A,this.hasBeenReset=!0}})),Object.defineProperty(m,"position",_({},p,{get:function(){return C},set:function(S){if(S<0||S>100)throw new Error("Position must be between 0 and 100.");C=S,this.hasBeenReset=!0}})),Object.defineProperty(m,"positionAlign",_({},p,{get:function(){return y},set:function(S){var A=N(S);if(!A)throw new SyntaxError("An invalid or illegal string was specified.");y=A,this.hasBeenReset=!0}})),Object.defineProperty(m,"size",_({},p,{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(m,"align",_({},p,{get:function(){return u},set:function(S){var A=N(S);if(!A)throw new SyntaxError("An invalid or illegal string was specified.");u=A,this.hasBeenReset=!0}})),m.displayState=void 0}return k.prototype.getCueAsHTML=function(){var d=self.WebVTT;return d.convertCueToDOMTree(self,this.text)},k}()},"./src/utils/vttparser.ts":function(ne,$,M){"use strict";M.r($),M.d($,"parseTimeStamp",function(){return D}),M.d($,"fixLineBreaks",function(){return f}),M.d($,"VTTParser",function(){return T});var K=M("./src/utils/vttcue.ts"),I=function(){function m(){}var p=m.prototype;return p.decode=function(o,i){if(!o)return"";if(typeof o!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(o))},m}();function D(m){function p(o,i,s,l){return(o|0)*3600+(i|0)*60+(s|0)+parseFloat(l||0)}var b=m.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return b?parseFloat(b[2])>59?p(b[2],b[3],0,b[4]):p(b[1],b[2],b[3],b[4]):null}var j=function(){function m(){this.values=Object.create(null)}var p=m.prototype;return p.set=function(o,i){!this.get(o)&&i!==""&&(this.values[o]=i)},p.get=function(o,i,s){return s?this.has(o)?this.values[o]:i[s]:this.has(o)?this.values[o]:i},p.has=function(o){return o in this.values},p.alt=function(o,i,s){for(var l=0;l<s.length;++l)if(i===s[l]){this.set(o,i);break}},p.integer=function(o,i){/^-?\d+$/.test(i)&&this.set(o,parseInt(i,10))},p.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},m}();function N(m,p,b,o){var i=o?m.split(o):[m];for(var s in i){if(typeof i[s]!="string")continue;var l=i[s].split(b);if(l.length!==2)continue;var E=l[0],g=l[1];p(E,g)}}var _=new K.default(0,0,""),k=_.align==="middle"?"middle":"center";function d(m,p,b){var o=m;function i(){var E=D(m);if(E===null)throw new Error("Malformed timestamp: "+o);return m=m.replace(/^[^\sa-zA-Z-]+/,""),E}function s(E,g){var v=new j;N(E,function(C,y){var c;switch(C){case"region":for(var u=b.length-1;u>=0;u--)if(b[u].id===y){v.set(C,b[u].region);break}break;case"vertical":v.alt(C,y,["rl","lr"]);break;case"line":c=y.split(","),v.integer(C,c[0]),v.percent(C,c[0])&&v.set("snapToLines",!1),v.alt(C,c[0],["auto"]),c.length===2&&v.alt("lineAlign",c[1],["start",k,"end"]);break;case"position":c=y.split(","),v.percent(C,c[0]),c.length===2&&v.alt("positionAlign",c[1],["start",k,"end","line-left","line-right","auto"]);break;case"size":v.percent(C,y);break;case"align":v.alt(C,y,["start",k,"end","left","right"]);break}},/:/,/\s/),g.region=v.get("region",null),g.vertical=v.get("vertical","");var O=v.get("line","auto");O==="auto"&&_.line===-1&&(O=-1),g.line=O,g.lineAlign=v.get("lineAlign","start"),g.snapToLines=v.get("snapToLines",!0),g.size=v.get("size",100),g.align=v.get("align",k);var w=v.get("position","auto");w==="auto"&&_.position===50&&(w=g.align==="start"||g.align==="left"?0:g.align==="end"||g.align==="right"?100:50),g.position=w}function l(){m=m.replace(/^\s+/,"")}if(l(),p.startTime=i(),l(),m.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+o);m=m.substr(3),l(),p.endTime=i(),l(),s(m,p)}function f(m){return m.replace(/<br(?: \/)?>/gi,`
|
|
`)}var T=function(){function m(){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 p=m.prototype;return p.parse=function(o){var i=this;o&&(i.buffer+=i.decoder.decode(o,{stream:!0}));function s(){var w=i.buffer,C=0;for(w=f(w);C<w.length&&w[C]!=="\r"&&w[C]!==`
|
|
`;)++C;var y=w.substr(0,C);return w[C]==="\r"&&++C,w[C]===`
|
|
`&&++C,i.buffer=w.substr(C),y}function l(w){N(w,function(C,y){},/:/)}try{var E="";if(i.state==="INITIAL"){if(!/\r\n|\n/.test(i.buffer))return this;E=s();var g=E.match(/^()?WEBVTT([ \t].*)?$/);if(!g||!g[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:E=s();switch(i.state){case"HEADER":/:/.test(E)?l(E):E||(i.state="ID");continue;case"NOTE":E||(i.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(E)){i.state="NOTE";break}if(!E)continue;if(i.cue=new K.default(0,0,""),i.state="CUE",E.indexOf("-->")===-1){i.cue.id=E;continue}case"CUE":if(!i.cue){i.state="BADCUE";continue}try{d(E,i.cue,i.regionList)}catch(w){i.cue=null,i.state="BADCUE";continue}i.state="CUETEXT";continue;case"CUETEXT":{var O=E.indexOf("-->")!==-1;if(!E||O&&(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+=E}continue;case"BADCUE":E||(i.state="ID")}}}catch(w){i.state==="CUETEXT"&&i.cue&&i.oncue&&i.oncue(i.cue),i.cue=null,i.state=i.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},p.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},m}()},"./src/utils/webvtt-parser.ts":function(ne,$,M){"use strict";M.r($),M.d($,"generateCueId",function(){return T}),M.d($,"parseWebVTT",function(){return p});var K=M("./src/polyfills/number.ts"),I=M("./src/utils/vttparser.ts"),D=M("./src/demux/id3.ts"),j=M("./src/utils/timescale-conversion.ts"),N=M("./src/remux/mp4-remuxer.ts"),_=/\r\n|\n\r|\n|\r/g,k=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)),E=o.length>9?parseInt(o.substr(0,o.indexOf(":"))):0;if(!Object(K.isFiniteNumber)(i)||!Object(K.isFiniteNumber)(s)||!Object(K.isFiniteNumber)(l)||!Object(K.isFiniteNumber)(E))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+o);return i+=1e3*s,i+=60*1e3*l,i+=60*60*1e3*E,i},f=function(o){for(var i=5381,s=o.length;s;)i=i*33^o.charCodeAt(--s);return(i>>>0).toString()};function T(b,o,i){return f(b.toString())+f(o.toString())+f(i)}var m=function(o,i,s){var l=o[i],E=o[l.prevCC];if(!E||!E.new&&l.new){o.ccOffset=o.presentationOffset=l.start,l.new=!1;return}for(;(g=E)!==null&&g!==void 0&&g.new;){var g;o.ccOffset+=l.start-E.start,l.new=!1,l=E,E=o[l.prevCC]}o.presentationOffset=s};function p(b,o,i,s,l,E,g,v){var O=new I.VTTParser,w=Object(D.utf8ArrayToStr)(new Uint8Array(b)).trim().replace(_,`
|
|
`).split(`
|
|
`),C=[],y=Object(j.toMpegTsClockFromTimescale)(o,i),c="00:00.000",u=0,L=0,S,A=!0,P=!1;O.oncue=function(W){var V=s[l],Z=s.ccOffset,z=(u-y)/9e4;if(V!=null&&V.new&&(L!==void 0?Z=s.ccOffset=V.start:m(s,l,z)),z&&(Z=z-s.presentationOffset),P){var F=W.endTime-W.startTime,te=Object(N.normalizePts)((W.startTime+Z-L)*9e4,E*9e4)/9e4;W.startTime=te,W.endTime=te+F}var ie=W.text.trim();W.text=decodeURIComponent(encodeURIComponent(ie)),W.id||(W.id=T(W.startTime,W.endTime,ie)),W.endTime>0&&C.push(W)},O.onparsingerror=function(W){S=W},O.onflush=function(){if(S){v(S);return}g(C)},w.forEach(function(W){if(A)if(k(W,"X-TIMESTAMP-MAP=")){A=!1,P=!0,W.substr(16).split(",").forEach(function(V){k(V,"LOCAL:")?c=V.substr(6):k(V,"MPEGTS:")&&(u=parseInt(V.substr(7)))});try{L=d(c)/1e3}catch(V){P=!1,S=V}return}else W===""&&(A=!1);O.parse(W+`
|
|
`)}),O.flush()}},"./src/utils/xhr-loader.ts":function(ne,$,M){"use strict";M.r($);var K=M("./src/utils/logger.ts"),I=M("./src/loader/load-stats.ts"),D=/^age:\s*[\d.]+\s*$/m,j=function(){function N(k){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=k?k.xhrSetup:null,this.stats=new I.LoadStats,this.retryDelay=0}var _=N.prototype;return _.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},_.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()))},_.abort=function(){var d;this.abortInternal(),(d=this.callbacks)!==null&&d!==void 0&&d.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},_.load=function(d,f,T){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=T,this.retryDelay=f.retryDelay,this.loadInternal()},_.loadInternal=function(){var d=this.config,f=this.context;if(!d)return;var T=this.loader=new self.XMLHttpRequest,m=this.stats;m.loading.first=0,m.loaded=0;var p=this.xhrSetup;try{if(p)try{p(T,f.url)}catch(i){T.open("GET",f.url,!0),p(T,f.url)}T.readyState||T.open("GET",f.url,!0);var b=this.context.headers;if(b)for(var o in b)T.setRequestHeader(o,b[o])}catch(i){this.callbacks.onError({code:T.status,text:i.message},f,T);return}f.rangeEnd&&T.setRequestHeader("Range","bytes="+f.rangeStart+"-"+(f.rangeEnd-1)),T.onreadystatechange=this.readystatechange.bind(this),T.onprogress=this.loadprogress.bind(this),T.responseType=f.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),d.timeout),T.send()},_.readystatechange=function(){var d=this.context,f=this.loader,T=this.stats;if(!d||!f)return;var m=f.readyState,p=this.config;if(T.aborted)return;if(m>=2)if(self.clearTimeout(this.requestTimeout),T.loading.first===0&&(T.loading.first=Math.max(self.performance.now(),T.loading.start)),m===4){f.onreadystatechange=null,f.onprogress=null;var b=f.status;if(b>=200&&b<300){T.loading.end=Math.max(self.performance.now(),T.loading.first);var o,i;if(d.responseType==="arraybuffer"?(o=f.response,i=o.byteLength):(o=f.responseText,i=o.length),T.loaded=T.total=i,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(T,d,o,f),!this.callbacks)return;var l={url:f.responseURL,data:o};this.callbacks.onSuccess(l,T,d,f)}else T.retry>=p.maxRetry||b>=400&&b<499?(K.logger.error(b+" while loading "+d.url),this.callbacks.onError({code:b,text:f.statusText},d,f)):(K.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,p.maxRetryDelay),T.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),p.timeout)},_.loadtimeout=function(){K.logger.warn("timeout while loading "+this.context.url);var d=this.callbacks;d&&(this.abortInternal(),d.onTimeout(this.stats,this.context,this.loader))},_.loadprogress=function(d){var f=this.stats;f.loaded=d.loaded,d.lengthComputable&&(f.total=d.total)},_.getCacheAge=function(){var d=null;if(this.loader&&D.test(this.loader.getAllResponseHeaders())){var f=this.loader.getResponseHeader("age");d=f?parseFloat(f):null}return d},N}();$.default=j}}).default})},vHTk:function(yt,Ee,Q){yt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);
|