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.
445 lines
1.2 MiB
445 lines
1.2 MiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[305,5,6,7,9,12],{"+NIl":function(Qe,Te,q){(function(oe){oe(q("VrN/"))})(function(oe){"use strict";oe.defineMode("stex",function(Y,N){"use strict";function J(h,u){h.cmdState.push(u)}function H(h){return h.cmdState.length>0?h.cmdState[h.cmdState.length-1]:null}function M(h){var u=h.cmdState.pop();u&&u.closeBracket()}function z(h){for(var u=h.cmdState,f=u.length-1;f>=0;f--){var o=u[f];if(o.name=="DEFAULT")continue;return o}return{styleIdentifier:function(){return null}}}function G(h,u,f){return function(){this.name=h,this.bracketNo=0,this.style=u,this.styles=f,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var r={};r.importmodule=G("importmodule","tag",["string","builtin"]),r.documentclass=G("documentclass","tag",["","atom"]),r.usepackage=G("usepackage","tag",["atom"]),r.begin=G("begin","tag",["atom"]),r.end=G("end","tag",["atom"]),r.label=G("label","tag",["atom"]),r.ref=G("ref","tag",["atom"]),r.eqref=G("eqref","tag",["atom"]),r.cite=G("cite","tag",["atom"]),r.bibitem=G("bibitem","tag",["atom"]),r.Bibitem=G("Bibitem","tag",["atom"]),r.RBibitem=G("RBibitem","tag",["atom"]),r.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function O(h,u){h.f=u}function v(h,u){var f;if(h.match(/^\\[a-zA-Z@]+/)){var o=h.current().slice(1);return f=r.hasOwnProperty(o)?r[o]:r.DEFAULT,f=new f,J(u,f),O(u,p),f.style}if(h.match(/^\\[$&%#{}_]/))return"tag";if(h.match(/^\\[,;!\/\\]/))return"tag";if(h.match("\\["))return O(u,function(s,a){return m(s,a,"\\]")}),"keyword";if(h.match("\\("))return O(u,function(s,a){return m(s,a,"\\)")}),"keyword";if(h.match("$$"))return O(u,function(s,a){return m(s,a,"$$")}),"keyword";if(h.match("$"))return O(u,function(s,a){return m(s,a,"$")}),"keyword";var l=h.next();if(l=="%")return h.skipToEnd(),"comment";if(l=="}"||l=="]"){if(f=H(u),f)f.closeBracket(l),O(u,p);else return"error";return"bracket"}else return l=="{"||l=="["?(f=r.DEFAULT,f=new f,J(u,f),"bracket"):/\d/.test(l)?(h.eatWhile(/[\w.%]/),"atom"):(h.eatWhile(/[\w\-_]/),f=z(u),f.name=="begin"&&(f.argument=h.current()),f.styleIdentifier())}function m(h,u,f){if(h.eatSpace())return null;if(f&&h.match(f))return O(u,v),"keyword";if(h.match(/^\\[a-zA-Z@]+/))return"tag";if(h.match(/^[a-zA-Z]+/))return"variable-2";if(h.match(/^\\[$&%#{}_]/))return"tag";if(h.match(/^\\[,;!\/]/))return"tag";if(h.match(/^[\^_&]/))return"tag";if(h.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(h.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var o=h.next();return o=="{"||o=="}"||o=="["||o=="]"||o=="("||o==")"?"bracket":o=="%"?(h.skipToEnd(),"comment"):"error"}function p(h,u){var f=h.peek(),o;return f=="{"||f=="["?(o=H(u),o.openBracket(f),h.eat(f),O(u,v),"bracket"):/[ \t\r]/.test(f)?(h.eat(f),null):(O(u,v),M(u),v(h,u))}return{startState:function(){var h=N.inMathMode?function(u,f){return m(u,f)}:v;return{cmdState:[],f:h}},copyState:function(h){return{cmdState:h.cmdState.slice(),f:h.f}},token:function(h,u){return u.f(h,u)},blankLine:function(h){h.f=v,h.cmdState.length=0},lineComment:"%"}}),oe.defineMIME("text/x-stex","stex"),oe.defineMIME("text/x-latex","stex")})},"+ua5":function(Qe,Te,q){},"/cxE":function(Qe,Te,q){"use strict";q.d(Te,"f",function(){return N}),q.d(Te,"g",function(){return J}),q.d(Te,"h",function(){return H}),q.d(Te,"e",function(){return z}),q.d(Te,"b",function(){return G}),q.d(Te,"c",function(){return r}),q.d(Te,"d",function(){return O}),q.d(Te,"a",function(){return v});class oe{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(m){setTimeout(()=>{throw m.stack?new Error(m.message+`
|
|
|
|
`+m.stack):m},0)}}emit(m){this.listeners.forEach(p=>{p(m)})}onUnexpectedError(m){this.unexpectedErrorHandler(m),this.emit(m)}onUnexpectedExternalError(m){this.unexpectedErrorHandler(m)}}const Y=new oe;function N(m){z(m)||Y.onUnexpectedError(m);return}function J(m){z(m)||Y.onUnexpectedExternalError(m);return}function H(m){if(m instanceof Error){let{name:p,message:h}=m;const u=m.stacktrace||m.stack;return{$isError:!0,name:p,message:h,stack:u}}return m}const M="Canceled";function z(m){return m instanceof Error&&m.name===M&&m.message===M}function G(){const m=new Error(M);return m.name=m.message,m}function r(m){return m?new Error(`Illegal argument: ${m}`):new Error("Illegal argument")}function O(m){return m?new Error(`Illegal state: ${m}`):new Error("Illegal state")}class v extends Error{constructor(m){super("NotSupported");m&&(this.message=m)}}},"19Vz":function(Qe,Te,q){(function(oe){oe(q("VrN/"))})(function(oe){oe.defineOption("placeholder","",function(G,r,O){var v=O&&O!=oe.Init;if(r&&!v)G.on("blur",H),G.on("change",M),G.on("swapDoc",M),oe.on(G.getInputField(),"compositionupdate",G.state.placeholderCompose=function(){J(G)}),M(G);else if(!r&&v){G.off("blur",H),G.off("change",M),G.off("swapDoc",M),oe.off(G.getInputField(),"compositionupdate",G.state.placeholderCompose),Y(G);var m=G.getWrapperElement();m.className=m.className.replace(" CodeMirror-empty","")}r&&!G.hasFocus()&&H(G)});function Y(G){G.state.placeholder&&(G.state.placeholder.parentNode.removeChild(G.state.placeholder),G.state.placeholder=null)}function N(G){Y(G);var r=G.state.placeholder=document.createElement("pre");r.style.cssText="height: 0; overflow: visible",r.style.direction=G.getOption("direction"),r.className="CodeMirror-placeholder CodeMirror-line-like";var O=G.getOption("placeholder");typeof O=="string"&&(O=document.createTextNode(O)),r.appendChild(O),G.display.lineSpace.insertBefore(r,G.display.lineSpace.firstChild)}function J(G){setTimeout(function(){var r=!1,O=G.getInputField();O.nodeName=="TEXTAREA"?r=!O.value:G.lineCount()==1&&(r=!/[^\u200b]/.test(O.querySelector(".CodeMirror-line").textContent)),r?N(G):Y(G)},20)}function H(G){z(G)&&N(G)}function M(G){var r=G.getWrapperElement(),O=z(G);r.className=r.className.replace(" CodeMirror-empty","")+(O?" CodeMirror-empty":""),O?N(G):Y(G)}function z(G){return G.lineCount()===1&&G.getLine(0)===""}})},"1eCo":function(Qe,Te,q){(function(oe){oe(q("VrN/"))})(function(oe){"use strict";var Y={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},N={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};oe.defineMode("xml",function(J,H){var M=J.indentUnit,z={},G=H.htmlMode?Y:N;for(var r in G)z[r]=G[r];for(var r in H)z[r]=H[r];var O,v;function m(d,w){function y(B){return w.tokenize=B,B(d,w)}var b=d.next();if(b=="<")return d.eat("!")?d.eat("[")?d.match("CDATA[")?y(u("atom","]]>")):null:d.match("--")?y(u("comment","-->")):d.match("DOCTYPE",!0,!0)?(d.eatWhile(/[\w\._\-]/),y(f(1))):null:d.eat("?")?(d.eatWhile(/[\w\._\-]/),w.tokenize=u("meta","?>"),"meta"):(O=d.eat("/")?"closeTag":"openTag",w.tokenize=p,"tag bracket");if(b=="&"){var j;return d.eat("#")?d.eat("x")?j=d.eatWhile(/[a-fA-F\d]/)&&d.eat(";"):j=d.eatWhile(/[\d]/)&&d.eat(";"):j=d.eatWhile(/[\w\.\-:]/)&&d.eat(";"),j?"atom":"error"}else return d.eatWhile(/[^&<]/),null}m.isInText=!0;function p(d,w){var y=d.next();if(y==">"||y=="/"&&d.eat(">"))return w.tokenize=m,O=y==">"?"endTag":"selfcloseTag","tag bracket";if(y=="=")return O="equals",null;if(y=="<"){w.tokenize=m,w.state=a,w.tagName=w.tagStart=null;var b=w.tokenize(d,w);return b?b+" tag error":"tag error"}else return/[\'\"]/.test(y)?(w.tokenize=h(y),w.stringStartCol=d.column(),w.tokenize(d,w)):(d.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function h(d){var w=function(y,b){for(;!y.eol();)if(y.next()==d){b.tokenize=p;break}return"string"};return w.isInAttribute=!0,w}function u(d,w){return function(y,b){for(;!y.eol();){if(y.match(w)){b.tokenize=m;break}y.next()}return d}}function f(d){return function(w,y){for(var b;(b=w.next())!=null;){if(b=="<")return y.tokenize=f(d+1),y.tokenize(w,y);if(b==">")if(d==1){y.tokenize=m;break}else return y.tokenize=f(d-1),y.tokenize(w,y)}return"meta"}}function o(d,w,y){this.prev=d.context,this.tagName=w,this.indent=d.indented,this.startOfLine=y,(z.doNotIndent.hasOwnProperty(w)||d.context&&d.context.noIndent)&&(this.noIndent=!0)}function l(d){d.context&&(d.context=d.context.prev)}function s(d,w){for(var y;;){if(!d.context)return;if(y=d.context.tagName,!z.contextGrabbers.hasOwnProperty(y)||!z.contextGrabbers[y].hasOwnProperty(w))return;l(d)}}function a(d,w,y){return d=="openTag"?(y.tagStart=w.column(),S):d=="closeTag"?x:a}function S(d,w,y){return d=="word"?(y.tagName=w.current(),v="tag",L):z.allowMissingTagName&&d=="endTag"?(v="tag bracket",L(d,w,y)):(v="error",S)}function x(d,w,y){if(d=="word"){var b=w.current();return y.context&&y.context.tagName!=b&&z.implicitlyClosed.hasOwnProperty(y.context.tagName)&&l(y),y.context&&y.context.tagName==b||z.matchClosing===!1?(v="tag",C):(v="tag error",D)}else return z.allowMissingTagName&&d=="endTag"?(v="tag bracket",C(d,w,y)):(v="error",D)}function C(d,w,y){return d!="endTag"?(v="error",C):(l(y),a)}function D(d,w,y){return v="error",C(d,w,y)}function L(d,w,y){if(d=="word")return v="attribute",R;if(d=="endTag"||d=="selfcloseTag"){var b=y.tagName,j=y.tagStart;return y.tagName=y.tagStart=null,d=="selfcloseTag"||z.autoSelfClosers.hasOwnProperty(b)?s(y,b):(s(y,b),y.context=new o(y,b,j==y.indented)),a}return v="error",L}function R(d,w,y){return d=="equals"?A:(z.allowMissing||(v="error"),L(d,w,y))}function A(d,w,y){return d=="string"?T:d=="word"&&z.allowUnquoted?(v="string",L):(v="error",L(d,w,y))}function T(d,w,y){return d=="string"?T:L(d,w,y)}return{startState:function(d){var w={tokenize:m,state:a,indented:d||0,tagName:null,tagStart:null,context:null};return d!=null&&(w.baseIndent=d),w},token:function(d,w){if(!w.tagName&&d.sol()&&(w.indented=d.indentation()),d.eatSpace())return null;O=null;var y=w.tokenize(d,w);return(y||O)&&y!="comment"&&(v=null,w.state=w.state(O||y,d,w),v&&(y=v=="error"?y+" error":v)),y},indent:function(d,w,y){var b=d.context;if(d.tokenize.isInAttribute)return d.tagStart==d.indented?d.stringStartCol+1:d.indented+M;if(b&&b.noIndent)return oe.Pass;if(d.tokenize!=p&&d.tokenize!=m)return y?y.match(/^(\s*)/)[0].length:0;if(d.tagName)return z.multilineTagIndentPastTag!==!1?d.tagStart+d.tagName.length+2:d.tagStart+M*(z.multilineTagIndentFactor||1);if(z.alignCDATA&&/<!\[CDATA\[/.test(w))return 0;var j=w&&/^<(\/)?([\w_:\.-]*)/.exec(w);if(j&&j[1])for(;b;)if(b.tagName==j[2]){b=b.prev;break}else if(z.implicitlyClosed.hasOwnProperty(b.tagName))b=b.prev;else break;else if(j)for(;b;){var B=z.contextGrabbers[b.tagName];if(B&&B.hasOwnProperty(j[2]))b=b.prev;else break}for(;b&&b.prev&&!b.startOfLine;)b=b.prev;return b?b.indent+M:d.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:z.htmlMode?"html":"xml",helperType:z.htmlMode?"html":"xml",skipAttribute:function(d){d.state==A&&(d.state=L)},xmlCurrentTag:function(d){return d.tagName?{name:d.tagName,close:d.type=="closeTag"}:null},xmlCurrentContext:function(d){for(var w=[],y=d.context;y;y=y.prev)y.tagName&&w.push(y.tagName);return w.reverse()}}}),oe.defineMIME("text/xml","xml"),oe.defineMIME("application/xml","xml"),oe.mimeModes.hasOwnProperty("text/html")||oe.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"24hK":function(Qe,Te,q){"use strict";q.d(Te,"a",function(){return Y});class oe{constructor(N){this.element=N,this.next=oe.Undefined,this.prev=oe.Undefined}}oe.Undefined=new oe(void 0);class Y{constructor(){this._first=oe.Undefined,this._last=oe.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===oe.Undefined}clear(){let N=this._first;for(;N!==oe.Undefined;){const J=N.next;N.prev=oe.Undefined,N.next=oe.Undefined,N=J}this._first=oe.Undefined,this._last=oe.Undefined,this._size=0}unshift(N){return this._insert(N,!1)}push(N){return this._insert(N,!0)}_insert(N,J){const H=new oe(N);if(this._first===oe.Undefined)this._first=H,this._last=H;else if(J){const z=this._last;this._last=H,H.prev=z,z.next=H}else{const z=this._first;this._first=H,H.next=z,z.prev=H}this._size+=1;let M=!1;return()=>{M||(M=!0,this._remove(H))}}shift(){if(this._first===oe.Undefined)return;{const N=this._first.element;return this._remove(this._first),N}}pop(){if(this._last===oe.Undefined)return;{const N=this._last.element;return this._remove(this._last),N}}_remove(N){if(N.prev!==oe.Undefined&&N.next!==oe.Undefined){const J=N.prev;J.next=N.next,N.next.prev=J}else N.prev===oe.Undefined&&N.next===oe.Undefined?(this._first=oe.Undefined,this._last=oe.Undefined):N.next===oe.Undefined?(this._last=this._last.prev,this._last.next=oe.Undefined):N.prev===oe.Undefined&&(this._first=this._first.next,this._first.prev=oe.Undefined);this._size-=1}*[Symbol.iterator](){let N=this._first;for(;N!==oe.Undefined;)yield N.element,N=N.next}}},"3/fG":function(Qe,Te,q){"use strict";q.d(Te,"a",function(){return Y});function oe(N,J){let H;return J.length===0?H=N:H=N.replace(/\{(\d+)\}/g,function(M,z){const G=z[0];return typeof J[G]!="undefined"?J[G]:M}),H}function Y(N,J,...H){return oe(J,H)}},"55Ip":function(Qe,Te,q){"use strict";q.d(Te,"a",function(){return s});var oe=q("Ty5D"),Y=q("dI71"),N=q("q1tI"),J=q.n(N),H=q("YS25"),M=q("17x9"),z=q.n(M),G=q("wx14"),r=q("zLVn"),O=q("9R94"),v=function(A){Object(Y.a)(T,A);function T(){for(var w,y=arguments.length,b=new Array(y),j=0;j<y;j++)b[j]=arguments[j];return w=A.call.apply(A,[this].concat(b))||this,w.history=Object(H.a)(w.props),w}var d=T.prototype;return d.render=function(){return J.a.createElement(oe.c,{history:this.history,children:this.props.children})},T}(J.a.Component),m=function(A){Object(Y.a)(T,A);function T(){for(var w,y=arguments.length,b=new Array(y),j=0;j<y;j++)b[j]=arguments[j];return w=A.call.apply(A,[this].concat(b))||this,w.history=Object(H.b)(w.props),w}var d=T.prototype;return d.render=function(){return J.a.createElement(oe.c,{history:this.history,children:this.props.children})},T}(J.a.Component),p=function(T,d){return typeof T=="function"?T(d):T},h=function(T,d){return typeof T=="string"?Object(H.c)(T,null,null,d):T},u=function(T){return T},f=J.a.forwardRef;typeof f=="undefined"&&(f=u);function o(A){return!!(A.metaKey||A.altKey||A.ctrlKey||A.shiftKey)}var l=f(function(A,T){var d=A.innerRef,w=A.navigate,y=A.onClick,b=Object(r.a)(A,["innerRef","navigate","onClick"]),j=b.target,B=Object(G.a)({},b,{onClick:function(F){try{y&&y(F)}catch(I){throw F.preventDefault(),I}!F.defaultPrevented&&F.button===0&&(!j||j==="_self")&&!o(F)&&(F.preventDefault(),w())}});return u!==f?B.ref=T||d:B.ref=d,J.a.createElement("a",B)}),s=f(function(A,T){var d=A.component,w=d===void 0?l:d,y=A.replace,b=A.to,j=A.innerRef,B=Object(r.a)(A,["component","replace","to","innerRef"]);return J.a.createElement(oe.e.Consumer,null,function(E){E||Object(O.a)(!1);var F=E.history,I=h(p(b,E.location),E.location),g=I?F.createHref(I):"",W=Object(G.a)({},B,{href:g,navigate:function(){var le=p(b,E.location),de=y?F.replace:F.push;de(le)}});return u!==f?W.ref=T||j:W.innerRef=j,J.a.createElement(w,W)})});if(!1)var a,S;var x=function(T){return T},C=J.a.forwardRef;typeof C=="undefined"&&(C=x);function D(){for(var A=arguments.length,T=new Array(A),d=0;d<A;d++)T[d]=arguments[d];return T.filter(function(w){return w}).join(" ")}var L=C(function(A,T){var d=A["aria-current"],w=d===void 0?"page":d,y=A.activeClassName,b=y===void 0?"active":y,j=A.activeStyle,B=A.className,E=A.exact,F=A.isActive,I=A.location,g=A.sensitive,W=A.strict,$=A.style,le=A.to,de=A.innerRef,Ce=Object(r.a)(A,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return J.a.createElement(oe.e.Consumer,null,function(be){be||Object(O.a)(!1);var Ae=I||be.location,Se=h(p(le,Ae),Ae),Re=Se.pathname,ve=Re&&Re.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),X=ve?Object(oe.f)(Ae.pathname,{path:ve,exact:E,sensitive:g,strict:W}):null,_=!!(F?F(X,Ae):X),k=_?D(B,b):B,U=_?Object(G.a)({},$,{},j):$,Q=Object(G.a)({"aria-current":_&&w||null,className:k,style:U,to:Se},Ce);return x!==C?Q.ref=T||de:Q.innerRef=de,J.a.createElement(s,Q)})});if(!1)var R},"5VLF":function(Qe,Te,q){"use strict";var oe,Y;function N(J,H,M){var z=function(G,r){return J.js_beautify(G,r)};return z.js=J.js_beautify,z.css=H.css_beautify,z.html=M.html_beautify,z.js_beautify=J.js_beautify,z.css_beautify=H.css_beautify,z.html_beautify=M.html_beautify,z}!(oe=[q("6UM0"),q("TXwP"),q("psGv")],Y=function(J,H,M){return N(J,H,M)}.apply(Te,oe),Y!==void 0&&(Qe.exports=Y))},"5Y4S":function(Qe,Te,q){"use strict";q.d(Te,"a",function(){return N});var oe=q("MNsG");const Y=oe.b.performance&&typeof oe.b.performance.now=="function";class N{constructor(J){this._highResolution=Y&&J,this._startTime=this._now(),this._stopTime=-1}static create(J=!0){return new N(J)}stop(){this._stopTime=this._now()}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}_now(){return this._highResolution?oe.b.performance.now():Date.now()}}},"6UM0":function(Qe,Te,q){var oe,Y;(function(){var N;(function(){"use strict";var H=[function(r,O,v){var m=v(1).Beautifier,p=v(5).Options;function h(u,f){var o=new m(u,f);return o.beautify()}r.exports=h,r.exports.defaultOptions=function(){return new p}},function(r,O,v){var m=v(2).Output,p=v(3).Token,h=v(4),u=v(5).Options,f=v(7).Tokenizer,o=v(7).line_starters,l=v(7).positionable_operators,s=v(7).TOKEN;function a(g,W){return W.indexOf(g)!==-1}function S(g){return g.replace(/^\s+/g,"")}function x(g){for(var W={},$=0;$<g.length;$++)W[g[$].replace(/-/g,"_")]=g[$];return W}function C(g,W){return g&&g.type===s.RESERVED&&g.text===W}function D(g,W){return g&&g.type===s.RESERVED&&a(g.text,W)}var L=["case","return","do","if","throw","else","await","break","continue","async"],R=["before-newline","after-newline","preserve-newline"],A=x(R),T=[A.before_newline,A.preserve_newline],d={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function w(g,W){if(W.multiline_frame||W.mode===d.ForInitializer||W.mode===d.Conditional)return;g.remove_indent(W.start_line_index)}function y(g){g=g.replace(h.allLineBreaks,`
|
|
`);for(var W=[],$=g.indexOf(`
|
|
`);$!==-1;)W.push(g.substring(0,$)),g=g.substring($+1),$=g.indexOf(`
|
|
`);return g.length&&W.push(g),W}function b(g){return g===d.ArrayLiteral}function j(g){return a(g,[d.Expression,d.ForInitializer,d.Conditional])}function B(g,W){for(var $=0;$<g.length;$++){var le=g[$].trim();if(le.charAt(0)!==W)return!1}return!0}function E(g,W){for(var $=0,le=g.length,de;$<le;$++)if(de=g[$],de&&de.indexOf(W)!==0)return!1;return!0}function F(g,W){W=W||{},this._source_text=g||"",this._output=null,this._tokens=null,this._last_last_text=null,this._flags=null,this._previous_flags=null,this._flag_store=null,this._options=new u(W)}F.prototype.create_flags=function(g,W){var $=0;g&&($=g.indentation_level,!this._output.just_added_newline()&&g.line_indent_level>$&&($=g.line_indent_level));var le={mode:W,parent:g,last_token:g?g.last_token:new p(s.START_BLOCK,""),last_word:g?g.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,inline_frame:!1,if_block:!1,else_block:!1,class_start_block:!1,do_block:!1,do_while:!1,import_block:!1,in_case_statement:!1,in_case:!1,case_body:!1,case_block:!1,indentation_level:$,alignment:0,line_indent_level:g?g.line_indent_level:$,start_line_index:this._output.get_line_number(),ternary_depth:0};return le},F.prototype._reset=function(g){var W=g.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new m(this._options,W),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(d.BlockStatement);var $=new f(g,this._options);return this._tokens=$.tokenize(),g},F.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var g,W=this._reset(this._source_text),$=this._options.eol;this._options.eol==="auto"&&($=`
|
|
`,W&&h.lineBreak.test(W||"")&&($=W.match(h.lineBreak)[0]));for(var le=this._tokens.next();le;)this.handle_token(le),this._last_last_text=this._flags.last_token.text,this._flags.last_token=le,le=this._tokens.next();return g=this._output.get_code($),g},F.prototype.handle_token=function(g,W){g.type===s.START_EXPR?this.handle_start_expr(g):g.type===s.END_EXPR?this.handle_end_expr(g):g.type===s.START_BLOCK?this.handle_start_block(g):g.type===s.END_BLOCK?this.handle_end_block(g):g.type===s.WORD?this.handle_word(g):g.type===s.RESERVED?this.handle_word(g):g.type===s.SEMICOLON?this.handle_semicolon(g):g.type===s.STRING?this.handle_string(g):g.type===s.EQUALS?this.handle_equals(g):g.type===s.OPERATOR?this.handle_operator(g):g.type===s.COMMA?this.handle_comma(g):g.type===s.BLOCK_COMMENT?this.handle_block_comment(g,W):g.type===s.COMMENT?this.handle_comment(g,W):g.type===s.DOT?this.handle_dot(g):g.type===s.EOF?this.handle_eof(g):g.type===s.UNKNOWN?this.handle_unknown(g,W):this.handle_unknown(g,W)},F.prototype.handle_whitespace_and_comments=function(g,W){var $=g.newlines,le=this._options.keep_array_indentation&&b(this._flags.mode);if(g.comments_before)for(var de=g.comments_before.next();de;)this.handle_whitespace_and_comments(de,W),this.handle_token(de,W),de=g.comments_before.next();if(le)for(var Ce=0;Ce<$;Ce+=1)this.print_newline(Ce>0,W);else if(this._options.max_preserve_newlines&&$>this._options.max_preserve_newlines&&($=this._options.max_preserve_newlines),this._options.preserve_newlines&&$>1){this.print_newline(!1,W);for(var be=1;be<$;be+=1)this.print_newline(!0,W)}};var I=["async","break","continue","return","throw","yield"];F.prototype.allow_wrap_or_preserved_newline=function(g,W){if(W=W===void 0?!1:W,this._output.just_added_newline())return;var $=this._options.preserve_newlines&&g.newlines||W,le=a(this._flags.last_token.text,l)||a(g.text,l);if(le){var de=a(this._flags.last_token.text,l)&&a(this._options.operator_position,T)||a(g.text,l);$=$&&de}if($)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(D(this._flags.last_token,I))return;this._output.set_wrap_point()}},F.prototype.print_newline=function(g,W){if(!W&&(this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==s.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")))for(var $=this._tokens.peek();this._flags.mode===d.Statement&&!(this._flags.if_block&&C($,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(g)&&(this._flags.multiline_frame=!0)},F.prototype.print_token_line_indentation=function(g){this._output.just_added_newline()&&(this._options.keep_array_indentation&&g.newlines&&(g.text==="["||b(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(g.whitespace_before),this._output.space_before_token=!1):this._output.set_indent(this._flags.indentation_level,this._flags.alignment)&&(this._flags.line_indent_level=this._flags.indentation_level))},F.prototype.print_token=function(g){if(this._output.raw){this._output.add_raw_token(g);return}if(this._options.comma_first&&g.previous&&g.previous.type===s.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var W=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(W),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(g),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(g),this._output.non_breaking_space=!0,this._output.add_token(g.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},F.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},F.prototype.deindent=function(){this._flags.indentation_level>0&&(!this._flags.parent||this._flags.indentation_level>this._flags.parent.indentation_level)&&(this._flags.indentation_level-=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},F.prototype.set_mode=function(g){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,g),this._flags=this.create_flags(this._previous_flags,g),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},F.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===d.Statement&&w(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},F.prototype.start_of_object_property=function(){return this._flags.parent.mode===d.ObjectLiteral&&this._flags.mode===d.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||D(this._flags.last_token,["get","set"]))},F.prototype.start_of_statement=function(g){var W=!1;return W=W||D(this._flags.last_token,["var","let","const"])&&g.type===s.WORD,W=W||C(this._flags.last_token,"do"),W=W||!(this._flags.parent.mode===d.ObjectLiteral&&this._flags.mode===d.Statement)&&D(this._flags.last_token,I)&&!g.newlines,W=W||C(this._flags.last_token,"else")&&!(C(g,"if")&&!g.comments_before),W=W||this._flags.last_token.type===s.END_EXPR&&(this._previous_flags.mode===d.ForInitializer||this._previous_flags.mode===d.Conditional),W=W||this._flags.last_token.type===s.WORD&&this._flags.mode===d.BlockStatement&&!this._flags.in_case&&!(g.text==="--"||g.text==="++")&&this._last_last_text!=="function"&&g.type!==s.WORD&&g.type!==s.RESERVED,W=W||this._flags.mode===d.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||D(this._flags.last_token,["get","set"])),W?(this.set_mode(d.Statement),this.indent(),this.handle_whitespace_and_comments(g,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(g,D(g,["do","for","if","while"])),!0):!1},F.prototype.handle_start_expr=function(g){this.start_of_statement(g)||this.handle_whitespace_and_comments(g);var W=d.Expression;if(g.text==="["){if(this._flags.last_token.type===s.WORD||this._flags.last_token.text===")"){D(this._flags.last_token,o)&&(this._output.space_before_token=!0),this.print_token(g),this.set_mode(W),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}W=d.ArrayLiteral,b(this._flags.mode)&&((this._flags.last_token.text==="["||this._flags.last_token.text===","&&(this._last_last_text==="]"||this._last_last_text==="}"))&&(this._options.keep_array_indentation||this.print_newline())),a(this._flags.last_token.type,[s.START_EXPR,s.END_EXPR,s.WORD,s.OPERATOR,s.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===s.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,W=d.ForInitializer):a(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,W=d.Conditional):a(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&g.whitespace_before===""?this._output.space_before_token=!1:(a(this._flags.last_token.text,o)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===s.EQUALS||this._flags.last_token.type===s.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(g);else if(this._flags.last_token.type===s.WORD){this._output.space_before_token=!1;var $=this._tokens.peek(-3);if(this._options.space_after_named_function&&$){var le=this._tokens.peek(-4);D($,["async","function"])||$.text==="*"&&D(le,["async","function"])?this._output.space_before_token=!0:this._flags.mode===d.ObjectLiteral?($.text==="{"||$.text===","||$.text==="*"&&(le.text==="{"||le.text===","))&&(this._output.space_before_token=!0):this._flags.parent&&this._flags.parent.class_start_block&&(this._output.space_before_token=!0)}}else this.allow_wrap_or_preserved_newline(g);(this._flags.last_token.type===s.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(a(this._last_last_text,["function","yield"])||this._flags.mode===d.ObjectLiteral&&a(this._last_last_text,["{",","])))&&(this._output.space_before_token=this._options.space_after_anon_function)}this._flags.last_token.text===";"||this._flags.last_token.type===s.START_BLOCK?this.print_newline():(this._flags.last_token.type===s.END_EXPR||this._flags.last_token.type===s.START_EXPR||this._flags.last_token.type===s.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===s.COMMA)&&this.allow_wrap_or_preserved_newline(g,g.newlines),this.print_token(g),this.set_mode(W),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},F.prototype.handle_end_expr=function(g){for(;this._flags.mode===d.Statement;)this.restore_mode();this.handle_whitespace_and_comments(g),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(g,g.text==="]"&&b(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===s.START_EXPR&&!this._options.space_in_empty_paren?(this._output.trim(),this._output.space_before_token=!1):this._output.space_before_token=!0),this.deindent(),this.print_token(g),this.restore_mode(),w(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===d.Conditional&&(this._previous_flags.mode=d.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},F.prototype.handle_start_block=function(g){this.handle_whitespace_and_comments(g);var W=this._tokens.peek(),$=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===s.END_EXPR?(this.set_mode(d.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(d.BlockStatement):$&&(a($.text,[":",","])&&a(W.type,[s.STRING,s.WORD,s.RESERVED])||a(W.text,["get","set","..."])&&a($.type,[s.WORD,s.RESERVED]))?a(this._last_last_text,["class","interface"])&&!a($.text,[":",","])?this.set_mode(d.BlockStatement):this.set_mode(d.ObjectLiteral):this._flags.last_token.type===s.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(d.BlockStatement):a(this._flags.last_token.type,[s.EQUALS,s.START_EXPR,s.COMMA,s.OPERATOR])||D(this._flags.last_token,["return","throw","import","default"])?this.set_mode(d.ObjectLiteral):this.set_mode(d.BlockStatement),this._flags.last_token&&(D(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0));var le=!W.comments_before&&W.text==="}",de=le&&this._flags.last_word==="function"&&this._flags.last_token.type===s.END_EXPR;if(this._options.brace_preserve_inline){var Ce=0,be=null;this._flags.inline_frame=!0;do if(Ce+=1,be=this._tokens.peek(Ce-1),be.newlines){this._flags.inline_frame=!1;break}while(be.type!==s.EOF&&!(be.type===s.END_BLOCK&&be.opened===g))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&g.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==s.OPERATOR&&(de||this._flags.last_token.type===s.EQUALS||D(this._flags.last_token,L)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(b(this._previous_flags.mode)&&(this._flags.last_token.type===s.START_EXPR||this._flags.last_token.type===s.COMMA)&&((this._flags.last_token.type===s.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===s.COMMA||this._flags.last_token.type===s.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(g),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==s.OPERATOR&&this._flags.last_token.type!==s.START_EXPR&&(this._flags.last_token.type===s.START_BLOCK&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(g),this.indent(),!le&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},F.prototype.handle_end_block=function(g){for(this.handle_whitespace_and_comments(g);this._flags.mode===d.Statement;)this.restore_mode();var W=this._flags.last_token.type===s.START_BLOCK;this._flags.inline_frame&&!W?this._output.space_before_token=!0:this._options.brace_style==="expand"?W||this.print_newline():W||(b(this._flags.mode)&&this._options.keep_array_indentation?(this._options.keep_array_indentation=!1,this.print_newline(),this._options.keep_array_indentation=!0):this.print_newline()),this.restore_mode(),this.print_token(g)},F.prototype.handle_word=function(g){if(g.type===s.RESERVED){if(a(g.text,["set","get"])&&this._flags.mode!==d.ObjectLiteral)g.type=s.WORD;else if(g.text==="import"&&a(this._tokens.peek().text,["(","."]))g.type=s.WORD;else if(a(g.text,["as","from"])&&!this._flags.import_block)g.type=s.WORD;else if(this._flags.mode===d.ObjectLiteral){var W=this._tokens.peek();W.text===":"&&(g.type=s.WORD)}}if(this.start_of_statement(g)?D(this._flags.last_token,["var","let","const"])&&g.type===s.WORD&&(this._flags.declaration_statement=!0):g.newlines&&!j(this._flags.mode)&&(this._flags.last_token.type!==s.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==s.EQUALS&&(this._options.preserve_newlines||!D(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(g),this.print_newline()):this.handle_whitespace_and_comments(g),this._flags.do_block&&!this._flags.do_while)if(C(g,"while")){this._output.space_before_token=!0,this.print_token(g),this._output.space_before_token=!0,this._flags.do_while=!0;return}else this.print_newline(),this._flags.do_block=!1;if(this._flags.if_block)if(!this._flags.else_block&&C(g,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===d.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&D(g,["case","default"])){this.print_newline(),!this._flags.case_block&&(this._flags.case_body||this._options.jslint_happy)&&this.deindent(),this._flags.case_body=!1,this.print_token(g),this._flags.in_case=!0;return}if((this._flags.last_token.type===s.COMMA||this._flags.last_token.type===s.START_EXPR||this._flags.last_token.type===s.EQUALS||this._flags.last_token.type===s.OPERATOR)&&(this.start_of_object_property()||this.allow_wrap_or_preserved_newline(g)),C(g,"function")){(a(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(a(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===s.OPERATOR))&&(!this._output.just_added_blankline()&&!g.comments_before&&(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===s.RESERVED||this._flags.last_token.type===s.WORD?D(this._flags.last_token,["get","set","new","export"])||D(this._flags.last_token,I)?this._output.space_before_token=!0:C(this._flags.last_token,"default")&&this._last_last_text==="export"?this._output.space_before_token=!0:this._flags.last_token.text==="declare"?this._output.space_before_token=!0:this.print_newline():this._flags.last_token.type===s.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(j(this._flags.mode)||b(this._flags.mode))||this.print_newline(),this.print_token(g),this._flags.last_word=g.text;return}var $="NONE";if(this._flags.last_token.type===s.END_BLOCK?this._previous_flags.inline_frame?$="SPACE":D(g,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&g.newlines?$="NEWLINE":($="SPACE",this._output.space_before_token=!0):$="NEWLINE":this._flags.last_token.type===s.SEMICOLON&&this._flags.mode===d.BlockStatement?$="NEWLINE":this._flags.last_token.type===s.SEMICOLON&&j(this._flags.mode)?$="SPACE":this._flags.last_token.type===s.STRING?$="NEWLINE":this._flags.last_token.type===s.RESERVED||this._flags.last_token.type===s.WORD||this._flags.last_token.text==="*"&&(a(this._last_last_text,["function","yield"])||this._flags.mode===d.ObjectLiteral&&a(this._last_last_text,["{",","]))?$="SPACE":this._flags.last_token.type===s.START_BLOCK?this._flags.inline_frame?$="SPACE":$="NEWLINE":this._flags.last_token.type===s.END_EXPR&&(this._output.space_before_token=!0,$="NEWLINE"),D(g,o)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?$="SPACE":$="NEWLINE"),D(g,["else","catch","finally"]))if((!(this._flags.last_token.type===s.END_BLOCK&&this._previous_flags.mode===d.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&g.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var le=this._output.current_line;le.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else $==="NEWLINE"?D(this._flags.last_token,L)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&D(g,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==s.END_EXPR?(this._flags.last_token.type!==s.START_EXPR||!D(g,["var","let","const"]))&&this._flags.last_token.text!==":"&&(C(g,"if")&&C(g.previous,"else")?this._output.space_before_token=!0:this.print_newline()):D(g,o)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&b(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():$==="SPACE"&&(this._output.space_before_token=!0);g.previous&&(g.previous.type===s.WORD||g.previous.type===s.RESERVED)&&(this._output.space_before_token=!0),this.print_token(g),this._flags.last_word=g.text,g.type===s.RESERVED&&(g.text==="do"?this._flags.do_block=!0:g.text==="if"?this._flags.if_block=!0:g.text==="import"?this._flags.import_block=!0:this._flags.import_block&&C(g,"from")&&(this._flags.import_block=!1))},F.prototype.handle_semicolon=function(g){this.start_of_statement(g)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(g);for(var W=this._tokens.peek();this._flags.mode===d.Statement&&!(this._flags.if_block&&C(W,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(g)},F.prototype.handle_string=function(g){g.text.startsWith("`")&&g.newlines===0&&g.whitespace_before===""&&(g.previous.text===")"||this._flags.last_token.type===s.WORD)||(this.start_of_statement(g)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(g),this._flags.last_token.type===s.RESERVED||this._flags.last_token.type===s.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===s.COMMA||this._flags.last_token.type===s.START_EXPR||this._flags.last_token.type===s.EQUALS||this._flags.last_token.type===s.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(g):g.text.startsWith("`")&&this._flags.last_token.type===s.END_EXPR&&(g.previous.text==="]"||g.previous.text===")")&&g.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(g)},F.prototype.handle_equals=function(g){this.start_of_statement(g)||this.handle_whitespace_and_comments(g),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(g),this._output.space_before_token=!0},F.prototype.handle_comma=function(g){this.handle_whitespace_and_comments(g,!0),this.print_token(g),this._output.space_before_token=!0,this._flags.declaration_statement?(j(this._flags.parent.mode)&&(this._flags.declaration_assignment=!1),this._flags.declaration_assignment?(this._flags.declaration_assignment=!1,this.print_newline(!1,!0)):this._options.comma_first&&this.allow_wrap_or_preserved_newline(g)):this._flags.mode===d.ObjectLiteral||this._flags.mode===d.Statement&&this._flags.parent.mode===d.ObjectLiteral?(this._flags.mode===d.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(g)},F.prototype.handle_operator=function(g){var W=g.text==="*"&&(D(this._flags.last_token,["function","yield"])||a(this._flags.last_token.type,[s.START_BLOCK,s.COMMA,s.END_BLOCK,s.SEMICOLON])),$=a(g.text,["-","+"])&&(a(this._flags.last_token.type,[s.START_BLOCK,s.START_EXPR,s.EQUALS,s.OPERATOR])||a(this._flags.last_token.text,o)||this._flags.last_token.text===",");if(!this.start_of_statement(g)){var le=!W;this.handle_whitespace_and_comments(g,le)}if(g.text==="*"&&this._flags.last_token.type===s.DOT){this.print_token(g);return}if(g.text==="::"){this.print_token(g);return}if(this._flags.last_token.type===s.OPERATOR&&a(this._options.operator_position,T)&&this.allow_wrap_or_preserved_newline(g),g.text===":"&&this._flags.in_case){this.print_token(g),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==s.START_BLOCK?(this.indent(),this.print_newline(),this._flags.case_block=!1):(this._flags.case_block=!0,this._output.space_before_token=!0);return}var de=!0,Ce=!0,be=!1;if(g.text===":"?this._flags.ternary_depth===0?de=!1:(this._flags.ternary_depth-=1,be=!0):g.text==="?"&&(this._flags.ternary_depth+=1),!$&&!W&&this._options.preserve_newlines&&a(g.text,l)){var Ae=g.text===":",Se=Ae&&be,Re=Ae&&!be;switch(this._options.operator_position){case A.before_newline:this._output.space_before_token=!Re,this.print_token(g),(!Ae||Se)&&this.allow_wrap_or_preserved_newline(g),this._output.space_before_token=!0;return;case A.after_newline:this._output.space_before_token=!0,!Ae||Se?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(g):this._output.space_before_token=!1,this.print_token(g),this._output.space_before_token=!0;return;case A.preserve_newline:Re||this.allow_wrap_or_preserved_newline(g),de=!(this._output.just_added_newline()||Re),this._output.space_before_token=de,this.print_token(g),this._output.space_before_token=!0;return}}if(W){this.allow_wrap_or_preserved_newline(g),de=!1;var ve=this._tokens.peek();Ce=ve&&a(ve.type,[s.WORD,s.RESERVED])}else if(g.text==="...")this.allow_wrap_or_preserved_newline(g),de=this._flags.last_token.type===s.START_BLOCK,Ce=!1;else if(a(g.text,["--","++","!","~"])||$){if((this._flags.last_token.type===s.COMMA||this._flags.last_token.type===s.START_EXPR)&&this.allow_wrap_or_preserved_newline(g),de=!1,Ce=!1,g.newlines&&(g.text==="--"||g.text==="++"||g.text==="~")){var X=D(this._flags.last_token,L)&&g.newlines;X&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(X,!0)}this._flags.last_token.text===";"&&j(this._flags.mode)&&(de=!0),this._flags.last_token.type===s.RESERVED?de=!0:this._flags.last_token.type===s.END_EXPR?de=!(this._flags.last_token.text==="]"&&(g.text==="--"||g.text==="++")):this._flags.last_token.type===s.OPERATOR&&(de=a(g.text,["--","-","++","+"])&&a(this._flags.last_token.text,["--","-","++","+"]),a(g.text,["+","-"])&&a(this._flags.last_token.text,["--","++"])&&(Ce=!0)),(this._flags.mode===d.BlockStatement&&!this._flags.inline_frame||this._flags.mode===d.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||de,this.print_token(g),this._output.space_before_token=Ce},F.prototype.handle_block_comment=function(g,W){if(this._output.raw){this._output.add_raw_token(g),g.directives&&g.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(g.directives){this.print_newline(!1,W),this.print_token(g),g.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!h.newline.test(g.text)&&!g.newlines){this._output.space_before_token=!0,this.print_token(g),this._output.space_before_token=!0;return}else this.print_block_commment(g,W)},F.prototype.print_block_commment=function(g,W){var $=y(g.text),le,de=!1,Ce=!1,be=g.whitespace_before,Ae=be.length;if(this.print_newline(!1,W),this.print_token_line_indentation(g),this._output.add_token($[0]),this.print_newline(!1,W),$.length>1){for($=$.slice(1),de=B($,"*"),Ce=E($,be),de&&(this._flags.alignment=1),le=0;le<$.length;le++)de?(this.print_token_line_indentation(g),this._output.add_token(S($[le]))):Ce&&$[le]?(this.print_token_line_indentation(g),this._output.add_token($[le].substring(Ae))):(this._output.current_line.set_indent(-1),this._output.add_token($[le])),this.print_newline(!1,W);this._flags.alignment=0}},F.prototype.handle_comment=function(g,W){g.newlines?this.print_newline(!1,W):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(g),this.print_newline(!1,W)},F.prototype.handle_dot=function(g){this.start_of_statement(g)||this.handle_whitespace_and_comments(g,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),D(this._flags.last_token,L)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(g,this._flags.last_token.text===")"&&this._options.break_chained_methods),this._options.unindent_chained_methods&&this._output.just_added_newline()&&this.deindent(),this.print_token(g)},F.prototype.handle_unknown=function(g,W){this.print_token(g),g.text[g.text.length-1]===`
|
|
`&&this.print_newline(!1,W)},F.prototype.handle_eof=function(g){for(;this._flags.mode===d.Statement;)this.restore_mode();this.handle_whitespace_and_comments(g)},r.exports.Beautifier=F},function(r){function O(p){this.__parent=p,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}O.prototype.clone_empty=function(){var p=new O(this.__parent);return p.set_indent(this.__indent_count,this.__alignment_count),p},O.prototype.item=function(p){return p<0?this.__items[this.__items.length+p]:this.__items[p]},O.prototype.has_match=function(p){for(var h=this.__items.length-1;h>=0;h--)if(this.__items[h].match(p))return!0;return!1},O.prototype.set_indent=function(p,h){this.is_empty()&&(this.__indent_count=p||0,this.__alignment_count=h||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},O.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},O.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},O.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var p=this.__parent.current_line;return p.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),p.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),p.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,p.__items[0]===" "&&(p.__items.splice(0,1),p.__character_count-=1),!0}return!1},O.prototype.is_empty=function(){return this.__items.length===0},O.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},O.prototype.push=function(p){this.__items.push(p);var h=p.lastIndexOf(`
|
|
`);h!==-1?this.__character_count=p.length-h:this.__character_count+=p.length},O.prototype.pop=function(){var p=null;return this.is_empty()||(p=this.__items.pop(),this.__character_count-=p.length),p},O.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},O.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},O.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},O.prototype.toString=function(){var p="";return this.is_empty()?this.__parent.indent_empty_lines&&(p=this.__parent.get_indent_string(this.__indent_count)):(p=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),p+=this.__items.join("")),p};function v(p,h){this.__cache=[""],this.__indent_size=p.indent_size,this.__indent_string=p.indent_char,p.indent_with_tabs||(this.__indent_string=new Array(p.indent_size+1).join(p.indent_char)),h=h||"",p.indent_level>0&&(h=new Array(p.indent_level+1).join(this.__indent_string)),this.__base_string=h,this.__base_string_length=h.length}v.prototype.get_indent_size=function(p,h){var u=this.__base_string_length;return h=h||0,p<0&&(u=0),u+=p*this.__indent_size,u+=h,u},v.prototype.get_indent_string=function(p,h){var u=this.__base_string;return h=h||0,p<0&&(p=0,u=""),h+=p*this.__indent_size,this.__ensure_cache(h),u+=this.__cache[h],u},v.prototype.__ensure_cache=function(p){for(;p>=this.__cache.length;)this.__add_column()},v.prototype.__add_column=function(){var p=this.__cache.length,h=0,u="";this.__indent_size&&p>=this.__indent_size&&(h=Math.floor(p/this.__indent_size),p-=h*this.__indent_size,u=new Array(h+1).join(this.__indent_string)),p&&(u+=new Array(p+1).join(" ")),this.__cache.push(u)};function m(p,h){this.__indent_cache=new v(p,h),this.raw=!1,this._end_with_newline=p.end_with_newline,this.indent_size=p.indent_size,this.wrap_line_length=p.wrap_line_length,this.indent_empty_lines=p.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new O(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}m.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},m.prototype.get_line_number=function(){return this.__lines.length},m.prototype.get_indent_string=function(p,h){return this.__indent_cache.get_indent_string(p,h)},m.prototype.get_indent_size=function(p,h){return this.__indent_cache.get_indent_size(p,h)},m.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},m.prototype.add_new_line=function(p){return this.is_empty()||!p&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},m.prototype.get_code=function(p){this.trim(!0);var h=this.current_line.pop();h&&(h[h.length-1]===`
|
|
`&&(h=h.replace(/\n+$/g,"")),this.current_line.push(h)),this._end_with_newline&&this.__add_outputline();var u=this.__lines.join(`
|
|
`);return p!==`
|
|
`&&(u=u.replace(/[\n]/g,p)),u},m.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},m.prototype.set_indent=function(p,h){return p=p||0,h=h||0,this.next_line.set_indent(p,h),this.__lines.length>1?(this.current_line.set_indent(p,h),!0):(this.current_line.set_indent(),!1)},m.prototype.add_raw_token=function(p){for(var h=0;h<p.newlines;h++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(p.whitespace_before),this.current_line.push(p.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},m.prototype.add_token=function(p){this.__add_space_before_token(),this.current_line.push(p),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},m.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},m.prototype.remove_indent=function(p){for(var h=this.__lines.length;p<h;)this.__lines[p]._remove_indent(),p++;this.current_line._remove_wrap_indent()},m.prototype.trim=function(p){for(p=p===void 0?!1:p,this.current_line.trim();p&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},m.prototype.just_added_newline=function(){return this.current_line.is_empty()},m.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},m.prototype.ensure_empty_line_above=function(p,h){for(var u=this.__lines.length-2;u>=0;){var f=this.__lines[u];if(f.is_empty())break;if(f.item(0).indexOf(p)!==0&&f.item(-1)!==h){this.__lines.splice(u+1,0,new O(this)),this.previous_line=this.__lines[this.__lines.length-2];break}u--}},r.exports.Output=m},function(r){function O(v,m,p,h){this.type=v,this.text=m,this.comments_before=null,this.newlines=p||0,this.whitespace_before=h||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}r.exports.Token=O},function(r,O){var v="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",m="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",p="\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0\\u08a2-\\u08ac\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097f\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d\\u0c58\\u0c59\\u0c60\\u0c61\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d60\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f0\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19c1-\\u19c7\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2e2f\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua697\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa80-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uabc0-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc",h="\\u0300-\\u036f\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u0620-\\u0649\\u0672-\\u06d3\\u06e7-\\u06e8\\u06fb-\\u06fc\\u0730-\\u074a\\u0800-\\u0814\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0840-\\u0857\\u08e4-\\u08fe\\u0900-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962-\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09d7\\u09df-\\u09e0\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2-\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5f-\\u0b60\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c01-\\u0c03\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62-\\u0c63\\u0c66-\\u0c6f\\u0c82\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2-\\u0ce3\\u0ce6-\\u0cef\\u0d02\\u0d03\\u0d46-\\u0d48\\u0d57\\u0d62-\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e34-\\u0e3a\\u0e40-\\u0e45\\u0e50-\\u0e59\\u0eb4-\\u0eb9\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f41-\\u0f47\\u0f71-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u1029\\u1040-\\u1049\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u170e-\\u1710\\u1720-\\u1730\\u1740-\\u1750\\u1772\\u1773\\u1780-\\u17b2\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u1920-\\u192b\\u1930-\\u193b\\u1951-\\u196d\\u19b0-\\u19c0\\u19c8-\\u19c9\\u19d0-\\u19d9\\u1a00-\\u1a15\\u1a20-\\u1a53\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1b46-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c00-\\u1c22\\u1c40-\\u1c49\\u1c5b-\\u1c7d\\u1cd0-\\u1cd2\\u1d00-\\u1dbe\\u1e01-\\u1f15\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2d81-\\u2d96\\u2de0-\\u2dff\\u3021-\\u3028\\u3099\\u309a\\ua640-\\ua66d\\ua674-\\ua67d\\ua69f\\ua6f0-\\ua6f1\\ua7f8-\\ua800\\ua806\\ua80b\\ua823-\\ua827\\ua880-\\ua881\\ua8b4-\\ua8c4\\ua8d0-\\ua8d9\\ua8f3-\\ua8f7\\ua900-\\ua909\\ua926-\\ua92d\\ua930-\\ua945\\ua980-\\ua983\\ua9b3-\\ua9c0\\uaa00-\\uaa27\\uaa40-\\uaa41\\uaa4c-\\uaa4d\\uaa50-\\uaa59\\uaa7b\\uaae0-\\uaae9\\uaaf2-\\uaaf3\\uabc0-\\uabe1\\uabec\\uabed\\uabf0-\\uabf9\\ufb20-\\ufb28\\ufe00-\\ufe0f\\ufe20-\\ufe26\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f",u="(?:\\\\u[0-9a-fA-F]{4}|["+v+p+"])",f="(?:\\\\u[0-9a-fA-F]{4}|["+m+p+h+"])*";O.identifier=new RegExp(u+f,"g"),O.identifierStart=new RegExp(u),O.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+m+p+h+"])+");var o=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;O.newline=/[\n\r\u2028\u2029]/,O.lineBreak=new RegExp(`\r
|
|
|`+O.newline.source),O.allLineBreaks=new RegExp(O.lineBreak.source,"g")},function(r,O,v){var m=v(6).Options,p=["before-newline","after-newline","preserve-newline"];function h(u){m.call(this,u,"js");var f=this.raw_options.brace_style||null;f==="expand-strict"?this.raw_options.brace_style="expand":f==="collapse-preserve-inline"?this.raw_options.brace_style="collapse,preserve-inline":this.raw_options.braces_on_own_line!==void 0&&(this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse");var o=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var l=0;l<o.length;l++)o[l]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=o[l];this.unindent_chained_methods=this._get_boolean("unindent_chained_methods"),this.break_chained_methods=this._get_boolean("break_chained_methods"),this.space_in_paren=this._get_boolean("space_in_paren"),this.space_in_empty_paren=this._get_boolean("space_in_empty_paren"),this.jslint_happy=this._get_boolean("jslint_happy"),this.space_after_anon_function=this._get_boolean("space_after_anon_function"),this.space_after_named_function=this._get_boolean("space_after_named_function"),this.keep_array_indentation=this._get_boolean("keep_array_indentation"),this.space_before_conditional=this._get_boolean("space_before_conditional",!0),this.unescape_strings=this._get_boolean("unescape_strings"),this.e4x=this._get_boolean("e4x"),this.comma_first=this._get_boolean("comma_first"),this.operator_position=this._get_selection("operator_position",p),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}h.prototype=new m,r.exports.Options=h},function(r){function O(p,h){this.raw_options=v(p,h),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}O.prototype._get_array=function(p,h){var u=this.raw_options[p],f=h||[];return typeof u=="object"?u!==null&&typeof u.concat=="function"&&(f=u.concat()):typeof u=="string"&&(f=u.split(/[^a-zA-Z0-9_\/\-]+/)),f},O.prototype._get_boolean=function(p,h){var u=this.raw_options[p],f=u===void 0?!!h:!!u;return f},O.prototype._get_characters=function(p,h){var u=this.raw_options[p],f=h||"";return typeof u=="string"&&(f=u.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),f},O.prototype._get_number=function(p,h){var u=this.raw_options[p];h=parseInt(h,10),isNaN(h)&&(h=0);var f=parseInt(u,10);return isNaN(f)&&(f=h),f},O.prototype._get_selection=function(p,h,u){var f=this._get_selection_list(p,h,u);if(f.length!==1)throw new Error("Invalid Option Value: The option '"+p+`' can only be one of the following values:
|
|
`+h+`
|
|
You passed in: '`+this.raw_options[p]+"'");return f[0]},O.prototype._get_selection_list=function(p,h,u){if(!h||h.length===0)throw new Error("Selection list cannot be empty.");if(u=u||[h[0]],!this._is_valid_selection(u,h))throw new Error("Invalid Default Value!");var f=this._get_array(p,u);if(!this._is_valid_selection(f,h))throw new Error("Invalid Option Value: The option '"+p+`' can contain only the following values:
|
|
`+h+`
|
|
You passed in: '`+this.raw_options[p]+"'");return f},O.prototype._is_valid_selection=function(p,h){return p.length&&h.length&&!p.some(function(u){return h.indexOf(u)===-1})};function v(p,h){var u={};p=m(p);var f;for(f in p)f!==h&&(u[f]=p[f]);if(h&&p[h])for(f in p[h])u[f]=p[h][f];return u}function m(p){var h={},u;for(u in p){var f=u.replace(/-/g,"_");h[f]=p[u]}return h}r.exports.Options=O,r.exports.normalizeOpts=m,r.exports.mergeOpts=v},function(r,O,v){var m=v(8).InputScanner,p=v(9).Tokenizer,h=v(9).TOKEN,u=v(13).Directives,f=v(4),o=v(12).Pattern,l=v(14).TemplatablePattern;function s(B,E){return E.indexOf(B)!==-1}var a={START_EXPR:"TK_START_EXPR",END_EXPR:"TK_END_EXPR",START_BLOCK:"TK_START_BLOCK",END_BLOCK:"TK_END_BLOCK",WORD:"TK_WORD",RESERVED:"TK_RESERVED",SEMICOLON:"TK_SEMICOLON",STRING:"TK_STRING",EQUALS:"TK_EQUALS",OPERATOR:"TK_OPERATOR",COMMA:"TK_COMMA",BLOCK_COMMENT:"TK_BLOCK_COMMENT",COMMENT:"TK_COMMENT",DOT:"TK_DOT",UNKNOWN:"TK_UNKNOWN",START:h.START,RAW:h.RAW,EOF:h.EOF},S=new u(/\/\*/,/\*\//),x=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,C=/[0-9]/,D=/[^\d\.]/,L=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),R=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";R=R.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),R="\\?\\.(?!\\d) "+R,R=R.replace(/ /g,"|");var A=new RegExp(R),T="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),d=T.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),w=new RegExp("^(?:"+d.join("|")+")$"),y,b=function(B,E){p.call(this,B,E),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var F=new o(this._input),I=new l(this._input).read_options(this._options);this.__patterns={template:I,identifier:I.starting_with(f.identifier).matching(f.identifierMatch),number:F.matching(x),punct:F.matching(A),comment:F.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:F.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:F.matching(/<!--/),html_comment_end:F.matching(/-->/),include:F.starting_with(/#include/).until_after(f.lineBreak),shebang:F.starting_with(/#!/).until_after(f.lineBreak),xml:F.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[^}]+?}|!\[CDATA\[[^\]]*?\]\]|)(\s*{[^}]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{([^{}]|{[^}]+?})+?}))*\s*(\/?)\s*>/),single_quote:I.until(/['\\\n\r\u2028\u2029]/),double_quote:I.until(/["\\\n\r\u2028\u2029]/),template_text:I.until(/[`\\$]/),template_expression:I.until(/[`}\\]/)}};b.prototype=new p,b.prototype._is_comment=function(B){return B.type===a.COMMENT||B.type===a.BLOCK_COMMENT||B.type===a.UNKNOWN},b.prototype._is_opening=function(B){return B.type===a.START_BLOCK||B.type===a.START_EXPR},b.prototype._is_closing=function(B,E){return(B.type===a.END_BLOCK||B.type===a.END_EXPR)&&E&&(B.text==="]"&&E.text==="["||B.text===")"&&E.text==="("||B.text==="}"&&E.text==="{")},b.prototype._reset=function(){y=!1},b.prototype._get_next_token=function(B,E){var F=null;this._readWhitespace();var I=this._input.peek();return I===null?this._create_token(a.EOF,""):(F=F||this._read_non_javascript(I),F=F||this._read_string(I),F=F||this._read_word(B),F=F||this._read_singles(I),F=F||this._read_comment(I),F=F||this._read_regexp(I,B),F=F||this._read_xml(I,B),F=F||this._read_punctuation(),F=F||this._create_token(a.UNKNOWN,this._input.next()),F)},b.prototype._read_word=function(B){var E;if(E=this.__patterns.identifier.read(),E!=="")return E=E.replace(f.allLineBreaks,`
|
|
`),!(B.type===a.DOT||B.type===a.RESERVED&&(B.text==="set"||B.text==="get"))&&w.test(E)?(E==="in"||E==="of")&&(B.type===a.WORD||B.type===a.STRING)?this._create_token(a.OPERATOR,E):this._create_token(a.RESERVED,E):this._create_token(a.WORD,E);if(E=this.__patterns.number.read(),E!=="")return this._create_token(a.WORD,E)},b.prototype._read_singles=function(B){var E=null;return B==="("||B==="["?E=this._create_token(a.START_EXPR,B):B===")"||B==="]"?E=this._create_token(a.END_EXPR,B):B==="{"?E=this._create_token(a.START_BLOCK,B):B==="}"?E=this._create_token(a.END_BLOCK,B):B===";"?E=this._create_token(a.SEMICOLON,B):B==="."&&D.test(this._input.peek(1))?E=this._create_token(a.DOT,B):B===","&&(E=this._create_token(a.COMMA,B)),E&&this._input.next(),E},b.prototype._read_punctuation=function(){var B=this.__patterns.punct.read();if(B!=="")return B==="="?this._create_token(a.EQUALS,B):B==="?."?this._create_token(a.DOT,B):this._create_token(a.OPERATOR,B)},b.prototype._read_non_javascript=function(B){var E="";if(B==="#"){if(this._is_first_token()&&(E=this.__patterns.shebang.read(),E))return this._create_token(a.UNKNOWN,E.trim()+`
|
|
`);if(E=this.__patterns.include.read(),E)return this._create_token(a.UNKNOWN,E.trim()+`
|
|
`);B=this._input.next();var F="#";if(this._input.hasNext()&&this._input.testChar(C)){do B=this._input.next(),F+=B;while(this._input.hasNext()&&B!=="#"&&B!=="=");return B==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(F+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(F+="{}",this._input.next(),this._input.next())),this._create_token(a.WORD,F)}this._input.back()}else if(B==="<"&&this._is_first_token()){if(E=this.__patterns.html_comment_start.read(),E){for(;this._input.hasNext()&&!this._input.testChar(f.newline);)E+=this._input.next();return y=!0,this._create_token(a.COMMENT,E)}}else if(y&&B==="-"&&(E=this.__patterns.html_comment_end.read(),E))return y=!1,this._create_token(a.COMMENT,E);return null},b.prototype._read_comment=function(B){var E=null;if(B==="/"){var F="";if(this._input.peek(1)==="*"){F=this.__patterns.block_comment.read();var I=S.get_directives(F);I&&I.ignore==="start"&&(F+=S.readIgnored(this._input)),F=F.replace(f.allLineBreaks,`
|
|
`),E=this._create_token(a.BLOCK_COMMENT,F),E.directives=I}else this._input.peek(1)==="/"&&(F=this.__patterns.comment.read(),E=this._create_token(a.COMMENT,F))}return E},b.prototype._read_string=function(B){if(B==="`"||B==="'"||B==='"'){var E=this._input.next();return this.has_char_escapes=!1,B==="`"?E+=this._read_string_recursive("`",!0,"${"):E+=this._read_string_recursive(B),this.has_char_escapes&&this._options.unescape_strings&&(E=j(E)),this._input.peek()===B&&(E+=this._input.next()),E=E.replace(f.allLineBreaks,`
|
|
`),this._create_token(a.STRING,E)}return null},b.prototype._allow_regexp_or_xml=function(B){return B.type===a.RESERVED&&s(B.text,["return","case","throw","else","do","typeof","yield"])||B.type===a.END_EXPR&&B.text===")"&&B.opened.previous.type===a.RESERVED&&s(B.opened.previous.text,["if","while","for"])||s(B.type,[a.COMMENT,a.START_EXPR,a.START_BLOCK,a.START,a.END_BLOCK,a.OPERATOR,a.EQUALS,a.EOF,a.SEMICOLON,a.COMMA])},b.prototype._read_regexp=function(B,E){if(B==="/"&&this._allow_regexp_or_xml(E)){for(var F=this._input.next(),I=!1,g=!1;this._input.hasNext()&&(I||g||this._input.peek()!==B)&&!this._input.testChar(f.newline);)F+=this._input.peek(),I?I=!1:(I=this._input.peek()==="\\",this._input.peek()==="["?g=!0:this._input.peek()==="]"&&(g=!1)),this._input.next();return this._input.peek()===B&&(F+=this._input.next(),F+=this._input.read(f.identifier)),this._create_token(a.STRING,F)}return null},b.prototype._read_xml=function(B,E){if(this._options.e4x&&B==="<"&&this._allow_regexp_or_xml(E)){var F="",I=this.__patterns.xml.read_match();if(I){for(var g=I[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),W=g.indexOf("{")===0,$=0;I;){var le=!!I[1],de=I[2],Ce=!!I[I.length-1]||de.slice(0,8)==="![CDATA[";if(!Ce&&(de===g||W&&de.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(le?--$:++$),F+=I[0],$<=0)break;I=this.__patterns.xml.read_match()}return I||(F+=this._input.match(/[\s\S]*/g)[0]),F=F.replace(f.allLineBreaks,`
|
|
`),this._create_token(a.STRING,F)}}return null};function j(B){for(var E="",F=0,I=new m(B),g=null;I.hasNext();)if(g=I.match(/([\s]|[^\\]|\\\\)+/g),g&&(E+=g[0]),I.peek()==="\\"){if(I.next(),I.peek()==="x")g=I.match(/x([0-9A-Fa-f]{2})/g);else if(I.peek()==="u")g=I.match(/u([0-9A-Fa-f]{4})/g);else{E+="\\",I.hasNext()&&(E+=I.next());continue}if(!g)return B;if(F=parseInt(g[1],16),F>126&&F<=255&&g[0].indexOf("x")===0)return B;if(F>=0&&F<32){E+="\\"+g[0];continue}else F===34||F===39||F===92?E+="\\"+String.fromCharCode(F):E+=String.fromCharCode(F)}return E}b.prototype._read_string_recursive=function(B,E,F){var I,g;B==="'"?g=this.__patterns.single_quote:B==='"'?g=this.__patterns.double_quote:B==="`"?g=this.__patterns.template_text:B==="}"&&(g=this.__patterns.template_expression);for(var W=g.read(),$="";this._input.hasNext();){if($=this._input.next(),$===B||!E&&f.newline.test($)){this._input.back();break}else $==="\\"&&this._input.hasNext()?(I=this._input.peek(),I==="x"||I==="u"?this.has_char_escapes=!0:I==="\r"&&this._input.peek(1)===`
|
|
`&&this._input.next(),$+=this._input.next()):F&&(F==="${"&&$==="$"&&this._input.peek()==="{"&&($+=this._input.next()),F===$&&(B==="`"?$+=this._read_string_recursive("}",E,"`"):$+=this._read_string_recursive("`",E,"${"),this._input.hasNext()&&($+=this._input.next())));$+=g.read(),W+=$}return W},r.exports.Tokenizer=b,r.exports.TOKEN=a,r.exports.positionable_operators=L.slice(),r.exports.line_starters=T.slice()},function(r){var O=RegExp.prototype.hasOwnProperty("sticky");function v(m){this.__input=m||"",this.__input_length=this.__input.length,this.__position=0}v.prototype.restart=function(){this.__position=0},v.prototype.back=function(){this.__position>0&&(this.__position-=1)},v.prototype.hasNext=function(){return this.__position<this.__input_length},v.prototype.next=function(){var m=null;return this.hasNext()&&(m=this.__input.charAt(this.__position),this.__position+=1),m},v.prototype.peek=function(m){var p=null;return m=m||0,m+=this.__position,m>=0&&m<this.__input_length&&(p=this.__input.charAt(m)),p},v.prototype.__match=function(m,p){m.lastIndex=p;var h=m.exec(this.__input);return h&&!(O&&m.sticky)&&(h.index!==p&&(h=null)),h},v.prototype.test=function(m,p){return p=p||0,p+=this.__position,p>=0&&p<this.__input_length?!!this.__match(m,p):!1},v.prototype.testChar=function(m,p){var h=this.peek(p);return m.lastIndex=0,h!==null&&m.test(h)},v.prototype.match=function(m){var p=this.__match(m,this.__position);return p?this.__position+=p[0].length:p=null,p},v.prototype.read=function(m,p,h){var u="",f;return m&&(f=this.match(m),f&&(u+=f[0])),p&&(f||!m)&&(u+=this.readUntil(p,h)),u},v.prototype.readUntil=function(m,p){var h="",u=this.__position;m.lastIndex=this.__position;var f=m.exec(this.__input);return f?(u=f.index,p&&(u+=f[0].length)):u=this.__input_length,h=this.__input.substring(this.__position,u),this.__position=u,h},v.prototype.readUntilAfter=function(m){return this.readUntil(m,!0)},v.prototype.get_regexp=function(m,p){var h=null,u="g";return p&&O&&(u="y"),typeof m=="string"&&m!==""?h=new RegExp(m,u):m&&(h=new RegExp(m.source,u)),h},v.prototype.get_literal_regexp=function(m){return RegExp(m.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},v.prototype.peekUntilAfter=function(m){var p=this.__position,h=this.readUntilAfter(m);return this.__position=p,h},v.prototype.lookBack=function(m){var p=this.__position-1;return p>=m.length&&this.__input.substring(p-m.length,p).toLowerCase()===m},r.exports.InputScanner=v},function(r,O,v){var m=v(8).InputScanner,p=v(3).Token,h=v(10).TokenStream,u=v(11).WhitespacePattern,f={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},o=function(l,s){this._input=new m(l),this._options=s||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new u(this._input)};o.prototype.tokenize=function(){this._input.restart(),this.__tokens=new h,this._reset();for(var l,s=new p(f.START,""),a=null,S=[],x=new h;s.type!==f.EOF;){for(l=this._get_next_token(s,a);this._is_comment(l);)x.add(l),l=this._get_next_token(s,a);x.isEmpty()||(l.comments_before=x,x=new h),l.parent=a,this._is_opening(l)?(S.push(a),a=l):a&&this._is_closing(l,a)&&(l.opened=a,a.closed=l,a=S.pop(),l.parent=a),l.previous=s,s.next=l,this.__tokens.add(l),s=l}return this.__tokens},o.prototype._is_first_token=function(){return this.__tokens.isEmpty()},o.prototype._reset=function(){},o.prototype._get_next_token=function(l,s){this._readWhitespace();var a=this._input.read(/.+/g);return a?this._create_token(f.RAW,a):this._create_token(f.EOF,"")},o.prototype._is_comment=function(l){return!1},o.prototype._is_opening=function(l){return!1},o.prototype._is_closing=function(l,s){return!1},o.prototype._create_token=function(l,s){var a=new p(l,s,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return a},o.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},r.exports.Tokenizer=o,r.exports.TOKEN=f},function(r){function O(v){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=v}O.prototype.restart=function(){this.__position=0},O.prototype.isEmpty=function(){return this.__tokens_length===0},O.prototype.hasNext=function(){return this.__position<this.__tokens_length},O.prototype.next=function(){var v=null;return this.hasNext()&&(v=this.__tokens[this.__position],this.__position+=1),v},O.prototype.peek=function(v){var m=null;return v=v||0,v+=this.__position,v>=0&&v<this.__tokens_length&&(m=this.__tokens[v]),m},O.prototype.add=function(v){this.__parent_token&&(v.parent=this.__parent_token),this.__tokens.push(v),this.__tokens_length+=1},r.exports.TokenStream=O},function(r,O,v){var m=v(12).Pattern;function p(h,u){m.call(this,h,u),u?this._line_regexp=this._input.get_regexp(u._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}p.prototype=new m,p.prototype.__set_whitespace_patterns=function(h,u){h+="\\t ",u+="\\n\\r",this._match_pattern=this._input.get_regexp("["+h+u+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+u+"]")},p.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var h=this._input.read(this._match_pattern);if(h===" ")this.whitespace_before_token=" ";else if(h){var u=this.__split(this._newline_regexp,h);this.newline_count=u.length-1,this.whitespace_before_token=u[this.newline_count]}return h},p.prototype.matching=function(h,u){var f=this._create();return f.__set_whitespace_patterns(h,u),f._update(),f},p.prototype._create=function(){return new p(this._input,this)},p.prototype.__split=function(h,u){h.lastIndex=0;for(var f=0,o=[],l=h.exec(u);l;)o.push(u.substring(f,l.index)),f=l.index+l[0].length,l=h.exec(u);return f<u.length?o.push(u.substring(f,u.length)):o.push(""),o},r.exports.WhitespacePattern=p},function(r){function O(v,m){this._input=v,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,m&&(this._starting_pattern=this._input.get_regexp(m._starting_pattern,!0),this._match_pattern=this._input.get_regexp(m._match_pattern,!0),this._until_pattern=this._input.get_regexp(m._until_pattern),this._until_after=m._until_after)}O.prototype.read=function(){var v=this._input.read(this._starting_pattern);return(!this._starting_pattern||v)&&(v+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),v},O.prototype.read_match=function(){return this._input.match(this._match_pattern)},O.prototype.until_after=function(v){var m=this._create();return m._until_after=!0,m._until_pattern=this._input.get_regexp(v),m._update(),m},O.prototype.until=function(v){var m=this._create();return m._until_after=!1,m._until_pattern=this._input.get_regexp(v),m._update(),m},O.prototype.starting_with=function(v){var m=this._create();return m._starting_pattern=this._input.get_regexp(v,!0),m._update(),m},O.prototype.matching=function(v){var m=this._create();return m._match_pattern=this._input.get_regexp(v,!0),m._update(),m},O.prototype._create=function(){return new O(this._input,this)},O.prototype._update=function(){},r.exports.Pattern=O},function(r){function O(v,m){v=typeof v=="string"?v:v.source,m=typeof m=="string"?m:m.source,this.__directives_block_pattern=new RegExp(v+/ beautify( \w+[:]\w+)+ /.source+m,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(v+/\sbeautify\signore:end\s/.source+m,"g")}O.prototype.get_directives=function(v){if(!v.match(this.__directives_block_pattern))return null;var m={};this.__directive_pattern.lastIndex=0;for(var p=this.__directive_pattern.exec(v);p;)m[p[1]]=p[2],p=this.__directive_pattern.exec(v);return m},O.prototype.readIgnored=function(v){return v.readUntilAfter(this.__directives_end_ignore_pattern)},r.exports.Directives=O},function(r,O,v){var m=v(12).Pattern,p={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function h(u,f){m.call(this,u,f),this.__template_pattern=null,this._disabled=Object.assign({},p),this._excluded=Object.assign({},p),f&&(this.__template_pattern=this._input.get_regexp(f.__template_pattern),this._excluded=Object.assign(this._excluded,f._excluded),this._disabled=Object.assign(this._disabled,f._disabled));var o=new m(u);this.__patterns={handlebars_comment:o.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:o.starting_with(/{{{/).until_after(/}}}/),handlebars:o.starting_with(/{{/).until_after(/}}/),php:o.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:o.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:o.starting_with(/{%/).until_after(/%}/),django_value:o.starting_with(/{{/).until_after(/}}/),django_comment:o.starting_with(/{#/).until_after(/#}/),smarty:o.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:o.starting_with(/{\*/).until_after(/\*}/),smarty_literal:o.starting_with(/{literal}/).until_after(/{\/literal}/)}}h.prototype=new m,h.prototype._create=function(){return new h(this._input,this)},h.prototype._update=function(){this.__set_templated_pattern()},h.prototype.disable=function(u){var f=this._create();return f._disabled[u]=!0,f._update(),f},h.prototype.read_options=function(u){var f=this._create();for(var o in p)f._disabled[o]=u.templating.indexOf(o)===-1;return f._update(),f},h.prototype.exclude=function(u){var f=this._create();return f._excluded[u]=!0,f._update(),f},h.prototype.read=function(){var u="";this._match_pattern?u=this._input.read(this._starting_pattern):u=this._input.read(this._starting_pattern,this.__template_pattern);for(var f=this._read_template();f;)this._match_pattern?f+=this._input.read(this._match_pattern):f+=this._input.readUntil(this.__template_pattern),u+=f,f=this._read_template();return this._until_after&&(u+=this._input.readUntilAfter(this._until_pattern)),u},h.prototype.__set_templated_pattern=function(){var u=[];this._disabled.php||u.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||u.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||u.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(u.push(this.__patterns.django._starting_pattern.source),u.push(this.__patterns.django_value._starting_pattern.source),u.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||u.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&u.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+u.join("|")+")")},h.prototype._read_template=function(){var u="",f=this._input.peek();if(f==="<"){var o=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&o==="?"&&(u=u||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&o==="%"&&(u=u||this.__patterns.erb.read())}else f==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(u=u||this.__patterns.handlebars_comment.read(),u=u||this.__patterns.handlebars_unescaped.read(),u=u||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(u=u||this.__patterns.django_value.read()),this._excluded.django||(u=u||this.__patterns.django_comment.read(),u=u||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(u=u||this.__patterns.smarty_comment.read(),u=u||this.__patterns.smarty_literal.read(),u=u||this.__patterns.smarty.read()));return u},r.exports.TemplatablePattern=h}],M={};function z(r){var O=M[r];if(O!==void 0)return O.exports;var v=M[r]={exports:{}};return H[r](v,v.exports,z),v.exports}var G=z(0);N=G})();var J=N;!(oe=[],Y=function(){return{js_beautify:J}}.apply(Te,oe),Y!==void 0&&(Qe.exports=Y))})()},"746U":function(Qe,Te,q){"use strict";q.d(Te,"f",function(){return oe}),q.d(Te,"l",function(){return Y}),q.d(Te,"k",function(){return N}),q.d(Te,"j",function(){return J}),q.d(Te,"g",function(){return H}),q.d(Te,"m",function(){return M}),q.d(Te,"h",function(){return z}),q.d(Te,"n",function(){return G}),q.d(Te,"c",function(){return r}),q.d(Te,"a",function(){return O}),q.d(Te,"i",function(){return v}),q.d(Te,"o",function(){return m}),q.d(Te,"e",function(){return u}),q.d(Te,"d",function(){return f}),q.d(Te,"p",function(){return o}),q.d(Te,"b",function(){return l});function oe(s){return Array.isArray(s)}function Y(s){return typeof s=="string"}function N(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)&&!(s instanceof RegExp)&&!(s instanceof Date)}function J(s){return typeof s=="number"&&!isNaN(s)}function H(s){return s===!0||s===!1}function M(s){return typeof s=="undefined"}function z(s){return!G(s)}function G(s){return M(s)||s===null}function r(s,a){if(!s)throw new Error(a?`Unexpected type, expected '${a}'`:"Unexpected type")}function O(s){if(G(s))throw new Error("Assertion Failed: argument is undefined or null");return s}function v(s){return typeof s=="function"}function m(s,a){const S=Math.min(s.length,a.length);for(let x=0;x<S;x++)p(s[x],a[x])}function p(s,a){if(Y(a)){if(typeof s!==a)throw new Error(`argument does not match constraint: typeof ${a}`)}else if(v(a)){try{if(s instanceof a)return}catch(S){}if(!G(s)&&s.constructor===a)return;if(a.length===1&&a.call(void 0,s)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function h(s){let a=[],S=Object.getPrototypeOf(s);for(;Object.prototype!==S;)a=a.concat(Object.getOwnPropertyNames(S)),S=Object.getPrototypeOf(S);return a}function u(s){const a=[];for(const S of h(s))typeof s[S]=="function"&&a.push(S);return a}function f(s,a){const S=C=>function(){const D=Array.prototype.slice.call(arguments,0);return a(C,D)};let x={};for(const C of s)x[C]=S(C);return x}function o(s){return s===null?void 0:s}function l(s,a="Unreachable"){throw new Error(a)}},"7Cbv":function(Qe,Te,q){"use strict";var oe=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),Y=new Uint8Array(16);function N(){if(!oe)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return oe(Y)}var J=/^(?:[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 H(p){return typeof p=="string"&&J.test(p)}for(var M=H,z=[],G=0;G<256;++G)z.push((G+256).toString(16).substr(1));function r(p){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,u=(z[p[h+0]]+z[p[h+1]]+z[p[h+2]]+z[p[h+3]]+"-"+z[p[h+4]]+z[p[h+5]]+"-"+z[p[h+6]]+z[p[h+7]]+"-"+z[p[h+8]]+z[p[h+9]]+"-"+z[p[h+10]]+z[p[h+11]]+z[p[h+12]]+z[p[h+13]]+z[p[h+14]]+z[p[h+15]]).toLowerCase();if(!M(u))throw TypeError("Stringified UUID is invalid");return u}var O=r;function v(p,h,u){p=p||{};var f=p.random||(p.rng||N)();if(f[6]=f[6]&15|64,f[8]=f[8]&63|128,h){u=u||0;for(var o=0;o<16;++o)h[u+o]=f[o];return h}return O(f)}var m=Te.a=v},"7ahc":function(Qe,Te,q){"use strict";q.d(Te,"a",function(){return S});var oe=q("k1fw"),Y=q("0Owb"),N=q("+L6B"),J=q("2/Rp"),H=q("y8nQ"),M=q("Vl3Y"),z=q("tJVT"),G=q("OaEy"),r=q("2fM7"),O=q("q1tI"),v=q.n(O),m=q("VrN/"),p=q.n(m),h=q("p77/"),u=q.n(h),f=q("c5Ni"),o=q.n(f),l=r.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},a={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};Te.b=function(x){var C=x.callback,D=x.onCancel,L=Object(O.useState)("python"),R=Object(z.a)(L,2),A=R[0],T=R[1];function d(y){T(a[y][1])}function w(y){C(y)}return v.a.createElement(M.a,Object(Y.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:w}),v.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},v.a.createElement(r.a,{onChange:d},Object.keys(a).map(function(y){return v.a.createElement(l,{key:y,value:y},a[y][0])}))),v.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},v.a.createElement(S,{mode:A})),v.a.createElement("div",{className:"flex-container flex-end"},v.a.createElement(J.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),v.a.createElement(J.a,{type:"ghost",onClick:D},"\u53D6\u6D88")))};function S(x){var C=x.value,D=x.onChange,L=x.mode,R=x.options,A=R===void 0?{}:R,T=Object(O.useRef)(),d=Object(O.useState)(),w=Object(z.a)(d,2),y=w[0],b=w[1];return Object(O.useEffect)(function(){if(y){function j(B){var E=B.getValue();D&&D(E)}return y.on("change",j),function(){y.off("change",j)}}},[y,D]),Object(O.useEffect)(function(){y&&y.setOption("mode",L)},[y,L]),Object(O.useEffect)(function(){y&&((C!==y.getValue()||C==="")&&setTimeout(function(){y.setValue(C||" ")},300))},[y,C]),Object(O.useEffect)(function(){if(T.current&&!y){var j=p.a.fromTextArea(T.current,Object(oe.a)({mode:L,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},A));b(j)}},[T.current,y]),v.a.createElement("div",{className:"my-codemirror-container"},v.a.createElement("textarea",{ref:T}))}},"8EBN":function(Qe,Te,q){(function(oe){oe(q("VrN/"))})(function(oe){"use strict";oe.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 Y=0;Y<oe.modeInfo.length;Y++){var N=oe.modeInfo[Y];N.mimes&&(N.mime=N.mimes[0])}oe.findModeByMIME=function(J){J=J.toLowerCase();for(var H=0;H<oe.modeInfo.length;H++){var M=oe.modeInfo[H];if(M.mime==J)return M;if(M.mimes){for(var z=0;z<M.mimes.length;z++)if(M.mimes[z]==J)return M}}if(/\+xml$/.test(J))return oe.findModeByMIME("application/xml");if(/\+json$/.test(J))return oe.findModeByMIME("application/json")},oe.findModeByExtension=function(J){J=J.toLowerCase();for(var H=0;H<oe.modeInfo.length;H++){var M=oe.modeInfo[H];if(M.ext){for(var z=0;z<M.ext.length;z++)if(M.ext[z]==J)return M}}},oe.findModeByFileName=function(J){for(var H=0;H<oe.modeInfo.length;H++){var M=oe.modeInfo[H];if(M.file&&M.file.test(J))return M}var z=J.lastIndexOf("."),G=z>-1&&J.substring(z+1,J.length);if(G)return oe.findModeByExtension(G)},oe.findModeByName=function(J){J=J.toLowerCase();for(var H=0;H<oe.modeInfo.length;H++){var M=oe.modeInfo[H];if(M.name.toLowerCase()==J)return M;if(M.alias){for(var z=0;z<M.alias.length;z++)if(M.alias[z].toLowerCase()==J)return M}}}})},"8HAY":function(Qe,Te,q){"use strict";q.d(Te,"a",function(){return H}),q.d(Te,"b",function(){return M}),q.d(Te,"d",function(){return z}),q.d(Te,"e",function(){return G}),q.d(Te,"c",function(){return r});var oe=q("MI8n"),Y=q("pmY6"),N=q("3/fG"),J=function(O,v,m,p){function h(u){return u instanceof m?u:new m(function(f){f(u)})}return new(m||(m=Promise))(function(u,f){function o(a){try{s(p.next(a))}catch(S){f(S)}}function l(a){try{s(p.throw(a))}catch(S){f(S)}}function s(a){a.done?u(a.value):h(a.value).then(o,l)}s((p=p.apply(O,v||[])).next())})};class H extends Y.a{constructor(O,v="",m="",p=!0,h){super();this._onDidChange=this._register(new oe.b),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=O,this._label=v,this._cssClass=m,this._enabled=p,this._actionCallback=h}get id(){return this._id}get label(){return this._label}set label(O){this._setLabel(O)}_setLabel(O){this._label!==O&&(this._label=O,this._onDidChange.fire({label:O}))}get tooltip(){return this._tooltip||""}set tooltip(O){this._setTooltip(O)}_setTooltip(O){this._tooltip!==O&&(this._tooltip=O,this._onDidChange.fire({tooltip:O}))}get class(){return this._cssClass}set class(O){this._setClass(O)}_setClass(O){this._cssClass!==O&&(this._cssClass=O,this._onDidChange.fire({class:O}))}get enabled(){return this._enabled}set enabled(O){this._setEnabled(O)}_setEnabled(O){this._enabled!==O&&(this._enabled=O,this._onDidChange.fire({enabled:O}))}get checked(){return this._checked}set checked(O){this._setChecked(O)}_setChecked(O){this._checked!==O&&(this._checked=O,this._onDidChange.fire({checked:O}))}run(O,v){return J(this,void 0,void 0,function*(){this._actionCallback&&(yield this._actionCallback(O))})}}class M extends Y.a{constructor(){super(...arguments);this._onBeforeRun=this._register(new oe.b),this.onBeforeRun=this._onBeforeRun.event,this._onDidRun=this._register(new oe.b),this.onDidRun=this._onDidRun.event}run(O,v){return J(this,void 0,void 0,function*(){if(!O.enabled)return;this._onBeforeRun.fire({action:O});let m;try{yield this.runAction(O,v)}catch(p){m=p}this._onDidRun.fire({action:O,error:m})})}runAction(O,v){return J(this,void 0,void 0,function*(){yield O.run(v)})}}class z extends H{constructor(O){super(z.ID,O,O?"separator text":"separator");this.checked=!1,this.enabled=!1}}z.ID="vs.actions.separator";class G{constructor(O,v,m,p){this.tooltip="",this.enabled=!0,this.checked=!1,this.id=O,this.label=v,this.class=p,this._actions=m}get actions(){return this._actions}dispose(){}run(){return J(this,void 0,void 0,function*(){})}}class r extends H{constructor(){super(r.ID,N.a("submenu.empty","(empty)"),void 0,!1)}}r.ID="vs.actions.empty"},"8hTe":function(Qe,Te,q){Qe.exports={button:"button___1wy9m"}},"9Bee":function(Qe,Te,q){"use strict";var oe=q("DYRE"),Y=q("zeV3"),N=q("+L6B"),J=q("2/Rp"),H=q("k1fw"),M=q("9og8"),z=q("tJVT"),G=q("WmNS"),r=q.n(G),O=q("q1tI"),v=q.n(O),m=q("vg9a"),p=q("DlQD"),h=q.n(p),u=q("rUJ1");function f(he,ee){var re=he.match(/^(\s+)(?:```)/);if(re===null)return ee;var ae=re[1];return ee.split(`
|
|
`).map(function(fe){var ie=fe.match(/^\s+/);if(ie===null)return fe;var se=Object(z.a)(ie,1),pe=se[0];return pe.length>=ae.length?fe.slice(ae.length):fe}).join(`
|
|
`)}var o=[],l=["<ul>"],s=new h.a.Renderer,a=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function S(){o.length=0,l=["<ul>"]}var x={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function C(he,ee,re,ae){if(ee>=he.length||he[ee].level<=re)return ee;var fe=he[ee];ae.push("<li><a href='#"+fe.anchor+"'>"+fe.text+"</a>"),ee++;var ie=[];return ee=C(he,ee,fe.level,ie),ie.length>0&&(ae.push("<ul>"),ie.forEach(function(se){ae.push(se)}),ae.push("</ul>")),ae.push("</li>"),ee=C(he,ee,re,ae),ee}function D(){return C(o,0,0,l),l.push("</ul>"),l.join("")}var L={heading:function(ee){var re=a.exec(ee);if(re)return{type:"heading",raw:re[0],depth:re[1].length,text:re[2]}},fences:function(ee){var re=this.rules.block.fences.exec(ee);if(re){var ae=re[0],fe=f(ae,re[3]||""),ie=re[2]?re[2].trim():re[2];if(["latex","katex","math"].indexOf(ie)>=0){var se=T(),pe=fe;fe=se,d[se]={type:"block",expression:pe}}return{type:"code",raw:ae,lang:ie,text:fe}}}},R=/(?:\${2})([^\n`]+?)(?:\${2})/gi,A=0,T=function(){return"__special_katext_id_".concat(A++,"__")},d={};function w(){return d}function y(){A=0,d={}}function b(he){return he=he.replace(R,function(ee,re){var ae=T();return d[ae]={type:"inline",expression:re},ae}),he}var j=s.listitem;s.listitem=function(he){return j(b(he))};var B=s.paragraph;s.paragraph=function(he){return B(b(he))};var E=s.tablecell;s.tablecell=function(he,ee){return E(b(he),ee)},s.code=function(he,ee,re){var ae=(ee||"").match(/\S*/)[0];return ae?["latex","katex","math"].indexOf(ae)>=0?"<p class='editormd-tex'>".concat(he,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(ee,'">').concat(re?he:Object(u.escape)(he,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(re?he:Object(u.escape)(he,!0))+"</code></pre>"},s.heading=function(he,ee,re){var ae=this.options.headerPrefix+re.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return o.push({anchor:ae,level:ee,text:he}),"<h"+ee+' id="'+ae+'">'+he+"</h"+ee+">"},h.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),h.a.use({tokenizer:L,renderer:s});var F=h.a,I=q("SJMd"),g=q("ulZh"),W=q.n(g),$=q("m3rI"),le=q("Oy/b"),de=q("p5ED"),Ce=q("ErOA"),be=q("STEk");/* **********************************
|
|
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 Ae=function(he,ee){return(Ae=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(re,ae){re.__proto__=ae}||function(re,ae){for(var fe in ae)Object.prototype.hasOwnProperty.call(ae,fe)&&(re[fe]=ae[fe])})(he,ee)};function Se(he,ee){if(typeof ee!="function"&&ee!==null)throw new TypeError("Class extends value "+String(ee)+" is not a constructor or null");function re(){this.constructor=he}Ae(he,ee),he.prototype=ee===null?Object.create(ee):(re.prototype=ee.prototype,new re)}function Re(he,ee,re,ae){return new(re||(re=Promise))(function(fe,ie){function se(Ee){try{me(ae.next(Ee))}catch(Le){ie(Le)}}function pe(Ee){try{me(ae.throw(Ee))}catch(Le){ie(Le)}}function me(Ee){var Le;Ee.done?fe(Ee.value):(Le=Ee.value,Le instanceof re?Le:new re(function(Pe){Pe(Le)})).then(se,pe)}me((ae=ae.apply(he,ee||[])).next())})}function ve(he,ee){var re,ae,fe,ie,se={label:0,sent:function(){if(1&fe[0])throw fe[1];return fe[1]},trys:[],ops:[]};return ie={next:pe(0),throw:pe(1),return:pe(2)},typeof Symbol=="function"&&(ie[Symbol.iterator]=function(){return this}),ie;function pe(me){return function(Ee){return function(Le){if(re)throw new TypeError("Generator is already executing.");for(;se;)try{if(re=1,ae&&(fe=2&Le[0]?ae.return:Le[0]?ae.throw||((fe=ae.return)&&fe.call(ae),0):ae.next)&&!(fe=fe.call(ae,Le[1])).done)return fe;switch(ae=0,fe&&(Le=[2&Le[0],fe.value]),Le[0]){case 0:case 1:fe=Le;break;case 4:return se.label++,{value:Le[1],done:!1};case 5:se.label++,ae=Le[1],Le=[0];continue;case 7:Le=se.ops.pop(),se.trys.pop();continue;default:if(!(fe=se.trys,(fe=fe.length>0&&fe[fe.length-1])||Le[0]!==6&&Le[0]!==2)){se=0;continue}if(Le[0]===3&&(!fe||Le[1]>fe[0]&&Le[1]<fe[3])){se.label=Le[1];break}if(Le[0]===6&&se.label<fe[1]){se.label=fe[1],fe=Le;break}if(fe&&se.label<fe[2]){se.label=fe[2],se.ops.push(Le);break}fe[2]&&se.ops.pop(),se.trys.pop();continue}Le=ee.call(he,se)}catch(Pe){Le=[6,Pe],ae=0}finally{re=fe=0}if(5&Le[0])throw Le[1];return{value:Le[0]?Le[1]:void 0,done:!0}}([me,Ee])}}}var X=function(){function he(){}return he.addKey=function(ee){he.key=ee},Object.defineProperty(he,"isLicensed",{get:function(){return!!he.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(he.key)},enumerable:!1,configurable:!0}),he}(),_=function(){function he(){}return he.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},he.setAttributes=function(ee,re){for(var ae=0,fe=re;ae<fe.length;ae++){var ie=fe[ae],se=ie[0],pe=ie[1];ee.setAttribute(se,pe)}},he.createRect=function(ee,re,ae){var fe=document.createElementNS("http://www.w3.org/2000/svg","rect");return fe.setAttribute("width",ee.toString()),fe.setAttribute("height",re.toString()),ae&&he.setAttributes(fe,ae),fe},he.createLine=function(ee,re,ae,fe,ie){var se=document.createElementNS("http://www.w3.org/2000/svg","line");return se.setAttribute("x1",ee.toString()),se.setAttribute("y1",re.toString()),se.setAttribute("x2",ae.toString()),se.setAttribute("y2",fe.toString()),ie&&he.setAttributes(se,ie),se},he.createPolygon=function(ee,re){var ae=document.createElementNS("http://www.w3.org/2000/svg","polygon");return ae.setAttribute("points",ee),re&&he.setAttributes(ae,re),ae},he.createCircle=function(ee,re){var ae=document.createElementNS("http://www.w3.org/2000/svg","circle");return ae.setAttribute("cx",(ee/2).toString()),ae.setAttribute("cy",(ee/2).toString()),ae.setAttribute("r",ee.toString()),re&&he.setAttributes(ae,re),ae},he.createEllipse=function(ee,re,ae){var fe=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return fe.setAttribute("cx",(ee/2).toString()),fe.setAttribute("cy",(re/2).toString()),fe.setAttribute("rx",(ee/2).toString()),fe.setAttribute("ry",(re/2).toString()),ae&&he.setAttributes(fe,ae),fe},he.createGroup=function(ee){var re=document.createElementNS("http://www.w3.org/2000/svg","g");return ee&&he.setAttributes(re,ee),re},he.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},he.createMarker=function(ee,re,ae,fe,ie,se,pe){var me=document.createElementNS("http://www.w3.org/2000/svg","marker");return he.setAttributes(me,[["id",ee],["orient",re],["markerWidth",ae.toString()],["markerHeight",fe.toString()],["refX",ie.toString()],["refY",se.toString()]]),me.appendChild(pe),me},he.createText=function(ee){var re=document.createElementNS("http://www.w3.org/2000/svg","text");return re.setAttribute("x","0"),re.setAttribute("y","0"),ee&&he.setAttributes(re,ee),re},he.createTSpan=function(ee,re){var ae=document.createElementNS("http://www.w3.org/2000/svg","tspan");return ae.textContent=ee,re&&he.setAttributes(ae,re),ae},he.createImage=function(ee){var re=document.createElementNS("http://www.w3.org/2000/svg","image");return ee&&he.setAttributes(re,ee),re},he.createPoint=function(ee,re){var ae=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return ae.x=ee,ae.y=re,ae},he.createPath=function(ee,re){var ae=document.createElementNS("http://www.w3.org/2000/svg","path");return ae.setAttribute("d",ee),re&&he.setAttributes(ae,re),ae},he.createElement=function(ee,re){var ae=document.createElementNS("http://www.w3.org/2000/svg",ee);return re&&he.setAttributes(ae,re),ae},he.getHollowRectanglePath=function(ee,re,ae,fe,ie,se,pe,me){return"M"+ee+","+re+"V"+(re+fe)+"H"+(ee+ae)+"V"+re+"H"+ie+"V"+se+"H"+(ie+pe)+"V"+(se+me)+"H"+ie+"V"+re+"Z"},he}(),k=function(){function he(ee){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+ee+"_"}return Object.defineProperty(he.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(he.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(he.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(he.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(he.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),he.prototype.addClass=function(ee){return this.styleSheet===void 0&&this.addStyleSheet(),ee.name=""+this.classNamePrefix+ee.localName,this.classes.push(ee),this.styleSheet.sheet.insertRule("."+ee.name+" {"+ee.style+"}",this.styleSheet.sheet.cssRules.length),ee},he.prototype.addRule=function(ee){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(ee),this.styleSheet.sheet.insertRule(ee.selector+" {"+ee.style+"}",this.styleSheet.sheet.cssRules.length)},he.prototype.addStyleSheet=function(){var ee;this.styleSheet=document.createElement("style"),((ee=this.styleSheetRoot)!==null&&ee!==void 0?ee:document.head).appendChild(this.styleSheet),this.addRule(new U("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new U("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new U("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new Q("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new Q("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},he.prototype.removeStyleSheet=function(){var ee;this.styleSheet&&(((ee=this.styleSheetRoot)!==null&&ee!==void 0?ee:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},he}(),U=function(he,ee){this.selector=he,this.style=ee},Q=function(he,ee){this.localName=he,this.style=ee},K=function(){function he(){this.blocks=[],this.display=""}return he.prototype.addButtonBlock=function(ee){ee.className=this.blockClassName,ee.buttonClassName=this.buttonClassName,ee.buttonColorsClassName=this.buttonColorsClassName,ee.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(ee)},he.prototype.addElementBlock=function(ee){ee.className===void 0&&(ee.className=this.blockClassName),this.blocks.push(ee)},he.prototype.getUI=function(){var ee=document.createElement("div");return ee.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,ee.style.display=this.display,this.blocks.forEach(function(re){return ee.appendChild(re.getUI())}),ee},he}(),ce=function(){function he(){}return he.prototype.getUI=function(){var ee=document.createElement("div");if(ee.className=this.className,this.minWidth!==void 0&&(ee.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":ee.style.justifyContent="flex-start";break;case"center":ee.style.justifyContent="center";break;case"end":ee.style.justifyContent="flex-end"}return ee.style.whiteSpace="nowrap",ee},he}(),xe=function(he){function ee(){var re=he!==null&&he.apply(this,arguments)||this;return re.buttons=[],re}return Se(ee,he),ee.prototype.addButton=function(re){re.className=this.buttonClassName,re.colorsClassName=this.buttonColorsClassName,re.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(re)},ee.prototype.getUI=function(){var re=he.prototype.getUI.call(this);return this.buttons.forEach(function(ae){return re.appendChild(ae.getUI())}),re},ee}(ce),De=function(){function he(ee,re){this._isActive=!1,this._isHidden=!1,this._icon=ee,this.title=re,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(he.prototype,"icon",{get:function(){return this._icon},set:function(ee){this._icon=ee,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(he.prototype,"isActive",{get:function(){return this._isActive},set:function(ee){this._isActive=ee,this.adjustClassName()},enumerable:!1,configurable:!0}),he.prototype.getUI=function(){var ee=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 ee.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},he.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,"")))},he.prototype.hide=function(){this._isHidden=!0},he}(),ue=function(he){function ee(){var re=he!==null&&he.apply(this,arguments)||this;return re.elements=[],re}return Se(ee,he),ee.prototype.addElement=function(re){this.elements.push(re)},ee.prototype.getUI=function(){var re=he.prototype.getUI.call(this);return this.elements.forEach(function(ae){return re.appendChild(ae)}),re},ee}(ce),ge=function(){function he(ee,re){this.horizontal=ee,this.vertical=re}return Object.defineProperty(he.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),he.prototype.getVerticalLength=function(ee){return ee/this.ratio},he.prototype.getHorizontalLength=function(ee){return ee*this.ratio},he}(),we=function(){function he(){}return he.getIcon=function(ee,re){if(ee>0&&re>0){var ae=new ge(ee,re),fe=ae.ratio>=1?20:ae.getHorizontalLength(20),ie=ae.ratio<1?20:ae.getVerticalLength(20),se=document.createElementNS("http://www.w3.org/2000/svg","svg");se.setAttribute("xmlns","http://www.w3.org/2000/svg"),se.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(se);var pe=_.createDefs();se.appendChild(pe);var me=_.createElement("clipPath",[["id","text-bg-clip"]]);pe.appendChild(me);var Ee=_.createPath(_.getHollowRectanglePath((24-fe)/2,(24-ie)/2,fe,ie,(24-fe)/2+2,(24-ie)/2+2,fe-4,ie-4));se.appendChild(Ee);var Le=_.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Le.appendChild(_.createTSpan(ee+":"+re)),se.appendChild(Le);var Pe=Le.getBBox();_.setAttributes(Le,[["x",((24-Pe.width)/2).toString()],["y",((24-Pe.height)/2-Pe.y).toString()]]);var Ke=_.createPath(_.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Pe.width))/2,(24-Math.ceil(Pe.height))/2,Math.ceil(Pe.width),Math.ceil(Pe.height)));return me.appendChild(Ke),_.setAttributes(Ee,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(se),se.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>'},he}(),Oe=function(he){function ee(re,ae,fe){var ie=he.call(this,re,ae)||this;return ie.isDropdownOpen=!1,ie.onClick=ie.dropdownButtonClicked,ie.dropdownButtons=fe,ie}return Se(ee,he),ee.prototype.setupDropdown=function(){var re=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(ae){ae.className=re.className,ae.colorsClassName=re.colorsClassName,re.dropdownBlock.appendChild(ae.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},ee.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},ee.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},ee.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},ee.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},ee.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},ee}(De),Ne=function(){function he(ee,re){this.GRIP_SIZE=10,this.color=ee,this.fillColor=re,this.visual=_.createGroup(),this.visual.appendChild(_.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(_.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return he.prototype.ownsTarget=function(ee){return ee===this.visual||ee===this.visual.childNodes[0]||ee===this.visual.childNodes[1]},he.prototype.setCenter=function(ee,re){this.visual.childNodes.forEach(function(ae){return _.setAttributes(ae,[["cx",ee.toString()],["cy",re.toString()]])})},he}(),Ue=function(){function he(ee,re,ae,fe){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=ee,this.canvasHeight=re,this.margin=ae,this.container=fe,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(he.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(ee){this._aspectRatio=ee,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(he.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(ee){this._isGridVisible=ee,this.gridContainer&&_.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(he.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(ee){this._zoomFactor=ee,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),he.prototype.open=function(){var ee=this;this.cropShadeElement=_.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=_.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var re=0;re<this.numberOfGridLines;re++)this.horizontalGridLines.push(_.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(_.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(ae){return ee.gridContainer.appendChild(ae)}),this.verticalGridLines.forEach(function(ae){return ee.gridContainer.appendChild(ae)}),this.cropRectElement=_.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Ne(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Ne(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Ne(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Ne(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},he.prototype.setCropRectangle=function(ee){this.cropRect=ee;var re=Object.assign({},this.cropRect);this.zoomFactor!==1&&(re.width=this.cropRect.width*this.zoomFactor,re.height=this.cropRect.height*this.zoomFactor,re.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-re.width/2,re.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-re.height/2),_.setAttributes(this.cropRectElement,[["x",re.x.toString()],["y",re.y.toString()],["width",re.width.toString()],["height",re.height.toString()]]);var ae=re.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(ie,se){var pe=re.y+ae*(se+1);_.setAttributes(ie,[["x1",""+re.x],["y1",""+pe],["x2",""+(re.x+re.width)],["y2",""+pe]])});var fe=re.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(ie,se){var pe=re.x+fe*(se+1);_.setAttributes(ie,[["x1",""+pe],["y1",""+re.y],["x2",""+pe],["y2",""+(re.y+re.height)]])}),_.setAttributes(this.cropShadeElement,[["d",_.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,re.x,re.y,re.width,re.height)]]),this.topLeftGrip.setCenter(re.x,re.y),this.topRightGrip.setCenter(re.x+re.width,re.y),this.bottomLeftGrip.setCenter(re.x,re.y+re.height),this.bottomRightGrip.setCenter(re.x+re.width,re.y+re.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},he.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)},he.prototype.clientToLocalCoordinates=function(ee,re){var ae=this.container.getBoundingClientRect();return{x:ee-ae.left+this.margin,y:re-ae.top+this.margin}},he.prototype.onPointerDown=function(ee){this.container.setPointerCapture(ee.pointerId),this.previousPoint=this.clientToLocalCoordinates(ee.clientX,ee.clientY),this.cropRectElement===ee.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(ee.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(ee.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(ee.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(ee.target)&&(this.activeGrip=this.bottomRightGrip)},he.prototype.onPointerMove=function(ee){if(this.isMoving)this.move(this.clientToLocalCoordinates(ee.clientX,ee.clientY));else if(this.activeGrip){var re=this.clientToLocalCoordinates(ee.clientX,ee.clientY);this.resize(re)}ee.preventDefault()},he.prototype.onPointerUp=function(ee){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(ee.pointerId)},he.prototype.move=function(ee){var re=ee.x-this.previousPoint.x,ae=ee.y-this.previousPoint.y;this.zoomFactor!==1&&(re=-re/this.zoomFactor,ae=-ae/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+re),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+ae),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=ee},he.prototype.resize=function(ee){var re=Object.assign({},this.cropRect),ae=ee.x-this.previousPoint.x,fe=ee.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:re.x+ae<this.margin&&(ae=this.margin-re.x),re.x+=ae,re.width=this.cropRect.x+this.cropRect.width-re.x;break;case this.bottomRightGrip:case this.topRightGrip:re.width+ae>this.canvasWidth*this.zoomFactor&&(ae=this.canvasWidth*this.zoomFactor-re.width),re.width+=ae}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(re.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(ae),re.height=this.aspectRatio.getVerticalLength(re.width)):(re.y+=fe,re.height=this.cropRect.y+this.cropRect.height-re.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?re.height=this.aspectRatio.getVerticalLength(re.width):re.height+=fe}re.width<10&&(re.x=this.cropRect.x,re.width=10),re.height<10&&(re.y=this.cropRect.y,re.height=10),this.previousPoint=ee,re.x>=this.margin&&re.y>=this.margin&&re.x-this.margin+re.width<=this.canvasWidth&&re.y-this.margin+re.height<=this.canvasHeight&&(this.cropRect=re,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},he.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var ee=this.cropRect.x+this.cropRect.width/2,re=this.cropRect.y+this.cropRect.height/2,ae=this.aspectRatio.getHorizontalLength(this.cropRect.height),fe=this.aspectRatio.getVerticalLength(this.cropRect.width);ae/this.canvasWidth<fe/this.canvasHeight?this.cropRect.width=ae:this.cropRect.height=fe,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=ee-this.cropRect.width/2,this.cropRect.y=re-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)}},he.prototype.getRescaledRect=function(ee,re,ae,fe,ie,se){var pe=ae/ee,me=fe/re;return{x:(ie.x-se)*pe+se,y:(ie.y-se)*me+se,width:ie.width*pe,height:ie.height*me}},he.prototype.scaleCanvas=function(ee,re){var ae=this.getRescaledRect(this.canvasWidth,this.canvasHeight,ee,re,this.cropRect,this.margin);this.canvasWidth=ee,this.canvasHeight=re,this.onCropChange&&this.onCropChange(ae),this.setCropRectangle(ae)},he}(),Ge=function(){function he(ee){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=ee,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(he.prototype,"angle",{get:function(){return this._angle},set:function(ee){this._angle=ee,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),he.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},he.prototype.onPointerDown=function(ee){this.controlContainer.setPointerCapture(ee.pointerId),this.isDragging=!0,this.previousPoint={x:ee.clientX,y:ee.clientY}},he.prototype.onPointerMove=function(ee){this.isDragging&&(this.onAngleChange&&this.onAngleChange((ee.clientX-this.previousPoint.x)/5),this.previousPoint.x=ee.clientX)},he.prototype.onPointerUp=function(ee){this.isDragging&&this.onAngleChange&&this.onAngleChange((ee.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(ee.pointerId)},he.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var ee=this.angleLabelText.getBBox();_.setAttributes(this.angleLabelElement,[["x",((this.width-ee.width)/2).toString()],["y",(this.height/2).toString()]])}},he.prototype.positionScaleShape=function(){if(this.scaleShape){var ee=this.scaleShape.transform.baseVal.getItem(0);ee.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(ee,0)}},he.prototype.getVisual=function(){var ee=document.createElementNS("http://www.w3.org/2000/svg","svg");ee.setAttribute("xmlns","http://www.w3.org/2000/svg"),ee.setAttribute("width",this.width+"px"),ee.setAttribute("height",this.height+"px"),ee.setAttribute("viewBox","0 0 "+this.width+" "+this.height),ee.style.flexShrink="0",document.body.appendChild(ee);for(var re="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,ae=1;ae<=this.width/5+10;ae++){var fe=ae%5==0?this.height/3:this.height/6;re+="h4v"+-fe+"h1v"+fe}re+="v1H0Z",this.scaleShape=_.createPath(re);var ie=_.createTransform();this.scaleShape.transform.baseVal.appendItem(ie),ee.appendChild(this.scaleShape),this.angleLabelElement=_.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=_.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var se=_.createTSpan("");return se.innerHTML="°",this.angleLabelElement.appendChild(se),ee.appendChild(this.angleLabelElement),document.body.removeChild(ee),ee},he}(),We=function(){function he(){this.naturalSize=!1,this.imageType="image/png"}return he.prototype.rasterize=function(ee,re,ae,fe,ie,se,pe){var me=this;return new Promise(function(Ee){var Le=document.createElement("canvas");Le.width=ee.width.baseVal.value-2*fe,Le.height=ee.height.baseVal.value-2*fe;var Pe=1,Ke=1;me.naturalSize===!0?(Pe=re.naturalWidth/(ee.width.baseVal.value-2*fe)/se,Ke=re.naturalHeight/(ee.height.baseVal.value-2*fe)/pe,Le.width=re.naturalWidth/se,Le.height=re.naturalHeight/pe):me.width!==void 0&&me.height!==void 0&&(Pe=me.width/ae.width,Ke=me.height/ae.height,Le.width*=Pe,Le.height*=Ke);var et=Le.getContext("2d");et.translate(Le.width/2,Le.height/2),et.rotate(ie*Math.PI/180),et.scale(se,pe),et.translate(-Le.width/2,-Le.height/2),et.drawImage(re,0,0,Le.width,Le.height);var rt=document.createElement("canvas");rt.width=ae.width*Pe,rt.height=ae.height*Ke,rt.getContext("2d").putImageData(et.getImageData((ae.x-fe)*Pe,(ae.y-fe)*Ke,ae.width*Pe,ae.height*Ke),0,0),Ee(rt.toDataURL(me.imageType,me.imageQuality))})},he}(),Xe=function(){function he(ee){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=he.instanceCounter++,this.styles=new k(this.instanceNo),this.target=ee,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(he.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(he.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(ee){this._zoomToCropEnabled=ee,ee?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(he.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(ee){this._isGridVisible=ee,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(he.prototype,"gridLines",{get:function(){return this._gridLines},set:function(ee){this._gridLines=ee,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(he.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(ee){this._rotationAngle=ee,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(he.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(he.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(he.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(he.prototype,"aspectRatio",{get:function(){var ee;return(ee=this._aspectRatio)!==null&&ee!==void 0?ee:this.aspectRatios[0]},set:function(ee){this._aspectRatio=ee},enumerable:!1,configurable:!0}),he.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},he.prototype.show=function(){this.showUI(),this.open()},he.prototype.close=function(ee){ee===void 0&&(ee=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),ee||this.closeEventListeners.forEach(function(re){return re()}),this._isOpen=!1)},he.prototype.addRenderEventListener=function(ee){this.renderEventListeners.push(ee)},he.prototype.removeRenderEventListener=function(ee){this.renderEventListeners.indexOf(ee)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(ee),1)},he.prototype.addCloseEventListener=function(ee){this.closeEventListeners.push(ee)},he.prototype.removeCloseEventListener=function(ee){this.closeEventListeners.indexOf(ee)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(ee),1)},he.prototype.setupResizeObserver=function(){var ee=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){ee.resize(ee.target.clientWidth,ee.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))},he.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var ee=1*this.target.clientWidth/this.target.clientHeight,re=this.contentDiv.clientWidth/ee>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*ee:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,ae=re+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/ee;this.resize(re,ae)}},he.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},he.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",_.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},he.prototype.resize=function(ee,re){this.imageWidth=Math.round(ee),this.imageHeight=Math.round(re),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()},he.prototype.setEditingTarget=function(){var ee=document.createElement("canvas");ee.width=this.target.naturalWidth,ee.height=this.target.naturalHeight,ee.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var re=ee.toDataURL();_.setAttributes(this.editingTarget,[["href",re]]),this.setEditingTargetSize()},he.prototype.setTopLeft=function(){var ee=this.target.getBoundingClientRect(),re=this.editorCanvas.getBoundingClientRect();this.left=ee.left-re.left-this.CANVAS_MARGIN,this.top=ee.top-re.top-this.CANVAS_MARGIN},he.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=_.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=_.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=_.createGroup(),this.editingTargetRotationScaleContainer=_.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var ee=_.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(ee);var re=_.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(re),this.editingTargetContainer=_.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)},he.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},he.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=_.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Ue(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()},he.prototype.zoomToCrop=function(){if(this.cropRect){var ee=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,re=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=ee+"px "+re+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-ee+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-re+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},he.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)},he.prototype.cropRectChanged=function(ee){this.cropRect=ee,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},he.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},he.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"},he.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},he.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 ee=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,re=this.target.offsetTop>ee+this.CANVAS_MARGIN?this.target.offsetTop-(ee+this.CANVAS_MARGIN):0;this.coverDiv.style.top=re+"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},he.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},he.prototype.addTopToolbar=function(){var ee=this;this.topToolbar=new K,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 re=new xe;re.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(re);var ae=[];this.aspectRatios.forEach(function(Ke){var et=new De(we.getIcon(Ke.horizontal,Ke.vertical),Ke.horizontal===0&&Ke.vertical===0?"FREE":Ke.horizontal+":"+Ke.vertical);et.onClick=function(){return ee.ratioButtonClicked(Ke)},ae.push(et)}),this.aspectRatioButton=new Oe(we.getIcon(0,0),"Aspect ratio",ae),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,re.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var fe=new De('<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");fe.isActive=this.isGridVisible,fe.onClick=function(){ee.isGridVisible=!ee.isGridVisible,fe.isActive=ee.isGridVisible},re.addButton(fe);var ie=new De('<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(ie.isActive=this.zoomToCropEnabled,ie.onClick=function(){ee.zoomToCropEnabled=!ee.zoomToCropEnabled,ie.isActive=ee.zoomToCropEnabled},re.addButton(ie),!X.isLicensed){var se=new ue;this.topToolbar.addElementBlock(se);var pe=document.createElement("div");pe.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var me=document.createElement("a");me.style.color="currentColor",me.href="https://markerjs.com/products/cropro",me.target="_blank",me.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>',pe.appendChild(me),se.addElement(pe)}var Ee=new xe;Ee.minWidth=3*this.toolbarHeight+"px",Ee.contentAlign="end",this.topToolbar.addButtonBlock(Ee);var Le=new De('<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");Le.onClick=this.startRenderAndClose,Ee.addButton(Le),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Le.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Pe=new De('<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");Pe.onClick=this.close,Ee.addButton(Pe),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Pe.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},he.prototype.addBottomToolbar=function(){var ee=this;this.bottomToolbar=new K,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 re=new xe;re.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(re);var ae=new De('<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");ae.onClick=this.rotateLeftButtonClicked,re.addButton(ae);var fe=new De('<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");fe.onClick=this.rotateRightButtonClicked,re.addButton(fe);var ie=new ue;ie.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(ie),this.straightener=new Ge("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(Ee){ee.rotateBy(Ee),ee.straightener.angle=ee.rotationAngle},ie.addElement(this.straightener.getUI());var se=new xe;se.minWidth=2*this.toolbarHeight+"px",se.contentAlign="end",this.bottomToolbar.addButtonBlock(se);var pe=new De('<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");pe.onClick=this.flipHorizontallyButtonClicked,se.addButton(pe);var me=new De('<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");me.onClick=this.flipVerticallyButtonClicked,se.addButton(me)},he.prototype.ratioButtonClicked=function(ee){this.aspectRatio=ee,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},he.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=we.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},he.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new ge(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},he.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},he.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},he.prototype.restoreState=function(ee){if(ee){var re=this.cropLayer.getRescaledRect(ee.width,ee.height,this.imageWidth,this.imageHeight,ee.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(re),this.cropRectChanged(re),this.flippedHorizontally=ee.flippedHorizontally,this.flippedVertically=ee.flippedVertically,this.applyFlip(),this.rotationAngle=ee.rotationAngle,this.applyRotation()}},he.prototype.clientToLocalCoordinates=function(ee,re){var ae=this.cropImage.getBoundingClientRect();return{x:ee-ae.left,y:re-ae.top}},he.prototype.onWindowResize=function(){this.positionUI()},he.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var ee=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=ee+"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()},he.prototype.rotateLeftButtonClicked=function(){var ee=this.rotationAngle-90;this.rotationAngle%90!=0&&(ee+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(ee)},he.prototype.rotateRightButtonClicked=function(){var ee=this.rotationAngle+90;this.rotationAngle%90!=0&&(ee-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(ee)},he.prototype.rotateTo=function(ee){ee=(ee=ee>180?ee-360:ee)<=-180?ee+360:ee,this.rotationAngle=ee,this.applyRotation()},he.prototype.rotateBy=function(ee){this.rotateTo((this.rotationAngle+ee)%360)},he.prototype.applyRotation=function(){var ee=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var re=this.editingTargetRotationContainer.transform.baseVal.getItem(0);re.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(re,0);var ae=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/ae.width,this.imageHeight/ae.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=ee},he.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},he.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},he.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},he.prototype.startRenderAndClose=function(){return Re(this,void 0,void 0,function(){var ee,re;return ve(this,function(ae){switch(ae.label){case 0:return[4,this.render()];case 1:return ee=ae.sent(),re=this.getState(),this.renderEventListeners.forEach(function(fe){return fe(ee,re)}),this.close(!0),[2]}})})},he.prototype.render=function(){return Re(this,void 0,void 0,function(){var ee;return ve(this,function(re){switch(re.label){case 0:return(ee=new We).naturalSize=this.renderAtNaturalSize,ee.imageType=this.renderImageType,ee.imageQuality=this.renderImageQuality,ee.width=this.renderWidth,ee.height=this.renderHeight,this.unzoomFromCrop(),_.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,ee.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 re.sent(),[4,ee.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,re.sent()]}})})},he.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Q("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 Q("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Q("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var ee=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Q("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*ee)+`px;
|
|
height: `+(this.toolbarHeight-2*ee)+`px;
|
|
padding: `+ee+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Q("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Q("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new U("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new U("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new Q("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 Q("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Q("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 Q("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*ee)+`px;
|
|
padding: `+ee+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Q("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},he.instanceCounter=0,he}(),He=q("8hTe"),Ye=q.n(He),Me=/<pre[^>]*>/g;function it(he){var ee=document.createElement("div");return ee.innerHTML=he,ee.childNodes.length===0?"":ee.childNodes[0].nodeValue}var qe=Te.a=function(he){var ee=he.value,re=ee===void 0?"":ee,ae=he.edit,fe=ae===void 0?!1:ae,ie=he.className,se=he.showTextOnly,pe=he.showLines,me=he.replaces,Ee=he.zoomImg,Le=he.hasMask,Pe=he.style,Ke=Pe===void 0?{}:Pe,et=he.stylesPrev,rt=et===void 0?{}:et,yt=String(re),ot=Object(O.useRef)(),at=Object(O.useRef)(),Lt=Object(O.useState)(""),_t=Object(z.a)(Lt,2),Bt=_t[0],Ft=_t[1],Tt=Object(O.useState)("office"),sr=Object(z.a)(Tt,2),Er=sr[0],zt=sr[1],cr=function(){var Ct=new Xe(at.current);Ct.displayMode="popup",Ct.addRenderEventListener(function(){var Rt=Object(M.a)(r.a.mark(function dt(pt){var wt;return r.a.wrap(function(Ut){for(;;)switch(Ut.prev=Ut.next){case 0:return ot.current.style.display="none",Ut.next=3,Object(Ce.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:pt}});case 3:wt=Ut.sent,wt!=null&&wt.id&&me(at.current.getAttribute("src").replace($.a.API_SERVER,""),"/api/attachments/".concat(wt==null?void 0:wt.id,"?type=").concat(wt.content_type));case 5:case"end":return Ut.stop()}},dt)}));return function(dt){return Rt.apply(this,arguments)}}()),Ct.show()},ct=function(){var Ct=new be.a(at.current);Ct.settings.displayMode="popup",Ct.addEventListener("render",function(){var Rt=Object(M.a)(r.a.mark(function dt(pt){var wt;return r.a.wrap(function(Ut){for(;;)switch(Ut.prev=Ut.next){case 0:if(ot.current.style.display="none",!at.current){Ut.next=6;break}return Ut.next=4,Object(Ce.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:pt.dataUrl}});case 4:wt=Ut.sent,wt!=null&&wt.id&&me(at.current.getAttribute("src").replace($.a.API_SERVER,""),"/api/attachments/".concat(wt==null?void 0:wt.id,"?type=").concat(wt.content_type));case 6:case"end":return Ut.stop()}},dt)}));return function(dt){return Rt.apply(this,arguments)}}()),Ct.show(),window.markerArea=Ct},vt=Object(O.useMemo)(function(){ot.current&&(ot.current.style.zIndex=-1);try{var Ze=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Ct=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Rt=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;yt=yt.replace(Ze,"("+$.a.API_SERVER+"/api/attachments/").replace(Ct,'"'+$.a.API_SERVER+"/api/attachments/").replace(Rt,'"'+$.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,`
|
|
`)}catch(rr){}var dt=F(yt),pt=w();if(yt.match(/\[TOC\]/)&&(dt=dt.replace("<p>[TOC]</p>",D()),S()),dt=dt.replace(/(__special_katext_id_\d+__)/g,function(rr,Ut){var je=pt[Ut],ft=je.type,ri=je.expression;return Object(le.renderToString)(it(ri)||"",{displayMode:ft==="block",throwOnError:!1,output:"html"})}),dt=dt.replace(/▁/g,"\u2581\u2581\u2581"),y(),se){var wt=document.createElement("div");return wt.innerHTML=dt,wt.innerText}return setTimeout(function(){return or()},500),dt},[yt]),Et=Object(O.useRef)();x.WebkitLineClamp=pe,pe&&(Ke=Object(H.a)(Object(H.a)({},Ke),x));function Ht(Ze){var Ct=Ze.target;if(Ct.tagName.toUpperCase()==="IMG"){if(Ee){var Rt=Ct.getAttribute("src");Ft(Rt),zt("image")}}else if(Ct.tagName.toUpperCase()==="A"){var dt=Ct.getAttribute("href");if(dt.indexOf("office")>-1)Ze.preventDefault(),Ft(dt),zt("office");else if(dt.indexOf("application/pdf")>-1)Ze.preventDefault(),Ft(dt),zt("pdf");else if(dt.indexOf("text/html")>-1)Ze.preventDefault(),Ft(dt),zt("html");else if(dt.startsWith("#")){Ze.preventDefault();var pt=document.getElementById(dt.replace("#",""));pt&&pt.scrollIntoView(!0)}}}var or=function(){var Ct,Rt=(Ct=Et.current)===null||Ct===void 0?void 0:Ct.querySelectorAll("video");Rt==null||Rt.forEach(function(dt){if(dt.oncontextmenu=function(){return!1},dt.src.indexOf(".m3u8")>-1&&!dt.canPlayType("application/vnd.apple.mpegurl")){if(W.a.isSupported()){var pt=new W.a;pt.loadSource(dt.src),pt.attachMedia(dt)}}})};Object(O.useEffect)(function(){if(Et.current&&vt&&(vt.match(Me)&&window.PR.prettyPrint()),Et.current)return Et.current.addEventListener("click",Ht),function(){Et.current.removeEventListener("click",Ht),y(),S()}},[vt,Et.current,Ht]);var Mt=function(Ct){if(!fe)return;Ct.target.nodeName==="IMG"?(ot.current.style.zIndex=1,ot.current.style.display="flex",ot.current.style.width=Ct.target.clientWidth+"px",ot.current.style.height=Ct.target.clientHeight+"px",ot.current.style.top=Ct.target.offsetTop+"px",ot.current.style.left=Ct.target.offsetLeft+"px",at.current.src=Ct.target.getAttribute("src")):ot.current.style.display="none"};return v.a.createElement("div",{style:{position:"relative"}},v.a.createElement("div",{ref:Et,style:Object(H.a)({},Ke),className:"".concat(ie||""," markdown-body ").concat(Ye.a.mdBody),onMouseOver:Mt,dangerouslySetInnerHTML:{__html:vt}}),v.a.createElement("div",{ref:ot,className:Ye.a.button},v.a.createElement(Y.a,null,v.a.createElement(J.a,{onClick:function(){return cr()}},"\u88C1\u526A"),v.a.createElement(J.a,{onClick:function(){return ct()}},"\u7F16\u8F91"))),v.a.createElement("img",{ref:at,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),v.a.createElement(de.a,{close:!0,data:Bt,type:Bt!=null&&Bt.length?Er:"",style:Object(H.a)({},rt),onClose:function(){return Ft("")}}))}},"9VGf":function(Qe,Te,q){"use strict";q.d(Te,"a",function(){return N});var oe=q("q1tI"),Y=q.n(oe);function N(J,H){var M=Object(oe.useRef)();Object(oe.useEffect)(function(){M.current=J}),Object(oe.useEffect)(function(){function z(){M.current()}if(H!==null){var G=setInterval(z,H);return function(){return clearInterval(G)}}},[H])}},BU3w:function(Qe,Te,q){"use strict";q.d(Te,"a",function(){return M});var oe=q("MNnm"),Y="rc-util-key";function N(z){if(z.attachTo)return z.attachTo;var G=document.querySelector("head");return G||document.body}function J(z){var G,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(oe.a)())return null;var O=document.createElement("style");if((G=r.csp)===null||G===void 0?void 0:G.nonce){var v;O.nonce=(v=r.csp)===null||v===void 0?void 0:v.nonce}O.innerHTML=z;var m=N(r),p=m.firstChild;return r.prepend&&m.prepend?m.prepend(O):r.prepend&&p?m.insertBefore(O,p):m.appendChild(O),O}var H=new Map;function M(z,G){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},O=N(r);if(!H.has(O)){var v=J("",r),m=v.parentNode;H.set(O,m),m.removeChild(v)}var p=Array.from(H.get(O).children).find(function(l){return l.tagName==="STYLE"&&l[Y]===G});if(p){var h,u;if(((h=r.csp)===null||h===void 0?void 0:h.nonce)&&p.nonce!==((u=r.csp)===null||u===void 0?void 0:u.nonce)){var f;p.nonce=(f=r.csp)===null||f===void 0?void 0:f.nonce}return p.innerHTML!==z&&(p.innerHTML=z),p}var o=J(z,r);return o[Y]=G,o}},Bd2K:function(Qe,Te,q){(function(oe){oe(q("VrN/"),q("osHv"))})(function(oe){oe.defineOption("autoCloseTags",!1,function(r,O,v){if(v!=oe.Init&&v&&r.removeKeyMap("autoCloseTags"),!O)return;var m={name:"autoCloseTags"};(typeof O!="object"||O.whenClosing!==!1)&&(m["'/'"]=function(p){return M(p)}),(typeof O!="object"||O.whenOpening!==!1)&&(m["'>'"]=function(p){return J(p)}),r.addKeyMap(m)});var Y=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],N=["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 J(r){if(r.getOption("disableInput"))return oe.Pass;for(var O=r.listSelections(),v=[],m=r.getOption("autoCloseTags"),p=0;p<O.length;p++){if(!O[p].empty())return oe.Pass;var h=O[p].head,u=r.getTokenAt(h),f=oe.innerMode(r.getMode(),u.state),o=f.state,l=f.mode.xmlCurrentTag&&f.mode.xmlCurrentTag(o),s=l&&l.name;if(!s)return oe.Pass;var a=f.mode.configuration=="html",S=typeof m=="object"&&m.dontCloseTags||a&&Y,x=typeof m=="object"&&m.indentTags||a&&N;u.end>h.ch&&(s=s.slice(0,s.length-u.end+h.ch));var C=s.toLowerCase();if(!s||u.type=="string"&&(u.end!=h.ch||!/[\"\']/.test(u.string.charAt(u.string.length-1))||u.string.length==1)||u.type=="tag"&&l.close||u.string.indexOf("/")==h.ch-u.start-1||S&&z(S,C)>-1||G(r,f.mode.xmlCurrentContext&&f.mode.xmlCurrentContext(o)||[],s,h,!0))return oe.Pass;var D=typeof m=="object"&&m.emptyTags;if(D&&z(D,s)>-1){v[p]={text:"/>",newPos:oe.Pos(h.line,h.ch+2)};continue}var L=x&&z(x,C)>-1;v[p]={indent:L,text:">"+(L?`
|
|
|
|
`:"")+"</"+s+">",newPos:L?oe.Pos(h.line+1,0):oe.Pos(h.line,h.ch+1)}}for(var R=typeof m=="object"&&m.dontIndentOnAutoClose,p=O.length-1;p>=0;p--){var A=v[p];r.replaceRange(A.text,O[p].head,O[p].anchor,"+insert");var T=r.listSelections().slice(0);T[p]={head:A.newPos,anchor:A.newPos},r.setSelections(T),!R&&A.indent&&(r.indentLine(A.newPos.line,null,!0),r.indentLine(A.newPos.line+1,null,!0))}}function H(r,O){for(var v=r.listSelections(),m=[],p=O?"/":"</",h=r.getOption("autoCloseTags"),u=typeof h=="object"&&h.dontIndentOnSlash,f=0;f<v.length;f++){if(!v[f].empty())return oe.Pass;var o=v[f].head,l=r.getTokenAt(o),s=oe.innerMode(r.getMode(),l.state),a=s.state;if(O&&(l.type=="string"||l.string.charAt(0)!="<"||l.start!=o.ch-1))return oe.Pass;var S,x=s.mode.name!="xml"&&r.getMode().name=="htmlmixed";if(x&&s.mode.name=="javascript")S=p+"script";else if(x&&s.mode.name=="css")S=p+"style";else{var C=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(a);if(!C||C.length&&G(r,C,C[C.length-1],o))return oe.Pass;S=p+C[C.length-1]}r.getLine(o.line).charAt(l.end)!=">"&&(S+=">"),m[f]=S}if(r.replaceSelections(m),v=r.listSelections(),!u)for(var f=0;f<v.length;f++)(f==v.length-1||v[f].head.line<v[f+1].head.line)&&r.indentLine(v[f].head.line)}function M(r){return r.getOption("disableInput")?oe.Pass:H(r,!0)}oe.commands.closeTag=function(r){return H(r)};function z(r,O){if(r.indexOf)return r.indexOf(O);for(var v=0,m=r.length;v<m;++v)if(r[v]==O)return v;return-1}function G(r,O,v,m,p){if(!oe.scanForClosingTag)return!1;var h=Math.min(r.lastLine()+1,m.line+500),u=oe.scanForClosingTag(r,m,null,h);if(!u||u.tag!=v)return!1;for(var f=p?1:0,o=O.length-1;o>=0&&O[o]==v;o--)++f;m=u.to;for(var o=1;o<f;o++){var l=oe.scanForClosingTag(r,m,null,h);if(!l||l.tag!=v)return!1;m=l.to}return!0}})},BjJ7:function(Qe,Te,q){"use strict";q.d(Te,"d",function(){return Y}),q.d(Te,"c",function(){return N}),q.d(Te,"e",function(){return J}),q.d(Te,"b",function(){return H}),q.d(Te,"a",function(){return z});var oe=q("m3rI");function Y(G){var r=!0;if(G.length>0){for(var O=0;O<G.length;O++)if(G[O].compile_success==0||!G[O].compile_success){r=!1;break}}else r=!1;return r}function N(G){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",O=[],v=0;v<G.length;v++){var m=G[v],p=r?"".concat(r,"/").concat(m.name):"".concat(m.name);O.push({title:m.name,isLeaf:!(m.type==="tree"),key:p})}return O}function J(G,r,O){for(var v=0;v<G.length;v++){var m=G[v];if(m.key===r){m.children=O;break}m.children&&J(m.children,r,O)}return G}function H(G,r,O){var v;return function(){var m=this,p=arguments,h=function(){v=null,O||G.apply(m,p)},u=O&&!v;clearTimeout(v),v=setTimeout(h,r),u&&G.apply(m,p)}}var M=!0,z=oe.a.API_SERVER},"C+DQ":function(Qe,Te,q){},"C/vA":function(Qe,Te,q){"use strict";q.d(Te,"a",function(){return oe});function oe(Y){const N=this;let J=!1,H;return function(){return J||(J=!0,H=Y.apply(N,arguments)),H}}},"Cg/j":function(Qe,Te,q){"use strict";q.d(Te,"b",function(){return oe}),q.d(Te,"a",function(){return Y}),q.d(Te,"c",function(){return J}),q.d(Te,"d",function(){return H});var oe;(function(M){M.serviceIds=new Map,M.DI_TARGET="$di$target",M.DI_DEPENDENCIES="$di$dependencies";function z(G){return G[M.DI_DEPENDENCIES]||[]}M.getServiceDependencies=z})(oe||(oe={}));const Y=J("instantiationService");function N(M,z,G,r){z[oe.DI_TARGET]===z?z[oe.DI_DEPENDENCIES].push({id:M,index:G,optional:r}):(z[oe.DI_DEPENDENCIES]=[{id:M,index:G,optional:r}],z[oe.DI_TARGET]=z)}function J(M){if(oe.serviceIds.has(M))return oe.serviceIds.get(M);const z=function(G,r,O){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");N(z,G,O,!1)};return z.toString=()=>M,oe.serviceIds.set(M,z),z}function H(M){return function(z,G,r){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");N(M,z,r,!0)}}},DlQD:function(Qe,Te,q){(function(oe,Y){Qe.exports=Y()})(this,function(){"use strict";function oe(re,ae){for(var fe=0;fe<ae.length;fe++){var ie=ae[fe];ie.enumerable=ie.enumerable||!1,ie.configurable=!0,"value"in ie&&(ie.writable=!0),Object.defineProperty(re,ie.key,ie)}}function Y(re,ae,fe){return ae&&oe(re.prototype,ae),fe&&oe(re,fe),re}function N(re,ae){if(!re)return;if(typeof re=="string")return J(re,ae);var fe=Object.prototype.toString.call(re).slice(8,-1);if(fe==="Object"&&re.constructor&&(fe=re.constructor.name),fe==="Map"||fe==="Set")return Array.from(re);if(fe==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(fe))return J(re,ae)}function J(re,ae){(ae==null||ae>re.length)&&(ae=re.length);for(var fe=0,ie=new Array(ae);fe<ae;fe++)ie[fe]=re[fe];return ie}function H(re,ae){var fe;if(typeof Symbol=="undefined"||re[Symbol.iterator]==null){if(Array.isArray(re)||(fe=N(re))||ae&&re&&typeof re.length=="number"){fe&&(re=fe);var ie=0;return function(){return ie>=re.length?{done:!0}:{done:!1,value:re[ie++]}}}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 fe=re[Symbol.iterator](),fe.next.bind(fe)}function M(re,ae){return ae={exports:{}},re(ae,ae.exports),ae.exports}var z=M(function(re){function ae(){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 fe(ie){re.exports.defaults=ie}re.exports={defaults:ae(),getDefaults:ae,changeDefaults:fe}}),G=z.defaults,r=z.getDefaults,O=z.changeDefaults,v=/[&<>"']/,m=/[&<>"']/g,p=/[<>"']|&(?!#?\w+;)/,h=/[<>"']|&(?!#?\w+;)/g,u={"&":"&","<":"<",">":">",'"':""","'":"'"},f=function(ae){return u[ae]};function o(re,ae){if(ae){if(v.test(re))return re.replace(m,f)}else if(p.test(re))return re.replace(h,f);return re}var l=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(re){return re.replace(l,function(ae,fe){return fe=fe.toLowerCase(),fe==="colon"?":":fe.charAt(0)==="#"?fe.charAt(1)==="x"?String.fromCharCode(parseInt(fe.substring(2),16)):String.fromCharCode(+fe.substring(1)):""})}var a=/(^|[^\[])\^/g;function S(re,ae){re=re.source||re,ae=ae||"";var fe={replace:function(se,pe){return pe=pe.source||pe,pe=pe.replace(a,"$1"),re=re.replace(se,pe),fe},getRegex:function(){return new RegExp(re,ae)}};return fe}var x=/[^\w:]/g,C=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function D(re,ae,fe){if(re){var ie;try{ie=decodeURIComponent(s(fe)).replace(x,"").toLowerCase()}catch(se){return null}if(ie.indexOf("javascript:")===0||ie.indexOf("vbscript:")===0||ie.indexOf("data:")===0)return null}ae&&!C.test(fe)&&(fe=d(ae,fe));try{fe=encodeURI(fe).replace(/%25/g,"%")}catch(se){return null}return fe}var L={},R=/^[^:]+:\/*[^/]*$/,A=/^([^:]+:)[\s\S]*$/,T=/^([^:]+:\/*[^/]*)[\s\S]*$/;function d(re,ae){L[" "+re]||(R.test(re)?L[" "+re]=re+"/":L[" "+re]=j(re,"/",!0)),re=L[" "+re];var fe=re.indexOf(":")===-1;return ae.substring(0,2)==="//"?fe?ae:re.replace(A,"$1")+ae:ae.charAt(0)==="/"?fe?ae:re.replace(T,"$1")+ae:re+ae}var w={exec:function(){}};function y(re){for(var ae=1,fe,ie;ae<arguments.length;ae++){fe=arguments[ae];for(ie in fe)Object.prototype.hasOwnProperty.call(fe,ie)&&(re[ie]=fe[ie])}return re}function b(re,ae){var fe=re.replace(/\|/g,function(pe,me,Ee){for(var Le=!1,Pe=me;--Pe>=0&&Ee[Pe]==="\\";)Le=!Le;return Le?"|":" |"}),ie=fe.split(/ \|/),se=0;if(ie.length>ae)ie.splice(ae);else for(;ie.length<ae;)ie.push("");for(;se<ie.length;se++)ie[se]=ie[se].trim().replace(/\\\|/g,"|");return ie}function j(re,ae,fe){var ie=re.length;if(ie===0)return"";for(var se=0;se<ie;){var pe=re.charAt(ie-se-1);if(pe===ae&&!fe)se++;else if(pe!==ae&&fe)se++;else break}return re.substr(0,ie-se)}function B(re,ae){if(re.indexOf(ae[1])===-1)return-1;for(var fe=re.length,ie=0,se=0;se<fe;se++)if(re[se]==="\\")se++;else if(re[se]===ae[0])ie++;else if(re[se]===ae[1]&&(ie--,ie<0))return se;return-1}function E(re){re&&re.sanitize&&!re.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 F={escape:o,unescape:s,edit:S,cleanUrl:D,resolveUrl:d,noopTest:w,merge:y,splitCells:b,rtrim:j,findClosingBracket:B,checkSanitizeDeprecation:E},I=z.defaults,g=F.rtrim,W=F.splitCells,$=F.escape,le=F.findClosingBracket;function de(re,ae,fe){var ie=ae.href,se=ae.title?$(ae.title):null,pe=re[1].replace(/\\([\[\]])/g,"$1");return re[0].charAt(0)!=="!"?{type:"link",raw:fe,href:ie,title:se,text:pe}:{type:"image",raw:fe,href:ie,title:se,text:$(pe)}}function Ce(re,ae){var fe=re.match(/^(\s+)(?:```)/);if(fe===null)return ae;var ie=fe[1];return ae.split(`
|
|
`).map(function(se){var pe=se.match(/^\s+/);if(pe===null)return se;var me=pe[0];return me.length>=ie.length?se.slice(ie.length):se}).join(`
|
|
`)}var be=function(){function re(fe){this.options=fe||I}var ae=re.prototype;return ae.space=function(ie){var se=this.rules.block.newline.exec(ie);if(se)return se[0].length>1?{type:"space",raw:se[0]}:{raw:`
|
|
`}},ae.code=function(ie,se){var pe=this.rules.block.code.exec(ie);if(pe){var me=se[se.length-1];if(me&&me.type==="paragraph")return{raw:pe[0],text:pe[0].trimRight()};var Ee=pe[0].replace(/^ {4}/gm,"");return{type:"code",raw:pe[0],codeBlockStyle:"indented",text:this.options.pedantic?Ee:g(Ee,`
|
|
`)}}},ae.fences=function(ie){var se=this.rules.block.fences.exec(ie);if(se){var pe=se[0],me=Ce(pe,se[3]||"");return{type:"code",raw:pe,lang:se[2]?se[2].trim():se[2],text:me}}},ae.heading=function(ie){var se=this.rules.block.heading.exec(ie);if(se)return{type:"heading",raw:se[0],depth:se[1].length,text:se[2]}},ae.nptable=function(ie){var se=this.rules.block.nptable.exec(ie);if(se){var pe={type:"table",header:W(se[1].replace(/^ *| *\| *$/g,"")),align:se[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:se[3]?se[3].replace(/\n$/,"").split(`
|
|
`):[],raw:se[0]};if(pe.header.length===pe.align.length){var me=pe.align.length,Ee;for(Ee=0;Ee<me;Ee++)/^ *-+: *$/.test(pe.align[Ee])?pe.align[Ee]="right":/^ *:-+: *$/.test(pe.align[Ee])?pe.align[Ee]="center":/^ *:-+ *$/.test(pe.align[Ee])?pe.align[Ee]="left":pe.align[Ee]=null;for(me=pe.cells.length,Ee=0;Ee<me;Ee++)pe.cells[Ee]=W(pe.cells[Ee],pe.header.length);return pe}}},ae.hr=function(ie){var se=this.rules.block.hr.exec(ie);if(se)return{type:"hr",raw:se[0]}},ae.blockquote=function(ie){var se=this.rules.block.blockquote.exec(ie);if(se){var pe=se[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:se[0],text:pe}}},ae.list=function(ie){var se=this.rules.block.list.exec(ie);if(se){for(var pe=se[0],me=se[2],Ee=me.length>1,Le=me[me.length-1]===")",Pe={type:"list",raw:pe,ordered:Ee,start:Ee?+me.slice(0,-1):"",loose:!1,items:[]},Ke=se[0].match(this.rules.block.item),et=!1,rt,yt,ot,at,Lt,_t,Bt,Ft=Ke.length,Tt=0;Tt<Ft;Tt++)rt=Ke[Tt],pe=rt,yt=rt.length,rt=rt.replace(/^ *([*+-]|\d+[.)]) */,""),~rt.indexOf(`
|
|
`)&&(yt-=rt.length,rt=this.options.pedantic?rt.replace(/^ {1,4}/gm,""):rt.replace(new RegExp("^ {1,"+yt+"}","gm"),"")),Tt!==Ft-1&&(ot=this.rules.block.bullet.exec(Ke[Tt+1])[0],(Ee?ot.length===1||!Le&&ot[ot.length-1]===")":ot.length>1||this.options.smartLists&&ot!==me)&&(at=Ke.slice(Tt+1).join(`
|
|
`),Pe.raw=Pe.raw.substring(0,Pe.raw.length-at.length),Tt=Ft-1)),Lt=et||/\n\n(?!\s*$)/.test(rt),Tt!==Ft-1&&(et=rt.charAt(rt.length-1)===`
|
|
`,Lt||(Lt=et)),Lt&&(Pe.loose=!0),_t=/^\[[ xX]\] /.test(rt),Bt=void 0,_t&&(Bt=rt[1]!==" ",rt=rt.replace(/^\[[ xX]\] +/,"")),Pe.items.push({type:"list_item",raw:pe,task:_t,checked:Bt,loose:Lt,text:rt});return Pe}},ae.html=function(ie){var se=this.rules.block.html.exec(ie);if(se)return{type:this.options.sanitize?"paragraph":"html",raw:se[0],pre:!this.options.sanitizer&&(se[1]==="pre"||se[1]==="script"||se[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(se[0]):$(se[0]):se[0]}},ae.def=function(ie){var se=this.rules.block.def.exec(ie);if(se){se[3]&&(se[3]=se[3].substring(1,se[3].length-1));var pe=se[1].toLowerCase().replace(/\s+/g," ");return{tag:pe,raw:se[0],href:se[2],title:se[3]}}},ae.table=function(ie){var se=this.rules.block.table.exec(ie);if(se){var pe={type:"table",header:W(se[1].replace(/^ *| *\| *$/g,"")),align:se[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:se[3]?se[3].replace(/\n$/,"").split(`
|
|
`):[]};if(pe.header.length===pe.align.length){pe.raw=se[0];var me=pe.align.length,Ee;for(Ee=0;Ee<me;Ee++)/^ *-+: *$/.test(pe.align[Ee])?pe.align[Ee]="right":/^ *:-+: *$/.test(pe.align[Ee])?pe.align[Ee]="center":/^ *:-+ *$/.test(pe.align[Ee])?pe.align[Ee]="left":pe.align[Ee]=null;for(me=pe.cells.length,Ee=0;Ee<me;Ee++)pe.cells[Ee]=W(pe.cells[Ee].replace(/^ *\| *| *\| *$/g,""),pe.header.length);return pe}}},ae.lheading=function(ie){var se=this.rules.block.lheading.exec(ie);if(se)return{type:"heading",raw:se[0],depth:se[2].charAt(0)==="="?1:2,text:se[1]}},ae.paragraph=function(ie){var se=this.rules.block.paragraph.exec(ie);if(se)return{type:"paragraph",raw:se[0],text:se[1].charAt(se[1].length-1)===`
|
|
`?se[1].slice(0,-1):se[1]}},ae.text=function(ie,se){var pe=this.rules.block.text.exec(ie);if(pe){var me=se[se.length-1];return me&&me.type==="text"?{raw:pe[0],text:pe[0]}:{type:"text",raw:pe[0],text:pe[0]}}},ae.escape=function(ie){var se=this.rules.inline.escape.exec(ie);if(se)return{type:"escape",raw:se[0],text:$(se[1])}},ae.tag=function(ie,se,pe){var me=this.rules.inline.tag.exec(ie);if(me)return!se&&/^<a /i.test(me[0])?se=!0:se&&/^<\/a>/i.test(me[0])&&(se=!1),!pe&&/^<(pre|code|kbd|script)(\s|>)/i.test(me[0])?pe=!0:pe&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(me[0])&&(pe=!1),{type:this.options.sanitize?"text":"html",raw:me[0],inLink:se,inRawBlock:pe,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(me[0]):$(me[0]):me[0]}},ae.link=function(ie){var se=this.rules.inline.link.exec(ie);if(se){var pe=le(se[2],"()");if(pe>-1){var me=se[0].indexOf("!")===0?5:4,Ee=me+se[1].length+pe;se[2]=se[2].substring(0,pe),se[0]=se[0].substring(0,Ee).trim(),se[3]=""}var Le=se[2],Pe="";if(this.options.pedantic){var Ke=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Le);Ke?(Le=Ke[1],Pe=Ke[3]):Pe=""}else Pe=se[3]?se[3].slice(1,-1):"";Le=Le.trim().replace(/^<([\s\S]*)>$/,"$1");var et=de(se,{href:Le&&Le.replace(this.rules.inline._escapes,"$1"),title:Pe&&Pe.replace(this.rules.inline._escapes,"$1")},se[0]);return et}},ae.reflink=function(ie,se){var pe;if((pe=this.rules.inline.reflink.exec(ie))||(pe=this.rules.inline.nolink.exec(ie))){var me=(pe[2]||pe[1]).replace(/\s+/g," ");if(me=se[me.toLowerCase()],!me||!me.href){var Ee=pe[0].charAt(0);return{type:"text",raw:Ee,text:Ee}}var Le=de(pe,me,pe[0]);return Le}},ae.strong=function(ie,se,pe){pe===void 0&&(pe="");var me=this.rules.inline.strong.start.exec(ie);if(me&&(!me[1]||me[1]&&(pe===""||this.rules.inline.punctuation.exec(pe)))){se=se.slice(-1*ie.length);var Ee=me[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Ee.lastIndex=0;for(var Le;(me=Ee.exec(se))!=null;)if(Le=this.rules.inline.strong.middle.exec(se.slice(0,me.index+3)),Le)return{type:"strong",raw:ie.slice(0,Le[0].length),text:ie.slice(2,Le[0].length-2)}}},ae.em=function(ie,se,pe){pe===void 0&&(pe="");var me=this.rules.inline.em.start.exec(ie);if(me&&(!me[1]||me[1]&&(pe===""||this.rules.inline.punctuation.exec(pe)))){se=se.slice(-1*ie.length);var Ee=me[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Ee.lastIndex=0;for(var Le;(me=Ee.exec(se))!=null;)if(Le=this.rules.inline.em.middle.exec(se.slice(0,me.index+2)),Le)return{type:"em",raw:ie.slice(0,Le[0].length),text:ie.slice(1,Le[0].length-1)}}},ae.codespan=function(ie){var se=this.rules.inline.code.exec(ie);if(se){var pe=se[2].replace(/\n/g," "),me=/[^ ]/.test(pe),Ee=pe.startsWith(" ")&&pe.endsWith(" ");return me&&Ee&&(pe=pe.substring(1,pe.length-1)),pe=$(pe,!0),{type:"codespan",raw:se[0],text:pe}}},ae.br=function(ie){var se=this.rules.inline.br.exec(ie);if(se)return{type:"br",raw:se[0]}},ae.del=function(ie){var se=this.rules.inline.del.exec(ie);if(se)return{type:"del",raw:se[0],text:se[1]}},ae.autolink=function(ie,se){var pe=this.rules.inline.autolink.exec(ie);if(pe){var me,Ee;return pe[2]==="@"?(me=$(this.options.mangle?se(pe[1]):pe[1]),Ee="mailto:"+me):(me=$(pe[1]),Ee=me),{type:"link",raw:pe[0],text:me,href:Ee,tokens:[{type:"text",raw:me,text:me}]}}},ae.url=function(ie,se){var pe;if(pe=this.rules.inline.url.exec(ie)){var me,Ee;if(pe[2]==="@")me=$(this.options.mangle?se(pe[0]):pe[0]),Ee="mailto:"+me;else{var Le;do Le=pe[0],pe[0]=this.rules.inline._backpedal.exec(pe[0])[0];while(Le!==pe[0]);me=$(pe[0]),pe[1]==="www."?Ee="http://"+me:Ee=me}return{type:"link",raw:pe[0],text:me,href:Ee,tokens:[{type:"text",raw:me,text:me}]}}},ae.inlineText=function(ie,se,pe){var me=this.rules.inline.text.exec(ie);if(me){var Ee;return se?Ee=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(me[0]):$(me[0]):me[0]:Ee=$(this.options.smartypants?pe(me[0]):me[0]),{type:"text",raw:me[0],text:Ee}}},re}(),Ae=F.noopTest,Se=F.edit,Re=F.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=Se(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=Se(ve.item,"gm").replace(/bull/g,ve.bullet).getRegex(),ve.list=Se(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=Se(ve.html,"i").replace("comment",ve._comment).replace("tag",ve._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ve.paragraph=Se(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=Se(ve.blockquote).replace("paragraph",ve.paragraph).getRegex(),ve.normal=Re({},ve),ve.gfm=Re({},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=Se(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=Se(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=Re({},ve.normal,{html:Se(`^ *(?: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:Se(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 X={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])/};X._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",X.punctuation=Se(X.punctuation).replace(/punctuation/g,X._punctuation).getRegex(),X._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",X._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",X.em.start=Se(X.em.start).replace(/punctuation/g,X._punctuation).getRegex(),X.em.middle=Se(X.em.middle).replace(/punctuation/g,X._punctuation).replace(/overlapSkip/g,X._overlapSkip).getRegex(),X.em.endAst=Se(X.em.endAst,"g").replace(/punctuation/g,X._punctuation).getRegex(),X.em.endUnd=Se(X.em.endUnd,"g").replace(/punctuation/g,X._punctuation).getRegex(),X.strong.start=Se(X.strong.start).replace(/punctuation/g,X._punctuation).getRegex(),X.strong.middle=Se(X.strong.middle).replace(/punctuation/g,X._punctuation).replace(/blockSkip/g,X._blockSkip).getRegex(),X.strong.endAst=Se(X.strong.endAst,"g").replace(/punctuation/g,X._punctuation).getRegex(),X.strong.endUnd=Se(X.strong.endUnd,"g").replace(/punctuation/g,X._punctuation).getRegex(),X.blockSkip=Se(X._blockSkip,"g").getRegex(),X.overlapSkip=Se(X._overlapSkip,"g").getRegex(),X._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,X._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,X._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])?)+(?![-_])/,X.autolink=Se(X.autolink).replace("scheme",X._scheme).replace("email",X._email).getRegex(),X._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,X.tag=Se(X.tag).replace("comment",ve._comment).replace("attribute",X._attribute).getRegex(),X._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,X._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,X._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,X.link=Se(X.link).replace("label",X._label).replace("href",X._href).replace("title",X._title).getRegex(),X.reflink=Se(X.reflink).replace("label",X._label).getRegex(),X.reflinkSearch=Se(X.reflinkSearch,"g").replace("reflink",X.reflink).replace("nolink",X.nolink).getRegex(),X.normal=Re({},X),X.pedantic=Re({},X.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:Se(/^!?\[(label)\]\((.*?)\)/).replace("label",X._label).getRegex(),reflink:Se(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",X._label).getRegex()}),X.gfm=Re({},X.normal,{escape:Se(X.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),X.gfm.url=Se(X.gfm.url,"i").replace("email",X.gfm._extended_email).getRegex(),X.breaks=Re({},X.gfm,{br:Se(X.br).replace("{2,}","*").getRegex(),text:Se(X.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var _={block:ve,inline:X},k=z.defaults,U=_.block,Q=_.inline;function K(re){return re.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 ce(re){var ae="",fe,ie,se=re.length;for(fe=0;fe<se;fe++)ie=re.charCodeAt(fe),Math.random()>.5&&(ie="x"+ie.toString(16)),ae+="&#"+ie+";";return ae}var xe=function(){function re(fe){this.tokens=[],this.tokens.links=Object.create(null),this.options=fe||k,this.options.tokenizer=this.options.tokenizer||new be,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var ie={block:U.normal,inline:Q.normal};this.options.pedantic?(ie.block=U.pedantic,ie.inline=Q.pedantic):this.options.gfm&&(ie.block=U.gfm,this.options.breaks?ie.inline=Q.breaks:ie.inline=Q.gfm),this.tokenizer.rules=ie}re.lex=function(ie,se){var pe=new re(se);return pe.lex(ie)};var ae=re.prototype;return ae.lex=function(ie){return ie=ie.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(ie,this.tokens,!0),this.inline(this.tokens),this.tokens},ae.blockTokens=function(ie,se,pe){se===void 0&&(se=[]),pe===void 0&&(pe=!0),ie=ie.replace(/^ +$/gm,"");for(var me,Ee,Le,Pe;ie;){if(me=this.tokenizer.space(ie)){ie=ie.substring(me.raw.length),me.type&&se.push(me);continue}if(me=this.tokenizer.code(ie,se)){ie=ie.substring(me.raw.length),me.type?se.push(me):(Pe=se[se.length-1],Pe.raw+=`
|
|
`+me.raw,Pe.text+=`
|
|
`+me.text);continue}if(me=this.tokenizer.fences(ie)){ie=ie.substring(me.raw.length),se.push(me);continue}if(me=this.tokenizer.heading(ie)){ie=ie.substring(me.raw.length),se.push(me);continue}if(me=this.tokenizer.nptable(ie)){ie=ie.substring(me.raw.length),se.push(me);continue}if(me=this.tokenizer.hr(ie)){ie=ie.substring(me.raw.length),se.push(me);continue}if(me=this.tokenizer.blockquote(ie)){ie=ie.substring(me.raw.length),me.tokens=this.blockTokens(me.text,[],pe),se.push(me);continue}if(me=this.tokenizer.list(ie)){for(ie=ie.substring(me.raw.length),Le=me.items.length,Ee=0;Ee<Le;Ee++)me.items[Ee].tokens=this.blockTokens(me.items[Ee].text,[],!1);se.push(me);continue}if(me=this.tokenizer.html(ie)){ie=ie.substring(me.raw.length),se.push(me);continue}if(pe&&(me=this.tokenizer.def(ie))){ie=ie.substring(me.raw.length),this.tokens.links[me.tag]||(this.tokens.links[me.tag]={href:me.href,title:me.title});continue}if(me=this.tokenizer.table(ie)){ie=ie.substring(me.raw.length),se.push(me);continue}if(me=this.tokenizer.lheading(ie)){ie=ie.substring(me.raw.length),se.push(me);continue}if(pe&&(me=this.tokenizer.paragraph(ie))){ie=ie.substring(me.raw.length),se.push(me);continue}if(me=this.tokenizer.text(ie,se)){ie=ie.substring(me.raw.length),me.type?se.push(me):(Pe=se[se.length-1],Pe.raw+=`
|
|
`+me.raw,Pe.text+=`
|
|
`+me.text);continue}if(ie){var Ke="Infinite loop on byte: "+ie.charCodeAt(0);if(this.options.silent){console.error(Ke);break}else throw new Error(Ke)}}return se},ae.inline=function(ie){var se,pe,me,Ee,Le,Pe,Ke=ie.length;for(se=0;se<Ke;se++){Pe=ie[se];switch(Pe.type){case"paragraph":case"text":case"heading":{Pe.tokens=[],this.inlineTokens(Pe.text,Pe.tokens);break}case"table":{for(Pe.tokens={header:[],cells:[]},Ee=Pe.header.length,pe=0;pe<Ee;pe++)Pe.tokens.header[pe]=[],this.inlineTokens(Pe.header[pe],Pe.tokens.header[pe]);for(Ee=Pe.cells.length,pe=0;pe<Ee;pe++)for(Le=Pe.cells[pe],Pe.tokens.cells[pe]=[],me=0;me<Le.length;me++)Pe.tokens.cells[pe][me]=[],this.inlineTokens(Le[me],Pe.tokens.cells[pe][me]);break}case"blockquote":{this.inline(Pe.tokens);break}case"list":{for(Ee=Pe.items.length,pe=0;pe<Ee;pe++)this.inline(Pe.items[pe].tokens);break}}}return ie},ae.inlineTokens=function(ie,se,pe,me,Ee){se===void 0&&(se=[]),pe===void 0&&(pe=!1),me===void 0&&(me=!1),Ee===void 0&&(Ee="");var Le,Pe=ie,Ke;if(this.tokens.links){var et=Object.keys(this.tokens.links);if(et.length>0)for(;(Ke=this.tokenizer.rules.inline.reflinkSearch.exec(Pe))!=null;)et.includes(Ke[0].slice(Ke[0].lastIndexOf("[")+1,-1))&&(Pe=Pe.slice(0,Ke.index)+"["+"a".repeat(Ke[0].length-2)+"]"+Pe.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Ke=this.tokenizer.rules.inline.blockSkip.exec(Pe))!=null;)Pe=Pe.slice(0,Ke.index)+"["+"a".repeat(Ke[0].length-2)+"]"+Pe.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;ie;){if(Le=this.tokenizer.escape(ie)){ie=ie.substring(Le.raw.length),se.push(Le);continue}if(Le=this.tokenizer.tag(ie,pe,me)){ie=ie.substring(Le.raw.length),pe=Le.inLink,me=Le.inRawBlock,se.push(Le);continue}if(Le=this.tokenizer.link(ie)){ie=ie.substring(Le.raw.length),Le.type==="link"&&(Le.tokens=this.inlineTokens(Le.text,[],!0,me)),se.push(Le);continue}if(Le=this.tokenizer.reflink(ie,this.tokens.links)){ie=ie.substring(Le.raw.length),Le.type==="link"&&(Le.tokens=this.inlineTokens(Le.text,[],!0,me)),se.push(Le);continue}if(Le=this.tokenizer.strong(ie,Pe,Ee)){ie=ie.substring(Le.raw.length),Le.tokens=this.inlineTokens(Le.text,[],pe,me),se.push(Le);continue}if(Le=this.tokenizer.em(ie,Pe,Ee)){ie=ie.substring(Le.raw.length),Le.tokens=this.inlineTokens(Le.text,[],pe,me),se.push(Le);continue}if(Le=this.tokenizer.codespan(ie)){ie=ie.substring(Le.raw.length),se.push(Le);continue}if(Le=this.tokenizer.br(ie)){ie=ie.substring(Le.raw.length),se.push(Le);continue}if(Le=this.tokenizer.del(ie)){ie=ie.substring(Le.raw.length),Le.tokens=this.inlineTokens(Le.text,[],pe,me),se.push(Le);continue}if(Le=this.tokenizer.autolink(ie,ce)){ie=ie.substring(Le.raw.length),se.push(Le);continue}if(!pe&&(Le=this.tokenizer.url(ie,ce))){ie=ie.substring(Le.raw.length),se.push(Le);continue}if(Le=this.tokenizer.inlineText(ie,me,K)){ie=ie.substring(Le.raw.length),Ee=Le.raw.slice(-1),se.push(Le);continue}if(ie){var rt="Infinite loop on byte: "+ie.charCodeAt(0);if(this.options.silent){console.error(rt);break}else throw new Error(rt)}}return se},Y(re,null,[{key:"rules",get:function(){return{block:U,inline:Q}}}]),re}(),De=z.defaults,ue=F.cleanUrl,ge=F.escape,we=function(){function re(fe){this.options=fe||De}var ae=re.prototype;return ae.code=function(ie,se,pe){var me=(se||"").match(/\S*/)[0];if(this.options.highlight){var Ee=this.options.highlight(ie,me);Ee!=null&&Ee!==ie&&(pe=!0,ie=Ee)}return me?'<pre><code class="'+this.options.langPrefix+ge(me,!0)+'">'+(pe?ie:ge(ie,!0))+`</code></pre>
|
|
`:"<pre><code>"+(pe?ie:ge(ie,!0))+`</code></pre>
|
|
`},ae.blockquote=function(ie){return`<blockquote>
|
|
`+ie+`</blockquote>
|
|
`},ae.html=function(ie){return ie},ae.heading=function(ie,se,pe,me){return this.options.headerIds?"<h"+se+' id="'+this.options.headerPrefix+me.slug(pe)+'">'+ie+"</h"+se+`>
|
|
`:"<h"+se+">"+ie+"</h"+se+`>
|
|
`},ae.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},ae.list=function(ie,se,pe){var me=se?"ol":"ul",Ee=se&&pe!==1?' start="'+pe+'"':"";return"<"+me+Ee+`>
|
|
`+ie+"</"+me+`>
|
|
`},ae.listitem=function(ie){return"<li>"+ie+`</li>
|
|
`},ae.checkbox=function(ie){return"<input "+(ie?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ae.paragraph=function(ie){return"<p>"+ie+`</p>
|
|
`},ae.table=function(ie,se){return se&&(se="<tbody>"+se+"</tbody>"),`<table>
|
|
<thead>
|
|
`+ie+`</thead>
|
|
`+se+`</table>
|
|
`},ae.tablerow=function(ie){return`<tr>
|
|
`+ie+`</tr>
|
|
`},ae.tablecell=function(ie,se){var pe=se.header?"th":"td",me=se.align?"<"+pe+' align="'+se.align+'">':"<"+pe+">";return me+ie+"</"+pe+`>
|
|
`},ae.strong=function(ie){return"<strong>"+ie+"</strong>"},ae.em=function(ie){return"<em>"+ie+"</em>"},ae.codespan=function(ie){return"<code>"+ie+"</code>"},ae.br=function(){return this.options.xhtml?"<br/>":"<br>"},ae.del=function(ie){return"<del>"+ie+"</del>"},ae.link=function(ie,se,pe){if(ie=ue(this.options.sanitize,this.options.baseUrl,ie),ie===null)return pe;var me='<a href="'+ge(ie)+'"';return se&&(me+=' title="'+se+'"'),me+=">"+pe+"</a>",me},ae.image=function(ie,se,pe){if(ie=ue(this.options.sanitize,this.options.baseUrl,ie),ie===null)return pe;var me='<img src="'+ie+'" alt="'+pe+'"';return se&&(me+=' title="'+se+'"'),me+=this.options.xhtml?"/>":">",me},ae.text=function(ie){return ie},re}(),Oe=function(){function re(){}var ae=re.prototype;return ae.strong=function(ie){return ie},ae.em=function(ie){return ie},ae.codespan=function(ie){return ie},ae.del=function(ie){return ie},ae.html=function(ie){return ie},ae.text=function(ie){return ie},ae.link=function(ie,se,pe){return""+pe},ae.image=function(ie,se,pe){return""+pe},ae.br=function(){return""},re}(),Ne=function(){function re(){this.seen={}}var ae=re.prototype;return ae.slug=function(ie){var se=ie.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(se)){var pe=se;do this.seen[pe]++,se=pe+"-"+this.seen[pe];while(this.seen.hasOwnProperty(se))}return this.seen[se]=0,se},re}(),Ue=z.defaults,Ge=F.unescape,We=function(){function re(fe){this.options=fe||Ue,this.options.renderer=this.options.renderer||new we,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Oe,this.slugger=new Ne}re.parse=function(ie,se){var pe=new re(se);return pe.parse(ie)};var ae=re.prototype;return ae.parse=function(ie,se){se===void 0&&(se=!0);var pe="",me,Ee,Le,Pe,Ke,et,rt,yt,ot,at,Lt,_t,Bt,Ft,Tt,sr,Er,zt,cr=ie.length;for(me=0;me<cr;me++){at=ie[me];switch(at.type){case"space":continue;case"hr":{pe+=this.renderer.hr();continue}case"heading":{pe+=this.renderer.heading(this.parseInline(at.tokens),at.depth,Ge(this.parseInline(at.tokens,this.textRenderer)),this.slugger);continue}case"code":{pe+=this.renderer.code(at.text,at.lang,at.escaped);continue}case"table":{for(yt="",rt="",Pe=at.header.length,Ee=0;Ee<Pe;Ee++)rt+=this.renderer.tablecell(this.parseInline(at.tokens.header[Ee]),{header:!0,align:at.align[Ee]});for(yt+=this.renderer.tablerow(rt),ot="",Pe=at.cells.length,Ee=0;Ee<Pe;Ee++){for(et=at.tokens.cells[Ee],rt="",Ke=et.length,Le=0;Le<Ke;Le++)rt+=this.renderer.tablecell(this.parseInline(et[Le]),{header:!1,align:at.align[Le]});ot+=this.renderer.tablerow(rt)}pe+=this.renderer.table(yt,ot);continue}case"blockquote":{ot=this.parse(at.tokens),pe+=this.renderer.blockquote(ot);continue}case"list":{for(Lt=at.ordered,_t=at.start,Bt=at.loose,Pe=at.items.length,ot="",Ee=0;Ee<Pe;Ee++)Tt=at.items[Ee],sr=Tt.checked,Er=Tt.task,Ft="",Tt.task&&(zt=this.renderer.checkbox(sr),Bt?Tt.tokens.length>0&&Tt.tokens[0].type==="text"?(Tt.tokens[0].text=zt+" "+Tt.tokens[0].text,Tt.tokens[0].tokens&&Tt.tokens[0].tokens.length>0&&Tt.tokens[0].tokens[0].type==="text"&&(Tt.tokens[0].tokens[0].text=zt+" "+Tt.tokens[0].tokens[0].text)):Tt.tokens.unshift({type:"text",text:zt}):Ft+=zt),Ft+=this.parse(Tt.tokens,Bt),ot+=this.renderer.listitem(Ft,Er,sr);pe+=this.renderer.list(ot,Lt,_t);continue}case"html":{pe+=this.renderer.html(at.text);continue}case"paragraph":{pe+=this.renderer.paragraph(this.parseInline(at.tokens));continue}case"text":{for(ot=at.tokens?this.parseInline(at.tokens):at.text;me+1<cr&&ie[me+1].type==="text";)at=ie[++me],ot+=`
|
|
`+(at.tokens?this.parseInline(at.tokens):at.text);pe+=se?this.renderer.paragraph(ot):ot;continue}default:{var ct='Token with "'+at.type+'" type was not found.';if(this.options.silent){console.error(ct);return}else throw new Error(ct)}}}return pe},ae.parseInline=function(ie,se){se=se||this.renderer;var pe="",me,Ee,Le=ie.length;for(me=0;me<Le;me++){Ee=ie[me];switch(Ee.type){case"escape":{pe+=se.text(Ee.text);break}case"html":{pe+=se.html(Ee.text);break}case"link":{pe+=se.link(Ee.href,Ee.title,this.parseInline(Ee.tokens,se));break}case"image":{pe+=se.image(Ee.href,Ee.title,Ee.text);break}case"strong":{pe+=se.strong(this.parseInline(Ee.tokens,se));break}case"em":{pe+=se.em(this.parseInline(Ee.tokens,se));break}case"codespan":{pe+=se.codespan(Ee.text);break}case"br":{pe+=se.br();break}case"del":{pe+=se.del(this.parseInline(Ee.tokens,se));break}case"text":{pe+=se.text(Ee.text);break}default:{var Pe='Token with "'+Ee.type+'" type was not found.';if(this.options.silent){console.error(Pe);return}else throw new Error(Pe)}}}return pe},re}(),Xe=F.merge,He=F.checkSanitizeDeprecation,Ye=F.escape,Me=z.getDefaults,it=z.changeDefaults,qe=z.defaults;function he(re,ae,fe){if(typeof re=="undefined"||re===null)throw new Error("marked(): input parameter is undefined or null");if(typeof re!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(re)+", string expected");if(typeof ae=="function"&&(fe=ae,ae=null),ae=Xe({},he.defaults,ae||{}),He(ae),fe){var ie=ae.highlight,se;try{se=xe.lex(re,ae)}catch(Le){return fe(Le)}var pe=function(Pe){var Ke;if(!Pe)try{Ke=We.parse(se,ae)}catch(et){Pe=et}return ae.highlight=ie,Pe?fe(Pe):fe(null,Ke)};if(!ie||ie.length<3)return pe();if(delete ae.highlight,!se.length)return pe();var me=0;he.walkTokens(se,function(Le){Le.type==="code"&&(me++,setTimeout(function(){ie(Le.text,Le.lang,function(Pe,Ke){if(Pe)return pe(Pe);Ke!=null&&Ke!==Le.text&&(Le.text=Ke,Le.escaped=!0),me--,me===0&&pe()})},0))}),me===0&&pe();return}try{var Ee=xe.lex(re,ae);return ae.walkTokens&&he.walkTokens(Ee,ae.walkTokens),We.parse(Ee,ae)}catch(Le){if(Le.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,ae.silent)return"<p>An error occurred:</p><pre>"+Ye(Le.message+"",!0)+"</pre>";throw Le}}he.options=he.setOptions=function(re){return Xe(he.defaults,re),it(he.defaults),he},he.getDefaults=Me,he.defaults=qe,he.use=function(re){var ae=Xe({},re);if(re.renderer&&function(){var ie=he.defaults.renderer||new we,se=function(Ee){var Le=ie[Ee];ie[Ee]=function(){for(var Pe=arguments.length,Ke=new Array(Pe),et=0;et<Pe;et++)Ke[et]=arguments[et];var rt=re.renderer[Ee].apply(ie,Ke);return rt===!1&&(rt=Le.apply(ie,Ke)),rt}};for(var pe in re.renderer)se(pe);ae.renderer=ie}(),re.tokenizer&&function(){var ie=he.defaults.tokenizer||new be,se=function(Ee){var Le=ie[Ee];ie[Ee]=function(){for(var Pe=arguments.length,Ke=new Array(Pe),et=0;et<Pe;et++)Ke[et]=arguments[et];var rt=re.tokenizer[Ee].apply(ie,Ke);return rt===!1&&(rt=Le.apply(ie,Ke)),rt}};for(var pe in re.tokenizer)se(pe);ae.tokenizer=ie}(),re.walkTokens){var fe=he.defaults.walkTokens;ae.walkTokens=function(ie){re.walkTokens(ie),fe&&fe(ie)}}he.setOptions(ae)},he.walkTokens=function(re,ae){for(var fe=H(re),ie;!(ie=fe()).done;){var se=ie.value;ae(se);switch(se.type){case"table":{for(var pe=H(se.tokens.header),me;!(me=pe()).done;){var Ee=me.value;he.walkTokens(Ee,ae)}for(var Le=H(se.tokens.cells),Pe;!(Pe=Le()).done;)for(var Ke=Pe.value,et=H(Ke),rt;!(rt=et()).done;){var yt=rt.value;he.walkTokens(yt,ae)}break}case"list":{he.walkTokens(se.items,ae);break}default:se.tokens&&he.walkTokens(se.tokens,ae)}}},he.Parser=We,he.parser=We.parse,he.Renderer=we,he.TextRenderer=Oe,he.Lexer=xe,he.lexer=xe.lex,he.Tokenizer=be,he.Slugger=Ne,he.parse=he;var ee=he;return ee})},ELLl:function(Qe,Te,q){(function(oe){oe(q("VrN/"))})(function(oe){var Y={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},N=oe.Pos;oe.defineOption("autoCloseBrackets",!1,function(u,f,o){o&&o!=oe.Init&&(u.removeKeyMap(H),u.state.closeBrackets=null),f&&(M(J(f,"pairs")),u.state.closeBrackets=f,u.addKeyMap(H))});function J(u,f){return f=="pairs"&&typeof u=="string"?u:typeof u=="object"&&u[f]!=null?u[f]:Y[f]}var H={Backspace:r,Enter:O};function M(u){for(var f=0;f<u.length;f++){var o=u.charAt(f),l="'"+o+"'";H[l]||(H[l]=z(o))}}M(Y.pairs+"`");function z(u){return function(f){return m(f,u)}}function G(u){var f=u.state.closeBrackets;if(!f||f.override)return f;var o=u.getModeAt(u.getCursor());return o.closeBrackets||f}function r(u){var f=G(u);if(!f||u.getOption("disableInput"))return oe.Pass;for(var o=J(f,"pairs"),l=u.listSelections(),s=0;s<l.length;s++){if(!l[s].empty())return oe.Pass;var a=p(u,l[s].head);if(!a||o.indexOf(a)%2!=0)return oe.Pass}for(var s=l.length-1;s>=0;s--){var S=l[s].head;u.replaceRange("",N(S.line,S.ch-1),N(S.line,S.ch+1),"+delete")}}function O(u){var f=G(u),o=f&&J(f,"explode");if(!o||u.getOption("disableInput"))return oe.Pass;for(var l=u.listSelections(),s=0;s<l.length;s++){if(!l[s].empty())return oe.Pass;var a=p(u,l[s].head);if(!a||o.indexOf(a)%2!=0)return oe.Pass}u.operation(function(){var S=u.lineSeparator()||`
|
|
`;u.replaceSelection(S+S,null),u.execCommand("goCharLeft"),l=u.listSelections();for(var x=0;x<l.length;x++){var C=l[x].head.line;u.indentLine(C,null,!0),u.indentLine(C+1,null,!0)}})}function v(u){var f=oe.cmpPos(u.anchor,u.head)>0;return{anchor:new N(u.anchor.line,u.anchor.ch+(f?-1:1)),head:new N(u.head.line,u.head.ch+(f?1:-1))}}function m(u,f){var o=G(u);if(!o||u.getOption("disableInput"))return oe.Pass;var l=J(o,"pairs"),s=l.indexOf(f);if(s==-1)return oe.Pass;for(var a=J(o,"closeBefore"),S=J(o,"triples"),x=l.charAt(s+1)==f,C=u.listSelections(),D=s%2==0,L,R=0;R<C.length;R++){var A=C[R],T=A.head,d,w=u.getRange(T,N(T.line,T.ch+1));if(D&&!A.empty())d="surround";else if((x||!D)&&w==f)x&&h(u,T)?d="both":S.indexOf(f)>=0&&u.getRange(T,N(T.line,T.ch+3))==f+f+f?d="skipThree":d="skip";else if(x&&T.ch>1&&S.indexOf(f)>=0&&u.getRange(N(T.line,T.ch-2),T)==f+f){if(T.ch>2&&/\bstring/.test(u.getTokenTypeAt(N(T.line,T.ch-2))))return oe.Pass;d="addFour"}else if(x){var y=T.ch==0?" ":u.getRange(N(T.line,T.ch-1),T);if(!oe.isWordChar(w)&&y!=f&&!oe.isWordChar(y))d="both";else return oe.Pass}else if(D&&(w.length===0||/\s/.test(w)||a.indexOf(w)>-1))d="both";else return oe.Pass;if(!L)L=d;else if(L!=d)return oe.Pass}var b=s%2?l.charAt(s-1):f,j=s%2?f:l.charAt(s+1);u.operation(function(){if(L=="skip")u.execCommand("goCharRight");else if(L=="skipThree")for(var B=0;B<3;B++)u.execCommand("goCharRight");else if(L=="surround"){for(var E=u.getSelections(),B=0;B<E.length;B++)E[B]=b+E[B]+j;u.replaceSelections(E,"around"),E=u.listSelections().slice();for(var B=0;B<E.length;B++)E[B]=v(E[B]);u.setSelections(E)}else L=="both"?(u.replaceSelection(b+j,null),u.triggerElectric(b+j),u.execCommand("goCharLeft")):L=="addFour"&&(u.replaceSelection(b+b+b+b,"before"),u.execCommand("goCharRight"))})}function p(u,f){var o=u.getRange(N(f.line,f.ch-1),N(f.line,f.ch+1));return o.length==2?o:null}function h(u,f){var o=u.getTokenAt(N(f.line,f.ch+1));return/\bstring/.test(o.type)&&o.start==f.ch&&(f.ch==0||!/\bstring/.test(u.getTokenTypeAt(f)))}})},FWmy:function(Qe,Te,q){"use strict";q.d(Te,"a",function(){return oe});function oe(Y,N){if(!Y)throw new Error(N?`Assertion failed (${N})`:"Assertion Failed")}},GfqC:function(Qe,Te,q){"use strict";var oe=q("q1tI"),Y=q.n(oe),N=q("TSYQ"),J=q.n(N);function H(F,I){var g="cannot "+F.method+" "+F.action+" "+I.status+"'",W=new Error(g);return W.status=I.status,W.method=F.method,W.url=F.action,W}function M(F){var I=F.responseText||F.response;if(!I)return I;try{return JSON.parse(I)}catch(g){return I}}function z(F){var I=new XMLHttpRequest;F.onProgress&&I.upload&&(I.upload.onprogress=function(le){le.total>0&&(le.percent=le.loaded/le.total*100),F.onProgress(le)});var g=new FormData;F.data&&Object.keys(F.data).forEach(function($){var le=F.data[$];if(Array.isArray(le)){le.forEach(function(de){g.append($+"[]",de)});return}g.append($,F.data[$])}),F.file instanceof Blob?g.append(F.filename,F.file,F.file.name):g.append(F.filename,F.file),I.onerror=function(le){F.onError(le)},I.onload=function(){return I.status<200||I.status>=300?F.onError(H(F,I),M(I)):F.onSuccess(M(I),I)},I.open(F.method,F.action,!0),F.withCredentials&&"withCredentials"in I&&(I.withCredentials=!0);var W=F.headers||{};return W["X-Requested-With"]!==null&&I.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(W).forEach(function($){W[$]!==null&&I.setRequestHeader($,W[$])}),I.send(g),{abort:function(){I.abort()}}}var G=+new Date,r=0;function O(){return"rc-upload-"+G+"-"+ ++r}function v(F,I){return F.indexOf(I,F.length-I.length)!==-1}var m=function(F,I){if(F&&I){var g=Array.isArray(I)?I:I.split(","),W=F.name||"",$=F.type||"",le=$.replace(/\/.*$/,"");return g.some(function(de){var Ce=de.trim();return Ce.charAt(0)==="."?v(W.toLowerCase(),Ce.toLowerCase()):/\/\*$/.test(Ce)?le===Ce.replace(/\/.*$/,""):$===Ce})}return!0};function p(F,I){var g=F.createReader(),W=[];function $(){g.readEntries(function(le){var de=Array.prototype.slice.apply(le);W=W.concat(de);var Ce=!de.length;Ce?I(W):$()})}$()}var h=function(I,g,W){var $=function le(de,Ce){Ce=Ce||"",de.isFile?de.file(function(be){W(be)&&(de.fullPath&&!be.webkitRelativePath&&(Object.defineProperties(be,{webkitRelativePath:{writable:!0}}),be.webkitRelativePath=de.fullPath.replace(/^\//,""),Object.defineProperties(be,{webkitRelativePath:{writable:!1}})),g([be]))}):de.isDirectory&&p(de,function(be){be.forEach(function(Ae){le(Ae,""+Ce+de.name+"/")})})};I.forEach(function(le){$(le.webkitGetAsEntry())})},u=h,f=Object.assign||function(F){for(var I=1;I<arguments.length;I++){var g=arguments[I];for(var W in g)Object.prototype.hasOwnProperty.call(g,W)&&(F[W]=g[W])}return F},o=function(){function F(I,g){var W=[],$=!0,le=!1,de=void 0;try{for(var Ce=I[Symbol.iterator](),be;!($=(be=Ce.next()).done)&&!(W.push(be.value),g&&W.length===g);$=!0);}catch(Ae){le=!0,de=Ae}finally{try{!$&&Ce.return&&Ce.return()}finally{if(le)throw de}}return W}return function(I,g){if(Array.isArray(I))return I;if(Symbol.iterator in Object(I))return F(I,g);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=function(){function F(I,g){for(var W=0;W<g.length;W++){var $=g[W];$.enumerable=$.enumerable||!1,$.configurable=!0,"value"in $&&($.writable=!0),Object.defineProperty(I,$.key,$)}}return function(I,g,W){return g&&F(I.prototype,g),W&&F(I,W),I}}();function s(F,I,g){return I in F?Object.defineProperty(F,I,{value:g,enumerable:!0,configurable:!0,writable:!0}):F[I]=g,F}function a(F,I){var g={};for(var W in F){if(I.indexOf(W)>=0)continue;if(!Object.prototype.hasOwnProperty.call(F,W))continue;g[W]=F[W]}return g}function S(F,I){if(!(F instanceof I))throw new TypeError("Cannot call a class as a function")}function x(F,I){if(!F)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I&&(typeof I=="object"||typeof I=="function")?I:F}function C(F,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);F.prototype=Object.create(I&&I.prototype,{constructor:{value:F,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(F,I):F.__proto__=I)}var D=function(I){return Object.keys(I).reduce(function(g,W){return(W.substr(0,5)==="data-"||W.substr(0,5)==="aria-"||W==="role")&&(g[W]=I[W]),g},{})},L=function(F){C(I,F);function I(){var g,W,$,le;S(this,I);for(var de=arguments.length,Ce=Array(de),be=0;be<de;be++)Ce[be]=arguments[be];return le=(W=($=x(this,(g=I.__proto__||Object.getPrototypeOf(I)).call.apply(g,[this].concat(Ce))),$),$.state={uid:O()},$.reqs={},$.onChange=function(Ae){var Se=Ae.target.files;$.uploadFiles(Se),$.reset()},$.onClick=function(Ae){var Se=$.fileInput;if(!Se)return;var Re=$.props,ve=Re.children,X=Re.onClick;ve&&ve.type==="button"&&(Se.parentNode.focus(),Se.parentNode.querySelector("button").blur()),Se.click(),X&&X(Ae)},$.onKeyDown=function(Ae){Ae.key==="Enter"&&$.onClick()},$.onFileDrop=function(Ae){var Se=$.props.multiple;if(Ae.preventDefault(),Ae.type==="dragover")return;if($.props.directory)u(Array.prototype.slice.call(Ae.dataTransfer.items),$.uploadFiles,function(ve){return m(ve,$.props.accept)});else{var Re=Array.prototype.slice.call(Ae.dataTransfer.files).filter(function(ve){return m(ve,$.props.accept)});Se===!1&&(Re=Re.slice(0,1)),$.uploadFiles(Re)}},$.uploadFiles=function(Ae){var Se=Array.prototype.slice.call(Ae);Se.map(function(Re){return Re.uid=O(),Re}).forEach(function(Re){$.upload(Re,Se)})},$.saveFileInput=function(Ae){$.fileInput=Ae},W),x($,le)}return l(I,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(W,$){var le=this,de=this.props;if(!de.beforeUpload)return setTimeout(function(){return le.post(W)},0);var Ce=de.beforeUpload(W,$);Ce&&Ce.then?Ce.then(function(be){var Ae=Object.prototype.toString.call(be);return Ae==="[object File]"||Ae==="[object Blob]"?le.post(be):le.post(W)}).catch(function(be){console.log(be)}):Ce!==!1&&setTimeout(function(){return le.post(W)},0);return}},{key:"post",value:function(W){var $=this;if(!this._isMounted)return;var le=this.props,de=le.onStart,Ce=le.onProgress,be=le.transformFile,Ae=be===void 0?function(Se){return Se}:be;new Promise(function(Se){var Re=le.action;return typeof Re=="function"&&(Re=Re(W)),Se(Re)}).then(function(Se){var Re=W.uid,ve=le.customRequest||z,X=Promise.resolve(Ae(W)).then(function(_){var k=le.data;return typeof k=="function"&&(k=k(_)),Promise.all([_,k])}).catch(function(_){console.error(_)});X.then(function(_){var k=o(_,2),U=k[0],Q=k[1],K={action:Se,filename:le.name,data:Q,file:U,headers:le.headers,withCredentials:le.withCredentials,method:le.method||"post",onProgress:Ce?function(ce){Ce(ce,W)}:null,onSuccess:function(xe,De){delete $.reqs[Re],le.onSuccess(xe,W,De)},onError:function(xe,De){delete $.reqs[Re],le.onError(xe,De,W)}};de(W),$.reqs[Re]=ve(K)})})}},{key:"reset",value:function(){this.setState({uid:O()})}},{key:"abort",value:function(W){var $=this.reqs;if(W){var le=W;W&&W.uid&&(le=W.uid),$[le]&&$[le].abort&&$[le].abort(),delete $[le]}else Object.keys($).forEach(function(de){$[de]&&$[de].abort&&$[de].abort(),delete $[de]})}},{key:"render",value:function(){var W,$=this.props,le=$.component,de=$.prefixCls,Ce=$.className,be=$.disabled,Ae=$.id,Se=$.style,Re=$.multiple,ve=$.accept,X=$.children,_=$.directory,k=$.openFileDialogOnClick,U=$.onMouseEnter,Q=$.onMouseLeave,K=a($,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),ce=J()((W={},s(W,de,!0),s(W,de+"-disabled",be),s(W,Ce,Ce),W)),xe=be?{}:{onClick:k?this.onClick:function(){},onKeyDown:k?this.onKeyDown:function(){},onMouseEnter:U,onMouseLeave:Q,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return Y.a.createElement(le,f({},xe,{className:ce,role:"button",style:Se}),Y.a.createElement("input",f({},D(K),{id:Ae,type:"file",ref:this.saveFileInput,onClick:function(ue){return ue.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ve,directory:_?"directory":null,webkitdirectory:_?"webkitdirectory":null,multiple:Re,onChange:this.onChange})),X)}}]),I}(oe.Component),R=L,A=Object.assign||function(F){for(var I=1;I<arguments.length;I++){var g=arguments[I];for(var W in g)Object.prototype.hasOwnProperty.call(g,W)&&(F[W]=g[W])}return F},T=function(){function F(I,g){for(var W=0;W<g.length;W++){var $=g[W];$.enumerable=$.enumerable||!1,$.configurable=!0,"value"in $&&($.writable=!0),Object.defineProperty(I,$.key,$)}}return function(I,g,W){return g&&F(I.prototype,g),W&&F(I,W),I}}();function d(F,I){if(!(F instanceof I))throw new TypeError("Cannot call a class as a function")}function w(F,I){if(!F)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I&&(typeof I=="object"||typeof I=="function")?I:F}function y(F,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);F.prototype=Object.create(I&&I.prototype,{constructor:{value:F,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(F,I):F.__proto__=I)}function b(){}var j=function(F){y(I,F);function I(){var g,W,$,le;d(this,I);for(var de=arguments.length,Ce=Array(de),be=0;be<de;be++)Ce[be]=arguments[be];return le=(W=($=w(this,(g=I.__proto__||Object.getPrototypeOf(I)).call.apply(g,[this].concat(Ce))),$),$.saveUploader=function(Ae){$.uploader=Ae},W),w($,le)}return T(I,[{key:"abort",value:function(W){this.uploader.abort(W)}},{key:"render",value:function(){return Y.a.createElement(R,A({},this.props,{ref:this.saveUploader}))}}]),I}(oe.Component);j.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:b,onError:b,onSuccess:b,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var B=j,E=Te.a=B},HmJG:function(Qe,Te,q){},JYp7:function(Qe,Te,q){"use strict";q.d(Te,"a",function(){return oe});var oe;(function(Y){function N(a){return a&&typeof a=="object"&&typeof a[Symbol.iterator]=="function"}Y.is=N;const J=Object.freeze([]);function H(){return J}Y.empty=H;function*M(a){yield a}Y.single=M;function z(a){return a||J}Y.from=z;function G(a){return!a||a[Symbol.iterator]().next().done===!0}Y.isEmpty=G;function r(a){return a[Symbol.iterator]().next().value}Y.first=r;function O(a,S){for(const x of a)if(S(x))return!0;return!1}Y.some=O;function v(a,S){for(const x of a)if(S(x))return x;return}Y.find=v;function*m(a,S){for(const x of a)S(x)&&(yield x)}Y.filter=m;function*p(a,S){let x=0;for(const C of a)yield S(C,x++)}Y.map=p;function*h(...a){for(const S of a)for(const x of S)yield x}Y.concat=h;function*u(a){for(const S of a)for(const x of S)yield x}Y.concatNested=u;function f(a,S,x){let C=x;for(const D of a)C=S(C,D);return C}Y.reduce=f;function*o(a,S,x=a.length){for(S<0&&(S+=a.length),x<0?x+=a.length:x>a.length&&(x=a.length);S<x;S++)yield a[S]}Y.slice=o;function l(a,S=Number.POSITIVE_INFINITY){const x=[];if(S===0)return[x,a];const C=a[Symbol.iterator]();for(let D=0;D<S;D++){const L=C.next();if(L.done)return[x,Y.empty()];x.push(L.value)}return[x,{[Symbol.iterator](){return C}}]}Y.consume=l;function s(a,S,x=(C,D)=>C===D){const C=a[Symbol.iterator](),D=S[Symbol.iterator]();for(;;){const L=C.next(),R=D.next();if(L.done!==R.done)return!1;if(L.done)return!0;if(!x(L.value,R.value))return!1}}Y.equals=s})(oe||(oe={}))},LdHM:function(Qe,Te,q){"use strict";q.d(Te,"b",function(){return a}),q.d(Te,"a",function(){return x});var oe=q("1OyB"),Y=q("vuIU"),N=q("Ji7U"),J=q("LK+K"),H=q("q1tI"),M=q("rePB"),z=q("Ff2n"),G=q("ODXe"),r=q("4IlW"),O=q("bX4T"),v=q("YrtM"),m=q("TSYQ"),p=q.n(m),h=q("+nKL"),u=q("8OUc"),f=function(W,$){var le=W.prefixCls,de=W.id,Ce=W.flattenOptions,be=W.childrenAsData,Ae=W.values,Se=W.searchValue,Re=W.multiple,ve=W.defaultActiveFirstOption,X=W.height,_=W.itemHeight,k=W.notFoundContent,U=W.open,Q=W.menuItemSelectedIcon,K=W.virtual,ce=W.onSelect,xe=W.onToggleOpen,De=W.onActiveValue,ue=W.onScroll,ge=W.onMouseEnter,we="".concat(le,"-item"),Oe=Object(v.a)(function(){return Ce},[U,Ce],function(ee,re){return re[0]&&ee[1]!==re[1]}),Ne=H.useRef(null),Ue=function(re){re.preventDefault()},Ge=function(re){Ne.current&&Ne.current.scrollTo({index:re})},We=function(re){for(var ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,fe=Oe.length,ie=0;ie<fe;ie+=1){var se=(re+ie*ae+fe)%fe,pe=Oe[se],me=pe.group,Ee=pe.data;if(!me&&!Ee.disabled)return se}return-1},Xe=H.useState(function(){return We(0)}),He=Object(G.a)(Xe,2),Ye=He[0],Me=He[1],it=function(re){Me(re);var ae=Oe[re];if(!ae){De(null,-1);return}De(ae.data.value,re)};H.useEffect(function(){it(ve!==!1?We(0):-1)},[Oe.length,Se]),H.useEffect(function(){var ee=setTimeout(function(){if(!Re&&U&&Ae.size===1){var re=Array.from(Ae)[0],ae=Oe.findIndex(function(fe){var ie=fe.data;return ie.value===re});it(ae),Ge(ae)}});return function(){return clearTimeout(ee)}},[U]);var qe=function(re){re!==void 0&&ce(re,{selected:!Ae.has(re)}),Re||xe(!1)};if(H.useImperativeHandle($,function(){return{onKeyDown:function(re){var ae=re.which;switch(ae){case r.a.UP:case r.a.DOWN:{var fe=0;if(ae===r.a.UP?fe=-1:ae===r.a.DOWN&&(fe=1),fe!==0){var ie=We(Ye+fe,fe);Ge(ie),it(ie)}break}case r.a.ENTER:{var se=Oe[Ye];se&&!se.data.disabled?qe(se.data.value):qe(void 0),U&&re.preventDefault();break}case r.a.ESC:xe(!1)}},onKeyUp:function(){},scrollTo:function(re){Ge(re)}}}),Oe.length===0)return H.createElement("div",{role:"listbox",id:"".concat(de,"_list"),className:"".concat(we,"-empty"),onMouseDown:Ue},k);function he(ee){var re=Oe[ee];if(!re)return null;var ae=re.data||{},fe=ae.value,ie=ae.label,se=ae.children,pe=Object(O.a)(ae,!0),me=be?se:ie;return re?H.createElement("div",Object.assign({"aria-label":typeof me=="string"?me:null},pe,{key:ee,role:"option",id:"".concat(de,"_list_").concat(ee),"aria-selected":Ae.has(fe)}),fe):null}return H.createElement(H.Fragment,null,H.createElement("div",{role:"listbox",id:"".concat(de,"_list"),style:{height:0,width:0,overflow:"hidden"}},he(Ye-1),he(Ye),he(Ye+1)),H.createElement(h.a,{itemKey:"key",ref:Ne,data:Oe,height:X,itemHeight:_,fullHeight:!1,onMouseDown:Ue,onScroll:ue,virtual:K,onMouseEnter:ge},function(ee,re){var ae,fe=ee.group,ie=ee.groupOption,se=ee.data,pe=se.label,me=se.key;if(fe)return H.createElement("div",{className:p()(we,"".concat(we,"-group"))},pe!==void 0?pe:me);var Ee=se.disabled,Le=se.value,Pe=se.title,Ke=se.children,et=se.style,rt=se.className,yt=Object(z.a)(se,["disabled","value","title","children","style","className"]),ot=Ae.has(Le),at="".concat(we,"-option"),Lt=p()(we,at,rt,(ae={},Object(M.a)(ae,"".concat(at,"-grouped"),ie),Object(M.a)(ae,"".concat(at,"-active"),Ye===re&&!Ee),Object(M.a)(ae,"".concat(at,"-disabled"),Ee),Object(M.a)(ae,"".concat(at,"-selected"),ot),ae)),_t=be?Ke:pe,Bt=!Q||typeof Q=="function"||ot;return H.createElement("div",Object.assign({},yt,{"aria-selected":ot,className:Lt,title:Pe,onMouseMove:function(){if(Ye===re||Ee)return;it(re)},onClick:function(){Ee||qe(Le)},style:et}),H.createElement("div",{className:"".concat(at,"-content")},_t||Le),H.isValidElement(Q)||ot,Bt&&H.createElement(u.a,{className:"".concat(we,"-option-state"),customizeIcon:Q,customizeIconProps:{isSelected:ot}},ot?"\u2713":null))}))},o=H.forwardRef(f);o.displayName="OptionList";var l=o,s=function(){return null};s.isSelectOption=!0;var a=s,S=function(){return null};S.isSelectOptGroup=!0;var x=S,C=q("VTBJ"),D=q("Zm9Q");function L(g){var W=g.key,$=g.props,le=$.children,de=$.value,Ce=Object(z.a)($,["children","value"]);return Object(C.a)({key:W,value:de!==void 0?de:W,children:le},Ce)}function R(g){var W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(D.a)(g).map(function($,le){if(!H.isValidElement($)||!$.type)return null;var de=$.type.isSelectOptGroup,Ce=$.key,be=$.props,Ae=be.children,Se=Object(z.a)(be,["children"]);return W||!de?L($):Object(C.a)(Object(C.a)({key:"__RC_SELECT_GRP__".concat(Ce===null?le:Ce,"__"),label:Ce},Se),{},{options:R(Ae)})}).filter(function($){return $})}var A=q("2Qr1"),T=q("qNPg"),d=q("U8pU"),w=q("Kwbf"),y=q("WKfj");function b(g){var W=g.mode,$=g.options,le=g.children,de=g.backfill,Ce=g.allowClear,be=g.placeholder,Ae=g.getInputElement,Se=g.showSearch,Re=g.onSearch,ve=g.defaultOpen,X=g.autoFocus,_=g.labelInValue,k=g.value,U=g.inputValue,Q=g.optionLabelProp,K=W==="multiple"||W==="tags",ce=Se!==void 0?Se:K||W==="combobox",xe=$||R(le);if(Object(w.a)(W!=="tags"||xe.every(function(we){return!we.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),W==="tags"||W==="combobox"){var De=xe.some(function(we){return we.options?we.options.some(function(Oe){return typeof("value"in Oe?Oe.value:Oe.key)=="number"}):typeof("value"in we?we.value:we.key)=="number"});Object(w.a)(!De,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(w.a)(W!=="combobox"||!Q,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(w.a)(W==="combobox"||!de,"`backfill` only works with `combobox` mode."),Object(w.a)(W==="combobox"||!Ae,"`getInputElement` only work with `combobox` mode."),Object(w.b)(W!=="combobox"||!Ae||!Ce||!be,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Re&&!ce&&W!=="combobox"&&W!=="tags"&&Object(w.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(w.b)(!ve||X,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),k!=null){var ue=Object(y.d)(k);Object(w.a)(!_||ue.every(function(we){return Object(d.a)(we)==="object"&&("key"in we||"value"in we)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(w.a)(!K||Array.isArray(k),"`value` should be array when `mode` is `multiple` or `tags`")}if(le){var ge=null;Object(D.a)(le).some(function(we){if(!H.isValidElement(we)||!we.type)return!1;var Oe=we.type;if(Oe.isSelectOption)return!1;if(Oe.isSelectOptGroup){var Ne=Object(D.a)(we.props.children).every(function(Ue){return!H.isValidElement(Ue)||!we.type||Ue.type.isSelectOption?!0:(ge=Ue.type,!1)});return!Ne}return ge=Oe,!0}),ge&&Object(w.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(ge.displayName||ge.name||ge,"`.")),Object(w.a)(U===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var j=b,B=Object(T.a)({prefixCls:"rc-select",components:{optionList:l},convertChildrenToData:R,flattenOptions:A.d,getLabeledValue:A.e,filterOptions:A.b,isValueDisabled:A.g,findValueOption:A.c,warningProps:j,fillOptionsWithMissingValue:A.a}),E=function(g){Object(N.a)($,g);var W=Object(J.a)($);function $(){var le;return Object(oe.a)(this,$),le=W.apply(this,arguments),le.selectRef=H.createRef(),le.focus=function(){le.selectRef.current.focus()},le.blur=function(){le.selectRef.current.blur()},le}return Object(Y.a)($,[{key:"render",value:function(){return H.createElement(B,Object.assign({ref:this.selectRef},this.props))}}]),$}(H.Component);E.Option=a,E.OptGroup=x;var F=E,I=Te.c=F},M8RZ:function(Qe,Te,q){"use strict";q.d(Te,"a",function(){return r});var oe=q("fWQN"),Y=q("mtLc"),N=q("yKVA"),J=q("879j"),H=q("q1tI"),M=q.n(H),z=q("i8i4"),G=q.n(z),r=function(O){Object(N.a)(m,O);var v=Object(J.a)(m);function m(p){var h;Object(oe.a)(this,m),h=v.call(this,p);var u=window.document;return h.node=u.createElement("div"),u.body.appendChild(h.node),h}return Object(Y.a)(m,[{key:"render",value:function(){var h=this.props.children;return Object(z.createPortal)(h,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),m}(M.a.Component)},MI8n:function(Qe,Te,q){"use strict";q.d(Te,"c",function(){return H}),q.d(Te,"b",function(){return r}),q.d(Te,"e",function(){return O}),q.d(Te,"a",function(){return v}),q.d(Te,"d",function(){return m}),q.d(Te,"f",function(){return p});var oe=q("/cxE"),Y=q("pmY6"),N=q("24hK"),J=q("5Y4S"),H;(function(h){h.None=()=>Y.a.None;function u(b){return(j,B=null,E)=>{let F=!1,I;return I=b(g=>F?void 0:(I?I.dispose():F=!0,j.call(B,g)),null,E),F&&I.dispose(),I}}h.once=u;function f(b,j){return x((B,E=null,F)=>b(I=>B.call(E,j(I)),null,F))}h.map=f;function o(b,j){return x((B,E=null,F)=>b(I=>{j(I),B.call(E,I)},null,F))}h.forEach=o;function l(b,j){return x((B,E=null,F)=>b(I=>j(I)&&B.call(E,I),null,F))}h.filter=l;function s(b){return b}h.signal=s;function a(...b){return(j,B=null,E)=>Object(Y.e)(...b.map(F=>F(I=>j.call(B,I),null,E)))}h.any=a;function S(b,j,B){let E=B;return f(b,F=>(E=j(E,F),E))}h.reduce=S;function x(b){let j;const B=new r({onFirstListenerAdd(){j=b(B.fire,B)},onLastListenerRemove(){j.dispose()}});return B.event}function C(b,j,B=100,E=!1,F){let I,g,W,$=0;const le=new r({leakWarningThreshold:F,onFirstListenerAdd(){I=b(de=>{$++,g=j(g,de),E&&!W&&(le.fire(g),g=void 0),clearTimeout(W),W=setTimeout(()=>{const Ce=g;g=void 0,W=void 0,(!E||$>1)&&le.fire(Ce),$=0},B)})},onLastListenerRemove(){I.dispose()}});return le.event}h.debounce=C;function D(b,j=(B,E)=>B===E){let B=!0,E;return l(b,F=>{const I=B||!j(F,E);return B=!1,E=F,I})}h.latch=D;function L(b,j){return[h.filter(b,j),h.filter(b,B=>!j(B))]}h.split=L;function R(b,j=!1,B=[]){let E=B.slice(),F=b(W=>{E?E.push(W):g.fire(W)});const I=()=>{E&&E.forEach(W=>g.fire(W)),E=null},g=new r({onFirstListenerAdd(){F||(F=b(W=>g.fire(W)))},onFirstListenerDidAdd(){E&&(j?setTimeout(I):I())},onLastListenerRemove(){F&&F.dispose(),F=null}});return g.event}h.buffer=R;class A{constructor(b){this.event=b}map(b){return new A(f(this.event,b))}forEach(b){return new A(o(this.event,b))}filter(b){return new A(l(this.event,b))}reduce(b,j){return new A(S(this.event,b,j))}latch(){return new A(D(this.event))}debounce(b,j=100,B=!1,E){return new A(C(this.event,b,j,B,E))}on(b,j,B){return this.event(b,j,B)}once(b,j,B){return u(this.event)(b,j,B)}}function T(b){return new A(b)}h.chain=T;function d(b,j,B=E=>E){const E=(...W)=>g.fire(B(...W)),F=()=>b.on(j,E),I=()=>b.removeListener(j,E),g=new r({onFirstListenerAdd:F,onLastListenerRemove:I});return g.event}h.fromNodeEventEmitter=d;function w(b,j,B=E=>E){const E=(...W)=>g.fire(B(...W)),F=()=>b.addEventListener(j,E),I=()=>b.removeEventListener(j,E),g=new r({onFirstListenerAdd:F,onLastListenerRemove:I});return g.event}h.fromDOMEventEmitter=w;function y(b){return new Promise(j=>u(b)(j))}h.toPromise=y})(H||(H={}));class M{constructor(h){this._listenerCount=0,this._invocationCount=0,this._elapsedOverall=0,this._name=`${h}_${M._idPool++}`}start(h){this._stopWatch=new J.a(!0),this._listenerCount=h}stop(){if(this._stopWatch){const h=this._stopWatch.elapsed();this._elapsedOverall+=h,this._invocationCount+=1,console.info(`did FIRE ${this._name}: elapsed_ms: ${h.toFixed(5)}, listener: ${this._listenerCount} (elapsed_overall: ${this._elapsedOverall.toFixed(2)}, invocations: ${this._invocationCount})`),this._stopWatch=void 0}}}M._idPool=0;let z=-1;class G{constructor(h,u=Math.random().toString(18).slice(2,5)){this.customThreshold=h,this.name=u,this._warnCountdown=0}dispose(){this._stacks&&this._stacks.clear()}check(h){let u=z;if(typeof this.customThreshold=="number"&&(u=this.customThreshold),u<=0||h<u)return;this._stacks||(this._stacks=new Map);const f=new Error().stack.split(`
|
|
`).slice(3).join(`
|
|
`),o=this._stacks.get(f)||0;if(this._stacks.set(f,o+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=u*.5;let l,s=0;for(const[a,S]of this._stacks)(!l||s<S)&&(l=a,s=S);console.warn(`[${this.name}] potential listener LEAK detected, having ${h} listeners already. MOST frequent listener (${s}):`),console.warn(l)}return()=>{const l=this._stacks.get(f)||0;this._stacks.set(f,l-1)}}}class r{constructor(h){var u;this._disposed=!1,this._options=h,this._leakageMon=z>0?new G(this._options&&this._options.leakWarningThreshold):void 0,this._perfMon=((u=this._options)===null||u===void 0?void 0:u._profName)?new M(this._options._profName):void 0}get event(){return this._event||(this._event=(h,u,f)=>{var o;this._listeners||(this._listeners=new N.a);const l=this._listeners.isEmpty();l&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const s=this._listeners.push(u?[h,u]:h);l&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,h,u);const a=(o=this._leakageMon)===null||o===void 0?void 0:o.check(this._listeners.size),S=Object(Y.i)(()=>{if(a&&a(),!this._disposed&&(s(),this._options&&this._options.onLastListenerRemove)){const x=this._listeners&&!this._listeners.isEmpty();x||this._options.onLastListenerRemove(this)}});return f instanceof Y.b?f.add(S):Array.isArray(f)&&f.push(S),S}),this._event}fire(h){var u,f;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new N.a);for(let o of this._listeners)this._deliveryQueue.push([o,h]);for((u=this._perfMon)===null||u===void 0||u.start(this._deliveryQueue.size);this._deliveryQueue.size>0;){const[o,l]=this._deliveryQueue.shift();try{typeof o=="function"?o.call(void 0,l):o[0].call(o[1],l)}catch(s){Object(oe.f)(s)}}(f=this._perfMon)===null||f===void 0||f.stop()}}dispose(){var h,u,f,o,l;this._disposed||(this._disposed=!0,(h=this._listeners)===null||h===void 0||h.clear(),(u=this._deliveryQueue)===null||u===void 0||u.clear(),(o=(f=this._options)===null||f===void 0?void 0:f.onLastListenerRemove)===null||o===void 0||o.call(f),(l=this._leakageMon)===null||l===void 0||l.dispose())}}class O extends r{constructor(h){super(h);this._isPaused=0,this._eventQueue=new N.a,this._mergeFn=h==null?void 0:h.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){const h=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(h))}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(h){this._listeners&&(this._isPaused!==0?this._eventQueue.push(h):super.fire(h))}}class v extends O{constructor(h){var u;super(h);this._delay=(u=h.delay)!==null&&u!==void 0?u:100}fire(h){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(h)}}class m{constructor(){this.buffers=[]}wrapEvent(h){return(u,f,o)=>h(l=>{const s=this.buffers[this.buffers.length-1];s?s.push(()=>u.call(f,l)):u.call(f,l)},void 0,o)}bufferEvents(h){const u=[];this.buffers.push(u);const f=h();return this.buffers.pop(),u.forEach(o=>o()),f}}class p{constructor(){this.listening=!1,this.inputEvent=H.None,this.inputEventListener=Y.a.None,this.emitter=new r({onFirstListenerDidAdd:()=>{this.listening=!0,this.inputEventListener=this.inputEvent(this.emitter.fire,this.emitter)},onLastListenerRemove:()=>{this.listening=!1,this.inputEventListener.dispose()}}),this.event=this.emitter.event}set input(h){this.inputEvent=h,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=h(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}},MNsG:function(Qe,Te,q){"use strict";(function(oe,Y){q.d(Te,"b",function(){return f}),q.d(Te,"i",function(){return a}),q.d(Te,"f",function(){return S}),q.d(Te,"d",function(){return x}),q.d(Te,"g",function(){return C}),q.d(Te,"h",function(){return D}),q.d(Te,"c",function(){return L}),q.d(Te,"k",function(){return R}),q.d(Te,"j",function(){return A}),q.d(Te,"a",function(){return T}),q.d(Te,"e",function(){return y});var N;const J="en";let H=!1,M=!1,z=!1,G=!1,r=!1,O=!1,v=!1,m,p=J,h,u;const f=typeof self=="object"?self:typeof oe=="object"?oe:{};let o;typeof f.vscode!="undefined"&&typeof f.vscode.process!="undefined"?o=f.vscode.process:typeof Y!="undefined"&&(o=Y);const l=typeof((N=o==null?void 0:o.versions)===null||N===void 0?void 0:N.electron)=="string"&&o.type==="renderer";if(typeof navigator=="object"&&!l)u=navigator.userAgent,H=u.indexOf("Windows")>=0,M=u.indexOf("Macintosh")>=0,v=(u.indexOf("Macintosh")>=0||u.indexOf("iPad")>=0||u.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,z=u.indexOf("Linux")>=0,O=!0,m=navigator.language,p=m;else if(typeof o=="object"){H=o.platform==="win32",M=o.platform==="darwin",z=o.platform==="linux",G=z&&!!o.env.SNAP&&!!o.env.SNAP_REVISION,m=J,p=J;const b=o.env.VSCODE_NLS_CONFIG;if(b)try{const j=JSON.parse(b),B=j.availableLanguages["*"];m=j.locale,p=B||J,h=j._translationsConfigFile}catch(j){}r=!0}else console.error("Unable to resolve platform.");let s=0;M?s=1:H?s=3:z&&(s=2);const a=H,S=M,x=z,C=r,D=O,L=v,R=u,A=function(){if(f.setImmediate)return f.setImmediate.bind(f);if(typeof f.postMessage=="function"&&!f.importScripts){let B=[];f.addEventListener("message",F=>{if(F.data&&F.data.vscodeSetImmediateId)for(let I=0,g=B.length;I<g;I++){const W=B[I];if(W.id===F.data.vscodeSetImmediateId){B.splice(I,1),W.callback();return}}});let E=0;return F=>{const I=++E;B.push({id:I,callback:F}),f.postMessage({vscodeSetImmediateId:I},"*")}}if(typeof(o==null?void 0:o.nextTick)=="function")return o.nextTick.bind(o);const j=Promise.resolve();return B=>j.then(B)}(),T=M||v?2:H?1:3;let d=!0,w=!1;function y(){if(!w){w=!0;const b=new Uint8Array(2);b[0]=1,b[1]=2;const j=new Uint16Array(b.buffer);d=j[0]===(2<<8)+1}return d}}).call(this,q("IyRk"),q("Q2Ig"))},N0LK:function(Qe,Te,q){"use strict";q.d(Te,"C",function(){return oe}),q.d(Te,"v",function(){return N}),q.d(Te,"s",function(){return J}),q.d(Te,"t",function(){return H}),q.d(Te,"U",function(){return M}),q.d(Te,"J",function(){return z}),q.d(Te,"O",function(){return G}),q.d(Te,"p",function(){return r}),q.d(Te,"T",function(){return O}),q.d(Te,"q",function(){return v}),q.d(Te,"N",function(){return m}),q.d(Te,"M",function(){return p}),q.d(Te,"Q",function(){return h}),q.d(Te,"u",function(){return u}),q.d(Te,"x",function(){return f}),q.d(Te,"I",function(){return o}),q.d(Te,"f",function(){return l}),q.d(Te,"h",function(){return s}),q.d(Te,"g",function(){return a}),q.d(Te,"i",function(){return S}),q.d(Te,"G",function(){return x}),q.d(Te,"H",function(){return C}),q.d(Te,"r",function(){return D}),q.d(Te,"R",function(){return L}),q.d(Te,"d",function(){return R}),q.d(Te,"e",function(){return A}),q.d(Te,"E",function(){return T}),q.d(Te,"F",function(){return d}),q.d(Te,"j",function(){return w}),q.d(Te,"z",function(){return y}),q.d(Te,"K",function(){return j}),q.d(Te,"L",function(){return B}),q.d(Te,"m",function(){return F}),q.d(Te,"k",function(){return g}),q.d(Te,"A",function(){return $}),q.d(Te,"a",function(){return le}),q.d(Te,"n",function(){return de}),q.d(Te,"l",function(){return Ce}),q.d(Te,"D",function(){return be}),q.d(Te,"B",function(){return Ae}),q.d(Te,"b",function(){return Se}),q.d(Te,"S",function(){return Re}),q.d(Te,"o",function(){return ve}),q.d(Te,"P",function(){return X}),q.d(Te,"w",function(){return _}),q.d(Te,"c",function(){return k}),q.d(Te,"y",function(){return K});function oe(ue){return!ue||typeof ue!="string"?!0:ue.trim().length===0}const Y=/{(\d+)}/g;function N(ue,...ge){return ge.length===0?ue:ue.replace(Y,function(we,Oe){const Ne=parseInt(Oe,10);return isNaN(Ne)||Ne<0||Ne>=ge.length?we:ge[Ne]})}function J(ue){return ue.replace(/[<>&]/g,function(ge){switch(ge){case"<":return"<";case">":return">";case"&":return"&";default:return ge}})}function H(ue){return ue.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function M(ue,ge=" "){const we=z(ue,ge);return G(we,ge)}function z(ue,ge){if(!ue||!ge)return ue;const we=ge.length;if(we===0||ue.length===0)return ue;let Oe=0;for(;ue.indexOf(ge,Oe)===Oe;)Oe=Oe+we;return ue.substring(Oe)}function G(ue,ge){if(!ue||!ge)return ue;const we=ge.length,Oe=ue.length;if(we===0||Oe===0)return ue;let Ne=Oe,Ue=-1;for(;!(Ue=ue.lastIndexOf(ge,Ne-1),Ue===-1||Ue+we!==Ne);){if(Ue===0)return"";Ne=Ue}return ue.substring(0,Ne)}function r(ue){return ue.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function O(ue){return ue.replace(/\*/g,"")}function v(ue,ge,we={}){if(!ue)throw new Error("Cannot create regex from empty string");ge||(ue=H(ue)),we.wholeWord&&(/\B/.test(ue.charAt(0))||(ue="\\b"+ue),/\B/.test(ue.charAt(ue.length-1))||(ue=ue+"\\b"));let Oe="";return we.global&&(Oe+="g"),we.matchCase||(Oe+="i"),we.multiline&&(Oe+="m"),we.unicode&&(Oe+="u"),new RegExp(ue,Oe)}function m(ue){if(ue.source==="^"||ue.source==="^$"||ue.source==="$"||ue.source==="^\\s*$")return!1;const ge=ue.exec("");return!!(ge&&ue.lastIndex===0)}function p(ue){return(ue.global?"g":"")+(ue.ignoreCase?"i":"")+(ue.multiline?"m":"")+(ue.unicode?"u":"")}function h(ue){return ue.split(/\r\n|\r|\n/)}function u(ue){for(let ge=0,we=ue.length;ge<we;ge++){const Oe=ue.charCodeAt(ge);if(Oe!==32&&Oe!==9)return ge}return-1}function f(ue,ge=0,we=ue.length){for(let Oe=ge;Oe<we;Oe++){const Ne=ue.charCodeAt(Oe);if(Ne!==32&&Ne!==9)return ue.substring(ge,Oe)}return ue.substring(ge,we)}function o(ue,ge=ue.length-1){for(let we=ge;we>=0;we--){const Oe=ue.charCodeAt(we);if(Oe!==32&&Oe!==9)return we}return-1}function l(ue,ge){return ue<ge?-1:ue>ge?1:0}function s(ue,ge,we=0,Oe=ue.length,Ne=0,Ue=ge.length){for(;we<Oe&&Ne<Ue;we++,Ne++){let Xe=ue.charCodeAt(we),He=ge.charCodeAt(Ne);if(Xe<He)return-1;if(Xe>He)return 1}const Ge=Oe-we,We=Ue-Ne;return Ge<We?-1:Ge>We?1:0}function a(ue,ge){return S(ue,ge,0,ue.length,0,ge.length)}function S(ue,ge,we=0,Oe=ue.length,Ne=0,Ue=ge.length){for(;we<Oe&&Ne<Ue;we++,Ne++){let Xe=ue.charCodeAt(we),He=ge.charCodeAt(Ne);if(Xe===He)continue;if(Xe>=128||He>=128)return s(ue.toLowerCase(),ge.toLowerCase(),we,Oe,Ne,Ue);x(Xe)&&(Xe-=32),x(He)&&(He-=32);const Ye=Xe-He;if(Ye===0)continue;return Ye}const Ge=Oe-we,We=Ue-Ne;return Ge<We?-1:Ge>We?1:0}function x(ue){return ue>=97&&ue<=122}function C(ue){return ue>=65&&ue<=90}function D(ue,ge){return ue.length===ge.length&&S(ue,ge)===0}function L(ue,ge){const we=ge.length;return ge.length>ue.length?!1:S(ue,ge,0,we)===0}function R(ue,ge){let we,Oe=Math.min(ue.length,ge.length);for(we=0;we<Oe;we++)if(ue.charCodeAt(we)!==ge.charCodeAt(we))return we;return Oe}function A(ue,ge){let we,Oe=Math.min(ue.length,ge.length);const Ne=ue.length-1,Ue=ge.length-1;for(we=0;we<Oe;we++)if(ue.charCodeAt(Ne-we)!==ge.charCodeAt(Ue-we))return we;return Oe}function T(ue){return 55296<=ue&&ue<=56319}function d(ue){return 56320<=ue&&ue<=57343}function w(ue,ge){return(ue-55296<<10)+(ge-56320)+65536}function y(ue,ge,we){const Oe=ue.charCodeAt(we);if(T(Oe)&&we+1<ge){const Ne=ue.charCodeAt(we+1);if(d(Ne))return w(Oe,Ne)}return Oe}function b(ue,ge){const we=ue.charCodeAt(ge-1);if(d(we)&&ge>1){const Oe=ue.charCodeAt(ge-2);if(T(Oe))return w(Oe,we)}return we}function j(ue,ge){const we=U.getInstance(),Oe=ge,Ne=ue.length,Ue=y(ue,Ne,ge);ge+=Ue>=65536?2:1;let Ge=we.getGraphemeBreakType(Ue);for(;ge<Ne;){const We=y(ue,Ne,ge),Xe=we.getGraphemeBreakType(We);if(k(Ge,Xe))break;ge+=We>=65536?2:1,Ge=Xe}return ge-Oe}function B(ue,ge){const we=U.getInstance(),Oe=ge,Ne=b(ue,ge);ge-=Ne>=65536?2:1;let Ue=we.getGraphemeBreakType(Ne);for(;ge>0;){const Ge=b(ue,ge),We=we.getGraphemeBreakType(Ge);if(k(We,Ue))break;ge-=Ge>=65536?2:1,Ue=We}return Oe-ge}const E=/(?:[\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 F(ue){return E.test(ue)}const I=/(?:[\u231A\u231B\u23F0\u23F3\u2600-\u27BF\u2B50\u2B55]|\uD83C[\uDDE6-\uDDFF\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F\uDE80-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD00-\uDDFF\uDE70-\uDED6])/;function g(ue){return I.test(ue)}const W=/^[\t\n\r\x20-\x7E]*$/;function $(ue){return W.test(ue)}const le=/[\u2028\u2029]/;function de(ue){return le.test(ue)}function Ce(ue){for(let ge=0,we=ue.length;ge<we;ge++)if(be(ue.charCodeAt(ge)))return!0;return!1}function be(ue){return ue=+ue,ue>=11904&&ue<=55215||ue>=63744&&ue<=64255||ue>=65281&&ue<=65374}function Ae(ue){return ue>=127462&&ue<=127487||ue===8986||ue===8987||ue===9200||ue===9203||ue>=9728&&ue<=10175||ue===11088||ue===11093||ue>=127744&&ue<=128591||ue>=128640&&ue<=128764||ue>=128992&&ue<=129003||ue>=129280&&ue<=129535||ue>=129648&&ue<=129750}const Se=String.fromCharCode(65279);function Re(ue){return!!(ue&&ue.length>0&&ue.charCodeAt(0)===65279)}function ve(ue,ge=!1){return ue?(ge&&(ue=ue.replace(/\\./g,"")),ue.toLowerCase()!==ue):!1}function X(ue){const ge=90-65+1;return ue=ue%(2*ge),ue<ge?String.fromCharCode(97+ue):String.fromCharCode(65+ue-ge)}function _(ue){const ge=U.getInstance();return ge.getGraphemeBreakType(ue)}function k(ue,ge){return ue===0?ge!==5&&ge!==7:ue===2&&ge===3?!1:ue===4||ue===2||ue===3||(ge===4||ge===2||ge===3)?!0:ue===8&&(ge===8||ge===9||ge===11||ge===12)||((ue===11||ue===9)&&(ge===9||ge===10)||((ue===12||ue===10)&&ge===10||(ge===5||ge===13||(ge===7||(ue===1||ue===13&&ge===14)))))?!1:!(ue===6&&ge===6)}class U{constructor(){this._data=Q()}static getInstance(){return U._INSTANCE||(U._INSTANCE=new U),U._INSTANCE}getGraphemeBreakType(ue){if(ue<32)return ue===10?3:ue===13?2:4;if(ue<127)return 0;const ge=this._data,we=ge.length/3;let Oe=1;for(;Oe<=we;)if(ue<ge[3*Oe])Oe=2*Oe;else if(ue>ge[3*Oe+1])Oe=2*Oe+1;else return ge[3*Oe+2];return 0}}U._INSTANCE=null;function Q(){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]")}function K(ue,ge){if(ue===0)return 0;const we=ce(ue,ge);if(we!==void 0)return we;const Oe=b(ge,ue);return ue-=xe(Oe),ue}function ce(ue,ge){let we=b(ge,ue);for(ue-=xe(we);De(we)||we===65039||we===8419;){if(ue===0)return;we=b(ge,ue),ue-=xe(we)}if(!Ae(we))return;if(ue>=0){const Oe=b(ge,ue);Oe===8205&&(ue-=xe(Oe))}return ue}function xe(ue){return ue>=65536?2:1}function De(ue){return 127995<=ue&&ue<=127999}},Ot1p:function(Qe,Te,q){"use strict";var oe=q("2qtc"),Y=q("kLXV"),N=q("rAM+"),J=q("miYZ"),H=q("tsqr"),M=q("9og8"),z=q("tJVT"),G=q("jrin"),r=q("WmNS"),O=q.n(r),v=q("q1tI"),m=q.n(v),p=q("VrN/"),h=q.n(p),u=q("bdgK"),f=q("p77/"),o=q("Bd2K"),l=q("ELLl"),s=q("19Vz"),a=q("lZu9"),S=q("+NIl"),x=q("kSUc"),C=q("9Bee"),D=function(Ee){var Le=Ee.value,Pe=Le===void 0?"":Le,Ke=Ee.className,et=Ee.showTextOnly,rt=Ee.showLines,yt=Ee.style,ot=yt===void 0?{}:yt,at=Object(v.useMemo)(function(){return""},[Pe]);return m.a.createElement(m.a.Fragment,null,m.a.createElement("div",{dangerouslySetInnerHTML:{__html:at}}))},L=q("0Owb"),R=q("dejd"),A=q("C+DQ"),T=q("1vsH"),d=q("m3rI"),w=[{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 y(Ee){var Le=Ee.onActionCallback,Pe=Ee.title,Ke=Ee.icon,et=Ee.actionName,rt=Ee.className,yt=rt===void 0?"":rt,ot=Ee.children;function at(){Le(et)}return m.a.createElement("a",{title:Pe,className:yt,onClick:at},m.a.createElement("i",{className:"md-iconfont ".concat(Ke)}),ot)}var b=function(Ee){var Le=Ee.watch,Pe=Ee.showNullButton,Ke=Ee.onActionCallback,et=Ee.fullScreen,rt=Ee.insertTemp,yt=Ee.hidetoolBar,ot=Ee.uuid,at=Ee.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(T.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(T.F)("_educoder_session"),"&key=").concat(ot,"&api=").concat(encodeURIComponent(d.a.PROXY_SERVER)));var Lt=[].concat(w,[{title:"".concat(Le?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Le?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return m.a.createElement("ul",{className:"markdown-toolbar-container"},!yt&&Lt.map(function(_t,Bt){return m.a.createElement("li",{key:Bt},_t.actionName?m.a.createElement(y,Object(L.a)({},_t,{onActionCallback:Ke})):m.a.createElement("span",{className:"v-line"}))}),Pe?m.a.createElement("li",null,m.a.createElement(y,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Ke},m.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,rt&&m.a.createElement("li",null,m.a.createElement(y,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(rt),onActionCallback:Ke},m.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),m.a.createElement("li",{className:"btn-full-screen"},m.a.createElement(y,{icon:"".concat(et?"icon-shrink":"icon-enlarge"),title:et?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Ke})))},j=q("M8RZ"),B=q("+L6B"),E=q("2/Rp"),F=q("y8nQ"),I=q("Vl3Y"),g=q("5NDa"),W=q("5rEg"),$={labelCol:{span:4},wrapperCol:{span:20}},le=function(Ee){var Le=Ee.callback,Pe=Ee.onCancel;function Ke(et){Le(et)}return m.a.createElement(I.a,Object(L.a)({},$,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Ke}),m.a.createElement(I.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},m.a.createElement(W.a,null)),m.a.createElement(I.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},m.a.createElement(W.a,null)),m.a.createElement("div",{className:"flex-container flex-end"},m.a.createElement(E.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),m.a.createElement(E.a,{type:"ghost",onClick:Pe},"\u53D6\u6D88")))},de=q("7ahc"),Ce=q("HmJG"),be=q("BjJ7"),Ae=I.a.useForm,Se={width:280,marginRight:10},Re={labelCol:{span:5},wrapperCol:{span:19}},ve=function(Ee){var Le=Ee.callback,Pe=Ee.onCancel,Ke=Ae(),et=Object(z.a)(Ke,1),rt=et[0];function yt(Lt){Le(Lt)}function ot(Lt,_t){if(Lt.status===-1){H.b.error(Lt.message);return}rt.setFieldsValue({src:"/api/attachments/".concat(Lt.id),type:_t.type})}function at(Lt){var _t=Lt.target.files[0];_(_t,ot)}return m.a.createElement(I.a,Object(L.a)({form:rt},Re,{className:"upload-image-panel",onFinish:yt}),m.a.createElement(I.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},m.a.createElement("div",{className:"flex-container"},m.a.createElement(I.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},m.a.createElement(W.a,{style:Se})),m.a.createElement(X,{onFileChange:at}))),m.a.createElement(I.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},m.a.createElement(W.a,{style:{width:264}})),m.a.createElement(I.a.Item,{style:{textAlign:"right"}},m.a.createElement(E.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),m.a.createElement(E.a,{type:"ghost",onClick:Pe},"\u53D6\u6D88")))};function X(Ee){var Le=Ee.onFileChange;return m.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",m.a.createElement("input",{type:"file",onChange:Le}))}function _(Ee,Le){if(!Ee)throw new String("\u6CA1\u6709\u6587\u4EF6");var Pe=new FormData;Pe.append("editormd-image-file",Ee),Pe.append("file_param_name","editormd-image-file"),Pe.append("byxhr","true");var Ke=new window.XMLHttpRequest;Ke.withCredentials=!0,Ke.addEventListener("load",function(et){Le(JSON.parse(et.target.responseText),Ee)},!1),Ke.addEventListener("error",function(et){console.error(et)},!1),Ke.open("POST","".concat(be.a,"/api/attachments.json")),Ke.send(Pe)}var k=q("giR+"),U=q("fyUT"),Q=q("7Kak"),K=q("9yH6"),ce=K.a.Group,xe={margin:"0 8px"},De=function(Ee){var Le=Ee.callback,Pe=Ee.onCancel;function Ke(et){Le(et)}return m.a.createElement(I.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Ke},m.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},m.a.createElement("span",{style:xe},"\u5355\u5143\u683C\u6570\uFF1A"),m.a.createElement("span",{style:xe},"\u884C\u6570"),m.a.createElement(I.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},m.a.createElement(U.a,null)),m.a.createElement("span",{style:xe},"\u5217\u6570"),m.a.createElement(I.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},m.a.createElement(U.a,null))),m.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},m.a.createElement("span",{style:xe},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),m.a.createElement(I.a.Item,{name:"align"},m.a.createElement(ce,null,m.a.createElement(K.a,{value:"default"},m.a.createElement("i",{className:"fa fa-align-justify"})),m.a.createElement(K.a,{value:"left"},m.a.createElement("i",{className:"fa fa-align-left"})),m.a.createElement(K.a,{value:"center"},m.a.createElement("i",{className:"fa fa-align-center"})),m.a.createElement(K.a,{value:"right"},m.a.createElement("i",{className:"fa fa-align-right"}))))),m.a.createElement("div",{className:"flex-container flex-end"},m.a.createElement(E.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),m.a.createElement(E.a,{type:"ghost",onClick:Pe},"\u53D6\u6D88")))},ue=q("ErOA"),ge=q("7Cbv"),we="link",Oe="upload-image",Ne="code-block",Ue="add-table",Ge="------------",We={default:Ge,left:":".concat(Ge),center:":".concat(Ge,":"),right:"".concat(Ge,":")},Xe=q("9VGf"),He,Ye;function Me(){}var it=0,qe=1e4,he="\u2581",ee=`
|
|
**\u6A21\u677F\u6807\u9898**
|
|
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function re(Ee){return/^\d+$/.test(Ee)?"".concat(Ee,"px"):Ee}var ae=navigator.platform.toUpperCase().indexOf("MAC")>=0,fe=ae?"Cmd":"Ctrl",ie=["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"],se=(He={},Object(G.a)(He,fe+"-B","bold"),Object(G.a)(He,fe+"-I","italic"),He),pe=(Ye={},Object(G.a)(Ye,we,"\u6DFB\u52A0\u94FE\u63A5"),Object(G.a)(Ye,Ne,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(G.a)(Ye,Oe,"\u6DFB\u52A0\u6587\u4EF6"),Object(G.a)(Ye,Ue,"\u6DFB\u52A0\u8868\u683C"),Ye),me=Te.a=function(Ee){var Le=Ee.defaultValue,Pe=Le===void 0?"":Le,Ke=Ee.onChange,et=Ee.width,rt=et===void 0?"100%":et,yt=Ee.height,ot=yt===void 0?400:yt,at=Ee.miniToolbar,Lt=at===void 0?!1:at,_t=Ee.isFocus,Bt=_t===void 0?!1:_t,Ft=Ee.watch,Tt=Ee.insertTemp,sr=Ee.mode,Er=sr===void 0?"markdown":sr,zt=Ee.id,cr=zt===void 0?"markdown-editor-id":zt,ct=Ee.showResizeBar,vt=ct===void 0?!1:ct,Et=Ee.noStorage,Ht=Et===void 0?!1:Et,or=Ee.showNullButton,Mt=or===void 0?!1:or,Ze=Ee.hidetoolBar,Ct=Ze===void 0?!1:Ze,Rt=Ee.fullScreen,dt=Rt===void 0?!1:Rt,pt=Ee.onBlur,wt=Ee.onCMBeforeChange,rr=Ee.onFullScreen,Ut=Ee.className,je=Ut===void 0?"":Ut,ft=Ee.disablePaste,ri=ft===void 0?!1:ft,bi=Ee.placeholder,_i=bi===void 0?"":bi,ii=Ee.values,Ei=ii===void 0?"":ii,gt=Object(v.useState)(null),An=Object(z.a)(gt,2),ze=An[0],xi=An[1],Sr=Object(v.useState)(Pe),zi=Object(z.a)(Sr,2),ni=zi[0],Ar=zi[1],Vi=Object(v.useState)(Ft),Yi=Object(z.a)(Vi,2),Rr=Yi[0],Xi=Yi[1],Rn=Object(v.useState)(dt),$i=Object(z.a)(Rn,2),Or=$i[0],On=$i[1],aa=Object(v.useState)(""),Ji=Object(z.a)(aa,2),lr=Ji[0],Vr=Ji[1],sa=Object(v.useState)(0),ai=Object(z.a)(sa,2),Lr=ai[0],Qi=ai[1],oa=Object(v.useState)(ot),Ln=Object(z.a)(oa,2),In=Ln[0],Ti=Ln[1],Dn=Object(v.useState)(!1),kn=Object(z.a)(Dn,2),la=kn[0],wi=kn[1],si=Object(v.useRef)(Object(ge.a)()),oi=Object(v.useRef)(!1),Si=Object(v.useRef)(),Ur=Object(v.useRef)(),jr=Object(v.useRef)(),Hr=Object(v.useRef)(),Ci=Object(v.useRef)(),Mn=function(){var st=Object(M.a)(O.a.mark(function mt(){var ut,xt;return O.a.wrap(function(Pt){for(;;)switch(Pt.prev=Pt.next){case 0:return Pt.next=2,Object(ue.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:si.current}});case 2:xt=Pt.sent,xt!=null&&(ut=xt.attachments)!==null&&ut!==void 0&&ut.length&&(console.log("cm:",ze,Ur),xt.attachments.map(function(At){At.content_type.indexOf("image")>-1?ze.replaceSelection(".concat(At.content_type,")")):At.content_type.indexOf("video")>-1?ze.replaceSelection('<video width="100%" controls src="'.concat(d.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):At.content_type.indexOf("pdf")>-1?ze.replaceSelection('<a href="'.concat(d.a.API_SERVER,"/api/attachments/").concat(At.id,"?type=").concat(At.content_type,'&disposition=inline" target="_blank">').concat(At.name,"</a>")):ze.replaceSelection("[".concat(At.name,"](").concat(d.a.API_SERVER,"/api/attachments/").concat(At.id,"?type=").concat(At.content_type,")"))}));case 4:case"end":return Pt.stop()}},mt)}));return function(){return st.apply(this,arguments)}}();Object(v.useEffect)(function(){Ar(Ei),ze==null||ze.setValue(Ei)},[Ei]),Object(v.useEffect)(function(){rr==null||rr(Or)},[Or]),Object(v.useEffect)(function(){if(Ur.current){var st=h.a.fromTextArea(Ur.current,{mode:Er,lineNumbers:!Lt,lineWrapping:!0,value:Pe,autoCloseTags:!0,autoCloseBrackets:!0});Bt&&st.focus();function mt(ut,xt){if(ri){xt.preventDefault();return}var Ot=xt.clipboardData;if(Ot){var Pt=Ot.types.toString(),At=Ot.items;if(Pt==="Files"||Ot.types.indexOf("Files")>-1){if(xt.preventDefault(),Er=="stex")return;try{var Xt,dr=At[1];((Xt=At[0])===null||Xt===void 0?void 0:Xt.kind)==="file"&&(dr=At[0]);var St=dr.getAsFile(),Wr=St.name.split(".").pop();_(St,function(It){if(It.id){var fr,ir,Cr;(St==null||((fr=St.type)===null||fr===void 0)?void 0:fr.indexOf("image"))>-1?st.replaceSelection(".concat(It.content_type,")")):(St==null||((ir=St.type)===null||ir===void 0)?void 0:ir.indexOf("video"))>-1?st.replaceSelection('<video width="100%" controls src="'.concat(d.a.API_SERVER,"/api/attachments/").concat(It.id,'"></video>')):(St==null||((Cr=St.type)===null||Cr===void 0)?void 0:Cr.indexOf("pdf"))>-1?st.replaceSelection('<a href="'.concat(d.a.API_SERVER,"/api/attachments/").concat(It.id,"?type=").concat(St.type,'&disposition=inline" target="_blank">').concat(St.name,"</a>")):ie.includes(Wr)?st.replaceSelection('<a href="'.concat(d.a.API_SERVER,"/api/attachments/").concat(It.id,'?type=office&disposition=inline" target="_blank">').concat(St.name,"</a>")):st.replaceSelection("[".concat(St.name,"](").concat(d.a.API_SERVER,"/api/attachments/").concat(It.id,"?type=").concat(It.content_type,")"))}else(It==null?void 0:It.status)===401&&(document.location.href="/user/login")})}catch(It){H.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return st.on("paste",mt),st.on("dragleave",function(ut,xt){jr.current.classList.remove("mouse-hover-md")}),st.on("dragover",function(ut,xt){jr.current.classList.add("mouse-hover-md")}),st.on("drop",function(ut,xt){jr.current.classList.add("mouse-hover-md");var Ot;if(Ot=xt.dataTransfer.files,Ot.length>0){xt.preventDefault(),xt.stopPropagation();for(var Pt=function(dr){var St=Ot[dr],Wr=St.name.split(".").pop();_(St,function(It){if(It.id){var fr,ir,Cr;(St==null||((fr=St.type)===null||fr===void 0)?void 0:fr.indexOf("image"))>-1?st.replaceSelection(".concat(It.content_type,")")):(St==null||((ir=St.type)===null||ir===void 0)?void 0:ir.indexOf("video"))>-1?st.replaceSelection('<video width="100%" controls src="'.concat(d.a.API_SERVER,"/api/attachments/").concat(It.id,'"></video>')):(St==null||((Cr=St.type)===null||Cr===void 0)?void 0:Cr.indexOf("pdf"))>-1?st.replaceSelection('<a href="'.concat(d.a.API_SERVER,"/api/attachments/").concat(It.id,"?type=").concat(St.type,'&disposition=inline" target="_blank">').concat(St.name,"</a>")):ie.includes(Wr)?st.replaceSelection('<a href="'.concat(d.a.API_SERVER,"/api/attachments/").concat(It.id,'?type=office&disposition=inline" target="_blank">').concat(St.name,"</a>")):st.replaceSelection("[".concat(St.name,"](").concat(d.a.API_SERVER,"/api/attachments/").concat(It.id,"?type=").concat(It.content_type,")"))}else(It==null?void 0:It.status)===401&&(document.location.href="/user/login")})},At=0;At<Ot.length;At++)Pt(At)}}),xi(st),function(){st.off("paste",mt)}}},[]);var xr=Object(v.useCallback)(function(){if(jr.current)try{}catch(st){console.log(st,"---- to set md editor body height")}},[In,jr,Or]);Object(v.useEffect)(function(){function st(){var ut=new u.default(function(xt){var Ot=Object(N.a)(xt),Pt;try{for(Ot.s();!(Pt=Ot.n()).done;){var At=Pt.value;(At.target.offsetHeight>0||At.target.offsetWidth>0)&&(xr(),ze.setSize("100%","100%"),ze.refresh())}}catch(Xt){Ot.e(Xt)}finally{Ot.f()}});return ut.observe(Ur.current.parentElement),ut}if(ze){var mt=st();return function(){mt.unobserve(Ur.current.parentElement)}}},[ze,xr]),Object(v.useEffect)(function(){if(ze){for(var st=[],mt=function(){var At=xt[ut];Ot=Object(z.a)(At,2);var Xt=Ot[0],dr=Ot[1],St=Object(G.a)({},Xt,function(){Pn(dr)});st.push(St),ze.addKeyMap(St)},ut=0,xt=Object.entries(se);ut<xt.length;ut++){var Ot;mt()}return Si.current=setInterval(function(){oi.current&&Mn()},4e3),function(){clearInterval(Si.current);var Pt=Object(N.a)(st),At;try{for(Pt.s();!(At=Pt.n()).done;){var Xt=At.value;ze.removeKeyMap(Xt)}}catch(dr){Pt.e(dr)}finally{Pt.f()}}}},[ze]),Object(v.useEffect)(function(){dt!==Or&&On(dt)},[dt]),Object(Xe.a)(function(){if(!Ht&&Lr>0){var st=new Date().getTime(),mt=window.sessionStorage.getItem(cr);st>=Lr+qe&&(!mt||mt!==ni)&&(window.sessionStorage.setItem(cr,ni),wi(!0))}},qe),Object(v.useEffect)(function(){Xi(Ft)},[ze,Ft]),Object(v.useEffect)(function(){ze&&(Bt&&ze.focus())},[ze,Bt]),Object(v.useEffect)(function(){if(Rr&&ze){var st=ze.getScrollerElement();function mt(ut){var xt=ut.target;if(Ci.current){var Ot=xt.scrollTop/xt.scrollHeight;Ci.current.scrollTop=Ci.current.scrollHeight*Ot}}return st.addEventListener("scroll",mt),function(){st.removeEventListener("scroll",mt)}}},[ze,Rr]),Object(v.useEffect)(function(){if(ze&&wt){function st(mt,ut){wt(mt,ut)}return ze.on("beforeChange",st),function(){ze.off("beforeChange",st)}}},[ze,wt]),Object(v.useEffect)(function(){if(ze&&pt){function st(){pt(ze.getValue())}return ze.on("blur",st),function(){ze.off("blur",st)}}},[ze,pt]),Object(v.useEffect)(function(){if(ze){function st(mt){var ut=mt.getValue();Ar(ut),Qi(new Date().getTime()),mt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Ke&&Ke(ut)}return ze.on("change",st),function(){ze.off("change",st)}}},[ze,Ke]),Object(v.useEffect)(function(){ze&&(Pe==null?(ze.setValue(""),Ar("")):Pe!==ze.getValue()&&(ze.setValue(Pe),Ar(Pe),ze.setCursor(ze.lineCount(),0)))},[ze,Pe]);var Pn=Object(v.useCallback)(function(st){var mt=ze.getCursor(),ut=ze.getSelection(),xt=ut.split(`
|
|
`);switch(st){case"bold":return ze.replaceSelection("**"+ut+"**"),ut===""&&ze.setCursor(mt.line,mt.ch+2),ze.focus();case"italic":return ze.replaceSelection("*"+ut+"*"),ut===""&&ze.setCursor(mt.line,mt.ch+1),ze.focus();case"code":return ze.replaceSelection("`"+ut+"`"),ut===""&&ze.setCursor(mt.line,mt.ch+1),ze.focus();case"inline-latex":return ze.replaceSelection("`$$"+ut+"$$`"),ut===""&&ze.setCursor(mt.line,mt.ch+3),ze.focus();case"latex":return ze.replaceSelection("```latex\n"+ut+"\n```"),ze.setCursor(mt.line+1,ut.length+1),ze.focus();case"line-break":return ze.replaceSelection(`<br/>
|
|
`),ze.focus();case"list-ul":return ut===""?ze.replaceSelection("- "+ut):ze.replaceSelection(xt.map(function(Ot){return Ot===""?"":"- ".concat(Ot)}).join(`
|
|
`)),ze.focus();case"list-ol":return ut===""?ze.replaceSelection("1. "+ut):ze.replaceSelection(xt.map(function(Ot,Pt){return Ot===""?"":"".concat(Pt+1,". ").concat(Ot)}).join(`
|
|
`)),ze.focus();case"add-null-ch":return ut===""&&ze.setCursor(mt.line,mt.ch+1),ze.replaceSelection(he),ze.focus();case"inster-template-1":return ut===""&&ze.setCursor(mt.line,mt.ch),ze.replaceSelection(ee),ze.focus();case"eraser":return ze.setValue(""),ze.focus();case"trigger-watch":return Xi(!Rr),ze.focus();case"trigger-full-screen":return On(!Or),ze.focus();case we:Vr(we);return;case Ne:Vr(Ne);return;case Oe:Vr(Oe);return;case Ue:Vr(Ue);return;default:throw new Error}},[ze,Rr,Or]),Ai=Object(v.useCallback)(function(st){Vr("");switch(lr){case we:var mt=st.title,ut=st.link;return ze.replaceSelection("[".concat(mt,"](").concat(ut,")")),ze.focus();case Ne:var xt=st.language,Ot=st.content;return ze.replaceSelection(["```"+xt,Ot,"```"].join(`
|
|
`)),ze.focus();case Oe:var Pt=st.src,At=st.alt;return At?ze.replaceSelection(".concat(Pt,' "').concat(At,'" )')):ze.replaceSelection("")),ze.focus();case Ue:for(var Xt=st.row,dr=st.col,St=st.align,Wr=`
|
|
`,It=0;It<Xt;It++){for(var fr=[],ir=[],Cr=0;Cr<dr;Cr++)It===1&&ir.push(We[St]),fr.push(" ");It===1&&(Wr+="| ".concat(ir.join(" | "),` |
|
|
`)),Wr+="| ".concat(fr.join(dr===1?"":" | "),` |
|
|
`)}return ze.replaceSelection(Wr+`
|
|
`),ze.focus();default:throw new Error}},[ze,lr]),Zi=Object(v.useMemo)(function(){switch(lr){case we:return m.a.createElement(le,{callback:Ai,onCancel:Yr});case Ne:return m.a.createElement(de.b,{callback:Ai,onCancel:Yr});case Oe:return m.a.createElement(ve,{callback:Ai,onCancel:Yr});case Ue:return m.a.createElement(De,{callback:Ai,onCancel:Yr});default:return null}},[lr]);function Yr(){Vr("")}Object(v.useEffect)(function(){if(Hr.current){var st=Hr.current,mt=!1,ut=0;function xt(At){mt=!0,ut=At.pageY}function Ot(){mt=!1}function Pt(At){if(mt){var Xt=At.pageY-ut;Xt<0&&(Xt=0),Xt>300&&(Xt=300);var dr=ot+Xt+"px";Ti(dr)}}return st.addEventListener("mousedown",xt),document.addEventListener("mousemove",Pt),document.addEventListener("mouseup",Ot),function(){st.removeEventListener("mousedown",xt),document.removeEventListener("mousemove",Pt),document.removeEventListener("mouseup",Ot)}}},[ze,Hr]),Object(v.useEffect)(function(){Ti(ot)},[ot]);var Pr=re(rt),qi=re(In),Ir={width:Pr,height:qi},en=Object(v.useMemo)(function(){if(Lr){var st=new Date(Lr),mt=st.getHours(),ut=st.getMinutes(),xt=st.getSeconds();return mt=mt<10?"0"+mt:mt,ut=ut<10?"0"+ut:ut,xt=xt<10?"0"+xt:xt,"".concat(mt,":").concat(ut,":").concat(xt)}return 0},[Lr]);function Nn(){window.sessionStorage.removeItem(cr),wi(!1),Qi(0)}function li(){wi(!1),Qi(0),ze.setValue(window.sessionStorage.getItem(cr))}function ua(st,mt){var ut=ze.getValue();ut=ut.replace(st,mt),Ar(ut),ze==null||ze.setValue(ut)}return m.a.createElement(v.Fragment,null,m.a.createElement("div",{className:"markdown-editor-wrapper",ref:jr},m.a.createElement("div",{className:"markdown-editor-container ".concat(je," ").concat(Rr?"on-preview":""," ").concat(Lt?"mini":""," ").concat(Or?"full-screen":""),style:Ir},m.a.createElement(b,{insertTemp:Tt,watch:Rr,fullScreen:Or,showNullButton:Mt,onActionCallback:Pn,hidetoolBar:Ct,uuid:si.current,setOpenPhones:function(){oi.current=!0}}),m.a.createElement("div",{className:"markdown-editor-body"},m.a.createElement("div",{className:"codemirror-container"},m.a.createElement("textarea",{ref:Ur,placeholder:_i})),Rr?m.a.createElement("div",{ref:Ci,className:"preview-container"},Er==="stex"&&m.a.createElement(D,{value:ni}),Er!=="stex"&&m.a.createElement(C.a,{edit:!0,value:ni,replaces:ua})):null))),vt?m.a.createElement("a",{ref:Hr,className:"editor-resize"}):null,m.a.createElement(j.a,null,pe[lr]?m.a.createElement(Y.a,{centered:!0,title:pe[lr],visible:!0,onCancel:Yr,footer:null,className:"markdown-popup-form"},Zi):null))}},R7cW:function(Qe,Te,q){"use strict";q.r(Te);var oe=q("+L6B"),Y=q("2/Rp"),N=q("DZo9"),J=q("8z0m"),H=q("0Owb"),M=q("5NDa"),z=q("5rEg"),G=q("sPJy"),r=q("bE4q"),O=q("k1fw"),v=q("oBTY"),m=q("9og8"),p=q("miYZ"),h=q("tsqr"),u=q("y8nQ"),f=q("Vl3Y"),o=q("tJVT"),l=q("WmNS"),s=q.n(l),a=q("q1tI"),S=q.n(a),x=q("Ty5D"),C=q("9kvl"),D=q("55Ip"),L=q("Ot1p"),R=q("XYT7"),A=q("m3rI"),T=q("YiJy"),d=q.n(T),w=function(b){var j,B=b.shixunHomeworks,E=b.newCourse,F=b.globalSetting,I=b.loading,g=b.dispatch,W=b.match,$=Object(x.i)(),le=f.a.useForm(),de=Object(o.a)(le,1),Ce=de[0],be=Object(a.useState)({}),Ae=Object(o.a)(be,2),Se=Ae[0],Re=Ae[1],ve=Object(a.useState)(!1),X=Object(o.a)(ve,2),_=X[0],k=X[1],U=Object(a.useState)([]),Q=Object(o.a)(U,2),K=Q[0],ce=Q[1],xe=Object(a.useState)([]),De=Object(o.a)(xe,2),ue=De[0],ge=De[1],we=B.commonHomeWorkEditDefaultData,Oe={name:"file",multiple:!0,action:A.a.API_SERVER+"/api/attachments.json",defaultFileList:K,onChange:function(Xe){var He=Xe.file.status;He!=="uploading",He==="done"?h.b.success("".concat(Xe.file.name," \u6587\u4EF6\u4E0A\u4F20\u6210\u529F")):He==="error"&&h.b.error("".concat(Xe.file.name," \u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"))}};Object(a.useEffect)(function(){Ue()},[$.topicId]);var Ne=function(Xe){return Xe==null?void 0:Xe.map(function(He){return{uid:He.id,response:{id:He.id},name:He.title,status:"done",url:He.url}})},Ue=function(){var We=Object(m.a)(s.a.mark(function Xe(){var He;return s.a.wrap(function(Me){for(;;)switch(Me.prev=Me.next){case 0:return Me.next=2,g({type:"shixunHomeworks/editCommonHomeWorkDefaultBankData",payload:{id:$.topicId}});case 2:He=Me.sent,He&&(Ce.setFieldsValue({name:He.name}),Ce.setFieldsValue({description:He.description}),Ce.setFieldsValue({reference_answer:He.reference_answer}),ce(Object(v.a)(Ne(He.attachments))),ge(Object(v.a)(Ne(He.reference_attachments))),k(!0));case 4:case"end":return Me.stop()}},Xe)}));return function(){return We.apply(this,arguments)}}(),Ge=function(){var We=Object(m.a)(s.a.mark(function Xe(He){var Ye,Me,it,qe;return s.a.wrap(function(ee){for(;;)switch(ee.prev=ee.next){case 0:return Ye=Object(O.a)({},Se),Ye.attachment_ids&&(Ye.attachment_ids=Ye==null||((Me=Ye.attachment_ids.fileList)===null||Me===void 0)?void 0:Me.map(function(re){var ae;return(ae=re.response)===null||ae===void 0?void 0:ae.id})),Ye.reference_attachment_ids&&(Ye.reference_attachment_ids=Ye==null||((it=Ye.reference_attachment_ids.fileList)===null||it===void 0)?void 0:it.map(function(re){var ae;return(ae=re.response)===null||ae===void 0?void 0:ae.id})),ee.next=5,Object(R.n)(Object(O.a)(Object(O.a)({id:$.topicId},Ye),{},{base_on_project:null,type:1}));case 5:qe=ee.sent,qe&&C.d.push("/users/".concat($.username,"/topics/").concat($.topicId,"/").concat($.topictype,"/normal/detail"));case 7:case"end":return ee.stop()}},Xe)}));return function(He){return We.apply(this,arguments)}}();return S.a.createElement("section",{className:d.a.bg},S.a.createElement("section",{className:"animated fadeIn"},S.a.createElement("aside",{className:"mt10"},S.a.createElement(r.a,{separator:">"},S.a.createElement(r.a.Item,null,S.a.createElement(D.a,{to:"/users/".concat($.username,"/").concat($.topictype==="personal"?"topics":"topicbank","/").concat($.topictype)},$.topictype==="personal"?"\u6211\u7684\u8BFE\u5802\u8D44\u6E90":"\u516C\u5171\u9898\u5E93")),S.a.createElement(r.a.Item,null,S.a.createElement(D.a,{to:"/users/".concat($.username,"/topics/").concat($.topicId,"/").concat($.topictype,"/normal/detail")},"\u8BE6\u60C5")),S.a.createElement(r.a.Item,null,"\u7F16\u8F91")))),S.a.createElement("aside",{className:"font24 bold mt20 mb20"},"\u7F16\u8F91"),S.a.createElement(f.a,{form:Ce,className:d.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(){Re(Object(O.a)({},Ce.getFieldsValue()))},onFinish:Ge},S.a.createElement("div",{className:d.a.fieldWrap},S.a.createElement(f.a.Item,{name:"name",label:"\u6807\u9898:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6807\u9898"}]},S.a.createElement(z.a,{maxLength:60,suffix:"".concat(((j=Se.name)===null||j===void 0?void 0:j.length)||0,"/60"),placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A"}))),S.a.createElement("div",{className:d.a.mdWrap},S.a.createElement(f.a.Item,{name:"description",label:"\u7B80\u4ECB:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F5C\u4E1A\u7684\u7B80\u4ECB"},{max:5e3,message:"\u4F5C\u4E1A\u7B80\u4ECB\u6700\u5927\u9650\u52365000\u4E2A\u5B57\u7B26"}]},S.a.createElement(L.a,{id:"topic-normal-description",watch:!0,defaultValue:we.description})),S.a.createElement("div",null,S.a.createElement(f.a.Item,{name:"attachment_ids"},_&&S.a.createElement(J.a,Object(H.a)({defaultFileList:K},Oe),S.a.createElement("span",{className:"c-blue"},"\u4E0A\u4F20\u9644\u4EF6")," \uFF08\u5355\u4E2A\u6587\u4EF6150MB\u4EE5\u5185\uFF09")))),S.a.createElement("div",{className:d.a.mdWrap},S.a.createElement(f.a.Item,{name:"reference_answer",label:"\u53C2\u8003\u7B54\u6848:"},S.a.createElement(L.a,{id:"topic-normal-reference_answer",defaultValue:we.reference_answer,watch:!0})),S.a.createElement("div",null,S.a.createElement(f.a.Item,{name:"reference_attachment_ids"},_&&S.a.createElement(J.a,Object(H.a)({},Oe,{defaultFileList:ue}),S.a.createElement("span",{className:"c-blue"},"\u4E0A\u4F20\u9644\u4EF6")," \uFF08\u5355\u4E2A\u6587\u4EF6150MB\u4EE5\u5185\uFF09")))),S.a.createElement("div",{className:d.a.backgroundFa},S.a.createElement("div",{className:"pt40 mb30"},S.a.createElement(f.a.Item,null,S.a.createElement(Y.a,{size:"large",type:"primary",className:"".concat(d.a.button," mr20"),htmlType:"submit"},"\u63D0\u4EA4"),S.a.createElement(Y.a,{size:"large",type:"primary",ghost:!0,className:d.a.button,onClick:function(){return C.d.push("/users/".concat($.username,"/topics/").concat($.topicId,"/").concat($.topictype,"/normal/detail"))}},"\u53D6\u6D88"))))))};Te.default=Object(C.a)(function(y){var b=y.shixunHomeworks,j=y.newCourse,B=y.loading,E=y.globalSetting;return{shixunHomeworks:b,newCourse:j,globalSetting:E,loading:B.effects}})(w)},SJMd:function(Qe,Te){/**
|
|
* @license
|
|
* Copyright (C) 2006 Google Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var q,oe,Y,N=!1,J,H;window.PR_SHOULD_USE_CONTINUATION=!0;var M,z;(function(){var G=window,r=["break,continue,do,else,for,if,return,while"],O=[r,"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"],v=[O,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],m=[v,"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"],p=[v,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],h=[v,"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"],u="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",f=[v,"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",l=[r,"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=[r,"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"],a=[r,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],S=[m,h,p,f,o,l,s,a],x=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,C="str",D="kwd",L="com",R="typ",A="lit",T="pun",d="pln",w="tag",y="dec",b="src",j="atn",B="atv",E="nocode",F="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function I(ce){for(var xe=0,De=!1,ue=!1,ge=0,we=ce.length;ge<we;++ge){var Oe=ce[ge];if(Oe.ignoreCase)ue=!0;else if(/[a-z]/i.test(Oe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){De=!0,ue=!1;break}}var Ne={b:8,t:9,n:10,v:11,f:12,r:13};function Ue(Ye){var Me=Ye.charCodeAt(0);if(Me!==92)return Me;var it=Ye.charAt(1);return Me=Ne[it],Me||("0"<=it&&it<="7"?parseInt(Ye.substring(1),8):it==="u"||it==="x"?parseInt(Ye.substring(2),16):Ye.charCodeAt(1))}function Ge(Ye){if(Ye<32)return(Ye<16?"\\x0":"\\x")+Ye.toString(16);var Me=String.fromCharCode(Ye);return Me==="\\"||Me==="-"||Me==="]"||Me==="^"?"\\"+Me:Me}function We(Ye){var Me=Ye.substring(1,Ye.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")),it=[],qe=Me[0]==="^",he=["["];qe&&he.push("^");for(var ee=qe?1:0,re=Me.length;ee<re;++ee){var ae=Me[ee];if(/\\[bdsw]/i.test(ae))he.push(ae);else{var fe=Ue(ae),ie;ee+2<re&&Me[ee+1]==="-"?(ie=Ue(Me[ee+2]),ee+=2):ie=fe,it.push([fe,ie]),ie<65||fe>122||(ie<65||fe>90||it.push([Math.max(65,fe)|32,Math.min(ie,90)|32]),ie<97||fe>122||it.push([Math.max(97,fe)&~32,Math.min(ie,122)&~32]))}}it.sort(function(Ee,Le){return Ee[0]-Le[0]||Le[1]-Ee[1]});for(var se=[],pe=[],ee=0;ee<it.length;++ee){var me=it[ee];me[0]<=pe[1]+1?pe[1]=Math.max(pe[1],me[1]):se.push(pe=me)}for(var ee=0;ee<se.length;++ee){var me=se[ee];he.push(Ge(me[0])),me[1]>me[0]&&(me[1]+1>me[0]&&he.push("-"),he.push(Ge(me[1])))}return he.push("]"),he.join("")}function Xe(Ye){for(var Me=Ye.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")),it=Me.length,qe=[],he=0,ee=0;he<it;++he){var re=Me[he];if(re==="(")++ee;else if(re.charAt(0)==="\\"){var ae=+re.substring(1);ae&&(ae<=ee?qe[ae]=-1:Me[he]=Ge(ae))}}for(var he=1;he<qe.length;++he)qe[he]===-1&&(qe[he]=++xe);for(var he=0,ee=0;he<it;++he){var re=Me[he];if(re==="(")++ee,qe[ee]||(Me[he]="(?:");else if(re.charAt(0)==="\\"){var ae=+re.substring(1);ae&&ae<=ee&&(Me[he]="\\"+qe[ae])}}for(var he=0;he<it;++he)Me[he]==="^"&&Me[he+1]!=="^"&&(Me[he]="");if(Ye.ignoreCase&&De)for(var he=0;he<it;++he){var re=Me[he],fe=re.charAt(0);re.length>=2&&fe==="["?Me[he]=We(re):fe!=="\\"&&(Me[he]=re.replace(/[a-zA-Z]/g,function(pe){var me=pe.charCodeAt(0);return"["+String.fromCharCode(me&~32,me|32)+"]"}))}return Me.join("")}for(var He=[],ge=0,we=ce.length;ge<we;++ge){var Oe=ce[ge];if(Oe.global||Oe.multiline)throw new Error(""+Oe);He.push("(?:"+Xe(Oe)+")")}return new RegExp(He.join("|"),ue?"gi":"g")}function g(ce,xe){var De=/(?:^|\s)nocode(?:\s|$)/,ue=[],ge=0,we=[],Oe=0;function Ne(Ue){var Ge=Ue.nodeType;if(Ge==1){if(De.test(Ue.className))return;for(var We=Ue.firstChild;We;We=We.nextSibling)Ne(We);var Xe=Ue.nodeName.toLowerCase();(Xe==="br"||Xe==="li")&&(ue[Oe]=`
|
|
`,we[Oe<<1]=ge++,we[Oe++<<1|1]=Ue)}else if(Ge==3||Ge==4){var He=Ue.nodeValue;He.length&&(xe?He=He.replace(/\r\n?/g,`
|
|
`):He=He.replace(/[ \t\r\n]+/g," "),ue[Oe]=He,we[Oe<<1]=ge,ge+=He.length,we[Oe++<<1|1]=Ue)}}return Ne(ce),{sourceCode:ue.join("").replace(/\n$/,""),spans:we}}function W(ce,xe,De,ue,ge){if(!De)return;var we={sourceNode:ce,pre:1,langExtension:null,numberLines:null,sourceCode:De,spans:null,basePos:xe,decorations:null};ue(we),ge.push.apply(ge,we.decorations)}var $=/\S/;function le(ce){for(var xe=void 0,De=ce.firstChild;De;De=De.nextSibling){var ue=De.nodeType;xe=ue===1?xe?ce:De:ue===3&&$.test(De.nodeValue)?ce:xe}return xe===ce?void 0:xe}function de(ce,xe){var De={},ue;(function(){for(var Oe=ce.concat(xe),Ne=[],Ue={},Ge=0,We=Oe.length;Ge<We;++Ge){var Xe=Oe[Ge],He=Xe[3];if(He)for(var Ye=He.length;--Ye>=0;)De[He.charAt(Ye)]=Xe;var Me=Xe[1],it=""+Me;Ue.hasOwnProperty(it)||(Ne.push(Me),Ue[it]=null)}Ne.push(/[\0-\uffff]/),ue=I(Ne)})();var ge=xe.length,we=function(Oe){for(var Ne=Oe.sourceCode,Ue=Oe.basePos,Ge=Oe.sourceNode,We=[Ue,d],Xe=0,He=Ne.match(ue)||[],Ye={},Me=0,it=He.length;Me<it;++Me){var qe=He[Me],he=Ye[qe],ee=void 0,re;if(typeof he=="string")re=!1;else{var ae=De[qe.charAt(0)];if(ae)ee=qe.match(ae[1]),he=ae[0];else{for(var fe=0;fe<ge;++fe)if(ae=xe[fe],ee=qe.match(ae[1]),ee){he=ae[0];break}ee||(he=d)}re=he.length>=5&&he.substring(0,5)==="lang-",re&&!(ee&&typeof ee[1]=="string")&&(re=!1,he=b),re||(Ye[qe]=he)}var ie=Xe;if(Xe+=qe.length,!re)We.push(Ue+ie,he);else{var se=ee[1],pe=qe.indexOf(se),me=pe+se.length;ee[2]&&(me=qe.length-ee[2].length,pe=me-se.length);var Ee=he.substring(5);W(Ge,Ue+ie,qe.substring(0,pe),we,We),W(Ge,Ue+ie+pe,se,X(Ee,se),We),W(Ge,Ue+ie+me,qe.substring(me),we,We)}}Oe.decorations=We};return we}function Ce(ce){var xe=[],De=[];ce.tripleQuotedStrings?xe.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ce.multiLineStrings?xe.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):xe.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ce.verbatimStrings&&De.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var ue=ce.hashComments;ue&&(ce.cStyleComments?(ue>1?xe.push([L,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):xe.push([L,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),De.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):xe.push([L,/^#[^\r\n]*/,null,"#"])),ce.cStyleComments&&(De.push([L,/^\/\/[^\r\n]*/,null]),De.push([L,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var ge=ce.regexLiterals;if(ge){var we=ge>1?"":`
|
|
\r`,Oe=we?".":"[\\S\\s]",Ne="/(?=[^/*"+we+"])(?:[^/\\x5B\\x5C"+we+"]|\\x5C"+Oe+"|\\x5B(?:[^\\x5C\\x5D"+we+"]|\\x5C"+Oe+")*(?:\\x5D|$))+/";De.push(["lang-regex",RegExp("^"+F+"("+Ne+")")])}var Ue=ce.types;Ue&&De.push([R,Ue]);var Ge=(""+ce.keywords).replace(/^ | $/g,"");Ge.length&&De.push([D,new RegExp("^(?:"+Ge.replace(/[\s,]+/g,"|")+")\\b"),null]),xe.push([d,/^\s+/,null,` \r
|
|
\xA0`]);var We="^.[^\\s\\w.$@'\"`/\\\\]*";return ce.regexLiterals&&(We+="(?!s*/)"),De.push([A,/^@[a-z_$][a-z_$@0-9]*/i,null],[R,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[d,/^[a-z_$][a-z_$@0-9]*/i,null],[A,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[d,/^\\[\s\S]?/,null],[T,new RegExp(We),null]),de(xe,De)}var be=Ce({keywords:S,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Ae(ce,xe,De){for(var ue=/(?:^|\s)nocode(?:\s|$)/,ge=/\r\n?|\n/,we=ce.ownerDocument,Oe=we.createElement("li");ce.firstChild;)Oe.appendChild(ce.firstChild);var Ne=[Oe];function Ue(Me){var it=Me.nodeType;if(it==1&&!ue.test(Me.className))if(Me.nodeName==="br")Ge(Me),Me.parentNode&&Me.parentNode.removeChild(Me);else for(var qe=Me.firstChild;qe;qe=qe.nextSibling)Ue(qe);else if((it==3||it==4)&&De){var he=Me.nodeValue,ee=he.match(ge);if(ee){var re=he.substring(0,ee.index);Me.nodeValue=re;var ae=he.substring(ee.index+ee[0].length);if(ae){var fe=Me.parentNode;fe.insertBefore(we.createTextNode(ae),Me.nextSibling)}Ge(Me),re||Me.parentNode.removeChild(Me)}}}function Ge(Me){for(;!Me.nextSibling;)if(Me=Me.parentNode,!Me)return;function it(ee,re){var ae=re?ee.cloneNode(!1):ee,fe=ee.parentNode;if(fe){var ie=it(fe,1),se=ee.nextSibling;ie.appendChild(ae);for(var pe=se;pe;pe=se)se=pe.nextSibling,ie.appendChild(pe)}return ae}for(var qe=it(Me.nextSibling,0),he;(he=qe.parentNode)&&he.nodeType===1;)qe=he;Ne.push(qe)}for(var We=0;We<Ne.length;++We)Ue(Ne[We]);xe===(xe|0)&&Ne[0].setAttribute("value",xe);var Xe=we.createElement("ol");Xe.className="linenums";for(var He=Math.max(0,xe-1|0)||0,We=0,Ye=Ne.length;We<Ye;++We)Oe=Ne[We],Oe.className="L"+(We+He)%10,Oe.firstChild||Oe.appendChild(we.createTextNode("\xA0")),Xe.appendChild(Oe);ce.appendChild(Xe)}function Se(ce){var xe=/\bMSIE\s(\d+)/.exec(navigator.userAgent);xe=xe&&+xe[1]<=8;var De=/\n/g,ue=ce.sourceCode,ge=ue.length,we=0,Oe=ce.spans,Ne=Oe.length,Ue=0,Ge=ce.decorations,We=Ge.length,Xe=0;Ge[We]=ge;var He,Ye;for(Ye=He=0;Ye<We;)Ge[Ye]!==Ge[Ye+2]?(Ge[He++]=Ge[Ye++],Ge[He++]=Ge[Ye++]):Ye+=2;for(We=He,Ye=He=0;Ye<We;){for(var Me=Ge[Ye],it=Ge[Ye+1],qe=Ye+2;qe+2<=We&&Ge[qe+1]===it;)qe+=2;Ge[He++]=Me,Ge[He++]=it,Ye=qe}We=Ge.length=He;var he=ce.sourceNode,ee="";he&&(ee=he.style.display,he.style.display="none");try{for(var re=null;Ue<Ne;){var ae=Oe[Ue],fe=Oe[Ue+2]||ge,ie=Ge[Xe+2]||ge,qe=Math.min(fe,ie),se=Oe[Ue+1],pe;if(se.nodeType!==1&&(pe=ue.substring(we,qe))){xe&&(pe=pe.replace(De,"\r")),se.nodeValue=pe;var me=se.ownerDocument,Ee=me.createElement("span");Ee.className=Ge[Xe+1];var Le=se.parentNode;Le.replaceChild(Ee,se),Ee.appendChild(se),we<fe&&(Oe[Ue+1]=se=me.createTextNode(ue.substring(qe,fe)),Le.insertBefore(se,Ee.nextSibling))}we=qe,we>=fe&&(Ue+=2),we>=ie&&(Xe+=2)}}finally{he&&(he.style.display=ee)}}var Re={};function ve(ce,xe){for(var De=xe.length;--De>=0;){var ue=xe[De];Re.hasOwnProperty(ue)?G.console&&console.warn("cannot override language handler %s",ue):Re[ue]=ce}}function X(ce,xe){return ce&&Re.hasOwnProperty(ce)||(ce=/^\s*</.test(xe)?"default-markup":"default-code"),Re[ce]}ve(be,["default-code"]),ve(de([],[[d,/^[^<?]+/],[y,/^<!\w[^>]*(?:>|$)/],[L,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[T,/^(?:<[%?]|[%?]>)/],["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(de([[d,/^[\s]+/,null,` \r
|
|
`],[B,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[w,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[j,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[T,/^[=<>\/]+/],["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(de([],[[B,/^[\s\S]+/]]),["uq.val"]),ve(Ce({keywords:m,hashComments:!0,cStyleComments:!0,types:x}),["c","cc","cpp","cxx","cyc","m"]),ve(Ce({keywords:"null,true,false"}),["json"]),ve(Ce({keywords:h,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:x}),["cs"]),ve(Ce({keywords:p,cStyleComments:!0}),["java"]),ve(Ce({keywords:a,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ve(Ce({keywords:l,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ve(Ce({keywords:o,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ve(Ce({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ve(Ce({keywords:f,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ve(Ce({keywords:u,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ve(de([],[[C,/^[\s\S]+/]]),["regex"]);function _(ce){var xe=ce.langExtension;try{var De=g(ce.sourceNode,ce.pre),ue=De.sourceCode;ce.sourceCode=ue,ce.spans=De.spans,ce.basePos=0,X(xe,ue)(ce),Se(ce)}catch(ge){G.console&&console.log(ge&&ge.stack||ge)}}function k(ce,xe,De){var ue=De||!1,ge=xe||null,we=document.createElement("div");we.innerHTML="<pre>"+ce+"</pre>",we=we.firstChild,ue&&Ae(we,ue,!0);var Oe={langExtension:ge,numberLines:ue,sourceNode:we,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return _(Oe),we.innerHTML}function U(ce,xe){var De=xe||document.body,ue=De.ownerDocument||document;function ge(ae){return De.getElementsByTagName(ae)}for(var we=[ge("pre"),ge("code"),ge("xmp")],Oe=[],Ne=0;Ne<we.length;++Ne)for(var Ue=0,Ge=we[Ne].length;Ue<Ge;++Ue)Oe.push(we[Ne][Ue]);we=null;var We=Date;We.now||(We={now:function(){return+new Date}});var Xe=0,He=/\blang(?:uage)?-([\w.]+)(?!\S)/,Ye=/\bprettyprint\b/,Me=/\bprettyprinted\b/,it=/pre|xmp/i,qe=/^code$/i,he=/^(?:pre|code|xmp)$/i,ee={};function re(){for(var ae=G.PR_SHOULD_USE_CONTINUATION?We.now()+250:Infinity;Xe<Oe.length&&We.now()<ae;Xe++){for(var fe=Oe[Xe],ie=ee,se=fe;se=se.previousSibling;){var pe=se.nodeType,me=(pe===7||pe===8)&&se.nodeValue;if(me?!/^\??prettify\b/.test(me):pe!==3||/\S/.test(se.nodeValue))break;if(me){ie={},me.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Ft,Tt,sr){ie[Tt]=sr});break}}var Ee=fe.className;if((ie!==ee||Ye.test(Ee))&&!Me.test(Ee)){for(var Le=!1,Pe=fe.parentNode;Pe;Pe=Pe.parentNode){var Ke=Pe.tagName;if(he.test(Ke)&&Pe.className&&Ye.test(Pe.className)){Le=!0;break}}if(!Le){fe.className+=" prettyprinted";var et=ie.lang;if(!et){et=Ee.match(He);var rt;!et&&(rt=le(fe))&&qe.test(rt.tagName)&&(et=rt.className.match(He)),et&&(et=et[1])}var yt;if(it.test(fe.tagName))yt=1;else{var ot=fe.currentStyle,at=ue.defaultView,Lt=ot?ot.whiteSpace:at&&at.getComputedStyle?at.getComputedStyle(fe,null).getPropertyValue("white-space"):0;yt=Lt&&Lt.substring(0,3)==="pre"}var _t=ie.linenums;(_t=_t==="true"||+_t)||(_t=Ee.match(/\blinenums\b(?::(\d+))?/),_t=_t?_t[1]&&_t[1].length?+_t[1]:!0:!1),_t&&Ae(fe,_t,yt);var Bt={langExtension:et,sourceNode:fe,numberLines:_t,pre:yt,sourceCode:null,basePos:null,spans:null,decorations:null};_(Bt)}}}Xe<Oe.length?G.setTimeout(re,250):typeof ce=="function"&&ce()}re()}var Q=G.PR={createSimpleLexer:de,registerLangHandler:ve,sourceDecorator:Ce,PR_ATTRIB_NAME:j,PR_ATTRIB_VALUE:B,PR_COMMENT:L,PR_DECLARATION:y,PR_KEYWORD:D,PR_LITERAL:A,PR_NOCODE:E,PR_PLAIN:d,PR_PUNCTUATION:T,PR_SOURCE:b,PR_STRING:C,PR_TAG:w,PR_TYPE:R,prettyPrintOne:N?G.prettyPrintOne=k:M=k,prettyPrint:z=N?G.prettyPrint=U:z=U},K=G.define;typeof K=="function"&&K.amd&&K("google-code-prettify",[],function(){return Q})})()},STEk:function(Qe,Te,q){"use strict";q.d(Te,"a",function(){return ve});/*! *****************************************************************************
|
|
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 oe=function(X,_){return(oe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(k,U){k.__proto__=U}||function(k,U){for(var Q in U)Object.prototype.hasOwnProperty.call(U,Q)&&(k[Q]=U[Q])})(X,_)};function Y(X,_){function k(){this.constructor=X}oe(X,_),X.prototype=_===null?Object.create(_):(k.prototype=_.prototype,new k)}function N(X,_,k,U){return new(k||(k=Promise))(function(Q,K){function ce(ue){try{De(U.next(ue))}catch(ge){K(ge)}}function xe(ue){try{De(U.throw(ue))}catch(ge){K(ge)}}function De(ue){var ge;ue.done?Q(ue.value):(ge=ue.value,ge instanceof k?ge:new k(function(we){we(ge)})).then(ce,xe)}De((U=U.apply(X,_||[])).next())})}function J(X,_){var k,U,Q,K,ce={label:0,sent:function(){if(1&Q[0])throw Q[1];return Q[1]},trys:[],ops:[]};return K={next:xe(0),throw:xe(1),return:xe(2)},typeof Symbol=="function"&&(K[Symbol.iterator]=function(){return this}),K;function xe(De){return function(ue){return function(ge){if(k)throw new TypeError("Generator is already executing.");for(;ce;)try{if(k=1,U&&(Q=2&ge[0]?U.return:ge[0]?U.throw||((Q=U.return)&&Q.call(U),0):U.next)&&!(Q=Q.call(U,ge[1])).done)return Q;switch(U=0,Q&&(ge=[2&ge[0],Q.value]),ge[0]){case 0:case 1:Q=ge;break;case 4:return ce.label++,{value:ge[1],done:!1};case 5:ce.label++,U=ge[1],ge=[0];continue;case 7:ge=ce.ops.pop(),ce.trys.pop();continue;default:if(!(Q=ce.trys,(Q=Q.length>0&&Q[Q.length-1])||ge[0]!==6&&ge[0]!==2)){ce=0;continue}if(ge[0]===3&&(!Q||ge[1]>Q[0]&&ge[1]<Q[3])){ce.label=ge[1];break}if(ge[0]===6&&ce.label<Q[1]){ce.label=Q[1],Q=ge;break}if(Q&&ce.label<Q[2]){ce.label=Q[2],ce.ops.push(ge);break}Q[2]&&ce.ops.pop(),ce.trys.pop();continue}ge=_.call(X,ce)}catch(we){ge=[6,we],U=0}finally{k=Q=0}if(5&ge[0])throw ge[1];return{value:ge[0]?ge[1]:void 0,done:!0}}([De,ue])}}}function H(){for(var X=0,_=0,k=arguments.length;_<k;_++)X+=arguments[_].length;var U=Array(X),Q=0;for(_=0;_<k;_++)for(var K=arguments[_],ce=0,xe=K.length;ce<xe;ce++,Q++)U[Q]=K[ce];return U}var M=function(){function X(){}return X.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},X.setAttributes=function(_,k){for(var U=0,Q=k;U<Q.length;U++){var K=Q[U],ce=K[0],xe=K[1];_.setAttribute(ce,xe)}},X.createRect=function(_,k,U){var Q=document.createElementNS("http://www.w3.org/2000/svg","rect");return Q.setAttribute("width",_.toString()),Q.setAttribute("height",k.toString()),U&&X.setAttributes(Q,U),Q},X.createLine=function(_,k,U,Q,K){var ce=document.createElementNS("http://www.w3.org/2000/svg","line");return ce.setAttribute("x1",_.toString()),ce.setAttribute("y1",k.toString()),ce.setAttribute("x2",U.toString()),ce.setAttribute("y2",Q.toString()),K&&X.setAttributes(ce,K),ce},X.createPolygon=function(_,k){var U=document.createElementNS("http://www.w3.org/2000/svg","polygon");return U.setAttribute("points",_),k&&X.setAttributes(U,k),U},X.createCircle=function(_,k){var U=document.createElementNS("http://www.w3.org/2000/svg","circle");return U.setAttribute("cx",(_/2).toString()),U.setAttribute("cy",(_/2).toString()),U.setAttribute("r",_.toString()),k&&X.setAttributes(U,k),U},X.createEllipse=function(_,k,U){var Q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Q.setAttribute("cx",(_/2).toString()),Q.setAttribute("cy",(k/2).toString()),Q.setAttribute("rx",(_/2).toString()),Q.setAttribute("ry",(k/2).toString()),U&&X.setAttributes(Q,U),Q},X.createGroup=function(_){var k=document.createElementNS("http://www.w3.org/2000/svg","g");return _&&X.setAttributes(k,_),k},X.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},X.createMarker=function(_,k,U,Q,K,ce,xe){var De=document.createElementNS("http://www.w3.org/2000/svg","marker");return X.setAttributes(De,[["id",_],["orient",k],["markerWidth",U.toString()],["markerHeight",Q.toString()],["refX",K.toString()],["refY",ce.toString()]]),De.appendChild(xe),De},X.createText=function(_){var k=document.createElementNS("http://www.w3.org/2000/svg","text");return k.setAttribute("x","0"),k.setAttribute("y","0"),_&&X.setAttributes(k,_),k},X.createTSpan=function(_,k){var U=document.createElementNS("http://www.w3.org/2000/svg","tspan");return U.textContent=_,k&&X.setAttributes(U,k),U},X.createImage=function(_){var k=document.createElementNS("http://www.w3.org/2000/svg","image");return _&&X.setAttributes(k,_),k},X.createPoint=function(_,k){var U=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return U.x=_,U.y=k,U},X.createPath=function(_,k){var U=document.createElementNS("http://www.w3.org/2000/svg","path");return U.setAttribute("d",_),k&&X.setAttributes(U,k),U},X}(),z=function(){function X(){}return X.addKey=function(_){X.key=_},Object.defineProperty(X,"isLicensed",{get:function(){return!!X.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(X.key)},enumerable:!1,configurable:!0}),X}(),G=function(){function X(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return X.prototype.rasterize=function(_,k,U){var Q=this;return new Promise(function(K){var ce=U!==void 0?U:document.createElement("canvas");_===null&&(Q.markersOnly=!0,Q.naturalSize=!1);var xe=document.createElementNS("http://www.w3.org/2000/svg","svg");xe.setAttribute("xmlns","http://www.w3.org/2000/svg"),xe.setAttribute("width",k.width.baseVal.valueAsString),xe.setAttribute("height",k.height.baseVal.valueAsString),xe.setAttribute("viewBox","0 0 "+k.viewBox.baseVal.width.toString()+" "+k.viewBox.baseVal.height.toString()),xe.innerHTML=k.innerHTML,Q.naturalSize===!0?(xe.width.baseVal.value=_.naturalWidth,xe.height.baseVal.value=_.naturalHeight):Q.width!==void 0&&Q.height!==void 0&&(xe.width.baseVal.value=Q.width,xe.height.baseVal.value=Q.height),ce.width=xe.width.baseVal.value,ce.height=xe.height.baseVal.value;var De=xe.outerHTML,ue=ce.getContext("2d");Q.markersOnly!==!0&&ue.drawImage(_,0,0,ce.width,ce.height);var ge=window.URL,we=new Image(ce.width,ce.height);we.setAttribute("crossOrigin","anonymous");var Oe=new Blob([De],{type:"image/svg+xml"}),Ne=ge.createObjectURL(Oe);we.onload=function(){ue.drawImage(we,0,0),ge.revokeObjectURL(Ne);var Ue=ce.toDataURL(Q.imageType,Q.imageQuality);K(Ue)},we.src=Ne})},X}(),r=function(){},O=function(){function X(_){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+_+"_"}return Object.defineProperty(X.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(X.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(X.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),X.prototype.addClass=function(_){return this.styleSheet===void 0&&this.addStyleSheet(),_.name=""+this.classNamePrefix+_.localName,this.classes.push(_),this.styleSheet.sheet.insertRule("."+_.name+" {"+_.style+"}",this.styleSheet.sheet.cssRules.length),_},X.prototype.addRule=function(_){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(_),this.styleSheet.sheet.insertRule(_.selector+" {"+_.style+"}",this.styleSheet.sheet.cssRules.length)},X.prototype.addStyleSheet=function(){var _;this.styleSheet=document.createElement("style"),((_=this.styleSheetRoot)!==null&&_!==void 0?_:document.head).appendChild(this.styleSheet),this.addRule(new v("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new v("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new v("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new m("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new m("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},X.prototype.removeStyleSheet=function(){var _;this.styleSheet&&(((_=this.styleSheetRoot)!==null&&_!==void 0?_:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},X}(),v=function(X,_){this.selector=X,this.style=_},m=function(X,_){this.localName=X,this.style=_},p=function(){function X(_,k,U,Q,K){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=_,this.displayMode=k,this.markerItems=U,this.uiStyleSettings=Q,this.styles=K,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return X.prototype.show=function(_){var k=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=_,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var U=document.createElement("div");U.className=this.toolbarBlockStyleClass.name,U.style.whiteSpace="nowrap",this.uiContainer.appendChild(U),this.addActionButton(U,'<svg viewBox="0 0 24 24"><path d="M10.07 14.27a.997.997 0 011.33.48l2.3 4.99 1.8-.85-2.31-4.98c-.24-.5-.02-1.1.48-1.33l.28-.08 2.3-.45L8 5.12V15.9l1.82-1.47.25-.16m3.57 7.7a.99.99 0 01-1.33-.47l-2.18-4.74-2.51 2.02c-.17.14-.38.22-.62.22a1 1 0 01-1-1V3a1 1 0 011-1c.24 0 .47.09.64.23l.01-.01 11.49 9.64a1.001 1.001 0 01-.44 1.75l-3.16.62 2.2 4.73c.26.5.02 1.09-.48 1.32l-3.62 1.69z"/></svg>',"select"),this.addActionButton(U,'<svg viewBox="0 0 24 24"><path d="M9 3v1H4v2h1v13a2 2 0 002 2h10a2 2 0 002-2V6h1V4h-5V3H9M7 6h10v13H7V6m2 2v9h2V8H9m4 0v9h2V8h-2z"/></svg>',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(U,'<svg viewBox="0 0 24 24"><path d="M19.36 2.72l1.42 1.42-5.72 5.71c1.07 1.54 1.22 3.39.32 4.59L9.06 8.12c1.2-.9 3.05-.75 4.59.32l5.71-5.72M5.93 17.57c-2.01-2.01-3.24-4.41-3.58-6.65l4.88-2.09 7.44 7.44-2.09 4.88c-2.24-.34-4.64-1.57-6.65-3.58z"/></svg>',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(U,'<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(U,'<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 017.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(U,'<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(U,'<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 009.5 3 6.5 6.5 0 003 9.5 6.5 6.5 0 009.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5 1.5-1.5-5-5m-6 0C7 14 5 12 5 9.5S7 5 9.5 5 14 7 14 9.5 12 14 9.5 14M7 9h5v1H7V9z"/></svg>',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(U,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(K){var ce=document.createElement("div");ce.className=""+k.toolbarButtonStyleClass.name,ce.setAttribute("data-type-name",K.typeName),ce.innerHTML=K.icon,ce.addEventListener("click",function(){k.markerToolbarButtonClicked(ce,K)}),k.buttons.push(ce),k.markerButtons.push(ce)}),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 Q=document.createElement("div");Q.className=this.toolbarBlockStyleClass.name,Q.style.whiteSpace="nowrap",Q.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(Q),this.addActionButton(Q,'<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(Q,'<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()},X.prototype.addButtonClickListener=function(_){this.buttonClickListeners.push(_)},X.prototype.removeButtonClickListener=function(_){this.buttonClickListeners.indexOf(_)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(_),1)},X.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},X.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var _=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var k=0;k<this.markerButtons.length;k++)k<_||k===_&&this.markerButtons.length-1===_?this.markerButtonBlock.appendChild(this.markerButtons[k]):(k===_&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[k]))}},X.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")},X.prototype.resetButtonStyles=function(){var _=this;this.buttons.forEach(function(k){k.className=k.className.replace(_.uiStyleSettings.toolbarButtonStyleColorsClassName?_.uiStyleSettings.toolbarButtonStyleColorsClassName:_.toolbarButtonStyleColorsClass.name,"").trim(),k.className=k.className.replace(_.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?_.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:_.toolbarActiveButtonStyleColorsClass.name,"").trim(),k.className+=" "+(_.uiStyleSettings.toolbarButtonStyleColorsClassName?_.uiStyleSettings.toolbarButtonStyleColorsClassName:_.toolbarButtonStyleColorsClass.name)})},X.prototype.addActionButton=function(_,k,U){var Q=this,K=document.createElement("div");switch(K.className=""+this.toolbarButtonStyleClass.name,K.innerHTML=k,K.setAttribute("data-action",U),K.addEventListener("click",function(){Q.actionToolbarButtonClicked(K,U)}),U){case"select":K.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":K.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":K.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":K.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":K.style.fill=this.uiStyleSettings.closeButtonColor}_.appendChild(K),this.buttons.push(K)},X.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new m("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 m("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new m("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new m("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 m("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var _=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new m("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*_)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*_)+`px;
|
|
padding: `+_+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new m("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new m("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new v("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new v("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},X.prototype.markerToolbarButtonClicked=function(_,k){this.setActiveButton(_),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(U){return U("marker",k)}),this.markerButtonOverflowBlock.style.display="none"},X.prototype.actionToolbarButtonClicked=function(_,k){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(U){return U("action",k)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},X.prototype.setActiveButton=function(_){this.resetButtonStyles(),_.className=_.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),_.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},X.prototype.setActiveMarkerButton=function(_){var k=this.markerButtons.find(function(U){return U.getAttribute("data-type-name")===_});k&&this.setActiveButton(k)},X.prototype.setCurrentMarker=function(_){var k=this;this.currentMarker=_,this.buttons.filter(function(U){return/delete|notes/.test(U.getAttribute("data-action"))}).forEach(function(U){k.currentMarker===void 0?(U.style.fillOpacity="0.4",U.style.pointerEvents="none"):(U.style.fillOpacity="1",U.style.pointerEvents="all")})},X}(),h=function(){function X(_,k,U,Q){this.panels=[],this.panelButtons=[],this.markerjsContainer=_,this.displayMode=k,this.uiStyleSettings=U,this.styles=Q,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return X.prototype.addStyles=function(){var _;this.toolboxStyleClass=this.styles.addClass(new m("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 m("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var k=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new m("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new m("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new m("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 m("toolbox-panel-row_colors",`
|
|
background-color: `+((_=this.uiStyleSettings.toolboxBackgroundColor)!==null&&_!==void 0?_:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new m("toolbox_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*k)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*k)+`px;
|
|
padding: `+k+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new m("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new m("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new v("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new v("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`))},X.prototype.show=function(_){var k;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=_,this.uiContainer.className=this.toolboxStyleClass.name+" "+((k=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&k!==void 0?k:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},X.prototype.setPanelButtons=function(_){var k,U,Q=this;this.panels=_,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((k=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&k!==void 0?k:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((U=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&U!==void 0?U:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(K){var ce;K.uiStyleSettings=Q.uiStyleSettings;var xe=document.createElement("div");xe.className=Q.toolboxButtonStyleClass.name+" "+((ce=Q.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ce!==void 0?ce:Q.toolboxButtonStyleColorsClass.name),xe.innerHTML=K.icon,xe.title=K.title,xe.addEventListener("click",function(){Q.panelButtonClick(K)}),Q.panelButtons.push(xe),Q.buttonRow.appendChild(xe)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},X.prototype.panelButtonClick=function(_){var k=this,U=-1;if(_!==this.activePanel){U=this.panels.indexOf(_),this.panelRow.innerHTML="";var Q=_.getUi();Q.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(Q),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=_}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){k.displayMode==="inline"?k.panelRow.style.display="none":k.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(K,ce){var xe,De;K.className=k.toolboxButtonStyleClass.name+" "+(ce===U?""+((xe=k.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&xe!==void 0?xe:k.toolboxActiveButtonStyleColorsClass.name):""+((De=k.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&De!==void 0?De:k.toolboxButtonStyleColorsClass.name))})},X}(),u=function(X,_){this.title=X,this.icon=_},f=function(X){function _(k,U,Q,K){var ce=X.call(this,k,K||'<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 ce.colors=[],ce.addTransparent=!1,ce.colorBoxes=[],ce.colors=U,ce.currentColor=Q,ce.setCurrentColor=ce.setCurrentColor.bind(ce),ce.getColorBox=ce.getColorBox.bind(ce),ce}return Y(_,X),_.prototype.getUi=function(){var k=this,U=document.createElement("div");return U.style.overflow="hidden",U.style.whiteSpace="nowrap",this.colors.forEach(function(Q){var K=k.getColorBox(Q);U.appendChild(K),k.colorBoxes.push(K)}),U},_.prototype.getColorBox=function(k){var U=this,Q=this.uiStyleSettings.toolbarHeight/4,K=this.uiStyleSettings.toolbarHeight-Q,ce=document.createElement("div");ce.style.display="inline-block",ce.style.boxSizing="content-box",ce.style.width=K-2+"px",ce.style.height=K-2+"px",ce.style.padding="1px",ce.style.marginRight="2px",ce.style.marginBottom="2px",ce.style.borderWidth="2px",ce.style.borderStyle="solid",ce.style.borderRadius=(K+2)/2+"px",ce.style.borderColor=k===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ce.addEventListener("click",function(){U.setCurrentColor(k,ce)});var xe=document.createElement("div");return xe.style.display="inline-block",xe.style.width=K-2+"px",xe.style.height=K-2+"px",xe.style.backgroundColor=k,xe.style.borderRadius=K/2+"px",k==="transparent"&&(xe.style.fill=this.uiStyleSettings.toolboxAccentColor,xe.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>`),ce.appendChild(xe),ce},_.prototype.setCurrentColor=function(k,U){var Q=this;this.currentColor=k,this.colorBoxes.forEach(function(K){K.style.borderColor=K===U?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(k)},_}(u),o=function(){function X(_,k,U){this._state="new",this._isSelected=!1,this._container=_,this._overlayContainer=k,this.globalSettings=U,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(X.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),X.prototype.ownsTarget=function(_){return!1},Object.defineProperty(X.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),X.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},X.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},X.prototype.pointerDown=function(_,k){},X.prototype.dblClick=function(_,k){},X.prototype.manipulate=function(_){},X.prototype.pointerUp=function(_){this.stateChanged()},X.prototype.dispose=function(){},X.prototype.addMarkerVisualToContainer=function(_){this.container.childNodes.length>0?this.container.insertBefore(_,this.container.childNodes[0]):this.container.appendChild(_)},X.prototype.getState=function(){return{typeName:X.typeName,state:this.state,notes:this.notes}},X.prototype.restoreState=function(_){this._state=_.state,this.notes=_.notes},X.prototype.scale=function(_,k){},X.prototype.colorChanged=function(_){this.onColorChanged&&this.onColorChanged(_),this.stateChanged()},X.prototype.fillColorChanged=function(_){this.onFillColorChanged&&this.onFillColorChanged(_),this.stateChanged()},X.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var _=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),_.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(_)&&this.onStateChanged(this)}},X.typeName="MarkerBase",X}(),l=function(){function X(){this.findGripByVisual=this.findGripByVisual.bind(this)}return X.prototype.findGripByVisual=function(_){return this.topLeft.ownsTarget(_)?this.topLeft:this.topCenter.ownsTarget(_)?this.topCenter:this.topRight.ownsTarget(_)?this.topRight:this.centerLeft.ownsTarget(_)?this.centerLeft:this.centerRight.ownsTarget(_)?this.centerRight:this.bottomLeft.ownsTarget(_)?this.bottomLeft:this.bottomCenter.ownsTarget(_)?this.bottomCenter:this.bottomRight.ownsTarget(_)?this.bottomRight:void 0},X}(),s=function(){function X(){this.GRIP_SIZE=10,this.visual=M.createGroup(),this.visual.appendChild(M.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(M.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return X.prototype.ownsTarget=function(_){return _===this.visual||_===this.visual.childNodes[0]||_===this.visual.childNodes[1]},X}(),a=function(){function X(){}return X.toITransformMatrix=function(_){return{a:_.a,b:_.b,c:_.c,d:_.d,e:_.e,f:_.f}},X.toSVGMatrix=function(_,k){return _.a=k.a,_.b=k.b,_.c=k.c,_.d=k.d,_.e=k.e,_.f=k.f,_},X}(),S=function(X){function _(k,U,Q){var K=X.call(this,k,U,Q)||this;return K.left=0,K.top=0,K.width=0,K.height=0,K.defaultSize={x:50,y:20},K.offsetX=0,K.offsetY=0,K.rotationAngle=0,K.CB_DISTANCE=10,K._suppressMarkerCreateEvent=!1,K.container.transform.baseVal.appendItem(M.createTransform()),K.setupControlBox(),K}return Y(_,X),Object.defineProperty(_.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"visual",{get:function(){return this._visual},set:function(k){this._visual=k;var U=M.createTransform();this._visual.transform.baseVal.appendItem(U)},enumerable:!1,configurable:!0}),_.prototype.ownsTarget=function(k){return!!X.prototype.ownsTarget.call(this,k)||!!(this.controlGrips.findGripByVisual(k)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(k))},_.prototype.pointerDown=function(k,U){X.prototype.pointerDown.call(this,k,U),this.state==="new"&&(this.left=k.x,this.top=k.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var Q=this.unrotatePoint(k);if(this.manipulationStartX=Q.x,this.manipulationStartY=Q.y,this.offsetX=Q.x-this.left,this.offsetY=Q.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(U),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(U)){this.activeGrip=this.rotatorGrip;var K=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=K.x-this.width/2,this.top=K.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ce=this.container.transform.baseVal.getItem(0);ce.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ce,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},_.prototype.pointerUp=function(k){var U=this.state;X.prototype.pointerUp.call(this,k),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(k),this._state="select",U==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},_.prototype.moveVisual=function(k){this.visual.style.transform="translate("+k.x+"px, "+k.y+"px)"},_.prototype.manipulate=function(k){var U=this.unrotatePoint(k);this.state==="creating"?this.resize(k):this.state==="move"?(this.left=this.manipulationStartLeft+(U.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(U.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(U):this.state==="rotate"&&this.rotate(k)},_.prototype.resize=function(k){var U=this.manipulationStartLeft,Q=this.manipulationStartWidth,K=this.manipulationStartTop,ce=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:U=this.manipulationStartLeft+k.x-this.manipulationStartX,Q=this.manipulationStartWidth+this.manipulationStartLeft-U;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:Q=this.manipulationStartWidth+k.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:K=this.manipulationStartTop+k.y-this.manipulationStartY,ce=this.manipulationStartHeight+this.manipulationStartTop-K;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ce=this.manipulationStartHeight+k.y-this.manipulationStartY}Q>=0?(this.left=U,this.width=Q):(this.left=U+Q,this.width=-Q),ce>=0?(this.top=K,this.height=ce):(this.top=K+ce,this.height=-ce),this.setSize()},_.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},_.prototype.rotate=function(k){if(Math.abs(k.x-this.centerX)>.1){var U=Math.sign(k.x-this.centerX);this.rotationAngle=180*Math.atan((k.y-this.centerY)/(k.x-this.centerX))/Math.PI+90*U,this.applyRotation()}},_.prototype.applyRotation=function(){var k=this.container.transform.baseVal.getItem(0);k.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(k,0)},_.prototype.rotatePoint=function(k){if(this.rotationAngle===0)return k;var U=this.container.getCTM(),Q=M.createPoint(k.x,k.y);return{x:(Q=Q.matrixTransform(U)).x,y:Q.y}},_.prototype.unrotatePoint=function(k){if(this.rotationAngle===0)return k;var U=this.container.getCTM();U=U.inverse();var Q=M.createPoint(k.x,k.y);return{x:(Q=Q.matrixTransform(U)).x,y:Q.y}},_.prototype.select=function(){X.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},_.prototype.deselect=function(){X.prototype.deselect.call(this),this.controlBox.style.display="none"},_.prototype.setupControlBox=function(){this.controlBox=M.createGroup();var k=M.createTransform();k.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(k),this.container.appendChild(this.controlBox),this.controlRect=M.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=M.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 l,this.addControlGrips(),this.controlBox.style.display="none"},_.prototype.adjustControlBox=function(){var k=this.controlBox.transform.baseVal.getItem(0);k.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(k,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()},_.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()},_.prototype.createGrip=function(){var k=new s;return k.visual.transform.baseVal.appendItem(M.createTransform()),this.controlBox.appendChild(k.visual),k},_.prototype.positionGrips=function(){var k=this.controlGrips.topLeft.GRIP_SIZE,U=-k/2,Q=U,K=(this.width+this.CB_DISTANCE)/2-k/2,ce=(this.height+this.CB_DISTANCE)/2-k/2,xe=this.height+this.CB_DISTANCE-k/2,De=this.width+this.CB_DISTANCE-k/2;this.positionGrip(this.controlGrips.topLeft.visual,U,Q),this.positionGrip(this.controlGrips.topCenter.visual,K,Q),this.positionGrip(this.controlGrips.topRight.visual,De,Q),this.positionGrip(this.controlGrips.centerLeft.visual,U,ce),this.positionGrip(this.controlGrips.centerRight.visual,De,ce),this.positionGrip(this.controlGrips.bottomLeft.visual,U,xe),this.positionGrip(this.controlGrips.bottomCenter.visual,K,xe),this.positionGrip(this.controlGrips.bottomRight.visual,De,xe),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,K,Q-3*this.CB_DISTANCE)},_.prototype.positionGrip=function(k,U,Q){var K=k.transform.baseVal.getItem(0);K.setTranslate(U,Q),k.transform.baseVal.replaceItem(K,0)},_.prototype.hideControlBox=function(){this.controlBox.style.display="none"},_.prototype.showControlBox=function(){this.controlBox.style.display=""},_.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:a.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:a.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},X.prototype.getState.call(this))},_.prototype.restoreState=function(k){X.prototype.restoreState.call(this,k);var U=k;this.left=U.left,this.top=U.top,this.width=U.width,this.height=U.height,this.rotationAngle=U.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(a.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,U.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(a.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,U.containerTransformMatrix))},_.prototype.scale=function(k,U){X.prototype.scale.call(this,k,U);var Q=this.rotatePoint({x:this.left,y:this.top}),K=this.unrotatePoint({x:Q.x*k,y:Q.y*U});this.left=K.x,this.top=K.y,this.width=this.width*k,this.height=this.height*U,this.adjustControlBox()},_}(o),x=function(X){function _(k,U,Q){var K=X.call(this,k,U,Q)||this;return K.fillColor="transparent",K.strokeColor="transparent",K.strokeWidth=0,K.strokeDasharray="",K.opacity=1,K.setStrokeColor=K.setStrokeColor.bind(K),K.setFillColor=K.setFillColor.bind(K),K.setStrokeWidth=K.setStrokeWidth.bind(K),K.setStrokeDasharray=K.setStrokeDasharray.bind(K),K.createVisual=K.createVisual.bind(K),K}return Y(_,X),_.prototype.ownsTarget=function(k){return!(!X.prototype.ownsTarget.call(this,k)&&k!==this.visual)},_.prototype.createVisual=function(){this.visual=M.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)},_.prototype.pointerDown=function(k,U){X.prototype.pointerDown.call(this,k,U),this.state==="new"&&(this.createVisual(),this.moveVisual(k),this._state="creating")},_.prototype.manipulate=function(k){X.prototype.manipulate.call(this,k)},_.prototype.resize=function(k){X.prototype.resize.call(this,k),this.setSize()},_.prototype.setSize=function(){X.prototype.setSize.call(this),M.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},_.prototype.pointerUp=function(k){X.prototype.pointerUp.call(this,k),this.setSize()},_.prototype.setStrokeColor=function(k){this.strokeColor=k,this.visual&&M.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(k),this.stateChanged()},_.prototype.setFillColor=function(k){this.fillColor=k,this.visual&&M.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},_.prototype.setStrokeWidth=function(k){this.strokeWidth=k,this.visual&&M.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},_.prototype.setStrokeDasharray=function(k){this.strokeDasharray=k,this.visual&&M.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},_.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},X.prototype.getState.call(this))},_.prototype.restoreState=function(k){var U=k;this.fillColor=U.fillColor,this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.strokeDasharray,this.opacity=U.opacity,this.createVisual(),X.prototype.restoreState.call(this,k),this.setSize()},_.prototype.scale=function(k,U){X.prototype.scale.call(this,k,U),this.setSize()},_.title="Rectangle marker",_}(S),C=function(X){function _(k,U,Q,K){var ce=X.call(this,k,K||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return ce.widths=[],ce.widthBoxes=[],ce.widths=U,ce.currentWidth=Q,ce.setCurrentWidth=ce.setCurrentWidth.bind(ce),ce}return Y(_,X),_.prototype.getUi=function(){var k=this,U=document.createElement("div");return U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2",this.widths.forEach(function(Q){var K=document.createElement("div");K.style.display="flex",K.style.flexGrow="2",K.style.alignItems="center",K.style.justifyContent="space-between",K.style.padding="5px",K.style.borderWidth="2px",K.style.borderStyle="solid",K.style.borderColor=Q===k.currentWidth?k.uiStyleSettings.toolboxAccentColor:"transparent",K.addEventListener("click",function(){k.setCurrentWidth(Q,K)}),U.appendChild(K);var ce=document.createElement("div");ce.innerText=Q.toString(),ce.style.marginRight="5px",K.appendChild(ce);var xe=document.createElement("div");xe.style.minHeight="20px",xe.style.flexGrow="2",xe.style.display="flex",xe.style.alignItems="center";var De=document.createElement("hr");De.style.minWidth="20px",De.style.border="0px",De.style.borderTop=Q+"px solid "+k.uiStyleSettings.toolboxColor,De.style.flexGrow="2",xe.appendChild(De),K.appendChild(xe),k.widthBoxes.push(K)}),U},_.prototype.setCurrentWidth=function(k,U){var Q=this;this.currentWidth=k,this.widthBoxes.forEach(function(K){K.style.borderColor=K===U?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},_}(u),D=function(X){function _(k,U,Q,K){var ce=X.call(this,k,K||'<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 ce.styles=[],ce.styleBoxes=[],ce.styles=U,ce.currentStyle=Q,ce.setCurrentStyle=ce.setCurrentStyle.bind(ce),ce}return Y(_,X),_.prototype.getUi=function(){var k=this,U=document.createElement("div");return U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2",this.styles.forEach(function(Q){var K=document.createElement("div");K.style.display="flex",K.style.alignItems="center",K.style.justifyContent="space-between",K.style.padding="5px",K.style.borderWidth="2px",K.style.borderStyle="solid",K.style.overflow="hidden",K.style.maxWidth=100/k.styles.length-5+"%",K.style.borderColor=Q===k.currentStyle?k.uiStyleSettings.toolboxAccentColor:"transparent",K.addEventListener("click",function(){k.setCurrentStyle(Q,K)}),U.appendChild(K);var ce=document.createElement("div");ce.style.minHeight="20px",ce.style.flexGrow="2",ce.style.overflow="hidden";var xe=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+k.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(Q!==""?'stroke-dasharray="'+Q+'"':"")+` />
|
|
</svg>`;ce.innerHTML=xe,K.appendChild(ce),k.styleBoxes.push(K)}),U},_.prototype.setCurrentStyle=function(k,U){var Q=this;this.currentStyle=k,this.styleBoxes.forEach(function(K){K.style.borderColor=K===U?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},_}(u),L=function(X){function _(k,U,Q){var K=X.call(this,k,U,Q)||this;return K.strokeColor=Q.defaultColor,K.strokeWidth=Q.defaultStrokeWidth,K.strokeDasharray=Q.defaultStrokeDasharray,K.strokePanel=new f("Line color",Q.defaultColorSet,Q.defaultColor),K.strokePanel.onColorChanged=K.setStrokeColor,K.strokeWidthPanel=new C("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),K.strokeWidthPanel.onWidthChanged=K.setStrokeWidth,K.strokeStylePanel=new D("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),K.strokeStylePanel.onStyleChanged=K.setStrokeDasharray,K}return Y(_,X),Object.defineProperty(_.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),_.prototype.getState=function(){var k=X.prototype.getState.call(this);return k.typeName=_.typeName,k},_.typeName="FrameMarker",_.title="Frame marker",_.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',_}(x),R=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},A=function(X){function _(k,U,Q){var K=X.call(this,k,U,Q)||this;return K.x1=0,K.y1=0,K.x2=0,K.y2=0,K.defaultLength=50,K.manipulationStartX=0,K.manipulationStartY=0,K.manipulationStartX1=0,K.manipulationStartY1=0,K.manipulationStartX2=0,K.manipulationStartY2=0,K.setupControlBox(),K}return Y(_,X),_.prototype.ownsTarget=function(k){return!!X.prototype.ownsTarget.call(this,k)||!(!this.grip1.ownsTarget(k)&&!this.grip2.ownsTarget(k))},_.prototype.pointerDown=function(k,U){X.prototype.pointerDown.call(this,k,U),this.manipulationStartX=k.x,this.manipulationStartY=k.y,this.state==="new"&&(this.x1=k.x,this.y1=k.y,this.x2=k.x,this.y2=k.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,this.state!=="new"&&(this.select(),this.grip1.ownsTarget(U)?this.activeGrip=this.grip1:this.grip2.ownsTarget(U)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},_.prototype.pointerUp=function(k){var U=this.state;X.prototype.pointerUp.call(this,k),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(k),this._state="select",U==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},_.prototype.adjustVisual=function(){},_.prototype.manipulate=function(k){this.state==="creating"?this.resize(k):this.state==="move"?(this.x1=this.manipulationStartX1+k.x-this.manipulationStartX,this.y1=this.manipulationStartY1+k.y-this.manipulationStartY,this.x2=this.manipulationStartX2+k.x-this.manipulationStartX,this.y2=this.manipulationStartY2+k.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(k)},_.prototype.resize=function(k){switch(this.activeGrip){case this.grip1:this.x1=k.x,this.y1=k.y;break;case this.grip2:case void 0:this.x2=k.x,this.y2=k.y}this.adjustVisual(),this.adjustControlBox()},_.prototype.select=function(){X.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},_.prototype.deselect=function(){X.prototype.deselect.call(this),this.controlBox.style.display="none"},_.prototype.setupControlBox=function(){this.controlBox=M.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},_.prototype.adjustControlBox=function(){this.positionGrips()},_.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},_.prototype.createGrip=function(){var k=new s;return k.visual.transform.baseVal.appendItem(M.createTransform()),this.controlBox.appendChild(k.visual),k},_.prototype.positionGrips=function(){var k=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-k/2,this.y1-k/2),this.positionGrip(this.grip2.visual,this.x2-k/2,this.y2-k/2)},_.prototype.positionGrip=function(k,U,Q){var K=k.transform.baseVal.getItem(0);K.setTranslate(U,Q),k.transform.baseVal.replaceItem(K,0)},_.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},X.prototype.getState.call(this))},_.prototype.restoreState=function(k){X.prototype.restoreState.call(this,k);var U=k;this.x1=U.x1,this.y1=U.y1,this.x2=U.x2,this.y2=U.y2},_.prototype.scale=function(k,U){X.prototype.scale.call(this,k,U),this.x1=this.x1*k,this.y1=this.y1*U,this.x2=this.x2*k,this.y2=this.y2*U,this.adjustVisual(),this.adjustControlBox()},_}(o),T=function(X){function _(k,U,Q){var K=X.call(this,k,U,Q)||this;return K.strokeColor="transparent",K.strokeWidth=0,K.strokeDasharray="",K.setStrokeColor=K.setStrokeColor.bind(K),K.setStrokeWidth=K.setStrokeWidth.bind(K),K.setStrokeDasharray=K.setStrokeDasharray.bind(K),K.strokeColor=Q.defaultColor,K.strokeWidth=Q.defaultStrokeWidth,K.strokeDasharray=Q.defaultStrokeDasharray,K.strokePanel=new f("Line color",Q.defaultColorSet,Q.defaultColor),K.strokePanel.onColorChanged=K.setStrokeColor,K.strokeWidthPanel=new C("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),K.strokeWidthPanel.onWidthChanged=K.setStrokeWidth,K.strokeStylePanel=new D("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),K.strokeStylePanel.onStyleChanged=K.setStrokeDasharray,K}return Y(_,X),_.prototype.ownsTarget=function(k){return!(!X.prototype.ownsTarget.call(this,k)&&k!==this.visual&&k!==this.selectorLine&&k!==this.visibleLine)},_.prototype.createVisual=function(){this.visual=M.createGroup(),this.selectorLine=M.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=M.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)},_.prototype.pointerDown=function(k,U){X.prototype.pointerDown.call(this,k,U),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},_.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()),M.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),M.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),M.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},_.prototype.setStrokeColor=function(k){this.strokeColor=k,this.adjustVisual(),this.colorChanged(k)},_.prototype.setStrokeWidth=function(k){this.strokeWidth=k,this.adjustVisual()},_.prototype.setStrokeDasharray=function(k){this.strokeDasharray=k,this.adjustVisual(),this.stateChanged()},Object.defineProperty(_.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),_.prototype.getState=function(){var k=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},X.prototype.getState.call(this));return k.typeName=_.typeName,k},_.prototype.restoreState=function(k){X.prototype.restoreState.call(this,k);var U=k;this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.strokeDasharray,this.createVisual(),this.adjustVisual()},_.typeName="LineMarker",_.title="Line marker",_.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',_}(A),d=function(X){function _(k,U,Q,K){var ce=X.call(this,k,K||'<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 ce.fonts=[],ce.fontBoxes=[],ce.fonts=U,ce.currentFont=Q,ce.setCurrentFont=ce.setCurrentFont.bind(ce),ce}return Y(_,X),_.prototype.getUi=function(){var k=this,U=document.createElement("div");return U.style.overflow="hidden",U.style.flexGrow="2",this.fonts.forEach(function(Q){var K=document.createElement("div");K.style.display="inline-block",K.style.alignItems="center",K.style.justifyContent="space-between",K.style.padding="5px",K.style.borderWidth="2px",K.style.borderStyle="solid",K.style.overflow="hidden",K.style.maxWidth=100/k.fonts.length-5+"%",K.style.borderColor=Q===k.currentFont?k.uiStyleSettings.toolboxAccentColor:"transparent",K.addEventListener("click",function(){k.setCurrentFont(Q,K)}),U.appendChild(K);var ce=document.createElement("div");ce.style.display="flex",ce.style.minHeight="20px",ce.style.flexGrow="2",ce.style.fontFamily=Q,ce.style.overflow="hidden";var xe=document.createElement("div");xe.style.whiteSpace="nowrap",xe.style.overflow="hidden",xe.style.textOverflow="ellipsis",xe.innerHTML="The quick brown fox jumps over the lazy dog",ce.appendChild(xe),K.appendChild(ce),k.fontBoxes.push(K)}),U},_.prototype.setCurrentFont=function(k,U){var Q=this;this.currentFont=k,this.fontBoxes.forEach(function(K){K.style.borderColor=K===U?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},_}(u),w=function(X){function _(k,U,Q){var K=X.call(this,k,U,Q)||this;return K.color="transparent",K.padding=5,K.DEFAULT_TEXT="your text here",K.text=K.DEFAULT_TEXT,K.isMoved=!1,K.color=Q.defaultColor,K.fontFamily=Q.defaultFontFamily,K.defaultSize={x:100,y:30},K.setColor=K.setColor.bind(K),K.setFont=K.setFont.bind(K),K.renderText=K.renderText.bind(K),K.sizeText=K.sizeText.bind(K),K.textEditDivClicked=K.textEditDivClicked.bind(K),K.showTextEditor=K.showTextEditor.bind(K),K.setSize=K.setSize.bind(K),K.positionTextEditor=K.positionTextEditor.bind(K),K.colorPanel=new f("Color",Q.defaultColorSet,Q.defaultColor),K.colorPanel.onColorChanged=K.setColor,K.fontFamilyPanel=new d("Font",Q.defaultFontFamilies,Q.defaultFontFamily),K.fontFamilyPanel.onFontChanged=K.setFont,K}return Y(_,X),_.prototype.ownsTarget=function(k){if(X.prototype.ownsTarget.call(this,k)||k===this.visual||k===this.textElement||k===this.bgRectangle)return!0;var U=!1;return this.textElement.childNodes.forEach(function(Q){Q===k&&(U=!0)}),U},_.prototype.createVisual=function(){this.visual=M.createGroup(),this.bgRectangle=M.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=M.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(M.createTransform()),this.textElement.transform.baseVal.appendItem(M.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},_.prototype.pointerDown=function(k,U){X.prototype.pointerDown.call(this,k,U),this.isMoved=!1,this.pointerDownPoint=k,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(k),this._state="creating")},_.prototype.renderText=function(){var k=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function(U){k.textElement.appendChild(M.createTSpan(U.trim()===""?" ":U.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},_.prototype.getTextScale=function(){var k=this.textElement.getBBox(),U=1;if(k.width>0&&k.height>0){var Q=(1*this.width-this.width*this.padding*2/100)/k.width,K=(1*this.height-this.height*this.padding*2/100)/k.height;U=Math.min(Q,K)}return U},_.prototype.getTextPosition=function(k){var U=this.textElement.getBBox(),Q=0,K=0;return U.width>0&&U.height>0&&(Q=(this.width-U.width*k)/2,K=this.height/2-U.height*k/2),{x:Q,y:K}},_.prototype.sizeText=function(){var k=this.textElement.getBBox(),U=this.getTextScale(),Q=this.getTextPosition(U);Q.y-=k.y*U,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+Q.x+"px, "+Q.y+"px) scale("+U+", "+U+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(Q.x,Q.y),this.textElement.transform.baseVal.getItem(1).setScale(U,U))},_.prototype.manipulate=function(k){X.prototype.manipulate.call(this,k),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(k.x-this.pointerDownPoint.x)>5||Math.abs(k.y-this.pointerDownPoint.y)>5)},_.prototype.resize=function(k){X.prototype.resize.call(this,k),this.isMoved=!0,this.setSize(),this.sizeText()},_.prototype.setSize=function(){X.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(M.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),M.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},_.prototype.pointerUp=function(k){var U=this.state;U==="creating"&&(this._suppressMarkerCreateEvent=!0),X.prototype.pointerUp.call(this,k),this.setSize(),(U==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},_.prototype.showTextEditor=function(){var k=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",function(U){U.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var U=Number.parseFloat(k.textEditor.style.fontSize);k.textEditor.clientWidth>=Number.parseInt(k.textEditor.style.maxWidth)&&U>.9;)U-=.1,k.textEditor.style.fontSize=Math.max(U,.9)+"em"}),this.textEditor.addEventListener("keyup",function(U){U.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(U){if(U.clipboardData){var Q=U.clipboardData.getData("text"),K=window.getSelection();if(!K.rangeCount)return!1;K.deleteFromDocument(),K.getRangeAt(0).insertNode(document.createTextNode(Q)),U.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){k.textEditDivClicked(k.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},_.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var k=this.getTextScale(),U=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),Q=this.textElement.getBBox(),K={x:Q.width*k,y:Q.height*k};U.x-=K.x/2,U.y-=K.y/2,this.textEditor.style.top=U.y+"px",this.textEditor.style.left=U.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-U.x+"px",this.textEditor.style.fontSize=Math.max(16*k,12)+"px",this.textElement.style.display="none"}},_.prototype.textEditDivClicked=function(k){this.text=k.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},_.prototype.select=function(){X.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},_.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),X.prototype.deselect.call(this)},_.prototype.dblClick=function(k,U){X.prototype.dblClick.call(this,k,U),this.showTextEditor()},_.prototype.setColor=function(k){this.textElement&&M.setAttributes(this.textElement,[["fill",k]]),this.color=k,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(k)},_.prototype.setFont=function(k){this.textElement&&M.setAttributes(this.textElement,[["font-family",k]]),this.fontFamily=k,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},_.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},_.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(_.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),_.prototype.getState=function(){var k=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},X.prototype.getState.call(this));return k.typeName=_.typeName,k},_.prototype.restoreState=function(k){var U=k;this.color=U.color,this.fontFamily=U.fontFamily,this.padding=U.padding,this.text=U.text,this.createVisual(),X.prototype.restoreState.call(this,k),this.setSize()},_.prototype.scale=function(k,U){X.prototype.scale.call(this,k,U),this.setSize(),this.sizeText(),this.positionTextEditor()},_.typeName="TextMarker",_.title="Text marker",_.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>',_}(S),y=function(X){function _(k,U,Q){var K=X.call(this,k,U,Q)||this;return K.color="transparent",K.lineWidth=3,K.drawing=!1,K.pixelRatio=1,K.color=Q.defaultColor,K.lineWidth=Q.defaultStrokeWidth,K.pixelRatio=Q.freehandPixelRatio,K.setColor=K.setColor.bind(K),K.addCanvas=K.addCanvas.bind(K),K.finishCreation=K.finishCreation.bind(K),K.setLineWidth=K.setLineWidth.bind(K),K.colorPanel=new f("Color",Q.defaultColorSet,Q.defaultColor),K.colorPanel.onColorChanged=K.setColor,K.lineWidthPanel=new C("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),K.lineWidthPanel.onWidthChanged=K.setLineWidth,K}return Y(_,X),_.prototype.ownsTarget=function(k){return!(!X.prototype.ownsTarget.call(this,k)&&k!==this.visual&&k!==this.drawingImage)},_.prototype.createVisual=function(){this.visual=M.createGroup(),this.drawingImage=M.createImage(),this.visual.appendChild(this.drawingImage);var k=M.createTransform();this.visual.transform.baseVal.appendItem(k),this.addMarkerVisualToContainer(this.visual)},_.prototype.pointerDown=function(k,U){this.state==="new"&&(this.addCanvas(),this.createVisual(),this._state="creating"),this.state==="creating"?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(k.x,k.y),this.drawing=!0):X.prototype.pointerDown.call(this,k,U)},_.prototype.manipulate=function(k){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(k.x,k.y),this.canvasContext.stroke()):X.prototype.manipulate.call(this,k)},_.prototype.resize=function(k){X.prototype.resize.call(this,k),M.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),M.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},_.prototype.pointerUp=function(k){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):X.prototype.pointerUp.call(this,k)},_.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)},_.prototype.select=function(){this.state==="creating"&&this.finishCreation(),X.prototype.select.call(this)},_.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),X.prototype.deselect.call(this)},_.prototype.finishCreation=function(){for(var k=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),U=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],Q=U[0],K=U[1],ce=U[2],xe=U[3],De=!1,ue=0;ue<this.canvasElement.height;ue++)for(var ge=0;ge<this.canvasElement.width;ge++)k.data[ue*this.canvasElement.width*4+4*ge+3]>0&&(De=!0,ue<K&&(K=ue),ge<Q&&(Q=ge),ue>xe&&(xe=ue),ge>ce&&(ce=ge));if(De){this.left=Q/this.pixelRatio,this.top=K/this.pixelRatio,this.width=(ce-Q)/this.pixelRatio,this.height=(xe-K)/this.pixelRatio;var we=document.createElement("canvas");we.width=ce-Q,we.height=xe-K,we.getContext("2d").putImageData(this.canvasContext.getImageData(Q,K,ce-Q,xe-K),0,0),this.drawingImgUrl=we.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},_.prototype.setDrawingImage=function(){M.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),M.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},_.prototype.setColor=function(k){this.color=k,this.colorChanged(k)},_.prototype.setLineWidth=function(k){this.lineWidth=k},Object.defineProperty(_.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),_.prototype.getState=function(){var k=Object.assign({drawingImgUrl:this.drawingImgUrl},X.prototype.getState.call(this));return k.typeName=_.typeName,k},_.prototype.restoreState=function(k){this.createVisual(),X.prototype.restoreState.call(this,k),this.drawingImgUrl=k.drawingImgUrl,this.setDrawingImage()},_.prototype.scale=function(k,U){X.prototype.scale.call(this,k,U),this.setDrawingImage()},_.typeName="FreehandMarker",_.title="Freehand marker",_.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>',_}(S),b=function(X){function _(k,U,Q){var K=X.call(this,k,Q||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return K.typeBoxes=[],K.currentType=U,K.setCurrentType=K.setCurrentType.bind(K),K}return Y(_,X),_.prototype.getUi=function(){var k=this,U=document.createElement("div");U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2";for(var Q=function(xe){var De="both";switch(xe){case 0:De="both";break;case 1:De="start";break;case 2:De="end";break;case 3:De="none"}var ue=document.createElement("div");if(ue.style.display="flex",ue.style.flexGrow="2",ue.style.alignItems="center",ue.style.justifyContent="space-between",ue.style.padding="5px",ue.style.borderWidth="2px",ue.style.borderStyle="solid",ue.style.borderColor=De===K.currentType?K.uiStyleSettings.toolboxAccentColor:"transparent",ue.addEventListener("click",function(){k.setCurrentType(De,ue)}),U.appendChild(ue),De==="both"||De==="start"){var ge=document.createElement("div");ge.style.display="flex",ge.style.alignItems="center",ge.style.minHeight="20px",ge.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="`+(K.uiStyleSettings!==void 0?K.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,ge.style.marginLeft="5px",ue.appendChild(ge)}var we=document.createElement("div");we.style.display="flex",we.style.alignItems="center",we.style.minHeight="20px",we.style.flexGrow="2";var Oe=document.createElement("hr");if(Oe.style.minWidth="20px",Oe.style.border="0px",Oe.style.borderTop="3px solid "+(K.uiStyleSettings!==void 0?K.uiStyleSettings.toolboxColor:"#eeeeee"),Oe.style.flexGrow="2",we.appendChild(Oe),ue.appendChild(we),De==="both"||De==="end"){var Ne=document.createElement("div");Ne.style.display="flex",Ne.style.alignItems="center",Ne.style.minHeight="20px",Ne.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="`+(K.uiStyleSettings!==void 0?K.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Ne.style.marginRight="5px",ue.appendChild(Ne)}K.typeBoxes.push(ue)},K=this,ce=0;ce<4;ce++)Q(ce);return U},_.prototype.setCurrentType=function(k,U){var Q=this;this.currentType=k,this.typeBoxes.forEach(function(K){K.style.borderColor=K===U?Q.uiStyleSettings!==void 0?Q.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},_}(u),j=function(X){function _(k,U,Q){var K=X.call(this,k,U,Q)||this;return K.arrowType="end",K.arrowBaseHeight=10,K.arrowBaseWidth=10,K.getArrowPoints=K.getArrowPoints.bind(K),K.setArrowType=K.setArrowType.bind(K),K.arrowTypePanel=new b("Arrow type","end"),K.arrowTypePanel.onArrowTypeChanged=K.setArrowType,K}return Y(_,X),_.prototype.ownsTarget=function(k){return!(!X.prototype.ownsTarget.call(this,k)&&k!==this.arrow1&&k!==this.arrow2)},_.prototype.getArrowPoints=function(k,U){var Q=this.arrowBaseWidth+2*this.strokeWidth,K=this.arrowBaseHeight+2*this.strokeWidth;return k-Q/2+","+(U+K/2)+" "+k+","+(U-K/2)+" "+(k+Q/2)+","+(U+K/2)},_.prototype.createTips=function(){this.arrow1=M.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(M.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=M.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(M.createTransform()),this.visual.appendChild(this.arrow2)},_.prototype.pointerDown=function(k,U){X.prototype.pointerDown.call(this,k,U),this.state==="creating"&&this.createTips()},_.prototype.adjustVisual=function(){if(X.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",M.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),M.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var k=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),U=this.arrow1.transform.baseVal.getItem(0);U.setRotate(k,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(U,0);var Q=this.arrow2.transform.baseVal.getItem(0);Q.setRotate(k+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(Q,0)}},_.prototype.setArrowType=function(k){this.arrowType=k,this.adjustVisual(),this.stateChanged()},Object.defineProperty(_.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),_.prototype.getState=function(){var k=Object.assign({arrowType:this.arrowType},X.prototype.getState.call(this));return k.typeName=_.typeName,k},_.prototype.restoreState=function(k){X.prototype.restoreState.call(this,k);var U=k;this.arrowType=U.arrowType,this.createTips(),this.adjustVisual()},_.typeName="ArrowMarker",_.title="Arrow marker",_.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',_}(T),B=function(X){function _(k,U,Q){var K=X.call(this,k,U,Q)||this;return K.fillColor=Q.defaultFillColor,K.strokeWidth=0,K.fillPanel=new f("Color",Q.defaultColorSet,Q.defaultFillColor),K.fillPanel.onColorChanged=K.setFillColor,K}return Y(_,X),Object.defineProperty(_.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),_.prototype.getState=function(){var k=X.prototype.getState.call(this);return k.typeName=_.typeName,k},_.typeName="CoverMarker",_.title="Cover marker",_.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',_}(x),E=function(X){function _(k,U,Q,K){var ce=X.call(this,k,K||'<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 ce.opacities=[],ce.opacityBoxes=[],ce.opacities=U,ce.currentOpacity=Q,ce.setCurrentOpacity=ce.setCurrentOpacity.bind(ce),ce}return Y(_,X),_.prototype.getUi=function(){var k=this,U=document.createElement("div");return U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2",U.style.justifyContent="space-between",this.opacities.forEach(function(Q){var K=document.createElement("div");K.style.display="flex",K.style.alignItems="center",K.style.justifyContent="center",K.style.padding="5px",K.style.borderWidth="2px",K.style.borderStyle="solid",K.style.borderColor=Q===k.currentOpacity?k.uiStyleSettings.toolboxAccentColor:"transparent",K.addEventListener("click",function(){k.setCurrentOpacity(Q,K)}),U.appendChild(K);var ce=document.createElement("div");ce.innerText=100*Q+"%",K.appendChild(ce),k.opacityBoxes.push(K)}),U},_.prototype.setCurrentOpacity=function(k,U){var Q=this;this.currentOpacity=k,this.opacityBoxes.forEach(function(K){K.style.borderColor=K===U?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},_}(u),F=function(X){function _(k,U,Q){var K=X.call(this,k,U,Q)||this;return K.setOpacity=K.setOpacity.bind(K),K.fillColor=Q.defaultHighlightColor,K.strokeWidth=0,K.opacity=Q.defaultHighlightOpacity,K.fillPanel=new f("Color",Q.defaultColorSet,K.fillColor),K.fillPanel.onColorChanged=K.setFillColor,K.opacityPanel=new E("Opacity",Q.defaultOpacitySteps,K.opacity),K.opacityPanel.onOpacityChanged=K.setOpacity,K}return Y(_,X),_.prototype.setOpacity=function(k){this.opacity=k,this.visual&&M.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(_.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),_.prototype.getState=function(){var k=X.prototype.getState.call(this);return k.typeName=_.typeName,k},_.typeName="HighlightMarker",_.title="Highlight marker",_.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>',_}(B),I='<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>',g=function(X){function _(k,U,Q){var K=X.call(this,k,U,Q)||this;return K.bgColor="transparent",K.tipPosition={x:0,y:0},K.tipBase1Position={x:0,y:0},K.tipBase2Position={x:0,y:0},K.tipMoving=!1,K.color=Q.defaultStrokeColor,K.bgColor=Q.defaultFillColor,K.fontFamily=Q.defaultFontFamily,K.defaultSize={x:100,y:30},K.setBgColor=K.setBgColor.bind(K),K.getTipPoints=K.getTipPoints.bind(K),K.positionTip=K.positionTip.bind(K),K.setTipPoints=K.setTipPoints.bind(K),K.colorPanel=new f("Text color",Q.defaultColorSet,K.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>'),K.colorPanel.onColorChanged=K.setColor,K.bgColorPanel=new f("Fill color",Q.defaultColorSet,K.bgColor,I),K.bgColorPanel.onColorChanged=K.setBgColor,K.fontFamilyPanel=new d("Font",Q.defaultFontFamilies,Q.defaultFontFamily),K.fontFamilyPanel.onFontChanged=K.setFont,K.tipGrip=new s,K.tipGrip.visual.transform.baseVal.appendItem(M.createTransform()),K.controlBox.appendChild(K.tipGrip.visual),K}return Y(_,X),_.prototype.ownsTarget=function(k){return X.prototype.ownsTarget.call(this,k)||this.tipGrip.ownsTarget(k)||this.tip===k},_.prototype.createTip=function(){M.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=M.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},_.prototype.pointerDown=function(k,U){this.state==="new"&&X.prototype.pointerDown.call(this,k,U),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(U)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):X.prototype.pointerDown.call(this,k,U)},_.prototype.pointerUp=function(k){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,X.prototype.pointerUp.call(this,k);else{var U=this.state==="creating";X.prototype.pointerUp.call(this,k),this.setTipPoints(U),this.positionTip()}},_.prototype.manipulate=function(k){if(this.tipMoving){var U=this.unrotatePoint(k);this.tipPosition={x:U.x-this.manipulationStartLeft,y:U.y-this.manipulationStartTop},this.positionTip()}else X.prototype.manipulate.call(this,k)},_.prototype.setBgColor=function(k){this.bgRectangle&&this.tip&&(M.setAttributes(this.bgRectangle,[["fill",k]]),M.setAttributes(this.tip,[["fill",k]])),this.bgColor=k,this.fillColorChanged(k)},_.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},_.prototype.setTipPoints=function(k){k===void 0&&(k=!1);var U=Math.min(this.height/2,15),Q=this.height/5;k&&(this.tipPosition={x:U+Q/2,y:this.height+20});var K=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?K<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(Q=this.width/5,U=Math.min(this.width/2,15),this.tipBase1Position={x:U,y:0},this.tipBase2Position={x:U+Q,y:0}):(this.tipBase1Position={x:0,y:U},this.tipBase2Position={x:0,y:U+Q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?K<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(Q=this.width/5,U=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-U-Q,y:0},this.tipBase2Position={x:this.width-U,y:0}):(this.tipBase1Position={x:this.width,y:U},this.tipBase2Position={x:this.width,y:U+Q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?K<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(Q=this.width/5,U=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-U-Q,y:this.height},this.tipBase2Position={x:this.width-U,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-U-Q},this.tipBase2Position={x:this.width,y:this.height-U}):K<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(Q=this.width/5,U=Math.min(this.width/2,15),this.tipBase1Position={x:U,y:this.height},this.tipBase2Position={x:U+Q,y:this.height}):(this.tipBase1Position={x:0,y:this.height-U},this.tipBase2Position={x:0,y:this.height-U-Q})},_.prototype.resize=function(k){X.prototype.resize.call(this,k),this.positionTip()},_.prototype.positionTip=function(){M.setAttributes(this.tip,[["points",this.getTipPoints()]]);var k=this.tipGrip.visual.transform.baseVal.getItem(0);k.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(k,0)},Object.defineProperty(_.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),_.prototype.select=function(){this.positionTip(),X.prototype.select.call(this)},_.prototype.getState=function(){var k=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},X.prototype.getState.call(this));return k.typeName=_.typeName,k},_.prototype.restoreState=function(k){var U=k;this.bgColor=U.bgColor,this.tipPosition=U.tipPosition,X.prototype.restoreState.call(this,k),this.createTip(),this.setTipPoints()},_.prototype.scale=function(k,U){X.prototype.scale.call(this,k,U),this.tipPosition={x:this.tipPosition.x*k,y:this.tipPosition.y*U},this.positionTip()},_.typeName="CalloutMarker",_.title="Callout marker",_.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>',_}(w),W=function(X){function _(k,U,Q){var K=X.call(this,k,U,Q)||this;return K.fillColor="transparent",K.strokeColor="transparent",K.strokeWidth=0,K.strokeDasharray="",K.opacity=1,K.strokeColor=Q.defaultColor,K.strokeWidth=Q.defaultStrokeWidth,K.strokeDasharray=Q.defaultStrokeDasharray,K.fillColor=Q.defaultFillColor,K.setStrokeColor=K.setStrokeColor.bind(K),K.setFillColor=K.setFillColor.bind(K),K.setStrokeWidth=K.setStrokeWidth.bind(K),K.setStrokeDasharray=K.setStrokeDasharray.bind(K),K.setOpacity=K.setOpacity.bind(K),K.createVisual=K.createVisual.bind(K),K.strokePanel=new f("Line color",H(Q.defaultColorSet,["transparent"]),Q.defaultColor),K.strokePanel.onColorChanged=K.setStrokeColor,K.fillPanel=new f("Fill color",H(Q.defaultColorSet,["transparent"]),K.fillColor,I),K.fillPanel.onColorChanged=K.setFillColor,K.strokeWidthPanel=new C("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),K.strokeWidthPanel.onWidthChanged=K.setStrokeWidth,K.strokeStylePanel=new D("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),K.strokeStylePanel.onStyleChanged=K.setStrokeDasharray,K.opacityPanel=new E("Opacity",Q.defaultOpacitySteps,K.opacity),K.opacityPanel.onOpacityChanged=K.setOpacity,K}return Y(_,X),_.prototype.ownsTarget=function(k){return!(!X.prototype.ownsTarget.call(this,k)&&k!==this.visual)},_.prototype.createVisual=function(){this.visual=M.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)},_.prototype.pointerDown=function(k,U){X.prototype.pointerDown.call(this,k,U),this.state==="new"&&(this.createVisual(),this.moveVisual(k),this._state="creating")},_.prototype.manipulate=function(k){X.prototype.manipulate.call(this,k)},_.prototype.resize=function(k){X.prototype.resize.call(this,k),this.setSize()},_.prototype.setSize=function(){X.prototype.setSize.call(this),M.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},_.prototype.pointerUp=function(k){X.prototype.pointerUp.call(this,k),this.setSize()},_.prototype.setStrokeColor=function(k){this.strokeColor=k,this.visual&&M.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(k),this.stateChanged()},_.prototype.setFillColor=function(k){this.fillColor=k,this.visual&&M.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(k),this.stateChanged()},_.prototype.setStrokeWidth=function(k){this.strokeWidth=k,this.visual&&M.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},_.prototype.setStrokeDasharray=function(k){this.strokeDasharray=k,this.visual&&M.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},_.prototype.setOpacity=function(k){this.opacity=k,this.visual&&M.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(_.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),_.prototype.getState=function(){var k=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},X.prototype.getState.call(this));return k.typeName=_.typeName,k},_.prototype.restoreState=function(k){var U=k;this.fillColor=U.fillColor,this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.strokeDasharray,this.opacity=U.opacity,this.createVisual(),X.prototype.restoreState.call(this,k),this.setSize()},_.prototype.scale=function(k,U){X.prototype.scale.call(this,k,U),this.setSize()},_.typeName="EllipseMarker",_.title="Ellipse marker",_.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>',_}(S),$=function(X){function _(k,U,Q){return X.call(this,k,U,Q)||this}return Y(_,X),Object.defineProperty(_.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),_.prototype.ownsTarget=function(k){return!(!X.prototype.ownsTarget.call(this,k)&&k!==this.tip1&&k!==this.tip2)},_.prototype.createTips=function(){this.tip1=M.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(M.createTransform()),this.visual.appendChild(this.tip1),this.tip2=M.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(M.createTransform()),this.visual.appendChild(this.tip2)},_.prototype.pointerDown=function(k,U){X.prototype.pointerDown.call(this,k,U),this.state==="creating"&&this.createTips()},_.prototype.adjustVisual=function(){if(X.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(M.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()]]),M.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 k=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),U=this.tip1.transform.baseVal.getItem(0);U.setRotate(k,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(U,0);var Q=this.tip2.transform.baseVal.getItem(0);Q.setRotate(k+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(Q,0)}},Object.defineProperty(_.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),_.prototype.getState=function(){var k=X.prototype.getState.call(this);return k.typeName=_.typeName,k},_.prototype.restoreState=function(k){X.prototype.restoreState.call(this,k),this.createTips(),this.adjustVisual()},_.typeName="MeasurementMarker",_.title="Measurement marker",_.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>',_}(T),le=function(X){function _(k,U,Q){var K=X.call(this,k,U,Q)||this;return K.strokePanel.colors=Q.defaultColorSet,K.fillColor="transparent",K}return Y(_,X),Object.defineProperty(_.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),_.prototype.getState=function(){var k=X.prototype.getState.call(this);return k.typeName=_.typeName,k},_.typeName="EllipseFrameMarker",_.title="Ellipse frame marker",_.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>',_}(W),de=function(){function X(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(X.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),X.prototype.addUndoStep=function(_){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(_)||(this.undoStack.push(_),JSON.stringify(this.lastRedoStep)!==JSON.stringify(_)&&this.redoStack.splice(0,this.redoStack.length))},X.prototype.replaceLastUndoStep=function(_){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=_)},X.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},X.prototype.undo=function(){if(this.undoStack.length>1){var _=this.undoStack.pop();return _!==void 0&&this.redoStack.push(_),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},X.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},X}(),Ce=function(X){function _(k,U,Q){var K=X.call(this,k,U,Q)||this;return K.strokeColor="transparent",K.strokeWidth=0,K.strokeDasharray="",K.curveX=0,K.curveY=0,K.manipulationStartCurveX=0,K.manipulationStartCurveY=0,K.setStrokeColor=K.setStrokeColor.bind(K),K.setStrokeWidth=K.setStrokeWidth.bind(K),K.setStrokeDasharray=K.setStrokeDasharray.bind(K),K.positionGrips=K.positionGrips.bind(K),K.addControlGrips=K.addControlGrips.bind(K),K.adjustVisual=K.adjustVisual.bind(K),K.setupControlBox=K.setupControlBox.bind(K),K.resize=K.resize.bind(K),K.strokeColor=Q.defaultColor,K.strokeWidth=Q.defaultStrokeWidth,K.strokeDasharray=Q.defaultStrokeDasharray,K.strokePanel=new f("Line color",Q.defaultColorSet,Q.defaultColor),K.strokePanel.onColorChanged=K.setStrokeColor,K.strokeWidthPanel=new C("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),K.strokeWidthPanel.onWidthChanged=K.setStrokeWidth,K.strokeStylePanel=new D("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),K.strokeStylePanel.onStyleChanged=K.setStrokeDasharray,K}return Y(_,X),_.prototype.ownsTarget=function(k){return!(!X.prototype.ownsTarget.call(this,k)&&k!==this.visual&&k!==this.selectorCurve&&k!==this.visibleCurve&&!this.curveGrip.ownsTarget(k))},_.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},_.prototype.createVisual=function(){this.visual=M.createGroup(),this.selectorCurve=M.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=M.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)},_.prototype.pointerDown=function(k,U){X.prototype.pointerDown.call(this,k,U),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=k.x,this.curveY=k.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(U)&&(this.activeGrip=this.curveGrip,this._state="resize")},_.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),M.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),M.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),M.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},_.prototype.setupControlBox=function(){X.prototype.setupControlBox.call(this),this.curveControlLine1=M.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=M.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)},_.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,X.prototype.addControlGrips.call(this)},_.prototype.positionGrips=function(){X.prototype.positionGrips.call(this);var k=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-k/2,this.curveY-k/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()))},_.prototype.manipulate=function(k){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+k.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+k.y-this.manipulationStartY),X.prototype.manipulate.call(this,k)},_.prototype.resize=function(k){this.activeGrip===this.curveGrip&&(this.curveX=k.x,this.curveY=k.y),X.prototype.resize.call(this,k),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},_.prototype.setStrokeColor=function(k){this.strokeColor=k,this.adjustVisual(),this.colorChanged(k)},_.prototype.setStrokeWidth=function(k){this.strokeWidth=k,this.adjustVisual()},_.prototype.setStrokeDasharray=function(k){this.strokeDasharray=k,this.adjustVisual()},_.prototype.scale=function(k,U){this.curveX=this.curveX*k,this.curveY=this.curveY*U,X.prototype.scale.call(this,k,U)},Object.defineProperty(_.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),_.prototype.getState=function(){var k=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},X.prototype.getState.call(this));return k.typeName=_.typeName,k},_.prototype.restoreState=function(k){X.prototype.restoreState.call(this,k);var U=k;this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.strokeDasharray,this.curveX=U.curveX,this.curveY=U.curveY,this.createVisual(),this.adjustVisual()},_.typeName="CurveMarker",_.title="Curve marker",_.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>',_}(A),be=function(){function X(_,k){k===void 0&&(k=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=_,this.cancelable=k}return Object.defineProperty(X.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),X.prototype.preventDefault=function(){this._defaultPrevented=!0},X}(),Ae=function(X){function _(k,U,Q){var K=X.call(this,k,!1)||this;return K.dataUrl=U,K.state=Q,K}return Y(_,X),_}(be),Se=function(X){function _(k,U,Q){Q===void 0&&(Q=!1);var K=X.call(this,k,Q)||this;return K.marker=U,K}return Y(_,X),_}(be),Re=function(){function X(){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 X.prototype.addEventListener=function(_,k){this[_].push(k)},X.prototype.removeEventListener=function(_,k){var U=this[_].indexOf(k);U>-1&&this[_].splice(U,1)},X}(),ve=function(){function X(_){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new R,this._isOpen=!1,this.undoRedoManager=new de,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 Re,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=X.instanceCounter++,this.styles=new O(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=_,this.targetRoot=document.body,this.width=_.clientWidth,this.height=_.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(X.prototype,"ALL_MARKER_TYPES",{get:function(){return[L,y,j,w,le,W,F,g,$,B,T,Ce]},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[L,y,j,w,W,F,g]},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"BASIC_MARKER_TYPES",{get:function(){return[L,y,j,w,F]},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(_){var k=this;this._availableMarkerTypes.splice(0),_.forEach(function(U){if(typeof U=="string"){var Q=k.ALL_MARKER_TYPES.find(function(K){return K.typeName===U});Q!==void 0&&k._availableMarkerTypes.push(Q)}else k._availableMarkerTypes.push(U)})},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(_){this._zoomLevel=_,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(X.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),X.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),z.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},X.prototype.show=function(){var _=this;this.styles.styleSheetRoot===void 0&&r.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=r.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(k){return k(new be(_))})},X.prototype.render=function(){return N(this,void 0,void 0,function(){var _;return J(this,function(k){switch(k.label){case 0:return this.setCurrentMarker(),(_=new G).naturalSize=this.renderAtNaturalSize,_.imageType=this.renderImageType,_.imageQuality=this.renderImageQuality,_.markersOnly=this.renderMarkersOnly,_.width=this.renderWidth,_.height=this.renderHeight,[4,_.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return k.sent(),[4,_.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,k.sent()]}})})},X.prototype.close=function(_){var k=this;if(_===void 0&&(_=!1),this.isOpen){var U=!1;_||this.eventListeners.beforeclose.forEach(function(Q){var K=new be(k,!0);Q(K),K.defaultPrevented&&(U=!0)}),U||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(Q){return Q(new be(k))}),this.detachEvents(),this._isOpen=!1)}},X.prototype.addMarkersToToolbar=function(){for(var _,k=[],U=0;U<arguments.length;U++)k[U]=arguments[U];(_=this._availableMarkerTypes).push.apply(_,k)},X.prototype.addRenderEventListener=function(_){this.addEventListener("render",function(k){_(k.dataUrl,k.state)})},X.prototype.removeRenderEventListener=function(_){},X.prototype.addCloseEventListener=function(_){this.addEventListener("close",function(){_()})},X.prototype.removeCloseEventListener=function(_){},X.prototype.setupResizeObserver=function(){var _=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){_.resize(_.target.clientWidth,_.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return _.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},X.prototype.onPopupTargetResize=function(){var _=1*this.target.clientWidth/this.target.clientHeight,k=this.editorCanvas.clientWidth/_>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*_:this.editorCanvas.clientWidth,U=k<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/_;this.resize(k,U)},X.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},X.prototype.resize=function(_,k){this._isResizing=!0;var U=_/this.imageWidth,Q=k/this.imageHeight;this.imageWidth=Math.round(_),this.imageHeight=Math.round(k),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(U,Q),this._isResizing=!1},X.prototype.scaleMarkers=function(_,k){var U,Q=this;this._currentMarker&&this._currentMarker instanceof w?this._currentMarker.scale(_,k):(U=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(K){K!==Q._currentMarker&&K.scale(_,k)}),U!==void 0&&this.setCurrentMarker(U)},X.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"},X.prototype.setTopLeft=function(){var _=this.editingTarget.getBoundingClientRect(),k=this.editorCanvas.getBoundingClientRect();this.left=_.left-k.left,this.top=_.top-k.top},X.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)},X.prototype.addDefs=function(){for(var _,k=[],U=0;U<arguments.length;U++)k[U]=arguments[U];this.defs=M.createDefs(),this.addDefsToImage(),(_=this.defs).append.apply(_,k)},X.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},X.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)},X.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},X.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},X.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)},X.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},X.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)},X.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 _=document.createElement("a");_.href="https://markerjs.com/",_.target="_blank",_.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>',_.title="Powered by marker.js",_.style.display="grid",_.style.alignItems="center",_.style.justifyItems="center",_.style.padding="3px",_.style.width="20px",_.style.height="20px",this.logoUI.appendChild(_),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},X.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")},X.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"},X.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},X.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 _=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=_+"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 p(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 h(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},X.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},X.prototype.removeMarker=function(_){this.markerImage.removeChild(_.container),this.markers.indexOf(_)>-1&&this.markers.splice(this.markers.indexOf(_),1),_.dispose()},X.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())},X.prototype.toolbarButtonClicked=function(_,k){if(_==="marker"&&k!==void 0)this.createNewMarker(k);else if(_==="action")switch(k){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()}},X.prototype.deleteSelectedMarker=function(){var _=this;if(this._currentMarker!==void 0){var k=!1;if(this.eventListeners.markerbeforedelete.forEach(function(Q){var K=new Se(_,_._currentMarker,!0);Q(K),K.defaultPrevented&&(k=!0)}),!k){var U=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(Q){return Q(new Se(_,U))})}}},X.prototype.clear=function(){var _=this,k=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ce){var xe=new Se(_,void 0,!0);ce(xe),xe.defaultPrevented&&(k=!0)}),!k)){this.setCurrentMarker();for(var U=function(ce){var xe=Q.markers[ce];Q.setCurrentMarker(Q.markers[ce]),Q._currentMarker.dispose(),Q.markerImage.removeChild(Q._currentMarker.container),Q.markers.splice(Q.markers.indexOf(Q._currentMarker),1),Q.eventListeners.markerdelete.forEach(function(De){return De(new Se(_,xe))})},Q=this,K=this.markers.length-1;K>=0;K--)U(K);this.addUndoStep()}},Object.defineProperty(X.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),X.prototype.showNotesEditor=function(){var _;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=(_=this._currentMarker.notes)!==null&&_!==void 0?_:"",this.overlayContainer.appendChild(this.notesArea))},X.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)},X.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},X.prototype.addUndoStep=function(){var _=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var k=this.getState(),U=this.undoRedoManager.getLastUndoStep();if(!U||U.width===k.width&&U.height===k.height){var Q=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(k),Q<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(K){return K(new be(_))})}else this.undoRedoManager.replaceLastUndoStep(k),this.eventListeners.statechange.forEach(function(K){return K(new be(_))})}},X.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},X.prototype.undoStep=function(){var _=this,k=this.undoRedoManager.undo();k!==void 0&&(this.restoreState(k),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(U){return U(new be(_))}))},X.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},X.prototype.redoStep=function(){var _=this,k=this.undoRedoManager.redo();k!==void 0&&(this.restoreState(k),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(U){return U(new be(_))}))},X.prototype.stepZoom=function(){var _=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=_<this.zoomSteps.length-1?this.zoomSteps[_+1]:this.zoomSteps[0]},X.prototype.panTo=function(_){this.contentDiv.scrollBy({left:this.prevPanPoint.x-_.x,top:this.prevPanPoint.y-_.y}),this.prevPanPoint=_},X.prototype.startRenderAndClose=function(){return N(this,void 0,void 0,function(){var _,k,U=this;return J(this,function(Q){switch(Q.label){case 0:return[4,this.render()];case 1:return _=Q.sent(),k=this.getState(),this.eventListeners.render.forEach(function(K){return K(new Ae(U,_,k))}),this.close(!0),[2]}})})},X.prototype.getState=function(_){_===!0&&this.setCurrentMarker();var k={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(U){return k.markers.push(U.getState())}),k},X.prototype.restoreState=function(_){var k=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);_.markers.forEach(function(U){var Q=k._availableMarkerTypes.find(function(ce){return ce.typeName===U.typeName});if(Q!==void 0){var K=k.addNewMarker(Q);K.restoreState(U),k.markers.push(K)}}),_.width&&_.height&&(_.width!==this.imageWidth||_.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/_.width,this.imageHeight/_.height),this.eventListeners.restorestate.forEach(function(U){return U(new be(k))})},X.prototype.addNewMarker=function(_){var k=M.createGroup();return this.markerImage.appendChild(k),new _(k,this.overlayContainer,this.settings)},X.prototype.createNewMarker=function(_){var k,U=this;(k=typeof _=="string"?this._availableMarkerTypes.find(function(Q){return Q.typeName===_}):_)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(k),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(k.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(Q){return Q(new Se(U,U._currentMarker))}))},X.prototype.markerCreated=function(_){var k=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(_),this.setCurrentMarker(_),_ instanceof y&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(y):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(U){return U(new Se(k,k._currentMarker))})},X.prototype.colorChanged=function(_){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=_,this.settings.defaultStrokeColor=_)},X.prototype.fillColorChanged=function(_){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=_)},X.prototype.markerStateChanged=function(_){var k=this;this.eventListeners.markerchange.forEach(function(U){return U(new Se(k,_))})},X.prototype.setCurrentMarker=function(_){var k=this;this._currentMarker!==_&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(U){return U(new Se(k,k._currentMarker))})),this._currentMarker=_,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(U){return U(new Se(k,k._currentMarker))}))},X.prototype.onPointerDown=function(_){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||_.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var k=this.markers.find(function(U){return U.ownsTarget(_.target)});k!==void 0?(this.setCurrentMarker(k),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(_.clientX,_.clientY),_.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:_.clientX,y:_.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(_.clientX,_.clientY))},X.prototype.onDblClick=function(_){if(this._isFocused||this.focus(),this.mode==="select"){var k=this.markers.find(function(U){return U.ownsTarget(_.target)});k!==void 0&&k!==this._currentMarker&&this.setCurrentMarker(k),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(_.clientX,_.clientY),_.target):this.setCurrentMarker()}},X.prototype.onPointerMove=function(_){this.touchPoints!==1&&_.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||_.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(_.clientX,_.clientY)):this.zoomLevel>1&&this.panTo({x:_.clientX,y:_.clientY}))},X.prototype.onPointerUp=function(_){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(_.clientX,_.clientY)),this.isDragging=!1,this.addUndoStep()},X.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},X.prototype.onKeyUp=function(_){this._currentMarker===void 0||this.notesArea!==void 0||_.key!=="Delete"&&_.key!=="Backspace"||this.deleteSelectedMarker()},X.prototype.clientToLocalCoordinates=function(_,k){var U=this.markerImage.getBoundingClientRect();return{x:(_-U.left)/this.zoomLevel,y:(k-U.top)/this.zoomLevel}},X.prototype.onWindowResize=function(){this.positionUI()},X.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var _=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=_+"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()},X.prototype.addLicenseKey=function(_){z.addKey(_)},X.prototype.addEventListener=function(_,k){this.eventListeners.addEventListener(_,k)},X.prototype.removeEventListener=function(_,k){this.eventListeners.removeEventListener(_,k)},X.prototype.renderState=function(_){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(_),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(X.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),X.prototype.focus=function(){var _=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(k){return k(new be(_))}))},X.prototype.blur=function(){var _=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(k){return k(new be(_))}))},X.instanceCounter=0,X}()},T8No:function(Qe,Te,q){"use strict";q.d(Te,"a",function(){return z}),q.d(Te,"e",function(){return G}),q.d(Te,"c",function(){return T}),q.d(Te,"b",function(){return d}),q.d(Te,"d",function(){return w}),q.d(Te,"f",function(){return j});var oe=q("MNsG"),Y=q("N0LK"),N=q("Cg/j");let J=oe.k||"";const H=new Map;H.set("false",!1),H.set("true",!0),H.set("isMac",oe.f),H.set("isLinux",oe.d),H.set("isWindows",oe.i),H.set("isWeb",oe.h),H.set("isMacNative",oe.f&&!oe.h),H.set("isEdge",J.indexOf("Edg/")>=0),H.set("isFirefox",J.indexOf("Firefox")>=0),H.set("isChrome",J.indexOf("Chrome")>=0),H.set("isSafari",J.indexOf("Safari")>=0);const M=Object.prototype.hasOwnProperty;class z{static has(E){return m.create(E)}static equals(E,F){return p.create(E,F)}static regex(E,F){return C.create(E,F)}static not(E){return o.create(E)}static and(...E){return R.create(E,null)}static or(...E){return A.create(E,null,!0)}static deserialize(E,F=!1){return E?this._deserializeOrExpression(E,F):void 0}static _deserializeOrExpression(E,F){let I=E.split("||");return A.create(I.map(g=>this._deserializeAndExpression(g,F)),null,!0)}static _deserializeAndExpression(E,F){let I=E.split("&&");return R.create(I.map(g=>this._deserializeOne(g,F)),null)}static _deserializeOne(E,F){if(E=E.trim(),E.indexOf("!=")>=0){let I=E.split("!=");return f.create(I[0].trim(),this._deserializeValue(I[1],F))}if(E.indexOf("==")>=0){let I=E.split("==");return p.create(I[0].trim(),this._deserializeValue(I[1],F))}if(E.indexOf("=~")>=0){let I=E.split("=~");return C.create(I[0].trim(),this._deserializeRegexValue(I[1],F))}if(E.indexOf(" in ")>=0){let I=E.split(" in ");return h.create(I[0].trim(),I[1].trim())}if(/^[^<=>]+>=[^<=>]+$/.test(E)){const I=E.split(">=");return a.create(I[0].trim(),I[1].trim())}if(/^[^<=>]+>[^<=>]+$/.test(E)){const I=E.split(">");return s.create(I[0].trim(),I[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(E)){const I=E.split("<=");return x.create(I[0].trim(),I[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(E)){const I=E.split("<");return S.create(I[0].trim(),I[1].trim())}return/^\!\s*/.test(E)?o.create(E.substr(1).trim()):m.create(E)}static _deserializeValue(E,F){if(E=E.trim(),E==="true")return!0;if(E==="false")return!1;let I=/^'([^']*)'$/.exec(E);return I?I[1].trim():E}static _deserializeRegexValue(E,F){if(Object(Y.C)(E)){if(F)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}let I=E.indexOf("/"),g=E.lastIndexOf("/");if(I===g||I<0){if(F)throw new Error(`bad regexp-value '${E}', missing /-enclosure`);return console.warn(`bad regexp-value '${E}', missing /-enclosure`),null}let W=E.slice(I+1,g),$=E[g+1]==="i"?"i":"";try{return new RegExp(W,$)}catch(le){if(F)throw new Error(`bad regexp-value '${E}', parse error: ${le}`);return console.warn(`bad regexp-value '${E}', parse error: ${le}`),null}}}function G(E,F){const I=E?E.substituteConstants():void 0,g=F?F.substituteConstants():void 0;return!I&&!g?!0:!I||!g?!1:I.equals(g)}function r(E,F){return E.cmp(F)}class O{constructor(){this.type=0}cmp(E){return this.type-E.type}equals(E){return E.type===this.type}substituteConstants(){return this}evaluate(E){return!1}serialize(){return"false"}keys(){return[]}negate(){return v.INSTANCE}}O.INSTANCE=new O;class v{constructor(){this.type=1}cmp(E){return this.type-E.type}equals(E){return E.type===this.type}substituteConstants(){return this}evaluate(E){return!0}serialize(){return"true"}keys(){return[]}negate(){return O.INSTANCE}}v.INSTANCE=new v;class m{constructor(E,F){this.key=E,this.negated=F,this.type=2}static create(E,F=null){const I=H.get(E);return typeof I=="boolean"?I?v.INSTANCE:O.INSTANCE:new m(E,F)}cmp(E){return E.type!==this.type?this.type-E.type:y(this.key,E.key)}equals(E){return E.type===this.type?this.key===E.key:!1}substituteConstants(){const E=H.get(this.key);return typeof E=="boolean"?E?v.INSTANCE:O.INSTANCE:this}evaluate(E){return!!E.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=o.create(this.key,this)),this.negated}}class p{constructor(E,F,I){this.key=E,this.value=F,this.negated=I,this.type=4}static create(E,F,I=null){if(typeof F=="boolean")return F?m.create(E,I):o.create(E,I);const g=H.get(E);if(typeof g=="boolean"){const W=g?"true":"false";return F===W?v.INSTANCE:O.INSTANCE}return new p(E,F,I)}cmp(E){return E.type!==this.type?this.type-E.type:b(this.key,this.value,E.key,E.value)}equals(E){return E.type===this.type?this.key===E.key&&this.value===E.value:!1}substituteConstants(){const E=H.get(this.key);if(typeof E=="boolean"){const F=E?"true":"false";return this.value===F?v.INSTANCE:O.INSTANCE}return this}evaluate(E){return E.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=f.create(this.key,this.value,this)),this.negated}}class h{constructor(E,F){this.key=E,this.valueKey=F,this.type=10,this.negated=null}static create(E,F){return new h(E,F)}cmp(E){return E.type!==this.type?this.type-E.type:b(this.key,this.valueKey,E.key,E.valueKey)}equals(E){return E.type===this.type?this.key===E.key&&this.valueKey===E.valueKey:!1}substituteConstants(){return this}evaluate(E){const F=E.getValue(this.valueKey),I=E.getValue(this.key);return Array.isArray(F)?F.indexOf(I)>=0:typeof I=="string"&&typeof F=="object"&&F!==null?M.call(F,I):!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return this.negated||(this.negated=u.create(this)),this.negated}}class u{constructor(E){this._actual=E,this.type=11}static create(E){return new u(E)}cmp(E){return E.type!==this.type?this.type-E.type:this._actual.cmp(E._actual)}equals(E){return E.type===this.type?this._actual.equals(E._actual):!1}substituteConstants(){return this}evaluate(E){return!this._actual.evaluate(E)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}class f{constructor(E,F,I){this.key=E,this.value=F,this.negated=I,this.type=5}static create(E,F,I=null){if(typeof F=="boolean")return F?o.create(E,I):m.create(E,I);const g=H.get(E);if(typeof g=="boolean"){const W=g?"true":"false";return F===W?O.INSTANCE:v.INSTANCE}return new f(E,F,I)}cmp(E){return E.type!==this.type?this.type-E.type:b(this.key,this.value,E.key,E.value)}equals(E){return E.type===this.type?this.key===E.key&&this.value===E.value:!1}substituteConstants(){const E=H.get(this.key);if(typeof E=="boolean"){const F=E?"true":"false";return this.value===F?O.INSTANCE:v.INSTANCE}return this}evaluate(E){return E.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=p.create(this.key,this.value,this)),this.negated}}class o{constructor(E,F){this.key=E,this.negated=F,this.type=3}static create(E,F=null){const I=H.get(E);return typeof I=="boolean"?I?O.INSTANCE:v.INSTANCE:new o(E,F)}cmp(E){return E.type!==this.type?this.type-E.type:y(this.key,E.key)}equals(E){return E.type===this.type?this.key===E.key:!1}substituteConstants(){const E=H.get(this.key);return typeof E=="boolean"?E?O.INSTANCE:v.INSTANCE:this}evaluate(E){return!E.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=m.create(this.key,this)),this.negated}}function l(E,F){if(typeof E=="string"){const I=parseFloat(E);isNaN(I)||(E=I)}return typeof E=="string"||typeof E=="number"?F(E):O.INSTANCE}class s{constructor(E,F,I){this.key=E,this.value=F,this.negated=I,this.type=12}static create(E,F,I=null){return l(F,g=>new s(E,g,I))}cmp(E){return E.type!==this.type?this.type-E.type:b(this.key,this.value,E.key,E.value)}equals(E){return E.type===this.type?this.key===E.key&&this.value===E.value:!1}substituteConstants(){return this}evaluate(E){return typeof this.value=="string"?!1:parseFloat(E.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=x.create(this.key,this.value,this)),this.negated}}class a{constructor(E,F,I){this.key=E,this.value=F,this.negated=I,this.type=13}static create(E,F,I=null){return l(F,g=>new a(E,g,I))}cmp(E){return E.type!==this.type?this.type-E.type:b(this.key,this.value,E.key,E.value)}equals(E){return E.type===this.type?this.key===E.key&&this.value===E.value:!1}substituteConstants(){return this}evaluate(E){return typeof this.value=="string"?!1:parseFloat(E.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=S.create(this.key,this.value,this)),this.negated}}class S{constructor(E,F,I){this.key=E,this.value=F,this.negated=I,this.type=14}static create(E,F,I=null){return l(F,g=>new S(E,g,I))}cmp(E){return E.type!==this.type?this.type-E.type:b(this.key,this.value,E.key,E.value)}equals(E){return E.type===this.type?this.key===E.key&&this.value===E.value:!1}substituteConstants(){return this}evaluate(E){return typeof this.value=="string"?!1:parseFloat(E.getValue(this.key))<this.value}serialize(){return`${this.key} < ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=a.create(this.key,this.value,this)),this.negated}}class x{constructor(E,F,I){this.key=E,this.value=F,this.negated=I,this.type=15}static create(E,F,I=null){return l(F,g=>new x(E,g,I))}cmp(E){return E.type!==this.type?this.type-E.type:b(this.key,this.value,E.key,E.value)}equals(E){return E.type===this.type?this.key===E.key&&this.value===E.value:!1}substituteConstants(){return this}evaluate(E){return typeof this.value=="string"?!1:parseFloat(E.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=s.create(this.key,this.value,this)),this.negated}}class C{constructor(E,F){this.key=E,this.regexp=F,this.type=7,this.negated=null}static create(E,F){return new C(E,F)}cmp(E){if(E.type!==this.type)return this.type-E.type;if(this.key<E.key)return-1;if(this.key>E.key)return 1;const F=this.regexp?this.regexp.source:"",I=E.regexp?E.regexp.source:"";return F<I?-1:F>I?1:0}equals(E){if(E.type===this.type){const F=this.regexp?this.regexp.source:"",I=E.regexp?E.regexp.source:"";return this.key===E.key&&F===I}return!1}substituteConstants(){return this}evaluate(E){let F=E.getValue(this.key);return this.regexp?this.regexp.test(F):!1}serialize(){const E=this.regexp?`/${this.regexp.source}/${this.regexp.ignoreCase?"i":""}`:"/invalid/";return`${this.key} =~ ${E}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=D.create(this)),this.negated}}class D{constructor(E){this._actual=E,this.type=8}static create(E){return new D(E)}cmp(E){return E.type!==this.type?this.type-E.type:this._actual.cmp(E._actual)}equals(E){return E.type===this.type?this._actual.equals(E._actual):!1}substituteConstants(){return this}evaluate(E){return!this._actual.evaluate(E)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}function L(E){let F=null;for(let I=0,g=E.length;I<g;I++){const W=E[I].substituteConstants();if(E[I]!==W&&F===null){F=[];for(let $=0;$<I;$++)F[$]=E[$]}F!==null&&(F[I]=W)}return F===null?E:F}class R{constructor(E,F){this.expr=E,this.negated=F,this.type=6}static create(E,F){return R._normalizeArr(E,F)}cmp(E){if(E.type!==this.type)return this.type-E.type;if(this.expr.length<E.expr.length)return-1;if(this.expr.length>E.expr.length)return 1;for(let F=0,I=this.expr.length;F<I;F++){const g=r(this.expr[F],E.expr[F]);if(g!==0)return g}return 0}equals(E){if(E.type===this.type){if(this.expr.length!==E.expr.length)return!1;for(let F=0,I=this.expr.length;F<I;F++)if(!this.expr[F].equals(E.expr[F]))return!1;return!0}return!1}substituteConstants(){const E=L(this.expr);return E===this.expr?this:R.create(E,this.negated)}evaluate(E){for(let F=0,I=this.expr.length;F<I;F++)if(!this.expr[F].evaluate(E))return!1;return!0}static _normalizeArr(E,F){const I=[];let g=!1;for(const W of E){if(!W)continue;if(W.type===1){g=!0;continue}if(W.type===0)return O.INSTANCE;if(W.type===6){I.push(...W.expr);continue}I.push(W)}if(I.length===0&&g)return v.INSTANCE;if(I.length===0)return;if(I.length===1)return I[0];I.sort(r);for(let W=1;W<I.length;W++)I[W-1].equals(I[W])&&(I.splice(W,1),W--);if(I.length===1)return I[0];for(;I.length>1;){const W=I[I.length-1];if(W.type!==9)break;I.pop();const $=I.pop(),le=I.length===0,de=A.create(W.expr.map(Ce=>R.create([Ce,$],null)),null,le);de&&(I.push(de),I.sort(r))}return I.length===1?I[0]:new R(I,F)}serialize(){return this.expr.map(E=>E.serialize()).join(" && ")}keys(){const E=[];for(let F of this.expr)E.push(...F.keys());return E}negate(){if(!this.negated){const E=[];for(let F of this.expr)E.push(F.negate());this.negated=A.create(E,this,!0)}return this.negated}}class A{constructor(E,F){this.expr=E,this.negated=F,this.type=9}static create(E,F,I){return A._normalizeArr(E,F,I)}cmp(E){if(E.type!==this.type)return this.type-E.type;if(this.expr.length<E.expr.length)return-1;if(this.expr.length>E.expr.length)return 1;for(let F=0,I=this.expr.length;F<I;F++){const g=r(this.expr[F],E.expr[F]);if(g!==0)return g}return 0}equals(E){if(E.type===this.type){if(this.expr.length!==E.expr.length)return!1;for(let F=0,I=this.expr.length;F<I;F++)if(!this.expr[F].equals(E.expr[F]))return!1;return!0}return!1}substituteConstants(){const E=L(this.expr);return E===this.expr?this:A.create(E,this.negated,!1)}evaluate(E){for(let F=0,I=this.expr.length;F<I;F++)if(this.expr[F].evaluate(E))return!0;return!1}static _normalizeArr(E,F,I){let g=[],W=!1;if(E){for(let $=0,le=E.length;$<le;$++){const de=E[$];if(!de)continue;if(de.type===0){W=!0;continue}if(de.type===1)return v.INSTANCE;if(de.type===9){g=g.concat(de.expr);continue}g.push(de)}if(g.length===0&&W)return O.INSTANCE;g.sort(r)}if(g.length===0)return;if(g.length===1)return g[0];for(let $=1;$<g.length;$++)g[$-1].equals(g[$])&&(g.splice($,1),$--);if(g.length===1)return g[0];if(I){for(let $=0;$<g.length;$++)for(let le=$+1;le<g.length;le++)j(g[$],g[le])&&(g.splice(le,1),le--);if(g.length===1)return g[0]}return new A(g,F)}serialize(){return this.expr.map(E=>E.serialize()).join(" || ")}keys(){const E=[];for(let F of this.expr)E.push(...F.keys());return E}negate(){if(!this.negated){let E=[];for(let F of this.expr)E.push(F.negate());for(;E.length>1;){const F=E.shift(),I=E.shift(),g=[];for(const $ of B(F))for(const le of B(I))g.push(R.create([$,le],null));const W=E.length===0;E.unshift(A.create(g,null,W))}this.negated=E[0]}return this.negated}}class T extends m{constructor(E,F,I){super(E,null);this._defaultValue=F,typeof I=="object"?T._info.push(Object.assign(Object.assign({},I),{key:E})):I!==!0&&T._info.push({key:E,description:I,type:F!=null?typeof F:void 0})}static all(){return T._info.values()}bindTo(E){return E.createKey(this.key,this._defaultValue)}getValue(E){return E.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(E){return p.create(this.key,E)}}T._info=[];const d=Object(N.c)("contextKeyService"),w="setContext";function y(E,F){return E<F?-1:E>F?1:0}function b(E,F,I,g){return E<I?-1:E>I?1:F<g?-1:F>g?1:0}function j(E,F){if(F.type===6&&E.type!==9&&E.type!==6){for(const W of F.expr)if(E.equals(W))return!0}const I=E.negate(),g=B(I).concat(B(F));g.sort(r);for(let W=0;W<g.length;W++){const $=g[W],le=$.negate();for(let de=W+1;de<g.length;de++){const Ce=g[de];if(le.equals(Ce))return!0}}return!1}function B(E){return E.type===9?E.expr:[E]}},TXwP:function(Qe,Te,q){var oe,Y;(function(){var N;(function(){"use strict";var H=[,,function(r){function O(p){this.__parent=p,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}O.prototype.clone_empty=function(){var p=new O(this.__parent);return p.set_indent(this.__indent_count,this.__alignment_count),p},O.prototype.item=function(p){return p<0?this.__items[this.__items.length+p]:this.__items[p]},O.prototype.has_match=function(p){for(var h=this.__items.length-1;h>=0;h--)if(this.__items[h].match(p))return!0;return!1},O.prototype.set_indent=function(p,h){this.is_empty()&&(this.__indent_count=p||0,this.__alignment_count=h||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},O.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},O.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},O.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var p=this.__parent.current_line;return p.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),p.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),p.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,p.__items[0]===" "&&(p.__items.splice(0,1),p.__character_count-=1),!0}return!1},O.prototype.is_empty=function(){return this.__items.length===0},O.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},O.prototype.push=function(p){this.__items.push(p);var h=p.lastIndexOf(`
|
|
`);h!==-1?this.__character_count=p.length-h:this.__character_count+=p.length},O.prototype.pop=function(){var p=null;return this.is_empty()||(p=this.__items.pop(),this.__character_count-=p.length),p},O.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},O.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},O.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},O.prototype.toString=function(){var p="";return this.is_empty()?this.__parent.indent_empty_lines&&(p=this.__parent.get_indent_string(this.__indent_count)):(p=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),p+=this.__items.join("")),p};function v(p,h){this.__cache=[""],this.__indent_size=p.indent_size,this.__indent_string=p.indent_char,p.indent_with_tabs||(this.__indent_string=new Array(p.indent_size+1).join(p.indent_char)),h=h||"",p.indent_level>0&&(h=new Array(p.indent_level+1).join(this.__indent_string)),this.__base_string=h,this.__base_string_length=h.length}v.prototype.get_indent_size=function(p,h){var u=this.__base_string_length;return h=h||0,p<0&&(u=0),u+=p*this.__indent_size,u+=h,u},v.prototype.get_indent_string=function(p,h){var u=this.__base_string;return h=h||0,p<0&&(p=0,u=""),h+=p*this.__indent_size,this.__ensure_cache(h),u+=this.__cache[h],u},v.prototype.__ensure_cache=function(p){for(;p>=this.__cache.length;)this.__add_column()},v.prototype.__add_column=function(){var p=this.__cache.length,h=0,u="";this.__indent_size&&p>=this.__indent_size&&(h=Math.floor(p/this.__indent_size),p-=h*this.__indent_size,u=new Array(h+1).join(this.__indent_string)),p&&(u+=new Array(p+1).join(" ")),this.__cache.push(u)};function m(p,h){this.__indent_cache=new v(p,h),this.raw=!1,this._end_with_newline=p.end_with_newline,this.indent_size=p.indent_size,this.wrap_line_length=p.wrap_line_length,this.indent_empty_lines=p.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new O(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}m.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},m.prototype.get_line_number=function(){return this.__lines.length},m.prototype.get_indent_string=function(p,h){return this.__indent_cache.get_indent_string(p,h)},m.prototype.get_indent_size=function(p,h){return this.__indent_cache.get_indent_size(p,h)},m.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},m.prototype.add_new_line=function(p){return this.is_empty()||!p&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},m.prototype.get_code=function(p){this.trim(!0);var h=this.current_line.pop();h&&(h[h.length-1]===`
|
|
`&&(h=h.replace(/\n+$/g,"")),this.current_line.push(h)),this._end_with_newline&&this.__add_outputline();var u=this.__lines.join(`
|
|
`);return p!==`
|
|
`&&(u=u.replace(/[\n]/g,p)),u},m.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},m.prototype.set_indent=function(p,h){return p=p||0,h=h||0,this.next_line.set_indent(p,h),this.__lines.length>1?(this.current_line.set_indent(p,h),!0):(this.current_line.set_indent(),!1)},m.prototype.add_raw_token=function(p){for(var h=0;h<p.newlines;h++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(p.whitespace_before),this.current_line.push(p.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},m.prototype.add_token=function(p){this.__add_space_before_token(),this.current_line.push(p),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},m.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},m.prototype.remove_indent=function(p){for(var h=this.__lines.length;p<h;)this.__lines[p]._remove_indent(),p++;this.current_line._remove_wrap_indent()},m.prototype.trim=function(p){for(p=p===void 0?!1:p,this.current_line.trim();p&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},m.prototype.just_added_newline=function(){return this.current_line.is_empty()},m.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},m.prototype.ensure_empty_line_above=function(p,h){for(var u=this.__lines.length-2;u>=0;){var f=this.__lines[u];if(f.is_empty())break;if(f.item(0).indexOf(p)!==0&&f.item(-1)!==h){this.__lines.splice(u+1,0,new O(this)),this.previous_line=this.__lines[this.__lines.length-2];break}u--}},r.exports.Output=m},,,,function(r){function O(p,h){this.raw_options=v(p,h),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}O.prototype._get_array=function(p,h){var u=this.raw_options[p],f=h||[];return typeof u=="object"?u!==null&&typeof u.concat=="function"&&(f=u.concat()):typeof u=="string"&&(f=u.split(/[^a-zA-Z0-9_\/\-]+/)),f},O.prototype._get_boolean=function(p,h){var u=this.raw_options[p],f=u===void 0?!!h:!!u;return f},O.prototype._get_characters=function(p,h){var u=this.raw_options[p],f=h||"";return typeof u=="string"&&(f=u.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),f},O.prototype._get_number=function(p,h){var u=this.raw_options[p];h=parseInt(h,10),isNaN(h)&&(h=0);var f=parseInt(u,10);return isNaN(f)&&(f=h),f},O.prototype._get_selection=function(p,h,u){var f=this._get_selection_list(p,h,u);if(f.length!==1)throw new Error("Invalid Option Value: The option '"+p+`' can only be one of the following values:
|
|
`+h+`
|
|
You passed in: '`+this.raw_options[p]+"'");return f[0]},O.prototype._get_selection_list=function(p,h,u){if(!h||h.length===0)throw new Error("Selection list cannot be empty.");if(u=u||[h[0]],!this._is_valid_selection(u,h))throw new Error("Invalid Default Value!");var f=this._get_array(p,u);if(!this._is_valid_selection(f,h))throw new Error("Invalid Option Value: The option '"+p+`' can contain only the following values:
|
|
`+h+`
|
|
You passed in: '`+this.raw_options[p]+"'");return f},O.prototype._is_valid_selection=function(p,h){return p.length&&h.length&&!p.some(function(u){return h.indexOf(u)===-1})};function v(p,h){var u={};p=m(p);var f;for(f in p)f!==h&&(u[f]=p[f]);if(h&&p[h])for(f in p[h])u[f]=p[h][f];return u}function m(p){var h={},u;for(u in p){var f=u.replace(/-/g,"_");h[f]=p[u]}return h}r.exports.Options=O,r.exports.normalizeOpts=m,r.exports.mergeOpts=v},,function(r){var O=RegExp.prototype.hasOwnProperty("sticky");function v(m){this.__input=m||"",this.__input_length=this.__input.length,this.__position=0}v.prototype.restart=function(){this.__position=0},v.prototype.back=function(){this.__position>0&&(this.__position-=1)},v.prototype.hasNext=function(){return this.__position<this.__input_length},v.prototype.next=function(){var m=null;return this.hasNext()&&(m=this.__input.charAt(this.__position),this.__position+=1),m},v.prototype.peek=function(m){var p=null;return m=m||0,m+=this.__position,m>=0&&m<this.__input_length&&(p=this.__input.charAt(m)),p},v.prototype.__match=function(m,p){m.lastIndex=p;var h=m.exec(this.__input);return h&&!(O&&m.sticky)&&(h.index!==p&&(h=null)),h},v.prototype.test=function(m,p){return p=p||0,p+=this.__position,p>=0&&p<this.__input_length?!!this.__match(m,p):!1},v.prototype.testChar=function(m,p){var h=this.peek(p);return m.lastIndex=0,h!==null&&m.test(h)},v.prototype.match=function(m){var p=this.__match(m,this.__position);return p?this.__position+=p[0].length:p=null,p},v.prototype.read=function(m,p,h){var u="",f;return m&&(f=this.match(m),f&&(u+=f[0])),p&&(f||!m)&&(u+=this.readUntil(p,h)),u},v.prototype.readUntil=function(m,p){var h="",u=this.__position;m.lastIndex=this.__position;var f=m.exec(this.__input);return f?(u=f.index,p&&(u+=f[0].length)):u=this.__input_length,h=this.__input.substring(this.__position,u),this.__position=u,h},v.prototype.readUntilAfter=function(m){return this.readUntil(m,!0)},v.prototype.get_regexp=function(m,p){var h=null,u="g";return p&&O&&(u="y"),typeof m=="string"&&m!==""?h=new RegExp(m,u):m&&(h=new RegExp(m.source,u)),h},v.prototype.get_literal_regexp=function(m){return RegExp(m.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},v.prototype.peekUntilAfter=function(m){var p=this.__position,h=this.readUntilAfter(m);return this.__position=p,h},v.prototype.lookBack=function(m){var p=this.__position-1;return p>=m.length&&this.__input.substring(p-m.length,p).toLowerCase()===m},r.exports.InputScanner=v},,,,,function(r){function O(v,m){v=typeof v=="string"?v:v.source,m=typeof m=="string"?m:m.source,this.__directives_block_pattern=new RegExp(v+/ beautify( \w+[:]\w+)+ /.source+m,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(v+/\sbeautify\signore:end\s/.source+m,"g")}O.prototype.get_directives=function(v){if(!v.match(this.__directives_block_pattern))return null;var m={};this.__directive_pattern.lastIndex=0;for(var p=this.__directive_pattern.exec(v);p;)m[p[1]]=p[2],p=this.__directive_pattern.exec(v);return m},O.prototype.readIgnored=function(v){return v.readUntilAfter(this.__directives_end_ignore_pattern)},r.exports.Directives=O},,function(r,O,v){var m=v(16).Beautifier,p=v(17).Options;function h(u,f){var o=new m(u,f);return o.beautify()}r.exports=h,r.exports.defaultOptions=function(){return new p}},function(r,O,v){var m=v(17).Options,p=v(2).Output,h=v(8).InputScanner,u=v(13).Directives,f=new u(/\/\*/,/\*\//),o=/\r\n|[\r\n]/,l=/\r\n|[\r\n]/g,s=/\s/,a=/(?:\s|\n)+/g,S=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,x=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function C(D,L){this._source_text=D||"",this._options=new m(L),this._ch=null,this._input=null,this.NESTED_AT_RULE={"@page":!0,"@font-face":!0,"@keyframes":!0,"@media":!0,"@supports":!0,"@document":!0},this.CONDITIONAL_GROUP_RULE={"@media":!0,"@supports":!0,"@document":!0},this.NON_SEMICOLON_NEWLINE_PROPERTY=["grid-template-areas","grid-template"]}C.prototype.eatString=function(D){var L="";for(this._ch=this._input.next();this._ch;){if(L+=this._ch,this._ch==="\\")L+=this._input.next();else if(D.indexOf(this._ch)!==-1||this._ch===`
|
|
`)break;this._ch=this._input.next()}return L},C.prototype.eatWhitespace=function(D){for(var L=s.test(this._input.peek()),R=0;s.test(this._input.peek());)this._ch=this._input.next(),D&&this._ch===`
|
|
`&&((R===0||R<this._options.max_preserve_newlines)&&(R++,this._output.add_new_line(!0)));return L},C.prototype.foundNestedPseudoClass=function(){for(var D=0,L=1,R=this._input.peek(L);R;){if(R==="{")return!0;if(R==="(")D+=1;else if(R===")"){if(D===0)return!1;D-=1}else if(R===";"||R==="}")return!1;L++,R=this._input.peek(L)}return!1},C.prototype.print_string=function(D){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(D)},C.prototype.preserveSingleSpace=function(D){D&&(this._output.space_before_token=!0)},C.prototype.indent=function(){this._indentLevel++},C.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},C.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var D=this._source_text,L=this._options.eol;L==="auto"&&(L=`
|
|
`,D&&o.test(D||"")&&(L=D.match(o)[0])),D=D.replace(l,`
|
|
`);var R=D.match(/^[\t ]*/)[0];this._output=new p(this._options,R),this._input=new h(D),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var A=0,T=!1,d=!1,w=!1,y=!1,b=!1,j=!1,B=this._ch,E=!1,F,I,g;F=this._input.read(a),I=F!=="",g=B,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),B=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var W=this._input.read(S),$=f.get_directives(W);$&&$.ignore==="start"&&(W+=f.readIgnored(this._input)),this.print_string(W),this.eatWhitespace(!0),this._output.add_new_line()}else if(this._ch==="/"&&this._input.peek()==="/")this._output.space_before_token=!0,this._input.back(),this.print_string(this._input.read(x)),this.eatWhitespace(!0);else if(this._ch==="@"||this._ch==="$")if(this.preserveSingleSpace(I),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var le=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);le.match(/[ :]$/)&&(le=this.eatString(": ").replace(/\s$/,""),this.print_string(le),this._output.space_before_token=!0),le=le.replace(/\s$/,""),le==="extend"?y=!0:le==="import"&&(b=!0),le in this.NESTED_AT_RULE?(this._nestedLevel+=1,le in this.CONDITIONAL_GROUP_RULE&&(w=!0)):!T&&A===0&&le.indexOf(":")!==-1&&(d=!0,this.indent())}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(I),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")d&&(d=!1,this.outdent()),w?(w=!1,T=this._indentLevel>=this._nestedLevel):T=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&T&&(this._output.previous_line&&this._output.previous_line.item(-1)!=="{"&&this._output.ensure_empty_line_above("/",",")),this._output.space_before_token=!0,this._options.brace_style==="expand"?(this._output.add_new_line(),this.print_string(this._ch),this.indent(),this._output.set_indent(this._indentLevel)):(g==="("?this._output.space_before_token=!1:g!==","&&this.indent(),this.print_string(this._ch)),this.eatWhitespace(!0),this._output.add_new_line();else if(this._ch==="}")this.outdent(),this._output.add_new_line(),g==="{"&&this._output.trim(!0),b=!1,y=!1,d&&(this.outdent(),d=!1),this.print_string(this._ch),T=!1,this._nestedLevel&&this._nestedLevel--,this.eatWhitespace(!0),this._output.add_new_line(),this._options.newline_between_rules&&!this._output.just_added_blankline()&&(this._input.peek()!=="}"&&this._output.add_new_line(!0)),this._input.peek()===")"&&(this._output.trim(!0),this._options.brace_style==="expand"&&this._output.add_new_line(!0));else if(this._ch===":"){for(var de=0;de<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;de++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[de])){E=!0;break}(T||w)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!y&&A===0?(this.print_string(":"),d||(d=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent())):(this._input.lookBack(" ")&&(this._output.space_before_token=!0),this._input.peek()===":"?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":"))}else if(this._ch==='"'||this._ch==="'"){var Ce=g==='"'||g==="'";this.preserveSingleSpace(Ce||I),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")E=!1,A===0?(d&&(this.outdent(),d=!1),y=!1,b=!1,this.print_string(this._ch),this.eatWhitespace(!0),this._input.peek()!=="/"&&this._output.add_new_line()):(this.print_string(this._ch),this.eatWhitespace(!0),this._output.space_before_token=!0);else if(this._ch==="(")if(this._input.lookBack("url"))this.print_string(this._ch),this.eatWhitespace(),A++,this.indent(),this._ch=this._input.next(),this._ch===")"||this._ch==='"'||this._ch==="'"?this._input.back():this._ch&&(this.print_string(this._ch+this.eatString(")")),A&&(A--,this.outdent()));else{var be=!1;this._input.lookBack("with")&&(be=!0),this.preserveSingleSpace(I||be),this.print_string(this._ch),d&&g==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),j=!0):(this.eatWhitespace(),A++,this.indent())}else if(this._ch===")")A&&(A--,this.outdent()),j&&this._input.peek()===";"&&this._options.selector_separator_newline&&(j=!1,this.outdent(),this._output.add_new_line()),this.print_string(this._ch);else if(this._ch===",")this.print_string(this._ch),this.eatWhitespace(!0),this._options.selector_separator_newline&&(!d||j)&&A===0&&!b&&!y?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!d&&A===0)this._options.space_around_combinator?(this._output.space_before_token=!0,this.print_string(this._ch),this._output.space_before_token=!0):(this.print_string(this._ch),this.eatWhitespace(),this._ch&&s.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(I),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),s.test(this._ch)&&(this._ch="");else if(this._ch==="!"&&!this._input.lookBack("\\"))this._output.space_before_token=!0,this.print_string(this._ch);else{var Ae=g==='"'||g==="'";this.preserveSingleSpace(Ae||I),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
|
|
`&&E&&this._output.add_new_line()}var Se=this._output.get_code(L);return Se},r.exports.Beautifier=C},function(r,O,v){var m=v(6).Options;function p(h){m.call(this,h,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var u=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||u;var f=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var o=0;o<f.length;o++)f[o]!=="expand"?this.brace_style="collapse":this.brace_style=f[o]}p.prototype=new m,r.exports.Options=p}],M={};function z(r){var O=M[r];if(O!==void 0)return O.exports;var v=M[r]={exports:{}};return H[r](v,v.exports,z),v.exports}var G=z(15);N=G})();var J=N;!(oe=[],Y=function(){return{css_beautify:J}}.apply(Te,oe),Y!==void 0&&(Qe.exports=Y))})()},Vhoy:function(Qe,Te,q){"use strict";q.d(Te,"d",function(){return J}),q.d(Te,"e",function(){return H}),q.d(Te,"c",function(){return M}),q.d(Te,"b",function(){return z}),q.d(Te,"a",function(){return G});var oe=q("MI8n");class Y{constructor(){this._icons=new Map,this._onDidRegister=new oe.b}add(r){const O=this._icons.get(r.id);O?r.description?O.description=r.description:console.error(`Duplicate registration of codicon ${r.id}`):(this._icons.set(r.id,r),this._onDidRegister.fire(r))}get(r){return this._icons.get(r)}get all(){return this._icons.values()}get onDidRegister(){return this._onDidRegister.event}}const N=new Y,J=N;function H(r,O){return new z(r,O)}function M(r){return r?r.replace(/\$\((.*?)\)/g,(O,v)=>` ${v} `).trim():""}class z{constructor(r,O,v){this.id=r,this.definition=O,this.description=v,N.add(this)}get classNames(){return"codicon codicon-"+this.id}get classNamesArray(){return["codicon","codicon-"+this.id]}get cssSelector(){return".codicon.codicon-"+this.id}}var G;(function(r){r.iconNameSegment="[A-Za-z0-9]+",r.iconNameExpression="[A-Za-z0-9\\-]+",r.iconModifierExpression="~[A-Za-z]+";const O=new RegExp(`^(${r.iconNameExpression})(${r.iconModifierExpression})?$`);function v(h){if(h instanceof z)return["codicon","codicon-"+h.id];const u=O.exec(h.id);if(!u)return v(z.error);let[,f,o]=u;const l=["codicon","codicon-"+f];return o&&l.push("codicon-modifier-"+o.substr(1)),l}r.asClassNameArray=v;function m(h){return v(h).join(" ")}r.asClassName=m;function p(h){return"."+v(h).join(".")}r.asCSSSelector=p})(G||(G={})),function(r){r.add=new r("add",{fontCharacter:"\\ea60"}),r.plus=new r("plus",r.add.definition),r.gistNew=new r("gist-new",r.add.definition),r.repoCreate=new r("repo-create",r.add.definition),r.lightbulb=new r("lightbulb",{fontCharacter:"\\ea61"}),r.lightBulb=new r("light-bulb",{fontCharacter:"\\ea61"}),r.repo=new r("repo",{fontCharacter:"\\ea62"}),r.repoDelete=new r("repo-delete",{fontCharacter:"\\ea62"}),r.gistFork=new r("gist-fork",{fontCharacter:"\\ea63"}),r.repoForked=new r("repo-forked",{fontCharacter:"\\ea63"}),r.gitPullRequest=new r("git-pull-request",{fontCharacter:"\\ea64"}),r.gitPullRequestAbandoned=new r("git-pull-request-abandoned",{fontCharacter:"\\ea64"}),r.recordKeys=new r("record-keys",{fontCharacter:"\\ea65"}),r.keyboard=new r("keyboard",{fontCharacter:"\\ea65"}),r.tag=new r("tag",{fontCharacter:"\\ea66"}),r.tagAdd=new r("tag-add",{fontCharacter:"\\ea66"}),r.tagRemove=new r("tag-remove",{fontCharacter:"\\ea66"}),r.person=new r("person",{fontCharacter:"\\ea67"}),r.personFollow=new r("person-follow",{fontCharacter:"\\ea67"}),r.personOutline=new r("person-outline",{fontCharacter:"\\ea67"}),r.personFilled=new r("person-filled",{fontCharacter:"\\ea67"}),r.gitBranch=new r("git-branch",{fontCharacter:"\\ea68"}),r.gitBranchCreate=new r("git-branch-create",{fontCharacter:"\\ea68"}),r.gitBranchDelete=new r("git-branch-delete",{fontCharacter:"\\ea68"}),r.sourceControl=new r("source-control",{fontCharacter:"\\ea68"}),r.mirror=new r("mirror",{fontCharacter:"\\ea69"}),r.mirrorPublic=new r("mirror-public",{fontCharacter:"\\ea69"}),r.star=new r("star",{fontCharacter:"\\ea6a"}),r.starAdd=new r("star-add",{fontCharacter:"\\ea6a"}),r.starDelete=new r("star-delete",{fontCharacter:"\\ea6a"}),r.starEmpty=new r("star-empty",{fontCharacter:"\\ea6a"}),r.comment=new r("comment",{fontCharacter:"\\ea6b"}),r.commentAdd=new r("comment-add",{fontCharacter:"\\ea6b"}),r.alert=new r("alert",{fontCharacter:"\\ea6c"}),r.warning=new r("warning",{fontCharacter:"\\ea6c"}),r.search=new r("search",{fontCharacter:"\\ea6d"}),r.searchSave=new r("search-save",{fontCharacter:"\\ea6d"}),r.logOut=new r("log-out",{fontCharacter:"\\ea6e"}),r.signOut=new r("sign-out",{fontCharacter:"\\ea6e"}),r.logIn=new r("log-in",{fontCharacter:"\\ea6f"}),r.signIn=new r("sign-in",{fontCharacter:"\\ea6f"}),r.eye=new r("eye",{fontCharacter:"\\ea70"}),r.eyeUnwatch=new r("eye-unwatch",{fontCharacter:"\\ea70"}),r.eyeWatch=new r("eye-watch",{fontCharacter:"\\ea70"}),r.circleFilled=new r("circle-filled",{fontCharacter:"\\ea71"}),r.primitiveDot=new r("primitive-dot",{fontCharacter:"\\ea71"}),r.closeDirty=new r("close-dirty",{fontCharacter:"\\ea71"}),r.debugBreakpoint=new r("debug-breakpoint",{fontCharacter:"\\ea71"}),r.debugBreakpointDisabled=new r("debug-breakpoint-disabled",{fontCharacter:"\\ea71"}),r.debugHint=new r("debug-hint",{fontCharacter:"\\ea71"}),r.primitiveSquare=new r("primitive-square",{fontCharacter:"\\ea72"}),r.edit=new r("edit",{fontCharacter:"\\ea73"}),r.pencil=new r("pencil",{fontCharacter:"\\ea73"}),r.info=new r("info",{fontCharacter:"\\ea74"}),r.issueOpened=new r("issue-opened",{fontCharacter:"\\ea74"}),r.gistPrivate=new r("gist-private",{fontCharacter:"\\ea75"}),r.gitForkPrivate=new r("git-fork-private",{fontCharacter:"\\ea75"}),r.lock=new r("lock",{fontCharacter:"\\ea75"}),r.mirrorPrivate=new r("mirror-private",{fontCharacter:"\\ea75"}),r.close=new r("close",{fontCharacter:"\\ea76"}),r.removeClose=new r("remove-close",{fontCharacter:"\\ea76"}),r.x=new r("x",{fontCharacter:"\\ea76"}),r.repoSync=new r("repo-sync",{fontCharacter:"\\ea77"}),r.sync=new r("sync",{fontCharacter:"\\ea77"}),r.clone=new r("clone",{fontCharacter:"\\ea78"}),r.desktopDownload=new r("desktop-download",{fontCharacter:"\\ea78"}),r.beaker=new r("beaker",{fontCharacter:"\\ea79"}),r.microscope=new r("microscope",{fontCharacter:"\\ea79"}),r.vm=new r("vm",{fontCharacter:"\\ea7a"}),r.deviceDesktop=new r("device-desktop",{fontCharacter:"\\ea7a"}),r.file=new r("file",{fontCharacter:"\\ea7b"}),r.fileText=new r("file-text",{fontCharacter:"\\ea7b"}),r.more=new r("more",{fontCharacter:"\\ea7c"}),r.ellipsis=new r("ellipsis",{fontCharacter:"\\ea7c"}),r.kebabHorizontal=new r("kebab-horizontal",{fontCharacter:"\\ea7c"}),r.mailReply=new r("mail-reply",{fontCharacter:"\\ea7d"}),r.reply=new r("reply",{fontCharacter:"\\ea7d"}),r.organization=new r("organization",{fontCharacter:"\\ea7e"}),r.organizationFilled=new r("organization-filled",{fontCharacter:"\\ea7e"}),r.organizationOutline=new r("organization-outline",{fontCharacter:"\\ea7e"}),r.newFile=new r("new-file",{fontCharacter:"\\ea7f"}),r.fileAdd=new r("file-add",{fontCharacter:"\\ea7f"}),r.newFolder=new r("new-folder",{fontCharacter:"\\ea80"}),r.fileDirectoryCreate=new r("file-directory-create",{fontCharacter:"\\ea80"}),r.trash=new r("trash",{fontCharacter:"\\ea81"}),r.trashcan=new r("trashcan",{fontCharacter:"\\ea81"}),r.history=new r("history",{fontCharacter:"\\ea82"}),r.clock=new r("clock",{fontCharacter:"\\ea82"}),r.folder=new r("folder",{fontCharacter:"\\ea83"}),r.fileDirectory=new r("file-directory",{fontCharacter:"\\ea83"}),r.symbolFolder=new r("symbol-folder",{fontCharacter:"\\ea83"}),r.logoGithub=new r("logo-github",{fontCharacter:"\\ea84"}),r.markGithub=new r("mark-github",{fontCharacter:"\\ea84"}),r.github=new r("github",{fontCharacter:"\\ea84"}),r.terminal=new r("terminal",{fontCharacter:"\\ea85"}),r.console=new r("console",{fontCharacter:"\\ea85"}),r.repl=new r("repl",{fontCharacter:"\\ea85"}),r.zap=new r("zap",{fontCharacter:"\\ea86"}),r.symbolEvent=new r("symbol-event",{fontCharacter:"\\ea86"}),r.error=new r("error",{fontCharacter:"\\ea87"}),r.stop=new r("stop",{fontCharacter:"\\ea87"}),r.variable=new r("variable",{fontCharacter:"\\ea88"}),r.symbolVariable=new r("symbol-variable",{fontCharacter:"\\ea88"}),r.array=new r("array",{fontCharacter:"\\ea8a"}),r.symbolArray=new r("symbol-array",{fontCharacter:"\\ea8a"}),r.symbolModule=new r("symbol-module",{fontCharacter:"\\ea8b"}),r.symbolPackage=new r("symbol-package",{fontCharacter:"\\ea8b"}),r.symbolNamespace=new r("symbol-namespace",{fontCharacter:"\\ea8b"}),r.symbolObject=new r("symbol-object",{fontCharacter:"\\ea8b"}),r.symbolMethod=new r("symbol-method",{fontCharacter:"\\ea8c"}),r.symbolFunction=new r("symbol-function",{fontCharacter:"\\ea8c"}),r.symbolConstructor=new r("symbol-constructor",{fontCharacter:"\\ea8c"}),r.symbolBoolean=new r("symbol-boolean",{fontCharacter:"\\ea8f"}),r.symbolNull=new r("symbol-null",{fontCharacter:"\\ea8f"}),r.symbolNumeric=new r("symbol-numeric",{fontCharacter:"\\ea90"}),r.symbolNumber=new r("symbol-number",{fontCharacter:"\\ea90"}),r.symbolStructure=new r("symbol-structure",{fontCharacter:"\\ea91"}),r.symbolStruct=new r("symbol-struct",{fontCharacter:"\\ea91"}),r.symbolParameter=new r("symbol-parameter",{fontCharacter:"\\ea92"}),r.symbolTypeParameter=new r("symbol-type-parameter",{fontCharacter:"\\ea92"}),r.symbolKey=new r("symbol-key",{fontCharacter:"\\ea93"}),r.symbolText=new r("symbol-text",{fontCharacter:"\\ea93"}),r.symbolReference=new r("symbol-reference",{fontCharacter:"\\ea94"}),r.goToFile=new r("go-to-file",{fontCharacter:"\\ea94"}),r.symbolEnum=new r("symbol-enum",{fontCharacter:"\\ea95"}),r.symbolValue=new r("symbol-value",{fontCharacter:"\\ea95"}),r.symbolRuler=new r("symbol-ruler",{fontCharacter:"\\ea96"}),r.symbolUnit=new r("symbol-unit",{fontCharacter:"\\ea96"}),r.activateBreakpoints=new r("activate-breakpoints",{fontCharacter:"\\ea97"}),r.archive=new r("archive",{fontCharacter:"\\ea98"}),r.arrowBoth=new r("arrow-both",{fontCharacter:"\\ea99"}),r.arrowDown=new r("arrow-down",{fontCharacter:"\\ea9a"}),r.arrowLeft=new r("arrow-left",{fontCharacter:"\\ea9b"}),r.arrowRight=new r("arrow-right",{fontCharacter:"\\ea9c"}),r.arrowSmallDown=new r("arrow-small-down",{fontCharacter:"\\ea9d"}),r.arrowSmallLeft=new r("arrow-small-left",{fontCharacter:"\\ea9e"}),r.arrowSmallRight=new r("arrow-small-right",{fontCharacter:"\\ea9f"}),r.arrowSmallUp=new r("arrow-small-up",{fontCharacter:"\\eaa0"}),r.arrowUp=new r("arrow-up",{fontCharacter:"\\eaa1"}),r.bell=new r("bell",{fontCharacter:"\\eaa2"}),r.bold=new r("bold",{fontCharacter:"\\eaa3"}),r.book=new r("book",{fontCharacter:"\\eaa4"}),r.bookmark=new r("bookmark",{fontCharacter:"\\eaa5"}),r.debugBreakpointConditionalUnverified=new r("debug-breakpoint-conditional-unverified",{fontCharacter:"\\eaa6"}),r.debugBreakpointConditional=new r("debug-breakpoint-conditional",{fontCharacter:"\\eaa7"}),r.debugBreakpointConditionalDisabled=new r("debug-breakpoint-conditional-disabled",{fontCharacter:"\\eaa7"}),r.debugBreakpointDataUnverified=new r("debug-breakpoint-data-unverified",{fontCharacter:"\\eaa8"}),r.debugBreakpointData=new r("debug-breakpoint-data",{fontCharacter:"\\eaa9"}),r.debugBreakpointDataDisabled=new r("debug-breakpoint-data-disabled",{fontCharacter:"\\eaa9"}),r.debugBreakpointLogUnverified=new r("debug-breakpoint-log-unverified",{fontCharacter:"\\eaaa"}),r.debugBreakpointLog=new r("debug-breakpoint-log",{fontCharacter:"\\eaab"}),r.debugBreakpointLogDisabled=new r("debug-breakpoint-log-disabled",{fontCharacter:"\\eaab"}),r.briefcase=new r("briefcase",{fontCharacter:"\\eaac"}),r.broadcast=new r("broadcast",{fontCharacter:"\\eaad"}),r.browser=new r("browser",{fontCharacter:"\\eaae"}),r.bug=new r("bug",{fontCharacter:"\\eaaf"}),r.calendar=new r("calendar",{fontCharacter:"\\eab0"}),r.caseSensitive=new r("case-sensitive",{fontCharacter:"\\eab1"}),r.check=new r("check",{fontCharacter:"\\eab2"}),r.checklist=new r("checklist",{fontCharacter:"\\eab3"}),r.chevronDown=new r("chevron-down",{fontCharacter:"\\eab4"}),r.dropDownButton=new r("drop-down-button",r.chevronDown.definition),r.chevronLeft=new r("chevron-left",{fontCharacter:"\\eab5"}),r.chevronRight=new r("chevron-right",{fontCharacter:"\\eab6"}),r.chevronUp=new r("chevron-up",{fontCharacter:"\\eab7"}),r.chromeClose=new r("chrome-close",{fontCharacter:"\\eab8"}),r.chromeMaximize=new r("chrome-maximize",{fontCharacter:"\\eab9"}),r.chromeMinimize=new r("chrome-minimize",{fontCharacter:"\\eaba"}),r.chromeRestore=new r("chrome-restore",{fontCharacter:"\\eabb"}),r.circleOutline=new r("circle-outline",{fontCharacter:"\\eabc"}),r.debugBreakpointUnverified=new r("debug-breakpoint-unverified",{fontCharacter:"\\eabc"}),r.circleSlash=new r("circle-slash",{fontCharacter:"\\eabd"}),r.circuitBoard=new r("circuit-board",{fontCharacter:"\\eabe"}),r.clearAll=new r("clear-all",{fontCharacter:"\\eabf"}),r.clippy=new r("clippy",{fontCharacter:"\\eac0"}),r.closeAll=new r("close-all",{fontCharacter:"\\eac1"}),r.cloudDownload=new r("cloud-download",{fontCharacter:"\\eac2"}),r.cloudUpload=new r("cloud-upload",{fontCharacter:"\\eac3"}),r.code=new r("code",{fontCharacter:"\\eac4"}),r.collapseAll=new r("collapse-all",{fontCharacter:"\\eac5"}),r.colorMode=new r("color-mode",{fontCharacter:"\\eac6"}),r.commentDiscussion=new r("comment-discussion",{fontCharacter:"\\eac7"}),r.compareChanges=new r("compare-changes",{fontCharacter:"\\eafd"}),r.creditCard=new r("credit-card",{fontCharacter:"\\eac9"}),r.dash=new r("dash",{fontCharacter:"\\eacc"}),r.dashboard=new r("dashboard",{fontCharacter:"\\eacd"}),r.database=new r("database",{fontCharacter:"\\eace"}),r.debugContinue=new r("debug-continue",{fontCharacter:"\\eacf"}),r.debugDisconnect=new r("debug-disconnect",{fontCharacter:"\\ead0"}),r.debugPause=new r("debug-pause",{fontCharacter:"\\ead1"}),r.debugRestart=new r("debug-restart",{fontCharacter:"\\ead2"}),r.debugStart=new r("debug-start",{fontCharacter:"\\ead3"}),r.debugStepInto=new r("debug-step-into",{fontCharacter:"\\ead4"}),r.debugStepOut=new r("debug-step-out",{fontCharacter:"\\ead5"}),r.debugStepOver=new r("debug-step-over",{fontCharacter:"\\ead6"}),r.debugStop=new r("debug-stop",{fontCharacter:"\\ead7"}),r.debug=new r("debug",{fontCharacter:"\\ead8"}),r.deviceCameraVideo=new r("device-camera-video",{fontCharacter:"\\ead9"}),r.deviceCamera=new r("device-camera",{fontCharacter:"\\eada"}),r.deviceMobile=new r("device-mobile",{fontCharacter:"\\eadb"}),r.diffAdded=new r("diff-added",{fontCharacter:"\\eadc"}),r.diffIgnored=new r("diff-ignored",{fontCharacter:"\\eadd"}),r.diffModified=new r("diff-modified",{fontCharacter:"\\eade"}),r.diffRemoved=new r("diff-removed",{fontCharacter:"\\eadf"}),r.diffRenamed=new r("diff-renamed",{fontCharacter:"\\eae0"}),r.diff=new r("diff",{fontCharacter:"\\eae1"}),r.discard=new r("discard",{fontCharacter:"\\eae2"}),r.editorLayout=new r("editor-layout",{fontCharacter:"\\eae3"}),r.emptyWindow=new r("empty-window",{fontCharacter:"\\eae4"}),r.exclude=new r("exclude",{fontCharacter:"\\eae5"}),r.extensions=new r("extensions",{fontCharacter:"\\eae6"}),r.eyeClosed=new r("eye-closed",{fontCharacter:"\\eae7"}),r.fileBinary=new r("file-binary",{fontCharacter:"\\eae8"}),r.fileCode=new r("file-code",{fontCharacter:"\\eae9"}),r.fileMedia=new r("file-media",{fontCharacter:"\\eaea"}),r.filePdf=new r("file-pdf",{fontCharacter:"\\eaeb"}),r.fileSubmodule=new r("file-submodule",{fontCharacter:"\\eaec"}),r.fileSymlinkDirectory=new r("file-symlink-directory",{fontCharacter:"\\eaed"}),r.fileSymlinkFile=new r("file-symlink-file",{fontCharacter:"\\eaee"}),r.fileZip=new r("file-zip",{fontCharacter:"\\eaef"}),r.files=new r("files",{fontCharacter:"\\eaf0"}),r.filter=new r("filter",{fontCharacter:"\\eaf1"}),r.flame=new r("flame",{fontCharacter:"\\eaf2"}),r.foldDown=new r("fold-down",{fontCharacter:"\\eaf3"}),r.foldUp=new r("fold-up",{fontCharacter:"\\eaf4"}),r.fold=new r("fold",{fontCharacter:"\\eaf5"}),r.folderActive=new r("folder-active",{fontCharacter:"\\eaf6"}),r.folderOpened=new r("folder-opened",{fontCharacter:"\\eaf7"}),r.gear=new r("gear",{fontCharacter:"\\eaf8"}),r.gift=new r("gift",{fontCharacter:"\\eaf9"}),r.gistSecret=new r("gist-secret",{fontCharacter:"\\eafa"}),r.gist=new r("gist",{fontCharacter:"\\eafb"}),r.gitCommit=new r("git-commit",{fontCharacter:"\\eafc"}),r.gitCompare=new r("git-compare",{fontCharacter:"\\eafd"}),r.gitMerge=new r("git-merge",{fontCharacter:"\\eafe"}),r.githubAction=new r("github-action",{fontCharacter:"\\eaff"}),r.githubAlt=new r("github-alt",{fontCharacter:"\\eb00"}),r.globe=new r("globe",{fontCharacter:"\\eb01"}),r.grabber=new r("grabber",{fontCharacter:"\\eb02"}),r.graph=new r("graph",{fontCharacter:"\\eb03"}),r.gripper=new r("gripper",{fontCharacter:"\\eb04"}),r.heart=new r("heart",{fontCharacter:"\\eb05"}),r.home=new r("home",{fontCharacter:"\\eb06"}),r.horizontalRule=new r("horizontal-rule",{fontCharacter:"\\eb07"}),r.hubot=new r("hubot",{fontCharacter:"\\eb08"}),r.inbox=new r("inbox",{fontCharacter:"\\eb09"}),r.issueClosed=new r("issue-closed",{fontCharacter:"\\eba4"}),r.issueReopened=new r("issue-reopened",{fontCharacter:"\\eb0b"}),r.issues=new r("issues",{fontCharacter:"\\eb0c"}),r.italic=new r("italic",{fontCharacter:"\\eb0d"}),r.jersey=new r("jersey",{fontCharacter:"\\eb0e"}),r.json=new r("json",{fontCharacter:"\\eb0f"}),r.kebabVertical=new r("kebab-vertical",{fontCharacter:"\\eb10"}),r.key=new r("key",{fontCharacter:"\\eb11"}),r.law=new r("law",{fontCharacter:"\\eb12"}),r.lightbulbAutofix=new r("lightbulb-autofix",{fontCharacter:"\\eb13"}),r.linkExternal=new r("link-external",{fontCharacter:"\\eb14"}),r.link=new r("link",{fontCharacter:"\\eb15"}),r.listOrdered=new r("list-ordered",{fontCharacter:"\\eb16"}),r.listUnordered=new r("list-unordered",{fontCharacter:"\\eb17"}),r.liveShare=new r("live-share",{fontCharacter:"\\eb18"}),r.loading=new r("loading",{fontCharacter:"\\eb19"}),r.location=new r("location",{fontCharacter:"\\eb1a"}),r.mailRead=new r("mail-read",{fontCharacter:"\\eb1b"}),r.mail=new r("mail",{fontCharacter:"\\eb1c"}),r.markdown=new r("markdown",{fontCharacter:"\\eb1d"}),r.megaphone=new r("megaphone",{fontCharacter:"\\eb1e"}),r.mention=new r("mention",{fontCharacter:"\\eb1f"}),r.milestone=new r("milestone",{fontCharacter:"\\eb20"}),r.mortarBoard=new r("mortar-board",{fontCharacter:"\\eb21"}),r.move=new r("move",{fontCharacter:"\\eb22"}),r.multipleWindows=new r("multiple-windows",{fontCharacter:"\\eb23"}),r.mute=new r("mute",{fontCharacter:"\\eb24"}),r.noNewline=new r("no-newline",{fontCharacter:"\\eb25"}),r.note=new r("note",{fontCharacter:"\\eb26"}),r.octoface=new r("octoface",{fontCharacter:"\\eb27"}),r.openPreview=new r("open-preview",{fontCharacter:"\\eb28"}),r.package_=new r("package",{fontCharacter:"\\eb29"}),r.paintcan=new r("paintcan",{fontCharacter:"\\eb2a"}),r.pin=new r("pin",{fontCharacter:"\\eb2b"}),r.play=new r("play",{fontCharacter:"\\eb2c"}),r.run=new r("run",{fontCharacter:"\\eb2c"}),r.plug=new r("plug",{fontCharacter:"\\eb2d"}),r.preserveCase=new r("preserve-case",{fontCharacter:"\\eb2e"}),r.preview=new r("preview",{fontCharacter:"\\eb2f"}),r.project=new r("project",{fontCharacter:"\\eb30"}),r.pulse=new r("pulse",{fontCharacter:"\\eb31"}),r.question=new r("question",{fontCharacter:"\\eb32"}),r.quote=new r("quote",{fontCharacter:"\\eb33"}),r.radioTower=new r("radio-tower",{fontCharacter:"\\eb34"}),r.reactions=new r("reactions",{fontCharacter:"\\eb35"}),r.references=new r("references",{fontCharacter:"\\eb36"}),r.refresh=new r("refresh",{fontCharacter:"\\eb37"}),r.regex=new r("regex",{fontCharacter:"\\eb38"}),r.remoteExplorer=new r("remote-explorer",{fontCharacter:"\\eb39"}),r.remote=new r("remote",{fontCharacter:"\\eb3a"}),r.remove=new r("remove",{fontCharacter:"\\eb3b"}),r.replaceAll=new r("replace-all",{fontCharacter:"\\eb3c"}),r.replace=new r("replace",{fontCharacter:"\\eb3d"}),r.repoClone=new r("repo-clone",{fontCharacter:"\\eb3e"}),r.repoForcePush=new r("repo-force-push",{fontCharacter:"\\eb3f"}),r.repoPull=new r("repo-pull",{fontCharacter:"\\eb40"}),r.repoPush=new r("repo-push",{fontCharacter:"\\eb41"}),r.report=new r("report",{fontCharacter:"\\eb42"}),r.requestChanges=new r("request-changes",{fontCharacter:"\\eb43"}),r.rocket=new r("rocket",{fontCharacter:"\\eb44"}),r.rootFolderOpened=new r("root-folder-opened",{fontCharacter:"\\eb45"}),r.rootFolder=new r("root-folder",{fontCharacter:"\\eb46"}),r.rss=new r("rss",{fontCharacter:"\\eb47"}),r.ruby=new r("ruby",{fontCharacter:"\\eb48"}),r.saveAll=new r("save-all",{fontCharacter:"\\eb49"}),r.saveAs=new r("save-as",{fontCharacter:"\\eb4a"}),r.save=new r("save",{fontCharacter:"\\eb4b"}),r.screenFull=new r("screen-full",{fontCharacter:"\\eb4c"}),r.screenNormal=new r("screen-normal",{fontCharacter:"\\eb4d"}),r.searchStop=new r("search-stop",{fontCharacter:"\\eb4e"}),r.server=new r("server",{fontCharacter:"\\eb50"}),r.settingsGear=new r("settings-gear",{fontCharacter:"\\eb51"}),r.settings=new r("settings",{fontCharacter:"\\eb52"}),r.shield=new r("shield",{fontCharacter:"\\eb53"}),r.smiley=new r("smiley",{fontCharacter:"\\eb54"}),r.sortPrecedence=new r("sort-precedence",{fontCharacter:"\\eb55"}),r.splitHorizontal=new r("split-horizontal",{fontCharacter:"\\eb56"}),r.splitVertical=new r("split-vertical",{fontCharacter:"\\eb57"}),r.squirrel=new r("squirrel",{fontCharacter:"\\eb58"}),r.starFull=new r("star-full",{fontCharacter:"\\eb59"}),r.starHalf=new r("star-half",{fontCharacter:"\\eb5a"}),r.symbolClass=new r("symbol-class",{fontCharacter:"\\eb5b"}),r.symbolColor=new r("symbol-color",{fontCharacter:"\\eb5c"}),r.symbolConstant=new r("symbol-constant",{fontCharacter:"\\eb5d"}),r.symbolEnumMember=new r("symbol-enum-member",{fontCharacter:"\\eb5e"}),r.symbolField=new r("symbol-field",{fontCharacter:"\\eb5f"}),r.symbolFile=new r("symbol-file",{fontCharacter:"\\eb60"}),r.symbolInterface=new r("symbol-interface",{fontCharacter:"\\eb61"}),r.symbolKeyword=new r("symbol-keyword",{fontCharacter:"\\eb62"}),r.symbolMisc=new r("symbol-misc",{fontCharacter:"\\eb63"}),r.symbolOperator=new r("symbol-operator",{fontCharacter:"\\eb64"}),r.symbolProperty=new r("symbol-property",{fontCharacter:"\\eb65"}),r.wrench=new r("wrench",{fontCharacter:"\\eb65"}),r.wrenchSubaction=new r("wrench-subaction",{fontCharacter:"\\eb65"}),r.symbolSnippet=new r("symbol-snippet",{fontCharacter:"\\eb66"}),r.tasklist=new r("tasklist",{fontCharacter:"\\eb67"}),r.telescope=new r("telescope",{fontCharacter:"\\eb68"}),r.textSize=new r("text-size",{fontCharacter:"\\eb69"}),r.threeBars=new r("three-bars",{fontCharacter:"\\eb6a"}),r.thumbsdown=new r("thumbsdown",{fontCharacter:"\\eb6b"}),r.thumbsup=new r("thumbsup",{fontCharacter:"\\eb6c"}),r.tools=new r("tools",{fontCharacter:"\\eb6d"}),r.triangleDown=new r("triangle-down",{fontCharacter:"\\eb6e"}),r.triangleLeft=new r("triangle-left",{fontCharacter:"\\eb6f"}),r.triangleRight=new r("triangle-right",{fontCharacter:"\\eb70"}),r.triangleUp=new r("triangle-up",{fontCharacter:"\\eb71"}),r.twitter=new r("twitter",{fontCharacter:"\\eb72"}),r.unfold=new r("unfold",{fontCharacter:"\\eb73"}),r.unlock=new r("unlock",{fontCharacter:"\\eb74"}),r.unmute=new r("unmute",{fontCharacter:"\\eb75"}),r.unverified=new r("unverified",{fontCharacter:"\\eb76"}),r.verified=new r("verified",{fontCharacter:"\\eb77"}),r.versions=new r("versions",{fontCharacter:"\\eb78"}),r.vmActive=new r("vm-active",{fontCharacter:"\\eb79"}),r.vmOutline=new r("vm-outline",{fontCharacter:"\\eb7a"}),r.vmRunning=new r("vm-running",{fontCharacter:"\\eb7b"}),r.watch=new r("watch",{fontCharacter:"\\eb7c"}),r.whitespace=new r("whitespace",{fontCharacter:"\\eb7d"}),r.wholeWord=new r("whole-word",{fontCharacter:"\\eb7e"}),r.window=new r("window",{fontCharacter:"\\eb7f"}),r.wordWrap=new r("word-wrap",{fontCharacter:"\\eb80"}),r.zoomIn=new r("zoom-in",{fontCharacter:"\\eb81"}),r.zoomOut=new r("zoom-out",{fontCharacter:"\\eb82"}),r.listFilter=new r("list-filter",{fontCharacter:"\\eb83"}),r.listFlat=new r("list-flat",{fontCharacter:"\\eb84"}),r.listSelection=new r("list-selection",{fontCharacter:"\\eb85"}),r.selection=new r("selection",{fontCharacter:"\\eb85"}),r.listTree=new r("list-tree",{fontCharacter:"\\eb86"}),r.debugBreakpointFunctionUnverified=new r("debug-breakpoint-function-unverified",{fontCharacter:"\\eb87"}),r.debugBreakpointFunction=new r("debug-breakpoint-function",{fontCharacter:"\\eb88"}),r.debugBreakpointFunctionDisabled=new r("debug-breakpoint-function-disabled",{fontCharacter:"\\eb88"}),r.debugStackframeActive=new r("debug-stackframe-active",{fontCharacter:"\\eb89"}),r.debugStackframeDot=new r("debug-stackframe-dot",{fontCharacter:"\\eb8a"}),r.debugStackframe=new r("debug-stackframe",{fontCharacter:"\\eb8b"}),r.debugStackframeFocused=new r("debug-stackframe-focused",{fontCharacter:"\\eb8b"}),r.debugBreakpointUnsupported=new r("debug-breakpoint-unsupported",{fontCharacter:"\\eb8c"}),r.symbolString=new r("symbol-string",{fontCharacter:"\\eb8d"}),r.debugReverseContinue=new r("debug-reverse-continue",{fontCharacter:"\\eb8e"}),r.debugStepBack=new r("debug-step-back",{fontCharacter:"\\eb8f"}),r.debugRestartFrame=new r("debug-restart-frame",{fontCharacter:"\\eb90"}),r.callIncoming=new r("call-incoming",{fontCharacter:"\\eb92"}),r.callOutgoing=new r("call-outgoing",{fontCharacter:"\\eb93"}),r.menu=new r("menu",{fontCharacter:"\\eb94"}),r.expandAll=new r("expand-all",{fontCharacter:"\\eb95"}),r.feedback=new r("feedback",{fontCharacter:"\\eb96"}),r.groupByRefType=new r("group-by-ref-type",{fontCharacter:"\\eb97"}),r.ungroupByRefType=new r("ungroup-by-ref-type",{fontCharacter:"\\eb98"}),r.account=new r("account",{fontCharacter:"\\eb99"}),r.bellDot=new r("bell-dot",{fontCharacter:"\\eb9a"}),r.debugConsole=new r("debug-console",{fontCharacter:"\\eb9b"}),r.library=new r("library",{fontCharacter:"\\eb9c"}),r.output=new r("output",{fontCharacter:"\\eb9d"}),r.runAll=new r("run-all",{fontCharacter:"\\eb9e"}),r.syncIgnored=new r("sync-ignored",{fontCharacter:"\\eb9f"}),r.pinned=new r("pinned",{fontCharacter:"\\eba0"}),r.githubInverted=new r("github-inverted",{fontCharacter:"\\eba1"}),r.debugAlt=new r("debug-alt",{fontCharacter:"\\eb91"}),r.serverProcess=new r("server-process",{fontCharacter:"\\eba2"}),r.serverEnvironment=new r("server-environment",{fontCharacter:"\\eba3"}),r.pass=new r("pass",{fontCharacter:"\\eba4"}),r.stopCircle=new r("stop-circle",{fontCharacter:"\\eba5"}),r.playCircle=new r("play-circle",{fontCharacter:"\\eba6"}),r.record=new r("record",{fontCharacter:"\\eba7"}),r.debugAltSmall=new r("debug-alt-small",{fontCharacter:"\\eba8"}),r.vmConnect=new r("vm-connect",{fontCharacter:"\\eba9"}),r.cloud=new r("cloud",{fontCharacter:"\\ebaa"}),r.merge=new r("merge",{fontCharacter:"\\ebab"}),r.exportIcon=new r("export",{fontCharacter:"\\ebac"}),r.graphLeft=new r("graph-left",{fontCharacter:"\\ebad"}),r.magnet=new r("magnet",{fontCharacter:"\\ebae"}),r.notebook=new r("notebook",{fontCharacter:"\\ebaf"}),r.redo=new r("redo",{fontCharacter:"\\ebb0"}),r.checkAll=new r("check-all",{fontCharacter:"\\ebb1"}),r.pinnedDirty=new r("pinned-dirty",{fontCharacter:"\\ebb2"}),r.passFilled=new r("pass-filled",{fontCharacter:"\\ebb3"}),r.circleLargeFilled=new r("circle-large-filled",{fontCharacter:"\\ebb4"}),r.circleLargeOutline=new r("circle-large-outline",{fontCharacter:"\\ebb5"}),r.combine=new r("combine",{fontCharacter:"\\ebb6"}),r.gather=new r("gather",{fontCharacter:"\\ebb6"}),r.table=new r("table",{fontCharacter:"\\ebb7"}),r.variableGroup=new r("variable-group",{fontCharacter:"\\ebb8"}),r.typeHierarchy=new r("type-hierarchy",{fontCharacter:"\\ebb9"}),r.typeHierarchySub=new r("type-hierarchy-sub",{fontCharacter:"\\ebba"}),r.typeHierarchySuper=new r("type-hierarchy-super",{fontCharacter:"\\ebbb"}),r.gitPullRequestCreate=new r("git-pull-request-create",{fontCharacter:"\\ebbc"}),r.runAbove=new r("run-above",{fontCharacter:"\\ebbd"}),r.runBelow=new r("run-below",{fontCharacter:"\\ebbe"}),r.notebookTemplate=new r("notebook-template",{fontCharacter:"\\ebbf"}),r.debugRerun=new r("debug-rerun",{fontCharacter:"\\ebc0"}),r.workspaceTrusted=new r("workspace-trusted",{fontCharacter:"\\ebc1"}),r.workspaceUntrusted=new r("workspace-untrusted",{fontCharacter:"\\ebc2"}),r.workspaceUnspecified=new r("workspace-unspecified",{fontCharacter:"\\ebc3"}),r.terminalCmd=new r("terminal-cmd",{fontCharacter:"\\ebc4"}),r.terminalDebian=new r("terminal-debian",{fontCharacter:"\\ebc5"}),r.terminalLinux=new r("terminal-linux",{fontCharacter:"\\ebc6"}),r.terminalPowershell=new r("terminal-powershell",{fontCharacter:"\\ebc7"}),r.terminalTmux=new r("terminal-tmux",{fontCharacter:"\\ebc8"}),r.terminalUbuntu=new r("terminal-ubuntu",{fontCharacter:"\\ebc9"}),r.terminalBash=new r("terminal-bash",{fontCharacter:"\\ebca"}),r.arrowSwap=new r("arrow-swap",{fontCharacter:"\\ebcb"}),r.copy=new r("copy",{fontCharacter:"\\ebcc"}),r.personAdd=new r("person-add",{fontCharacter:"\\ebcd"}),r.filterFilled=new r("filter-filled",{fontCharacter:"\\ebce"}),r.wand=new r("wand",{fontCharacter:"\\ebcf"}),r.debugLineByLine=new r("debug-line-by-line",{fontCharacter:"\\ebd0"}),r.inspect=new r("inspect",{fontCharacter:"\\ebd1"}),r.layers=new r("layers",{fontCharacter:"\\ebd2"}),r.layersDot=new r("layers-dot",{fontCharacter:"\\ebd3"}),r.layersActive=new r("layers-active",{fontCharacter:"\\ebd4"}),r.compass=new r("compass",{fontCharacter:"\\ebd5"}),r.compassDot=new r("compass-dot",{fontCharacter:"\\ebd6"}),r.compassActive=new r("compass-active",{fontCharacter:"\\ebd7"}),r.azure=new r("azure",{fontCharacter:"\\ebd8"}),r.issueDraft=new r("issue-draft",{fontCharacter:"\\ebd9"}),r.gitPullRequestClosed=new r("git-pull-request-closed",{fontCharacter:"\\ebda"}),r.gitPullRequestDraft=new r("git-pull-request-draft",{fontCharacter:"\\ebdb"}),r.debugAll=new r("debug-all",{fontCharacter:"\\ebdc"}),r.debugCoverage=new r("debug-coverage",{fontCharacter:"\\ebdd"}),r.runErrors=new r("run-errors",{fontCharacter:"\\ebde"}),r.folderLibrary=new r("folder-library",{fontCharacter:"\\ebdf"}),r.debugContinueSmall=new r("debug-continue-small",{fontCharacter:"\\ebe0"}),r.beakerStop=new r("beaker-stop",{fontCharacter:"\\ebe1"}),r.graphLine=new r("graph-line",{fontCharacter:"\\ebe2"}),r.graphScatter=new r("graph-scatter",{fontCharacter:"\\ebe3"}),r.pieChart=new r("pie-chart",{fontCharacter:"\\ebe4"}),r.bracket=new r("bracket",r.json.definition),r.bracketDot=new r("bracket-dot",{fontCharacter:"\\ebe5"}),r.bracketError=new r("bracket-error",{fontCharacter:"\\ebe6"}),r.lockSmall=new r("lock-small",{fontCharacter:"\\ebe7"}),r.azureDevops=new r("azure-devops",{fontCharacter:"\\ebe8"}),r.verifiedFilled=new r("verified-filled",{fontCharacter:"\\ebe9"})}(z||(z={}))},"VrN/":function(Qe,Te,q){(function(oe,Y){Qe.exports=Y()})(this,function(){"use strict";var oe=navigator.userAgent,Y=navigator.platform,N=/gecko\/\d/i.test(oe),J=/MSIE \d/.test(oe),H=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(oe),M=/Edge\/(\d+)/.exec(oe),z=J||H||M,G=z&&(J?document.documentMode||6:+(M||H)[1]),r=!M&&/WebKit\//.test(oe),O=r&&/Qt\/\d+\.\d+/.test(oe),v=!M&&/Chrome\//.test(oe),m=/Opera\//.test(oe),p=/Apple Computer/.test(navigator.vendor),h=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(oe),u=/PhantomJS/.test(oe),f=!M&&/AppleWebKit/.test(oe)&&/Mobile\/\w+/.test(oe),o=/Android/.test(oe),l=f||o||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(oe),s=f||/Mac/.test(Y),a=/\bCrOS\b/.test(oe),S=/win/i.test(Y),x=m&&oe.match(/Version\/(\d*\.\d*)/);x&&(x=Number(x[1])),x&&x>=15&&(m=!1,r=!0);var C=s&&(O||m&&(x==null||x<12.11)),D=N||z&&G>=9;function L(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var R=function(e,t){var n=e.className,i=L(t).exec(n);if(i){var c=n.slice(i.index+i[0].length);e.className=n.slice(0,i.index)+(c?i[1]+c:"")}};function A(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function T(e,t){return A(e).appendChild(t)}function d(e,t,n,i){var c=document.createElement(e);if(n&&(c.className=n),i&&(c.style.cssText=i),typeof t=="string")c.appendChild(document.createTextNode(t));else if(t)for(var P=0;P<t.length;++P)c.appendChild(t[P]);return c}function w(e,t,n,i){var c=d(e,t,n,i);return c.setAttribute("role","presentation"),c}var y;document.createRange?y=function(e,t,n,i){var c=document.createRange();return c.setEnd(i||e,n),c.setStart(e,t),c}:y=function(e,t,n){var i=document.body.createTextRange();try{i.moveToElementText(e.parentNode)}catch(c){return i}return i.collapse(!0),i.moveEnd("character",n),i.moveStart("character",t),i};function b(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 j(){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 B(e,t){var n=e.className;L(t).test(n)||(e.className+=(n?" ":"")+t)}function E(e,t){for(var n=e.split(" "),i=0;i<n.length;i++)n[i]&&!L(n[i]).test(t)&&(t+=" "+n[i]);return t}var F=function(e){e.select()};f?F=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:z&&(F=function(e){try{e.select()}catch(t){}});function I(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function g(e,t,n){t||(t={});for(var i in e)e.hasOwnProperty(i)&&(n!==!1||!t.hasOwnProperty(i))&&(t[i]=e[i]);return t}function W(e,t,n,i,c){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var P=i||0,V=c||0;;){var Z=e.indexOf(" ",P);if(Z<0||Z>=t)return V+(t-P);V+=Z-P,V+=n-V%n,P=Z+1}}var $=function(){this.id=null,this.f=null,this.time=0,this.handler=I(this.onTimeout,this)};$.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},$.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 le(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var de=50,Ce={toString:function(){return"CodeMirror.Pass"}},be={scroll:!1},Ae={origin:"*mouse"},Se={origin:"+move"};function Re(e,t,n){for(var i=0,c=0;;){var P=e.indexOf(" ",i);P==-1&&(P=e.length);var V=P-i;if(P==e.length||c+V>=t)return i+Math.min(V,t-c);if(c+=P-i,c+=n-c%n,i=P+1,c>=t)return i}}var ve=[""];function X(e){for(;ve.length<=e;)ve.push(_(ve)+" ");return ve[e]}function _(e){return e[e.length-1]}function k(e,t){for(var n=[],i=0;i<e.length;i++)n[i]=t(e[i],i);return n}function U(e,t,n){for(var i=0,c=n(t);i<e.length&&n(e[i])<=c;)i++;e.splice(i,0,t)}function Q(){}function K(e,t){var n;return Object.create?n=Object.create(e):(Q.prototype=e,n=new Q),t&&g(t,n),n}var ce=/[\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()||ce.test(e))}function De(e,t){return t?t.source.indexOf("\\w")>-1&&xe(e)?!0:t.test(e):xe(e)}function ue(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ge=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function we(e){return e.charCodeAt(0)>=768&&ge.test(e)}function Oe(e,t,n){for(;(n<0?t>0:t<e.length)&&we(e.charAt(t));)t+=n;return t}function Ne(e,t,n){for(var i=t>n?-1:1;;){if(t==n)return t;var c=(t+n)/2,P=i<0?Math.ceil(c):Math.floor(c);if(P==t)return e(P)?t:n;e(P)?n=P:t=P+i}}function Ue(e,t,n,i){if(!e)return i(t,n,"ltr",0);for(var c=!1,P=0;P<e.length;++P){var V=e[P];(V.from<n&&V.to>t||t==n&&V.to==t)&&(i(Math.max(V.from,t),Math.min(V.to,n),V.level==1?"rtl":"ltr",P),c=!0)}c||i(t,n,"ltr")}var Ge=null;function We(e,t,n){var i;Ge=null;for(var c=0;c<e.length;++c){var P=e[c];if(P.from<t&&P.to>t)return c;P.to==t&&(P.from!=P.to&&n=="before"?i=c:Ge=c),P.from==t&&(P.from!=P.to&&n!="before"?i=c:Ge=c)}return i!=null?i:Ge}var Xe=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(ne){return ne<=247?e.charAt(ne):1424<=ne&&ne<=1524?"R":1536<=ne&&ne<=1785?t.charAt(ne-1536):1774<=ne&&ne<=2220?"r":8192<=ne&&ne<=8203?"w":ne==8204?"b":"L"}var i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,c=/[stwN]/,P=/[LRr]/,V=/[Lb1n]/,Z=/[1n]/;function te(ne,ye,_e){this.level=ne,this.from=ye,this.to=_e}return function(ne,ye){var _e=ye=="ltr"?"L":"R";if(ne.length==0||ye=="ltr"&&!i.test(ne))return!1;for(var ke=ne.length,Ie=[],Fe=0;Fe<ke;++Fe)Ie.push(n(ne.charCodeAt(Fe)));for(var Be=0,Ve=_e;Be<ke;++Be){var $e=Ie[Be];$e=="m"?Ie[Be]=Ve:Ve=$e}for(var tt=0,Je=_e;tt<ke;++tt){var nt=Ie[tt];nt=="1"&&Je=="r"?Ie[tt]="n":P.test(nt)&&(Je=nt,nt=="r"&&(Ie[tt]="R"))}for(var ht=1,lt=Ie[0];ht<ke-1;++ht){var bt=Ie[ht];bt=="+"&<=="1"&&Ie[ht+1]=="1"?Ie[ht]="1":bt==","&<==Ie[ht+1]&&(lt=="1"||lt=="n")&&(Ie[ht]=lt),lt=bt}for(var Nt=0;Nt<ke;++Nt){var Zt=Ie[Nt];if(Zt==",")Ie[Nt]="N";else if(Zt=="%"){var Wt=void 0;for(Wt=Nt+1;Wt<ke&&Ie[Wt]=="%";++Wt);for(var _r=Nt&&Ie[Nt-1]=="!"||Wt<ke&&Ie[Wt]=="1"?"1":"N",gr=Nt;gr<Wt;++gr)Ie[gr]=_r;Nt=Wt-1}}for(var Vt=0,vr=_e;Vt<ke;++Vt){var tr=Ie[Vt];vr=="L"&&tr=="1"?Ie[Vt]="L":P.test(tr)&&(vr=tr)}for(var $t=0;$t<ke;++$t)if(c.test(Ie[$t])){var Yt=void 0;for(Yt=$t+1;Yt<ke&&c.test(Ie[Yt]);++Yt);for(var Gt=($t?Ie[$t-1]:_e)=="L",yr=(Yt<ke?Ie[Yt]:_e)=="L",Gi=Gt==yr?Gt?"L":"R":_e,ti=$t;ti<Yt;++ti)Ie[ti]=Gi;$t=Yt-1}for(var ar=[],Br,qt=0;qt<ke;)if(V.test(Ie[qt])){var Va=qt;for(++qt;qt<ke&&V.test(Ie[qt]);++qt);ar.push(new te(0,Va,qt))}else{var zr=qt,vi=ar.length,yi=ye=="rtl"?1:0;for(++qt;qt<ke&&Ie[qt]!="L";++qt);for(var hr=zr;hr<qt;)if(Z.test(Ie[hr])){zr<hr&&(ar.splice(vi,0,new te(1,zr,hr)),vi+=yi);var Ki=hr;for(++hr;hr<qt&&Z.test(Ie[hr]);++hr);ar.splice(vi,0,new te(2,Ki,hr)),vi+=yi,zr=hr}else++hr;zr<qt&&ar.splice(vi,0,new te(1,zr,qt))}return ye=="ltr"&&(ar[0].level==1&&(Br=ne.match(/^\s+/))&&(ar[0].from=Br[0].length,ar.unshift(new te(0,0,Br[0].length))),_(ar).level==1&&(Br=ne.match(/\s+$/))&&(_(ar).to-=Br[0].length,ar.push(new te(0,ke-Br[0].length,ke)))),ye=="rtl"?ar.reverse():ar}}();function He(e,t){var n=e.order;return n==null&&(n=e.order=Xe(e.text,t)),n}var Ye=[],Me=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var i=e._handlers||(e._handlers={});i[t]=(i[t]||Ye).concat(n)}};function it(e,t){return e._handlers&&e._handlers[t]||Ye}function qe(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var i=e._handlers,c=i&&i[t];if(c){var P=le(c,n);P>-1&&(i[t]=c.slice(0,P).concat(c.slice(P+1)))}}}function he(e,t){var n=it(e,t);if(!n.length)return;for(var i=Array.prototype.slice.call(arguments,2),c=0;c<n.length;++c)n[c].apply(null,i)}function ee(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),he(e,n||t.type,e,t),pe(t)||t.codemirrorIgnore}function re(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),i=0;i<t.length;++i)le(n,t[i])==-1&&n.push(t[i])}function ae(e,t){return it(e,t).length>0}function fe(e){e.prototype.on=function(t,n){Me(this,t,n)},e.prototype.off=function(t,n){qe(this,t,n)}}function ie(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function se(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function pe(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function me(e){ie(e),se(e)}function Ee(e){return e.target||e.srcElement}function Le(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 Pe=function(){if(z&&G<9)return!1;var e=d("div");return"draggable"in e||"dragDrop"in e}(),Ke;function et(e){if(Ke==null){var t=d("span","\u200B");T(e,d("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Ke=t.offsetWidth<=1&&t.offsetHeight>2&&!(z&&G<8))}var n=Ke?d("span","\u200B"):d("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var rt;function yt(e){if(rt!=null)return rt;var t=T(e,document.createTextNode("A\u062EA")),n=y(t,0,1).getBoundingClientRect(),i=y(t,1,2).getBoundingClientRect();return A(e),!n||n.left==n.right?!1:rt=i.right-n.right<3}var ot=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],i=e.length;t<=i;){var c=e.indexOf(`
|
|
`,t);c==-1&&(c=e.length);var P=e.slice(t,e.charAt(c-1)=="\r"?c-1:c),V=P.indexOf("\r");V!=-1?(n.push(P.slice(0,V)),t+=V+1):(n.push(P),t=c+1)}return n}:function(e){return e.split(/\r\n?|\n/)},at=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},Lt=function(){var e=d("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),_t=null;function Bt(e){if(_t!=null)return _t;var t=T(e,d("span","x")),n=t.getBoundingClientRect(),i=y(t,0,1).getBoundingClientRect();return _t=Math.abs(n.left-i.left)>1}var Ft={},Tt={};function sr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ft[e]=t}function Er(e,t){Tt[e]=t}function zt(e){if(typeof e=="string"&&Tt.hasOwnProperty(e))e=Tt[e];else if(e&&typeof e.name=="string"&&Tt.hasOwnProperty(e.name)){var t=Tt[e.name];typeof t=="string"&&(t={name:t}),e=K(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return zt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return zt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function cr(e,t){t=zt(t);var n=Ft[t.name];if(!n)return cr(e,"text/plain");var i=n(e,t);if(ct.hasOwnProperty(t.name)){var c=ct[t.name];for(var P in c){if(!c.hasOwnProperty(P))continue;i.hasOwnProperty(P)&&(i["_"+P]=i[P]),i[P]=c[P]}}if(i.name=t.name,t.helperType&&(i.helperType=t.helperType),t.modeProps)for(var V in t.modeProps)i[V]=t.modeProps[V];return i}var ct={};function vt(e,t){var n=ct.hasOwnProperty(e)?ct[e]:ct[e]={};g(t,n)}function Et(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var i in t){var c=t[i];c instanceof Array&&(c=c.concat([])),n[i]=c}return n}function Ht(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 or(e,t,n){return e.startState?e.startState(t,n):!0}var Mt=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};Mt.prototype.eol=function(){return this.pos>=this.string.length},Mt.prototype.sol=function(){return this.pos==this.lineStart},Mt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Mt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Mt.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},Mt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Mt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Mt.prototype.skipToEnd=function(){this.pos=this.string.length},Mt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Mt.prototype.backUp=function(e){this.pos-=e},Mt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=W(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?W(this.string,this.lineStart,this.tabSize):0)},Mt.prototype.indentation=function(){return W(this.string,null,this.tabSize)-(this.lineStart?W(this.string,this.lineStart,this.tabSize):0)},Mt.prototype.match=function(e,t,n){if(typeof e=="string"){var i=function(V){return n?V.toLowerCase():V},c=this.string.substr(this.pos,e.length);if(i(c)==i(e))return t!==!1&&(this.pos+=e.length),!0}else{var P=this.string.slice(this.pos).match(e);return P&&P.index>0?null:(P&&t!==!1&&(this.pos+=P[0].length),P)}},Mt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Mt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Mt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Mt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function Ze(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 i=0;;++i){var c=n.children[i],P=c.chunkSize();if(t<P){n=c;break}t-=P}return n.lines[t]}function Ct(e,t,n){var i=[],c=t.line;return e.iter(t.line,n.line+1,function(P){var V=P.text;c==n.line&&(V=V.slice(0,n.ch)),c==t.line&&(V=V.slice(t.ch)),i.push(V),++c}),i}function Rt(e,t,n){var i=[];return e.iter(t,n,function(c){i.push(c.text)}),i}function dt(e,t){var n=t-e.height;if(n)for(var i=e;i;i=i.parent)i.height+=n}function pt(e){if(e.parent==null)return null;for(var t=e.parent,n=le(t.lines,e),i=t.parent;i;t=i,i=i.parent)for(var c=0;!(i.children[c]==t);++c)n+=i.children[c].chunkSize();return n+t.first}function wt(e,t){var n=e.first;e:do{for(var i=0;i<e.children.length;++i){var c=e.children[i],P=c.height;if(t<P){e=c;continue e}t-=P,n+=c.chunkSize()}return n}while(!e.lines);for(var V=0;V<e.lines.length;++V){var Z=e.lines[V],te=Z.height;if(t<te)break;t-=te}return n+V}function rr(e,t){return t>=e.first&&t<e.first+e.size}function Ut(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function je(e,t,n){if(n===void 0&&(n=null),!(this instanceof je))return new je(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 ri(e,t){return e.sticky==t.sticky&&ft(e,t)==0}function bi(e){return je(e.line,e.ch)}function _i(e,t){return ft(e,t)<0?t:e}function ii(e,t){return ft(e,t)<0?e:t}function Ei(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function gt(e,t){if(t.line<e.first)return je(e.first,0);var n=e.first+e.size-1;return t.line>n?je(n,Ze(e,n).text.length):An(t,Ze(e,t.line).text.length)}function An(e,t){var n=e.ch;return n==null||n>t?je(e.line,t):n<0?je(e.line,0):e}function ze(e,t){for(var n=[],i=0;i<t.length;i++)n[i]=gt(e,t[i]);return n}var xi=function(e,t){this.state=e,this.lookAhead=t},Sr=function(e,t,n,i){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};Sr.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},Sr.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}},Sr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Sr.fromSaved=function(e,t,n){return t instanceof xi?new Sr(e,Et(e.mode,t.state),n,t.lookAhead):new Sr(e,Et(e.mode,t),n)},Sr.prototype.save=function(e){var t=e!==!1?Et(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new xi(t,this.maxLookAhead):t};function zi(e,t,n,i){var c=[e.state.modeGen],P={};Or(e,t.text,e.doc.mode,n,function(ne,ye){return c.push(ne,ye)},P,i);for(var V=n.state,Z=function(ne){n.baseTokens=c;var ye=e.state.overlays[ne],_e=1,ke=0;n.state=!0,Or(e,t.text,ye.mode,n,function(Ie,Fe){for(var Be=_e;ke<Ie;){var Ve=c[_e];Ve>Ie&&c.splice(_e,1,Ie,c[_e+1],Ve),_e+=2,ke=Math.min(Ie,Ve)}if(!Fe)return;if(ye.opaque)c.splice(Be,_e-Be,Ie,"overlay "+Fe),_e=Be+2;else for(;Be<_e;Be+=2){var $e=c[Be+1];c[Be+1]=($e?$e+" ":"")+"overlay "+Fe}},P),n.state=V,n.baseTokens=null,n.baseTokenPos=1},te=0;te<e.state.overlays.length;++te)Z(te);return{styles:c,classes:P.bgClass||P.textClass?P:null}}function ni(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var i=Ar(e,pt(t)),c=t.text.length>e.options.maxHighlightLength&&Et(e.doc.mode,i.state),P=zi(e,t,i);c&&(i.state=c),t.stateAfter=i.save(!c),t.styles=P.styles,P.classes?t.styleClasses=P.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 Ar(e,t,n){var i=e.doc,c=e.display;if(!i.mode.startState)return new Sr(i,!0,t);var P=On(e,t,n),V=P>i.first&&Ze(i,P-1).stateAfter,Z=V?Sr.fromSaved(i,V,P):new Sr(i,or(i.mode),P);return i.iter(P,t,function(te){Vi(e,te.text,Z);var ne=Z.line;te.stateAfter=ne==t-1||ne%5==0||ne>=c.viewFrom&&ne<c.viewTo?Z.save():null,Z.nextLine()}),n&&(i.modeFrontier=Z.line),Z}function Vi(e,t,n,i){var c=e.doc.mode,P=new Mt(t,e.options.tabSize,n);for(P.start=P.pos=i||0,t==""&&Yi(c,n.state);!P.eol();)Rr(c,P,n.state),P.start=P.pos}function Yi(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=Ht(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function Rr(e,t,n,i){for(var c=0;c<10;c++){i&&(i[0]=Ht(e,n).mode);var P=e.token(t,n);if(t.pos>t.start)return P}throw new Error("Mode "+e.name+" failed to advance stream.")}var Xi=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Rn(e,t,n,i){var c=e.doc,P=c.mode,V;t=gt(c,t);var Z=Ze(c,t.line),te=Ar(e,t.line,n),ne=new Mt(Z.text,e.options.tabSize,te),ye;for(i&&(ye=[]);(i||ne.pos<t.ch)&&!ne.eol();)ne.start=ne.pos,V=Rr(P,ne,te.state),i&&ye.push(new Xi(ne,V,Et(c.mode,te.state)));return i?ye:new Xi(ne,V,te.state)}function $i(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 i=n[1]?"bgClass":"textClass";t[i]==null?t[i]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[i])||(t[i]+=" "+n[2])}return e}function Or(e,t,n,i,c,P,V){var Z=n.flattenSpans;Z==null&&(Z=e.options.flattenSpans);var te=0,ne=null,ye=new Mt(t,e.options.tabSize,i),_e,ke=e.options.addModeClass&&[null];for(t==""&&$i(Yi(n,i.state),P);!ye.eol();){if(ye.pos>e.options.maxHighlightLength?(Z=!1,V&&Vi(e,t,i,ye.pos),ye.pos=t.length,_e=null):_e=$i(Rr(n,ye,i.state,ke),P),ke){var Ie=ke[0].name;Ie&&(_e="m-"+(_e?Ie+" "+_e:Ie))}if(!Z||ne!=_e){for(;te<ye.start;)te=Math.min(ye.start,te+5e3),c(te,ne);ne=_e}ye.start=ye.pos}for(;te<ye.pos;){var Fe=Math.min(ye.pos,te+5e3);c(Fe,ne),te=Fe}}function On(e,t,n){for(var i,c,P=e.doc,V=n?-1:t-(e.doc.mode.innerMode?1e3:100),Z=t;Z>V;--Z){if(Z<=P.first)return P.first;var te=Ze(P,Z-1),ne=te.stateAfter;if(ne&&(!n||Z+(ne instanceof xi?ne.lookAhead:0)<=P.modeFrontier))return Z;var ye=W(te.text,null,e.options.tabSize);(c==null||i>ye)&&(c=Z-1,i=ye)}return c}function aa(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var n=e.first,i=t-1;i>n;i--){var c=Ze(e,i).stateAfter;if(c&&(!(c instanceof xi)||i+c.lookAhead<t)){n=i+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Ji=!1,lr=!1;function Vr(){Ji=!0}function sa(){lr=!0}function ai(e,t,n){this.marker=e,this.from=t,this.to=n}function Lr(e,t){if(e)for(var n=0;n<e.length;++n){var i=e[n];if(i.marker==t)return i}}function Qi(e,t){for(var n,i=0;i<e.length;++i)e[i]!=t&&(n||(n=[])).push(e[i]);return n}function oa(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Ln(e,t,n){var i;if(e)for(var c=0;c<e.length;++c){var P=e[c],V=P.marker,Z=P.from==null||(V.inclusiveLeft?P.from<=t:P.from<t);if(Z||P.from==t&&V.type=="bookmark"&&(!n||!P.marker.insertLeft)){var te=P.to==null||(V.inclusiveRight?P.to>=t:P.to>t);(i||(i=[])).push(new ai(V,P.from,te?null:P.to))}}return i}function In(e,t,n){var i;if(e)for(var c=0;c<e.length;++c){var P=e[c],V=P.marker,Z=P.to==null||(V.inclusiveRight?P.to>=t:P.to>t);if(Z||P.from==t&&V.type=="bookmark"&&(!n||P.marker.insertLeft)){var te=P.from==null||(V.inclusiveLeft?P.from<=t:P.from<t);(i||(i=[])).push(new ai(V,te?null:P.from-t,P.to==null?null:P.to-t))}}return i}function Ti(e,t){if(t.full)return null;var n=rr(e,t.from.line)&&Ze(e,t.from.line).markedSpans,i=rr(e,t.to.line)&&Ze(e,t.to.line).markedSpans;if(!n&&!i)return null;var c=t.from.ch,P=t.to.ch,V=ft(t.from,t.to)==0,Z=Ln(n,c,V),te=In(i,P,V),ne=t.text.length==1,ye=_(t.text).length+(ne?c:0);if(Z)for(var _e=0;_e<Z.length;++_e){var ke=Z[_e];if(ke.to==null){var Ie=Lr(te,ke.marker);Ie?ne&&(ke.to=Ie.to==null?null:Ie.to+ye):ke.to=c}}if(te)for(var Fe=0;Fe<te.length;++Fe){var Be=te[Fe];if(Be.to!=null&&(Be.to+=ye),Be.from==null){var Ve=Lr(Z,Be.marker);Ve||(Be.from=ye,ne&&(Z||(Z=[])).push(Be))}else Be.from+=ye,ne&&(Z||(Z=[])).push(Be)}Z&&(Z=Dn(Z)),te&&te!=Z&&(te=Dn(te));var $e=[Z];if(!ne){var tt=t.text.length-2,Je;if(tt>0&&Z)for(var nt=0;nt<Z.length;++nt)Z[nt].to==null&&(Je||(Je=[])).push(new ai(Z[nt].marker,null,null));for(var ht=0;ht<tt;++ht)$e.push(Je);$e.push(te)}return $e}function Dn(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 i=null;if(e.iter(t.line,n.line+1,function(Ie){if(Ie.markedSpans)for(var Fe=0;Fe<Ie.markedSpans.length;++Fe){var Be=Ie.markedSpans[Fe].marker;Be.readOnly&&(!i||le(i,Be)==-1)&&(i||(i=[])).push(Be)}}),!i)return null;for(var c=[{from:t,to:n}],P=0;P<i.length;++P)for(var V=i[P],Z=V.find(0),te=0;te<c.length;++te){var ne=c[te];if(ft(ne.to,Z.from)<0||ft(ne.from,Z.to)>0)continue;var ye=[te,1],_e=ft(ne.from,Z.from),ke=ft(ne.to,Z.to);(_e<0||!V.inclusiveLeft&&!_e)&&ye.push({from:ne.from,to:Z.from}),(ke>0||!V.inclusiveRight&&!ke)&&ye.push({from:Z.to,to:ne.to}),c.splice.apply(c,ye),te+=ye.length-3}return c}function la(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 wi(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function si(e){return e.inclusiveLeft?-1:0}function oi(e){return e.inclusiveRight?1:0}function Si(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var i=e.find(),c=t.find(),P=ft(i.from,c.from)||si(e)-si(t);if(P)return-P;var V=ft(i.to,c.to)||oi(e)-oi(t);return V||t.id-e.id}function Ur(e,t){var n=lr&&e.markedSpans,i;if(n)for(var c=void 0,P=0;P<n.length;++P)c=n[P],c.marker.collapsed&&(t?c.from:c.to)==null&&(!i||Si(i,c.marker)<0)&&(i=c.marker);return i}function jr(e){return Ur(e,!0)}function Hr(e){return Ur(e,!1)}function Ci(e,t){var n=lr&&e.markedSpans,i;if(n)for(var c=0;c<n.length;++c){var P=n[c];P.marker.collapsed&&(P.from==null||P.from<t)&&(P.to==null||P.to>t)&&(!i||Si(i,P.marker)<0)&&(i=P.marker)}return i}function Mn(e,t,n,i,c){var P=Ze(e,t),V=lr&&P.markedSpans;if(V)for(var Z=0;Z<V.length;++Z){var te=V[Z];if(!te.marker.collapsed)continue;var ne=te.marker.find(0),ye=ft(ne.from,n)||si(te.marker)-si(c),_e=ft(ne.to,i)||oi(te.marker)-oi(c);if(ye>=0&&_e<=0||ye<=0&&_e>=0)continue;if(ye<=0&&(te.marker.inclusiveRight&&c.inclusiveLeft?ft(ne.to,n)>=0:ft(ne.to,n)>0)||ye>=0&&(te.marker.inclusiveRight&&c.inclusiveLeft?ft(ne.from,i)<=0:ft(ne.from,i)<0))return!0}}function xr(e){for(var t;t=jr(e);)e=t.find(-1,!0).line;return e}function Pn(e){for(var t;t=Hr(e);)e=t.find(1,!0).line;return e}function Ai(e){for(var t,n;t=Hr(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Zi(e,t){var n=Ze(e,t),i=xr(n);return n==i?t:pt(i)}function Yr(e,t){if(t>e.lastLine())return t;var n=Ze(e,t),i;if(!Pr(e,n))return t;for(;i=Hr(n);)n=i.find(1,!0).line;return pt(n)+1}function Pr(e,t){var n=lr&&t.markedSpans;if(n)for(var i=void 0,c=0;c<n.length;++c){if(i=n[c],!i.marker.collapsed)continue;if(i.from==null)return!0;if(i.marker.widgetNode)continue;if(i.from==0&&i.marker.inclusiveLeft&&qi(e,t,i))return!0}}function qi(e,t,n){if(n.to==null){var i=n.marker.find(1,!0);return qi(e,i.line,Lr(i.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var c=void 0,P=0;P<t.markedSpans.length;++P)if(c=t.markedSpans[P],c.marker.collapsed&&!c.marker.widgetNode&&c.from==n.to&&(c.to==null||c.to!=n.from)&&(c.marker.inclusiveLeft||n.marker.inclusiveRight)&&qi(e,t,c))return!0}function Ir(e){e=xr(e);for(var t=0,n=e.parent,i=0;i<n.lines.length;++i){var c=n.lines[i];if(c==e)break;t+=c.height}for(var P=n.parent;P;n=P,P=n.parent)for(var V=0;V<P.children.length;++V){var Z=P.children[V];if(Z==n)break;t+=Z.height}return t}function en(e){if(e.height==0)return 0;for(var t=e.text.length,n,i=e;n=jr(i);){var c=n.find(0,!0);i=c.from.line,t+=c.from.ch-c.to.ch}for(i=e;n=Hr(i);){var P=n.find(0,!0);t-=i.text.length-P.from.ch,i=P.to.line,t+=i.text.length-P.to.ch}return t}function Nn(e){var t=e.display,n=e.doc;t.maxLine=Ze(n,n.first),t.maxLineLength=en(t.maxLine),t.maxLineChanged=!0,n.iter(function(i){var c=en(i);c>t.maxLineLength&&(t.maxLineLength=c,t.maxLine=i)})}var li=function(e,t,n){this.text=e,wi(this,t),this.height=n?n(this):1};li.prototype.lineNo=function(){return pt(this)},fe(li);function ua(e,t,n,i){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),la(e),wi(e,n);var c=i?i(e):1;c!=e.height&&dt(e,c)}function st(e){e.parent=null,la(e)}var mt={},ut={};function xt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?ut:mt;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Ot(e,t){var n=w("span",null,null,r?"padding-right: .1px":null),i={pre:w("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var c=0;c<=(t.rest?t.rest.length:0);c++){var P=c?t.rest[c-1]:t.line,V=void 0;i.pos=0,i.addToken=At,yt(e.display.measure)&&(V=He(P,e.doc.direction))&&(i.addToken=dr(i.addToken,V)),i.map=[];var Z=t!=e.display.externalMeasured&&pt(P);Wr(P,i,ni(e,P,Z)),P.styleClasses&&(P.styleClasses.bgClass&&(i.bgClass=E(P.styleClasses.bgClass,i.bgClass||"")),P.styleClasses.textClass&&(i.textClass=E(P.styleClasses.textClass,i.textClass||""))),i.map.length==0&&i.map.push(0,0,i.content.appendChild(et(e.display.measure))),c==0?(t.measure.map=i.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(i.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(r){var te=i.content.lastChild;(/\bcm-tab\b/.test(te.className)||te.querySelector&&te.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")}return he(e,"renderLine",e,t.line,i.pre),i.pre.className&&(i.textClass=E(i.pre.className,i.textClass||"")),i}function Pt(e){var t=d("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function At(e,t,n,i,c,P,V){if(!t)return;var Z=e.splitSpaces?Xt(t,e.trailingSpace):t,te=e.cm.state.specialChars,ne=!1,ye;if(!te.test(t))e.col+=t.length,ye=document.createTextNode(Z),e.map.push(e.pos,e.pos+t.length,ye),z&&G<9&&(ne=!0),e.pos+=t.length;else{ye=document.createDocumentFragment();for(var _e=0;;){te.lastIndex=_e;var ke=te.exec(t),Ie=ke?ke.index-_e:t.length-_e;if(Ie){var Fe=document.createTextNode(Z.slice(_e,_e+Ie));z&&G<9?ye.appendChild(d("span",[Fe])):ye.appendChild(Fe),e.map.push(e.pos,e.pos+Ie,Fe),e.col+=Ie,e.pos+=Ie}if(!ke)break;_e+=Ie+1;var Be=void 0;if(ke[0]==" "){var Ve=e.cm.options.tabSize,$e=Ve-e.col%Ve;Be=ye.appendChild(d("span",X($e),"cm-tab")),Be.setAttribute("role","presentation"),Be.setAttribute("cm-text"," "),e.col+=$e}else ke[0]=="\r"||ke[0]==`
|
|
`?(Be=ye.appendChild(d("span",ke[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Be.setAttribute("cm-text",ke[0]),e.col+=1):(Be=e.cm.options.specialCharPlaceholder(ke[0]),Be.setAttribute("cm-text",ke[0]),z&&G<9?ye.appendChild(d("span",[Be])):ye.appendChild(Be),e.col+=1);e.map.push(e.pos,e.pos+1,Be),e.pos++}}if(e.trailingSpace=Z.charCodeAt(t.length-1)==32,n||i||c||ne||P||V){var tt=n||"";i&&(tt+=i),c&&(tt+=c);var Je=d("span",[ye],tt,P);if(V)for(var nt in V)V.hasOwnProperty(nt)&&nt!="style"&&nt!="class"&&Je.setAttribute(nt,V[nt]);return e.content.appendChild(Je)}e.content.appendChild(ye)}function Xt(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,i="",c=0;c<e.length;c++){var P=e.charAt(c);P==" "&&n&&(c==e.length-1||e.charCodeAt(c+1)==32)&&(P="\xA0"),i+=P,n=P==" "}return i}function dr(e,t){return function(n,i,c,P,V,Z,te){c=c?c+" cm-force-border":"cm-force-border";for(var ne=n.pos,ye=ne+i.length;;){for(var _e=void 0,ke=0;ke<t.length&&!(_e=t[ke],_e.to>ne&&_e.from<=ne);ke++);if(_e.to>=ye)return e(n,i,c,P,V,Z,te);e(n,i.slice(0,_e.to-ne),c,P,null,Z,te),P=null,i=i.slice(_e.to-ne),ne=_e.to}}}function St(e,t,n,i){var c=!i&&n.widgetNode;c&&e.map.push(e.pos,e.pos+t,c),!i&&e.cm.display.input.needsContentAttribute&&(c||(c=e.content.appendChild(document.createElement("span"))),c.setAttribute("cm-marker",n.id)),c&&(e.cm.display.input.setUneditable(c),e.content.appendChild(c)),e.pos+=t,e.trailingSpace=!1}function Wr(e,t,n){var i=e.markedSpans,c=e.text,P=0;if(!i){for(var V=1;V<n.length;V+=2)t.addToken(t,c.slice(P,P=n[V]),xt(n[V+1],t.cm.options));return}for(var Z=c.length,te=0,ne=1,ye="",_e,ke,Ie=0,Fe,Be,Ve,$e,tt;;){if(Ie==te){Fe=Be=Ve=ke="",tt=null,$e=null,Ie=Infinity;for(var Je=[],nt=void 0,ht=0;ht<i.length;++ht){var lt=i[ht],bt=lt.marker;if(bt.type=="bookmark"&<.from==te&&bt.widgetNode)Je.push(bt);else if(lt.from<=te&&(lt.to==null||lt.to>te||bt.collapsed&<.to==te&<.from==te)){if(lt.to!=null&<.to!=te&&Ie>lt.to&&(Ie=lt.to,Be=""),bt.className&&(Fe+=" "+bt.className),bt.css&&(ke=(ke?ke+";":"")+bt.css),bt.startStyle&<.from==te&&(Ve+=" "+bt.startStyle),bt.endStyle&<.to==Ie&&(nt||(nt=[])).push(bt.endStyle,lt.to),bt.title&&((tt||(tt={})).title=bt.title),bt.attributes)for(var Nt in bt.attributes)(tt||(tt={}))[Nt]=bt.attributes[Nt];bt.collapsed&&(!$e||Si($e.marker,bt)<0)&&($e=lt)}else lt.from>te&&Ie>lt.from&&(Ie=lt.from)}if(nt)for(var Zt=0;Zt<nt.length;Zt+=2)nt[Zt+1]==Ie&&(Be+=" "+nt[Zt]);if(!$e||$e.from==te)for(var Wt=0;Wt<Je.length;++Wt)St(t,0,Je[Wt]);if($e&&($e.from||0)==te){if(St(t,($e.to==null?Z+1:$e.to)-te,$e.marker,$e.from==null),$e.to==null)return;$e.to==te&&($e=!1)}}if(te>=Z)break;for(var _r=Math.min(Z,Ie);;){if(ye){var gr=te+ye.length;if(!$e){var Vt=gr>_r?ye.slice(0,_r-te):ye;t.addToken(t,Vt,_e?_e+Fe:Fe,Ve,te+Vt.length==Ie?Be:"",ke,tt)}if(gr>=_r){ye=ye.slice(_r-te),te=_r;break}te=gr,Ve=""}ye=c.slice(P,P=n[ne++]),_e=xt(n[ne++],t.cm.options)}}}function It(e,t,n){this.line=t,this.rest=Ai(t),this.size=this.rest?pt(_(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Pr(e,t)}function fr(e,t,n){for(var i=[],c,P=t;P<n;P=c){var V=new It(e.doc,Ze(e.doc,P),P);c=P+V.size,i.push(V)}return i}var ir=null;function Cr(e){ir?ir.ops.push(e):e.ownsGroup=ir={ops:[e],delayedCallbacks:[]}}function Lo(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var i=0;i<e.ops.length;i++){var c=e.ops[i];if(c.cursorActivityHandlers)for(;c.cursorActivityCalled<c.cursorActivityHandlers.length;)c.cursorActivityHandlers[c.cursorActivityCalled++].call(null,c.cm)}}while(n<t.length)}function Io(e,t){var n=e.ownsGroup;if(!n)return;try{Lo(n)}finally{ir=null,t(n)}}var tn=null;function er(e,t){var n=it(e,t);if(!n.length)return;var i=Array.prototype.slice.call(arguments,2),c;ir?c=ir.delayedCallbacks:tn?c=tn:(c=tn=[],setTimeout(Do,0));for(var P=function(Z){c.push(function(){return n[Z].apply(null,i)})},V=0;V<n.length;++V)P(V)}function Do(){var e=tn;tn=null;for(var t=0;t<e.length;++t)e[t]()}function Xa(e,t,n,i){for(var c=0;c<t.changes.length;c++){var P=t.changes[c];P=="text"?Mo(e,t):P=="gutter"?Ja(e,t,n,i):P=="class"?ha(e,t):P=="widget"&&Po(e,t,i)}t.changes=null}function rn(e){return e.node==e.text&&(e.node=d("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),z&&G<8&&(e.node.style.zIndex=2)),e.node}function ko(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 i=rn(t);t.background=i.insertBefore(d("div",null,n),i.firstChild),e.display.input.setUneditable(t.background)}}function $a(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Ot(e,t)}function Mo(e,t){var n=t.text.className,i=$a(e,t);t.text==t.node&&(t.node=i.pre),t.text.parentNode.replaceChild(i.pre,t.text),t.text=i.pre,i.bgClass!=t.bgClass||i.textClass!=t.textClass?(t.bgClass=i.bgClass,t.textClass=i.textClass,ha(e,t)):n&&(t.text.className=n)}function ha(e,t){ko(e,t),t.line.wrapClass?rn(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 Ja(e,t,n,i){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 c=rn(t);t.gutterBackground=d("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px; width: "+i.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),c.insertBefore(t.gutterBackground,t.text)}var P=t.line.gutterMarkers;if(e.options.lineNumbers||P){var V=rn(t),Z=t.gutter=d("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px");if(e.display.input.setUneditable(Z),V.insertBefore(Z,t.text),t.line.gutterClass&&(Z.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!P||!P["CodeMirror-linenumbers"])&&(t.lineNumber=Z.appendChild(d("div",Ut(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+i.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),P)for(var te=0;te<e.display.gutterSpecs.length;++te){var ne=e.display.gutterSpecs[te].className,ye=P.hasOwnProperty(ne)&&P[ne];ye&&Z.appendChild(d("div",[ye],"CodeMirror-gutter-elt","left: "+i.gutterLeft[ne]+"px; width: "+i.gutterWidth[ne]+"px"))}}}function Po(e,t,n){t.alignable&&(t.alignable=null);for(var i=L("CodeMirror-linewidget"),c=t.node.firstChild,P=void 0;c;c=P)P=c.nextSibling,i.test(c.className)&&t.node.removeChild(c);Qa(e,t,n)}function No(e,t,n,i){var c=$a(e,t);return t.text=t.node=c.pre,c.bgClass&&(t.bgClass=c.bgClass),c.textClass&&(t.textClass=c.textClass),ha(e,t),Ja(e,t,n,i),Qa(e,t,i),t.node}function Qa(e,t,n){if(Za(e,t.line,t,n,!0),t.rest)for(var i=0;i<t.rest.length;i++)Za(e,t.rest[i],t,n,!1)}function Za(e,t,n,i,c){if(!t.widgets)return;for(var P=rn(n),V=0,Z=t.widgets;V<Z.length;++V){var te=Z[V],ne=d("div",[te.node],"CodeMirror-linewidget"+(te.className?" "+te.className:""));te.handleMouseEvents||ne.setAttribute("cm-ignore-events","true"),Fo(te,ne,n,i),e.display.input.setUneditable(ne),c&&te.above?P.insertBefore(ne,n.gutter||n.text):P.appendChild(ne),er(te,"redraw")}}function Fo(e,t,n,i){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var c=i.wrapperWidth;t.style.left=i.fixedPos+"px",e.coverGutter||(c-=i.gutterTotalWidth,t.style.paddingLeft=i.gutterTotalWidth+"px"),t.style.width=c+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-i.gutterTotalWidth+"px"))}function nn(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!b(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;"),T(t.display.measure,d("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Gr(e,t){for(var n=Ee(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 Fn(e){return e.lineSpace.offsetTop}function ca(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=T(e.measure,d("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,i={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(i.left)&&!isNaN(i.right)&&(e.cachedPaddingH=i),i}function Nr(e){return de-e.display.nativeBarWidth}function ui(e){return e.display.scroller.clientWidth-Nr(e)-e.display.barWidth}function da(e){return e.display.scroller.clientHeight-Nr(e)-e.display.barHeight}function Bo(e,t,n){var i=e.options.lineWrapping,c=i&&ui(e);if(!t.measure.heights||i&&t.measure.width!=c){var P=t.measure.heights=[];if(i){t.measure.width=c;for(var V=t.text.firstChild.getClientRects(),Z=0;Z<V.length-1;Z++){var te=V[Z],ne=V[Z+1];Math.abs(te.bottom-ne.bottom)>2&&P.push((te.bottom+ne.top)/2-n.top)}}P.push(n.bottom-n.top)}}function es(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var i=0;i<e.rest.length;i++)if(e.rest[i]==t)return{map:e.measure.maps[i],cache:e.measure.caches[i]};for(var c=0;c<e.rest.length;c++)if(pt(e.rest[c])>n)return{map:e.measure.maps[c],cache:e.measure.caches[c],before:!0}}function Uo(e,t){t=xr(t);var n=pt(t),i=e.display.externalMeasured=new It(e.doc,t,n);i.lineN=n;var c=i.built=Ot(e,i);return i.text=c.pre,T(e.display.lineMeasure,c.pre),i}function ts(e,t,n,i){return Fr(e,Ri(e,t),n,i)}function fa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[di(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Ri(e,t){var n=pt(t),i=fa(e,n);i&&!i.text?i=null:i&&i.changes&&(Xa(e,i,n,ba(e)),e.curOp.forceUpdate=!0),i||(i=Uo(e,t));var c=es(i,t,n);return{line:t,view:i,rect:null,map:c.map,cache:c.cache,before:c.before,hasHeights:!1}}function Fr(e,t,n,i,c){t.before&&(n=-1);var P=n+(i||""),V;return t.cache.hasOwnProperty(P)?V=t.cache[P]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Bo(e,t.view,t.rect),t.hasHeights=!0),V=Ho(e,t,n,i),V.bogus||(t.cache[P]=V)),{left:V.left,right:V.right,top:c?V.rtop:V.top,bottom:c?V.rbottom:V.bottom}}var rs={left:0,right:0,top:0,bottom:0};function is(e,t,n){for(var i,c,P,V,Z,te,ne=0;ne<e.length;ne+=3)if(Z=e[ne],te=e[ne+1],t<Z?(c=0,P=1,V="left"):t<te?(c=t-Z,P=c+1):(ne==e.length-3||t==te&&e[ne+3]>t)&&(P=te-Z,c=P-1,t>=te&&(V="right")),c!=null){if(i=e[ne+2],Z==te&&n==(i.insertLeft?"left":"right")&&(V=n),n=="left"&&c==0)for(;ne&&e[ne-2]==e[ne-3]&&e[ne-1].insertLeft;)i=e[(ne-=3)+2],V="left";if(n=="right"&&c==te-Z)for(;ne<e.length-3&&e[ne+3]==e[ne+4]&&!e[ne+5].insertLeft;)i=e[(ne+=3)+2],V="right";break}return{node:i,start:c,end:P,collapse:V,coverStart:Z,coverEnd:te}}function jo(e,t){var n=rs;if(t=="left")for(var i=0;i<e.length&&!((n=e[i]).left!=n.right);i++);else for(var c=e.length-1;c>=0&&!((n=e[c]).left!=n.right);c--);return n}function Ho(e,t,n,i){var c=is(t.map,n,i),P=c.node,V=c.start,Z=c.end,te=c.collapse,ne;if(P.nodeType==3){for(var ye=0;ye<4;ye++){for(;V&&we(t.line.text.charAt(c.coverStart+V));)--V;for(;c.coverStart+Z<c.coverEnd&&we(t.line.text.charAt(c.coverStart+Z));)++Z;if(z&&G<9&&V==0&&Z==c.coverEnd-c.coverStart?ne=P.parentNode.getBoundingClientRect():ne=jo(y(P,V,Z).getClientRects(),i),ne.left||ne.right||V==0)break;Z=V,V=V-1,te="right"}z&&G<11&&(ne=Wo(e.display.measure,ne))}else{V>0&&(te=i="right");var _e;e.options.lineWrapping&&(_e=P.getClientRects()).length>1?ne=_e[i=="right"?_e.length-1:0]:ne=P.getBoundingClientRect()}if(z&&G<9&&!V&&(!ne||!ne.left&&!ne.right)){var ke=P.parentNode.getClientRects()[0];ke?ne={left:ke.left,right:ke.left+Li(e.display),top:ke.top,bottom:ke.bottom}:ne=rs}for(var Ie=ne.top-t.rect.top,Fe=ne.bottom-t.rect.top,Be=(Ie+Fe)/2,Ve=t.view.measure.heights,$e=0;$e<Ve.length-1&&!(Be<Ve[$e]);$e++);var tt=$e?Ve[$e-1]:0,Je=Ve[$e],nt={left:(te=="right"?ne.right:ne.left)-t.rect.left,right:(te=="left"?ne.left:ne.right)-t.rect.left,top:tt,bottom:Je};return!ne.left&&!ne.right&&(nt.bogus=!0),e.options.singleCursorHeightPerLine||(nt.rtop=Ie,nt.rbottom=Fe),nt}function Wo(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Bt(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,i=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*i,bottom:t.bottom*i}}function ns(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 as(e){e.display.externalMeasure=null,A(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)ns(e.display.view[t])}function an(e){as(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function ss(){return v&&o?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function os(){return v&&o?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pa(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=nn(e.widgets[n]));return t}function Bn(e,t,n,i,c){if(!c){var P=pa(t);n.top+=P,n.bottom+=P}if(i=="line")return n;i||(i="local");var V=Ir(t);if(i=="local"?V+=Fn(e.display):V-=e.display.viewOffset,i=="page"||i=="window"){var Z=e.display.lineSpace.getBoundingClientRect();V+=Z.top+(i=="window"?0:os());var te=Z.left+(i=="window"?0:ss());n.left+=te,n.right+=te}return n.top+=V,n.bottom+=V,n}function ls(e,t,n){if(n=="div")return t;var i=t.left,c=t.top;if(n=="page")i-=ss(),c-=os();else if(n=="local"||!n){var P=e.display.sizer.getBoundingClientRect();i+=P.left,c+=P.top}var V=e.display.lineSpace.getBoundingClientRect();return{left:i-V.left,top:c-V.top}}function ma(e,t,n,i,c){return i||(i=Ze(e.doc,t.line)),Bn(e,i,ts(e,i,t.ch,c),n)}function Dr(e,t,n,i,c,P){i=i||Ze(e.doc,t.line),c||(c=Ri(e,i));function V(Fe,Be){var Ve=Fr(e,c,Fe,Be?"right":"left",P);return Be?Ve.left=Ve.right:Ve.right=Ve.left,Bn(e,i,Ve,n)}var Z=He(i,e.doc.direction),te=t.ch,ne=t.sticky;if(te>=i.text.length?(te=i.text.length,ne="before"):te<=0&&(te=0,ne="after"),!Z)return V(ne=="before"?te-1:te,ne=="before");function ye(Fe,Be,Ve){var $e=Z[Be],tt=$e.level==1;return V(Ve?Fe-1:Fe,tt!=Ve)}var _e=We(Z,te,ne),ke=Ge,Ie=ye(te,_e,ne=="before");return ke!=null&&(Ie.other=ye(te,ke,ne!="before")),Ie}function us(e,t){var n=0;t=gt(e.doc,t),e.options.lineWrapping||(n=Li(e.display)*t.ch);var i=Ze(e.doc,t.line),c=Ir(i)+Fn(e.display);return{left:n,right:n,top:c,bottom:c+i.height}}function ga(e,t,n,i,c){var P=je(e,t,n);return P.xRel=c,i&&(P.outside=i),P}function va(e,t,n){var i=e.doc;if(n+=e.display.viewOffset,n<0)return ga(i.first,0,null,-1,-1);var c=wt(i,n),P=i.first+i.size-1;if(c>P)return ga(i.first+i.size-1,Ze(i,P).text.length,null,1,1);t<0&&(t=0);for(var V=Ze(i,c);;){var Z=Go(e,V,c,t,n),te=Ci(V,Z.ch+(Z.xRel>0||Z.outside>0?1:0));if(!te)return Z;var ne=te.find(1);if(ne.line==c)return ne;V=Ze(i,c=ne.line)}}function hs(e,t,n,i){i-=pa(t);var c=t.text.length,P=Ne(function(V){return Fr(e,n,V-1).bottom<=i},c,0);return c=Ne(function(V){return Fr(e,n,V).top>i},P,c),{begin:P,end:c}}function cs(e,t,n,i){n||(n=Ri(e,t));var c=Bn(e,t,Fr(e,n,i),"line").top;return hs(e,t,n,c)}function ya(e,t,n,i){return e.bottom<=n?!1:e.top>n?!0:(i?e.left:e.right)>t}function Go(e,t,n,i,c){c-=Ir(t);var P=Ri(e,t),V=pa(t),Z=0,te=t.text.length,ne=!0,ye=He(t,e.doc.direction);if(ye){var _e=(e.options.lineWrapping?zo:Ko)(e,t,n,P,ye,i,c);ne=_e.level!=1,Z=ne?_e.from:_e.to-1,te=ne?_e.to:_e.from-1}var ke=null,Ie=null,Fe=Ne(function(ht){var lt=Fr(e,P,ht);return lt.top+=V,lt.bottom+=V,ya(lt,i,c,!1)?(lt.top<=c&<.left<=i&&(ke=ht,Ie=lt),!0):!1},Z,te),Be,Ve,$e=!1;if(Ie){var tt=i-Ie.left<Ie.right-i,Je=tt==ne;Fe=ke+(Je?0:1),Ve=Je?"after":"before",Be=tt?Ie.left:Ie.right}else{!ne&&(Fe==te||Fe==Z)&&Fe++,Ve=Fe==0?"after":Fe==t.text.length?"before":Fr(e,P,Fe-(ne?1:0)).bottom+V<=c==ne?"after":"before";var nt=Dr(e,je(n,Fe,Ve),"line",t,P);Be=nt.left,$e=c<nt.top?-1:c>=nt.bottom?1:0}return Fe=Oe(t.text,Fe,1),ga(n,Fe,Ve,$e,i-Be)}function Ko(e,t,n,i,c,P,V){var Z=Ne(function(_e){var ke=c[_e],Ie=ke.level!=1;return ya(Dr(e,je(n,Ie?ke.to:ke.from,Ie?"before":"after"),"line",t,i),P,V,!0)},0,c.length-1),te=c[Z];if(Z>0){var ne=te.level!=1,ye=Dr(e,je(n,ne?te.from:te.to,ne?"after":"before"),"line",t,i);ya(ye,P,V,!0)&&ye.top>V&&(te=c[Z-1])}return te}function zo(e,t,n,i,c,P,V){var Z=hs(e,t,i,V),te=Z.begin,ne=Z.end;/\s/.test(t.text.charAt(ne-1))&&ne--;for(var ye=null,_e=null,ke=0;ke<c.length;ke++){var Ie=c[ke];if(Ie.from>=ne||Ie.to<=te)continue;var Fe=Ie.level!=1,Be=Fr(e,i,Fe?Math.min(ne,Ie.to)-1:Math.max(te,Ie.from)).right,Ve=Be<P?P-Be+1e9:Be-P;(!ye||_e>Ve)&&(ye=Ie,_e=Ve)}return ye||(ye=c[c.length-1]),ye.from<te&&(ye={from:te,to:ye.to,level:ye.level}),ye.to>ne&&(ye={from:ye.from,to:ne,level:ye.level}),ye}var hi;function Oi(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(hi==null){hi=d("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)hi.appendChild(document.createTextNode("x")),hi.appendChild(d("br"));hi.appendChild(document.createTextNode("x"))}T(e.measure,hi);var n=hi.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),A(e.measure),n||1}function Li(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=d("span","xxxxxxxxxx"),n=d("pre",[t],"CodeMirror-line-like");T(e.measure,n);var i=t.getBoundingClientRect(),c=(i.right-i.left)/10;return c>2&&(e.cachedCharWidth=c),c||10}function ba(e){for(var t=e.display,n={},i={},c=t.gutters.clientLeft,P=t.gutters.firstChild,V=0;P;P=P.nextSibling,++V){var Z=e.display.gutterSpecs[V].className;n[Z]=P.offsetLeft+P.clientLeft+c,i[Z]=P.clientWidth}return{fixedPos:_a(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function _a(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ds(e){var t=Oi(e.display),n=e.options.lineWrapping,i=n&&Math.max(5,e.display.scroller.clientWidth/Li(e.display)-3);return function(c){if(Pr(e.doc,c))return 0;var P=0;if(c.widgets)for(var V=0;V<c.widgets.length;V++)c.widgets[V].height&&(P+=c.widgets[V].height);return n?P+(Math.ceil(c.text.length/i)||1)*t:P+t}}function Ea(e){var t=e.doc,n=ds(e);t.iter(function(i){var c=n(i);c!=i.height&&dt(i,c)})}function ci(e,t,n,i){var c=e.display;if(!n&&Ee(t).getAttribute("cm-not-content")=="true")return null;var P,V,Z=c.lineSpace.getBoundingClientRect();try{P=t.clientX-Z.left,V=t.clientY-Z.top}catch(_e){return null}var te=va(e,P,V),ne;if(i&&te.xRel>0&&(ne=Ze(e.doc,te.line).text).length==te.ch){var ye=W(ne,ne.length,e.options.tabSize)-ne.length;te=je(te.line,Math.max(0,Math.round((P-qa(e.display).left)/Li(e.display))-ye))}return te}function di(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,i=0;i<n.length;i++)if(t-=n[i].size,t<0)return i}function pr(e,t,n,i){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),i||(i=0);var c=e.display;if(i&&n<c.viewTo&&(c.updateLineNumbers==null||c.updateLineNumbers>t)&&(c.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=c.viewTo)lr&&Zi(e.doc,t)<c.viewTo&&$r(e);else if(n<=c.viewFrom)lr&&Yr(e.doc,n+i)>c.viewFrom?$r(e):(c.viewFrom+=i,c.viewTo+=i);else if(t<=c.viewFrom&&n>=c.viewTo)$r(e);else if(t<=c.viewFrom){var P=Un(e,n,n+i,1);P?(c.view=c.view.slice(P.index),c.viewFrom=P.lineN,c.viewTo+=i):$r(e)}else if(n>=c.viewTo){var V=Un(e,t,t,-1);V?(c.view=c.view.slice(0,V.index),c.viewTo=V.lineN):$r(e)}else{var Z=Un(e,t,t,-1),te=Un(e,n,n+i,1);Z&&te?(c.view=c.view.slice(0,Z.index).concat(fr(e,Z.lineN,te.lineN)).concat(c.view.slice(te.index)),c.viewTo+=i):$r(e)}var ne=c.externalMeasured;ne&&(n<ne.lineN?ne.lineN+=i:t<ne.lineN+ne.size&&(c.externalMeasured=null))}function Xr(e,t,n){e.curOp.viewChanged=!0;var i=e.display,c=e.display.externalMeasured;if(c&&t>=c.lineN&&t<c.lineN+c.size&&(i.externalMeasured=null),t<i.viewFrom||t>=i.viewTo)return;var P=i.view[di(e,t)];if(P.node==null)return;var V=P.changes||(P.changes=[]);le(V,n)==-1&&V.push(n)}function $r(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Un(e,t,n,i){var c=di(e,t),P,V=e.display.view;if(!lr||n==e.doc.first+e.doc.size)return{index:c,lineN:n};for(var Z=e.display.viewFrom,te=0;te<c;te++)Z+=V[te].size;if(Z!=t){if(i>0){if(c==V.length-1)return null;P=Z+V[c].size-t,c++}else P=Z-t;t+=P,n+=P}for(;Zi(e.doc,n)!=n;){if(c==(i<0?0:V.length-1))return null;n+=i*V[c-(i<0?1:0)].size,c+=i}return{index:c,lineN:n}}function Vo(e,t,n){var i=e.display,c=i.view;c.length==0||t>=i.viewTo||n<=i.viewFrom?(i.view=fr(e,t,n),i.viewFrom=t):(i.viewFrom>t?i.view=fr(e,t,i.viewFrom).concat(i.view):i.viewFrom<t&&(i.view=i.view.slice(di(e,t))),i.viewFrom=t,i.viewTo<n?i.view=i.view.concat(fr(e,i.viewTo,n)):i.viewTo>n&&(i.view=i.view.slice(0,di(e,n)))),i.viewTo=n}function fs(e){for(var t=e.display.view,n=0,i=0;i<t.length;i++){var c=t[i];!c.hidden&&(!c.node||c.changes)&&++n}return n}function sn(e){e.display.input.showSelection(e.display.input.prepareSelection())}function ps(e,t){t===void 0&&(t=!0);for(var n=e.doc,i={},c=i.cursors=document.createDocumentFragment(),P=i.selection=document.createDocumentFragment(),V=0;V<n.sel.ranges.length;V++){if(!t&&V==n.sel.primIndex)continue;var Z=n.sel.ranges[V];if(Z.from().line>=e.display.viewTo||Z.to().line<e.display.viewFrom)continue;var te=Z.empty();(te||e.options.showCursorWhenSelecting)&&ms(e,Z.head,c),te||Yo(e,Z,P)}return i}function ms(e,t,n){var i=Dr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),c=n.appendChild(d("div","\xA0","CodeMirror-cursor"));if(c.style.left=i.left+"px",c.style.top=i.top+"px",c.style.height=Math.max(0,i.bottom-i.top)*e.options.cursorHeight+"px",i.other){var P=n.appendChild(d("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));P.style.display="",P.style.left=i.other.left+"px",P.style.top=i.other.top+"px",P.style.height=(i.other.bottom-i.other.top)*.85+"px"}}function jn(e,t){return e.top-t.top||e.left-t.left}function Yo(e,t,n){var i=e.display,c=e.doc,P=document.createDocumentFragment(),V=qa(e.display),Z=V.left,te=Math.max(i.sizerWidth,ui(e)-i.sizer.offsetLeft)-V.right,ne=c.direction=="ltr";function ye(Je,nt,ht,lt){nt<0&&(nt=0),nt=Math.round(nt),lt=Math.round(lt),P.appendChild(d("div",null,"CodeMirror-selected","position: absolute; left: "+Je+`px;
|
|
top: `+nt+"px; width: "+(ht==null?te-Je:ht)+`px;
|
|
height: `+(lt-nt)+"px"))}function _e(Je,nt,ht){var lt=Ze(c,Je),bt=lt.text.length,Nt,Zt;function Wt(Vt,vr){return ma(e,je(Je,Vt),"div",lt,vr)}function _r(Vt,vr,tr){var $t=cs(e,lt,null,Vt),Yt=vr=="ltr"==(tr=="after")?"left":"right",Gt=tr=="after"?$t.begin:$t.end-(/\s/.test(lt.text.charAt($t.end-1))?2:1);return Wt(Gt,Yt)[Yt]}var gr=He(lt,c.direction);return Ue(gr,nt||0,ht==null?bt:ht,function(Vt,vr,tr,$t){var Yt=tr=="ltr",Gt=Wt(Vt,Yt?"left":"right"),yr=Wt(vr-1,Yt?"right":"left"),Gi=nt==null&&Vt==0,ti=ht==null&&vr==bt,ar=$t==0,Br=!gr||$t==gr.length-1;if(yr.top-Gt.top<=3){var qt=(ne?Gi:ti)&&ar,Va=(ne?ti:Gi)&&Br,zr=qt?Z:(Yt?Gt:yr).left,vi=Va?te:(Yt?yr:Gt).right;ye(zr,Gt.top,vi-zr,Gt.bottom)}else{var yi,hr,Ki,Ya;Yt?(yi=ne&&Gi&&ar?Z:Gt.left,hr=ne?te:_r(Vt,tr,"before"),Ki=ne?Z:_r(vr,tr,"after"),Ya=ne&&ti&&Br?te:yr.right):(yi=ne?_r(Vt,tr,"before"):Z,hr=!ne&&Gi&&ar?te:Gt.right,Ki=!ne&&ti&&Br?Z:yr.left,Ya=ne?_r(vr,tr,"after"):te),ye(yi,Gt.top,hr-yi,Gt.bottom),Gt.bottom<yr.top&&ye(Z,Gt.bottom,null,yr.top),ye(Ki,yr.top,Ya-Ki,yr.bottom)}(!Nt||jn(Gt,Nt)<0)&&(Nt=Gt),jn(yr,Nt)<0&&(Nt=yr),(!Zt||jn(Gt,Zt)<0)&&(Zt=Gt),jn(yr,Zt)<0&&(Zt=yr)}),{start:Nt,end:Zt}}var ke=t.from(),Ie=t.to();if(ke.line==Ie.line)_e(ke.line,ke.ch,Ie.ch);else{var Fe=Ze(c,ke.line),Be=Ze(c,Ie.line),Ve=xr(Fe)==xr(Be),$e=_e(ke.line,ke.ch,Ve?Fe.text.length+1:null).end,tt=_e(Ie.line,Ve?0:null,Ie.ch).start;Ve&&($e.top<tt.top-2?(ye($e.right,$e.top,null,$e.bottom),ye(Z,tt.top,tt.left,tt.bottom)):ye($e.right,$e.top,tt.left-$e.right,$e.bottom)),$e.bottom<tt.top&&ye(Z,$e.bottom,null,tt.top)}n.appendChild(P)}function xa(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()||Ii(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function gs(e){e.state.focused||(e.display.input.focus(),Ta(e))}function vs(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Ii(e))},100)}function Ta(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(he(e,"focus",e,t),e.state.focused=!0,B(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),r&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),xa(e)}function Ii(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(he(e,"blur",e,t),e.state.focused=!1,R(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Hn(e){for(var t=e.display,n=t.lineDiv.offsetTop,i=0;i<t.view.length;i++){var c=t.view[i],P=e.options.lineWrapping,V=void 0,Z=0;if(c.hidden)continue;if(z&&G<8){var te=c.node.offsetTop+c.node.offsetHeight;V=te-n,n=te}else{var ne=c.node.getBoundingClientRect();V=ne.bottom-ne.top,!P&&c.text.firstChild&&(Z=c.text.firstChild.getBoundingClientRect().right-ne.left-1)}var ye=c.line.height-V;if((ye>.005||ye<-.005)&&(dt(c.line,V),ys(c.line),c.rest))for(var _e=0;_e<c.rest.length;_e++)ys(c.rest[_e]);if(Z>e.display.sizerWidth){var ke=Math.ceil(Z/Li(e.display));ke>e.display.maxLineLength&&(e.display.maxLineLength=ke,e.display.maxLine=c.line,e.display.maxLineChanged=!0)}}}function ys(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],i=n.node.parentNode;i&&(n.height=i.offsetHeight)}}function Wn(e,t,n){var i=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;i=Math.floor(i-Fn(e));var c=n&&n.bottom!=null?n.bottom:i+e.wrapper.clientHeight,P=wt(t,i),V=wt(t,c);if(n&&n.ensure){var Z=n.ensure.from.line,te=n.ensure.to.line;Z<P?(P=Z,V=wt(t,Ir(Ze(t,Z))+e.wrapper.clientHeight)):Math.min(te,t.lastLine())>=V&&(P=wt(t,Ir(Ze(t,te))-e.wrapper.clientHeight),V=te)}return{from:P,to:Math.max(V,P+1)}}function Xo(e,t){if(ee(e,"scrollCursorIntoView"))return;var n=e.display,i=n.sizer.getBoundingClientRect(),c=null;if(t.top+i.top<0?c=!0:t.bottom+i.top>(window.innerHeight||document.documentElement.clientHeight)&&(c=!1),c!=null&&!u){var P=d("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-Fn(e.display))+`px;
|
|
height: `+(t.bottom-t.top+Nr(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(P),P.scrollIntoView(c),e.display.lineSpace.removeChild(P)}}function $o(e,t,n,i){i==null&&(i=0);var c;!e.options.lineWrapping&&t==n&&(t=t.ch?je(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?je(t.line,t.ch+1,"before"):t);for(var P=0;P<5;P++){var V=!1,Z=Dr(e,t),te=!n||n==t?Z:Dr(e,n);c={left:Math.min(Z.left,te.left),top:Math.min(Z.top,te.top)-i,right:Math.max(Z.left,te.left),bottom:Math.max(Z.bottom,te.bottom)+i};var ne=wa(e,c),ye=e.doc.scrollTop,_e=e.doc.scrollLeft;if(ne.scrollTop!=null&&(ln(e,ne.scrollTop),Math.abs(e.doc.scrollTop-ye)>1&&(V=!0)),ne.scrollLeft!=null&&(fi(e,ne.scrollLeft),Math.abs(e.doc.scrollLeft-_e)>1&&(V=!0)),!V)break}return c}function Jo(e,t){var n=wa(e,t);n.scrollTop!=null&&ln(e,n.scrollTop),n.scrollLeft!=null&&fi(e,n.scrollLeft)}function wa(e,t){var n=e.display,i=Oi(e.display);t.top<0&&(t.top=0);var c=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,P=da(e),V={};t.bottom-t.top>P&&(t.bottom=t.top+P);var Z=e.doc.height+ca(n),te=t.top<i,ne=t.bottom>Z-i;if(t.top<c)V.scrollTop=te?0:t.top;else if(t.bottom>c+P){var ye=Math.min(t.top,(ne?Z:t.bottom)-P);ye!=c&&(V.scrollTop=ye)}var _e=e.options.fixedGutter?0:n.gutters.offsetWidth,ke=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-_e,Ie=ui(e)-n.gutters.offsetWidth,Fe=t.right-t.left>Ie;return Fe&&(t.right=t.left+Ie),t.left<10?V.scrollLeft=0:t.left<ke?V.scrollLeft=Math.max(0,t.left+_e-(Fe?0:10)):t.right>Ie+ke-3&&(V.scrollLeft=t.right+(Fe?0:10)-Ie),V}function Sa(e,t){if(t==null)return;Gn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Di(e){Gn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function on(e,t,n){(t!=null||n!=null)&&Gn(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Qo(e,t){Gn(e),e.curOp.scrollToPos=t}function Gn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=us(e,t.from),i=us(e,t.to);bs(e,n,i,t.margin)}}function bs(e,t,n,i){var c=wa(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-i,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+i});on(e,c.scrollLeft,c.scrollTop)}function ln(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;N||Aa(e,{top:t}),_s(e,t,!0),N&&Aa(e),cn(e,100)}function _s(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 fi(e,t,n,i){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)&&!i)return;e.doc.scrollLeft=t,Ss(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function un(e){var t=e.display,n=t.gutters.offsetWidth,i=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:i,scrollHeight:i+Nr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var pi=function(e,t,n){this.cm=n;var i=this.vert=d("div",[d("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),c=this.horiz=d("div",[d("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=c.tabIndex=-1,e(i),e(c),Me(i,"scroll",function(){i.clientHeight&&t(i.scrollTop,"vertical")}),Me(c,"scroll",function(){c.clientWidth&&t(c.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,z&&G<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};pi.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,i=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?i+"px":"0";var c=e.viewHeight-(t?i:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+c)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?i+"px":"0",this.horiz.style.left=e.barLeft+"px";var P=e.viewWidth-e.barLeft-(n?i:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+P)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(i==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?i:0,bottom:t?i:0}},pi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},pi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},pi.prototype.zeroWidthHack=function(){var e=s&&!h?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new $,this.disableVert=new $},pi.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function i(){var c=e.getBoundingClientRect(),P=n=="vert"?document.elementFromPoint(c.right-1,(c.top+c.bottom)/2):document.elementFromPoint((c.right+c.left)/2,c.bottom-1);P!=e?e.style.pointerEvents="none":t.set(1e3,i)}t.set(1e3,i)},pi.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var hn=function(){};hn.prototype.update=function(){return{bottom:0,right:0}},hn.prototype.setScrollLeft=function(){},hn.prototype.setScrollTop=function(){},hn.prototype.clear=function(){};function ki(e,t){t||(t=un(e));var n=e.display.barWidth,i=e.display.barHeight;Es(e,t);for(var c=0;c<4&&n!=e.display.barWidth||i!=e.display.barHeight;c++)n!=e.display.barWidth&&e.options.lineWrapping&&Hn(e),Es(e,un(e)),n=e.display.barWidth,i=e.display.barHeight}function Es(e,t){var n=e.display,i=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=i.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=i.bottom)+"px",n.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=i.bottom+"px",n.scrollbarFiller.style.width=i.right+"px"):n.scrollbarFiller.style.display="",i.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=i.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var xs={native:pi,null:hn};function Ts(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&R(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new xs[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Me(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"?fi(e,t):ln(e,t)},e),e.display.scrollbars.addClass&&B(e.display.wrapper,e.display.scrollbars.addClass)}var Zo=0;function mi(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:++Zo},Cr(e.curOp)}function gi(e){var t=e.curOp;t&&Io(t,function(n){for(var i=0;i<n.ops.length;i++)n.ops[i].cm.curOp=null;qo(n)})}function qo(e){for(var t=e.ops,n=0;n<t.length;n++)el(t[n]);for(var i=0;i<t.length;i++)tl(t[i]);for(var c=0;c<t.length;c++)rl(t[c]);for(var P=0;P<t.length;P++)il(t[P]);for(var V=0;V<t.length;V++)nl(t[V])}function el(e){var t=e.cm,n=t.display;sl(t),e.updateMaxLine&&Nn(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 Kn(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Ca(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&Hn(t),e.barMeasure=un(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=ts(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+Nr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-ui(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function il(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&fi(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==j();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&ki(t,e.barMeasure),e.updatedDisplay&&Oa(t,e.barMeasure),e.selectionChanged&&xa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&gs(e.cm)}function nl(e){var t=e.cm,n=t.display,i=t.doc;if(e.updatedDisplay&&ws(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&_s(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&fi(t,e.scrollLeft,!0,!0),e.scrollToPos){var c=$o(t,gt(i,e.scrollToPos.from),gt(i,e.scrollToPos.to),e.scrollToPos.margin);Xo(t,c)}var P=e.maybeHiddenMarkers,V=e.maybeUnhiddenMarkers;if(P)for(var Z=0;Z<P.length;++Z)P[Z].lines.length||he(P[Z],"hide");if(V)for(var te=0;te<V.length;++te)V[te].lines.length&&he(V[te],"unhide");n.wrapper.offsetHeight&&(i.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&he(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function br(e,t){if(e.curOp)return t();mi(e);try{return t()}finally{gi(e)}}function Jt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);mi(e);try{return t.apply(e,arguments)}finally{gi(e)}}}function ur(e){return function(){if(this.curOp)return e.apply(this,arguments);mi(this);try{return e.apply(this,arguments)}finally{gi(this)}}}function Qt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);mi(t);try{return e.apply(this,arguments)}finally{gi(t)}}}function cn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,I(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,i=Ar(e,t.highlightFrontier),c=[];t.iter(i.line,Math.min(t.first+t.size,e.display.viewTo+500),function(P){if(i.line>=e.display.viewFrom){var V=P.styles,Z=P.text.length>e.options.maxHighlightLength?Et(t.mode,i.state):null,te=zi(e,P,i,!0);Z&&(i.state=Z),P.styles=te.styles;var ne=P.styleClasses,ye=te.classes;ye?P.styleClasses=ye:ne&&(P.styleClasses=null);for(var _e=!V||V.length!=P.styles.length||ne!=ye&&(!ne||!ye||ne.bgClass!=ye.bgClass||ne.textClass!=ye.textClass),ke=0;!_e&&ke<V.length;++ke)_e=V[ke]!=P.styles[ke];_e&&c.push(i.line),P.stateAfter=i.save(),i.nextLine()}else P.text.length<=e.options.maxHighlightLength&&Vi(e,P.text,i),P.stateAfter=i.line%5==0?i.save():null,i.nextLine();if(+new Date>n)return cn(e,e.options.workDelay),!0}),t.highlightFrontier=i.line,t.modeFrontier=Math.max(t.modeFrontier,i.line),c.length&&br(e,function(){for(var P=0;P<c.length;P++)Xr(e,c[P],"text")})}var Kn=function(e,t,n){var i=e.display;this.viewport=t,this.visible=Wn(i,e.doc,t),this.editorIsHidden=!i.wrapper.offsetWidth,this.wrapperHeight=i.wrapper.clientHeight,this.wrapperWidth=i.wrapper.clientWidth,this.oldDisplayWidth=ui(e),this.force=n,this.dims=ba(e),this.events=[]};Kn.prototype.signal=function(e,t){ae(e,t)&&this.events.push(arguments)},Kn.prototype.finish=function(){for(var e=0;e<this.events.length;e++)he.apply(null,this.events[e])};function sl(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Nr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Nr(e)+"px",t.scrollbarsClipped=!0)}function ol(e){if(e.hasFocus())return null;var t=j();if(!t||!b(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var i=window.getSelection();i.anchorNode&&i.extend&&b(e.display.lineDiv,i.anchorNode)&&(n.anchorNode=i.anchorNode,n.anchorOffset=i.anchorOffset,n.focusNode=i.focusNode,n.focusOffset=i.focusOffset)}return n}function ll(e){if(!e||!e.activeElt||e.activeElt==j())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&b(document.body,e.anchorNode)&&b(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 Ca(e,t){var n=e.display,i=e.doc;if(t.editorIsHidden)return $r(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&&fs(e)==0)return!1;Cs(e)&&($r(e),t.dims=ba(e));var c=i.first+i.size,P=Math.max(t.visible.from-e.options.viewportMargin,i.first),V=Math.min(c,t.visible.to+e.options.viewportMargin);n.viewFrom<P&&P-n.viewFrom<20&&(P=Math.max(i.first,n.viewFrom)),n.viewTo>V&&n.viewTo-V<20&&(V=Math.min(c,n.viewTo)),lr&&(P=Zi(e.doc,P),V=Yr(e.doc,V));var Z=P!=n.viewFrom||V!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vo(e,P,V),n.viewOffset=Ir(Ze(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var te=fs(e);if(!Z&&te==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var ne=ol(e);return te>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),te>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(ne),A(n.cursorDiv),A(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,Z&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,cn(e,400)),n.updateLineNumbers=null,!0}function ws(e,t){for(var n=t.viewport,i=!0;;i=!1){if(!i||!e.options.lineWrapping||t.oldDisplayWidth==ui(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ca(e.display)-da(e),n.top)}),t.visible=Wn(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else i&&(t.visible=Wn(e.display,e.doc,n));if(!Ca(e,t))break;Hn(e);var c=un(e);sn(e),ki(e,c),Oa(e,c),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 Aa(e,t){var n=new Kn(e,t);if(Ca(e,n)){Hn(e),ws(e,n);var i=un(e);sn(e),ki(e,i),Oa(e,i),n.finish()}}function ul(e,t,n){var i=e.display,c=e.options.lineNumbers,P=i.lineDiv,V=P.firstChild;function Z(Fe){var Be=Fe.nextSibling;return r&&s&&e.display.currentWheelTarget==Fe?Fe.style.display="none":Fe.parentNode.removeChild(Fe),Be}for(var te=i.view,ne=i.viewFrom,ye=0;ye<te.length;ye++){var _e=te[ye];if(!_e.hidden)if(!_e.node||_e.node.parentNode!=P){var ke=No(e,_e,ne,n);P.insertBefore(ke,V)}else{for(;V!=_e.node;)V=Z(V);var Ie=c&&t!=null&&t<=ne&&_e.lineNumber;_e.changes&&(le(_e.changes,"gutter")>-1&&(Ie=!1),Xa(e,_e,ne,n)),Ie&&(A(_e.lineNumber),_e.lineNumber.appendChild(document.createTextNode(Ut(e.options,ne)))),V=_e.node.nextSibling}ne+=_e.size}for(;V;)V=Z(V)}function Ra(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Oa(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+Nr(e)+"px"}function Ss(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var i=_a(t)-t.scroller.scrollLeft+e.doc.scrollLeft,c=t.gutters.offsetWidth,P=i+"px",V=0;V<n.length;V++)if(!n[V].hidden){e.options.fixedGutter&&(n[V].gutter&&(n[V].gutter.style.left=P),n[V].gutterBackground&&(n[V].gutterBackground.style.left=P));var Z=n[V].alignable;if(Z)for(var te=0;te<Z.length;te++)Z[te].style.left=P}e.options.fixedGutter&&(t.gutters.style.left=i+c+"px")}function Cs(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=Ut(e.options,t.first+t.size-1),i=e.display;if(n.length!=i.lineNumChars){var c=i.measure.appendChild(d("div",[d("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),P=c.firstChild.offsetWidth,V=c.offsetWidth-P;return i.lineGutter.style.width="",i.lineNumInnerWidth=Math.max(P,i.lineGutter.offsetWidth-V)+1,i.lineNumWidth=i.lineNumInnerWidth+V,i.lineNumChars=i.lineNumInnerWidth?n.length:-1,i.lineGutter.style.width=i.lineNumWidth+"px",Ra(e.display),!0}return!1}function La(e,t){for(var n=[],i=!1,c=0;c<e.length;c++){var P=e[c],V=null;if(typeof P!="string"&&(V=P.style,P=P.className),P=="CodeMirror-linenumbers")if(t)i=!0;else continue;n.push({className:P,style:V})}return t&&!i&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function As(e){var t=e.gutters,n=e.gutterSpecs;A(t),e.lineGutter=null;for(var i=0;i<n.length;++i){var c=n[i],P=c.className,V=c.style,Z=t.appendChild(d("div",null,"CodeMirror-gutter "+P));V&&(Z.style.cssText=V),P=="CodeMirror-linenumbers"&&(e.lineGutter=Z,Z.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Ra(e)}function dn(e){As(e.display),pr(e),Ss(e)}function hl(e,t,n,i){var c=this;this.input=n,c.scrollbarFiller=d("div",null,"CodeMirror-scrollbar-filler"),c.scrollbarFiller.setAttribute("cm-not-content","true"),c.gutterFiller=d("div",null,"CodeMirror-gutter-filler"),c.gutterFiller.setAttribute("cm-not-content","true"),c.lineDiv=w("div",null,"CodeMirror-code"),c.selectionDiv=d("div",null,null,"position: relative; z-index: 1"),c.cursorDiv=d("div",null,"CodeMirror-cursors"),c.measure=d("div",null,"CodeMirror-measure"),c.lineMeasure=d("div",null,"CodeMirror-measure"),c.lineSpace=w("div",[c.measure,c.lineMeasure,c.selectionDiv,c.cursorDiv,c.lineDiv],null,"position: relative; outline: none");var P=w("div",[c.lineSpace],"CodeMirror-lines");c.mover=d("div",[P],null,"position: relative"),c.sizer=d("div",[c.mover],"CodeMirror-sizer"),c.sizerWidth=null,c.heightForcer=d("div",null,null,"position: absolute; height: "+de+"px; width: 1px;"),c.gutters=d("div",null,"CodeMirror-gutters"),c.lineGutter=null,c.scroller=d("div",[c.sizer,c.heightForcer,c.gutters],"CodeMirror-scroll"),c.scroller.setAttribute("tabIndex","-1"),c.wrapper=d("div",[c.scrollbarFiller,c.gutterFiller,c.scroller],"CodeMirror"),z&&G<8&&(c.gutters.style.zIndex=-1,c.scroller.style.paddingRight=0),!r&&!(N&&l)&&(c.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(c.wrapper):e(c.wrapper)),c.viewFrom=c.viewTo=t.first,c.reportedViewFrom=c.reportedViewTo=t.first,c.view=[],c.renderedView=null,c.externalMeasured=null,c.viewOffset=0,c.lastWrapHeight=c.lastWrapWidth=0,c.updateLineNumbers=null,c.nativeBarWidth=c.barHeight=c.barWidth=0,c.scrollbarsClipped=!1,c.lineNumWidth=c.lineNumInnerWidth=c.lineNumChars=null,c.alignWidgets=!1,c.cachedCharWidth=c.cachedTextHeight=c.cachedPaddingH=null,c.maxLine=null,c.maxLineLength=0,c.maxLineChanged=!1,c.wheelDX=c.wheelDY=c.wheelStartX=c.wheelStartY=null,c.shift=!1,c.selForContextMenu=null,c.activeTouch=null,c.gutterSpecs=La(i.gutters,i.lineNumbers),As(c),n.init(c)}var zn=0,Tr=null;z?Tr=-.53:N?Tr=15:v?Tr=-.7:p&&(Tr=-1/3);function Rs(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 cl(e){var t=Rs(e);return t.x*=Tr,t.y*=Tr,t}function Os(e,t){var n=Rs(t),i=n.x,c=n.y,P=e.display,V=P.scroller,Z=V.scrollWidth>V.clientWidth,te=V.scrollHeight>V.clientHeight;if(!(i&&Z||c&&te))return;if(c&&s&&r){e:for(var ne=t.target,ye=P.view;ne!=V;ne=ne.parentNode)for(var _e=0;_e<ye.length;_e++)if(ye[_e].node==ne){e.display.currentWheelTarget=ne;break e}}if(i&&!N&&!m&&Tr!=null){c&&te&&ln(e,Math.max(0,V.scrollTop+c*Tr)),fi(e,Math.max(0,V.scrollLeft+i*Tr)),(!c||c&&te)&&ie(t),P.wheelStartX=null;return}if(c&&Tr!=null){var ke=c*Tr,Ie=e.doc.scrollTop,Fe=Ie+P.wrapper.clientHeight;ke<0?Ie=Math.max(0,Ie+ke-50):Fe=Math.min(e.doc.height,Fe+ke+50),Aa(e,{top:Ie,bottom:Fe})}zn<20&&(P.wheelStartX==null?(P.wheelStartX=V.scrollLeft,P.wheelStartY=V.scrollTop,P.wheelDX=i,P.wheelDY=c,setTimeout(function(){if(P.wheelStartX==null)return;var Be=V.scrollLeft-P.wheelStartX,Ve=V.scrollTop-P.wheelStartY,$e=Ve&&P.wheelDY&&Ve/P.wheelDY||Be&&P.wheelDX&&Be/P.wheelDX;if(P.wheelStartX=P.wheelStartY=null,!$e)return;Tr=(Tr*zn+$e)/(zn+1),++zn},200)):(P.wheelDX+=i,P.wheelDY+=c))}var wr=function(e,t){this.ranges=e,this.primIndex=t};wr.prototype.primary=function(){return this.ranges[this.primIndex]},wr.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],i=e.ranges[t];if(!ri(n.anchor,i.anchor)||!ri(n.head,i.head))return!1}return!0},wr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Dt(bi(this.ranges[t].anchor),bi(this.ranges[t].head));return new wr(e,this.primIndex)},wr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},wr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var i=this.ranges[n];if(ft(t,i.from())>=0&&ft(e,i.to())<=0)return n}return-1};var Dt=function(e,t){this.anchor=e,this.head=t};Dt.prototype.from=function(){return ii(this.anchor,this.head)},Dt.prototype.to=function(){return _i(this.anchor,this.head)},Dt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function kr(e,t,n){var i=e&&e.options.selectionsMayTouch,c=t[n];t.sort(function(ke,Ie){return ft(ke.from(),Ie.from())}),n=le(t,c);for(var P=1;P<t.length;P++){var V=t[P],Z=t[P-1],te=ft(Z.to(),V.from());if(i&&!V.empty()?te>0:te>=0){var ne=ii(Z.from(),V.from()),ye=_i(Z.to(),V.to()),_e=Z.empty()?V.from()==V.head:Z.from()==Z.head;P<=n&&--n,t.splice(--P,2,new Dt(_e?ye:ne,_e?ne:ye))}}return new wr(t,n)}function Jr(e,t){return new wr([new Dt(e,t||e)],0)}function Qr(e){return e.text?je(e.from.line+e.text.length-1,_(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Ls(e,t){if(ft(e,t.from)<0)return e;if(ft(e,t.to)<=0)return Qr(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;return e.line==t.to.line&&(i+=Qr(t).ch-t.to.ch),je(n,i)}function Ia(e,t){for(var n=[],i=0;i<e.sel.ranges.length;i++){var c=e.sel.ranges[i];n.push(new Dt(Ls(c.anchor,t),Ls(c.head,t)))}return kr(e.cm,n,e.sel.primIndex)}function Is(e,t,n){return e.line==t.line?je(n.line,e.ch-t.ch+n.ch):je(n.line+(e.line-t.line),e.ch)}function dl(e,t,n){for(var i=[],c=je(e.first,0),P=c,V=0;V<t.length;V++){var Z=t[V],te=Is(Z.from,c,P),ne=Is(Qr(Z),c,P);if(c=Z.to,P=ne,n=="around"){var ye=e.sel.ranges[V],_e=ft(ye.head,ye.anchor)<0;i[V]=new Dt(_e?ne:te,_e?te:ne)}else i[V]=new Dt(te,te)}return new wr(i,e.sel.primIndex)}function Da(e){e.doc.mode=cr(e.options,e.doc.modeOption),fn(e)}function fn(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,cn(e,100),e.state.modeGen++,e.curOp&&pr(e)}function Ds(e,t){return t.from.ch==0&&t.to.ch==0&&_(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function ka(e,t,n,i){function c(tt){return n?n[tt]:null}function P(tt,Je,nt){ua(tt,Je,nt,i),er(tt,"change",tt,t)}function V(tt,Je){for(var nt=[],ht=tt;ht<Je;++ht)nt.push(new li(ne[ht],c(ht),i));return nt}var Z=t.from,te=t.to,ne=t.text,ye=Ze(e,Z.line),_e=Ze(e,te.line),ke=_(ne),Ie=c(ne.length-1),Fe=te.line-Z.line;if(t.full)e.insert(0,V(0,ne.length)),e.remove(ne.length,e.size-ne.length);else if(Ds(e,t)){var Be=V(0,ne.length-1);P(_e,_e.text,Ie),Fe&&e.remove(Z.line,Fe),Be.length&&e.insert(Z.line,Be)}else if(ye==_e)if(ne.length==1)P(ye,ye.text.slice(0,Z.ch)+ke+ye.text.slice(te.ch),Ie);else{var Ve=V(1,ne.length-1);Ve.push(new li(ke+ye.text.slice(te.ch),Ie,i)),P(ye,ye.text.slice(0,Z.ch)+ne[0],c(0)),e.insert(Z.line+1,Ve)}else if(ne.length==1)P(ye,ye.text.slice(0,Z.ch)+ne[0]+_e.text.slice(te.ch),c(0)),e.remove(Z.line+1,Fe);else{P(ye,ye.text.slice(0,Z.ch)+ne[0],c(0)),P(_e,ke+_e.text.slice(te.ch),Ie);var $e=V(1,ne.length-1);Fe>1&&e.remove(Z.line+1,Fe-1),e.insert(Z.line+1,$e)}er(e,"change",e,t)}function Zr(e,t,n){function i(c,P,V){if(c.linked)for(var Z=0;Z<c.linked.length;++Z){var te=c.linked[Z];if(te.doc==P)continue;var ne=V&&te.sharedHist;if(n&&!ne)continue;t(te.doc,ne),i(te.doc,c,ne)}}i(e,null,!0)}function ks(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ea(e),Da(e),Ms(e),e.options.lineWrapping||Nn(e),e.options.mode=t.modeOption,pr(e)}function Ms(e){(e.doc.direction=="rtl"?B:R)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){br(e,function(){Ms(e),pr(e)})}function Vn(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 Ma(e,t){var n={from:bi(t.from),to:Qr(t),text:Ct(e,t.from,t.to)};return Fs(e,n,t.from.line,t.to.line+1),Zr(e,function(i){return Fs(i,n,t.from.line,t.to.line+1)},!0),n}function Ps(e){for(;e.length;){var t=_(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Ps(e.done),_(e.done);if(e.done.length&&!_(e.done).ranges)return _(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),_(e.done)}function Ns(e,t,n,i){var c=e.history;c.undone.length=0;var P=+new Date,V,Z;if((c.lastOp==i||c.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&c.lastModTime>P-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(V=pl(c,c.lastOp==i)))Z=_(V.changes),ft(t.from,t.to)==0&&ft(t.from,Z.to)==0?Z.to=Qr(t):V.changes.push(Ma(e,t));else{var te=_(c.done);for((!te||!te.ranges)&&Yn(e.sel,c.done),V={changes:[Ma(e,t)],generation:c.generation},c.done.push(V);c.done.length>c.undoDepth;)c.done.shift(),c.done[0].ranges||c.done.shift()}c.done.push(n),c.generation=++c.maxGeneration,c.lastModTime=c.lastSelTime=P,c.lastOp=c.lastSelOp=i,c.lastOrigin=c.lastSelOrigin=t.origin,Z||he(e,"historyAdded")}function ml(e,t,n,i){var c=t.charAt(0);return c=="*"||c=="+"&&n.ranges.length==i.ranges.length&&n.somethingSelected()==i.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,i){var c=e.history,P=i&&i.origin;n==c.lastSelOp||P&&c.lastSelOrigin==P&&(c.lastModTime==c.lastSelTime&&c.lastOrigin==P||ml(e,P,_(c.done),t))?c.done[c.done.length-1]=t:Yn(t,c.done),c.lastSelTime=+new Date,c.lastSelOrigin=P,c.lastSelOp=n,i&&i.clearRedo!==!1&&Ps(c.undone)}function Yn(e,t){var n=_(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Fs(e,t,n,i){var c=t["spans_"+e.id],P=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,i),function(V){V.markedSpans&&((c||(c=t["spans_"+e.id]={}))[P]=V.markedSpans),++P})}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 i=[],c=0;c<t.text.length;++c)i.push(vl(n[c]));return i}function Bs(e,t){var n=yl(e,t),i=Ti(e,t);if(!n)return i;if(!i)return n;for(var c=0;c<n.length;++c){var P=n[c],V=i[c];if(P&&V){e:for(var Z=0;Z<V.length;++Z){for(var te=V[Z],ne=0;ne<P.length;++ne)if(P[ne].marker==te.marker)continue e;P.push(te)}}else V&&(n[c]=V)}return n}function Mi(e,t,n){for(var i=[],c=0;c<e.length;++c){var P=e[c];if(P.ranges){i.push(n?wr.prototype.deepCopy.call(P):P);continue}var V=P.changes,Z=[];i.push({changes:Z});for(var te=0;te<V.length;++te){var ne=V[te],ye=void 0;if(Z.push({from:ne.from,to:ne.to,text:ne.text}),t)for(var _e in ne)(ye=_e.match(/^spans_(\d+)$/))&&(le(t,Number(ye[1]))>-1&&(_(Z)[_e]=ne[_e],delete ne[_e]))}}return i}function Pa(e,t,n,i){if(i){var c=e.anchor;if(n){var P=ft(t,c)<0;P!=ft(n,c)<0?(c=t,t=n):P!=ft(t,n)<0&&(t=n)}return new Dt(c,t)}else return new Dt(n||t,t)}function Xn(e,t,n,i,c){c==null&&(c=e.cm&&(e.cm.display.shift||e.extend)),nr(e,new wr([Pa(e.sel.primary(),t,n,c)],0),i)}function Us(e,t,n){for(var i=[],c=e.cm&&(e.cm.display.shift||e.extend),P=0;P<e.sel.ranges.length;P++)i[P]=Pa(e.sel.ranges[P],t[P],null,c);var V=kr(e.cm,i,e.sel.primIndex);nr(e,V,n)}function Na(e,t,n,i){var c=e.sel.ranges.slice(0);c[t]=n,nr(e,kr(e.cm,c,e.sel.primIndex),i)}function js(e,t,n,i){nr(e,Jr(t,n),i)}function bl(e,t,n){var i={ranges:t.ranges,update:function(c){this.ranges=[];for(var P=0;P<c.length;P++)this.ranges[P]=new Dt(gt(e,c[P].anchor),gt(e,c[P].head))},origin:n&&n.origin};return he(e,"beforeSelectionChange",e,i),e.cm&&he(e.cm,"beforeSelectionChange",e.cm,i),i.ranges!=t.ranges?kr(e.cm,i.ranges,i.ranges.length-1):t}function Hs(e,t,n){var i=e.history.done,c=_(i);c&&c.ranges?(i[i.length-1]=t,$n(e,t,n)):nr(e,t,n)}function nr(e,t,n){$n(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function $n(e,t,n){(ae(e,"beforeSelectionChange")||e.cm&&ae(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var i=n&&n.bias||(ft(t.primary().head,e.sel.primary().head)<0?-1:1);Ws(e,Ks(e,t,i,!0)),!(n&&n.scroll===!1)&&e.cm&&Di(e.cm)}function Ws(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,re(e.cm)),er(e,"cursorActivity",e)}function Gs(e){Ws(e,Ks(e,e.sel,null,!1))}function Ks(e,t,n,i){for(var c,P=0;P<t.ranges.length;P++){var V=t.ranges[P],Z=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[P],te=Jn(e,V.anchor,Z&&Z.anchor,n,i),ne=Jn(e,V.head,Z&&Z.head,n,i);(c||te!=V.anchor||ne!=V.head)&&(c||(c=t.ranges.slice(0,P)),c[P]=new Dt(te,ne))}return c?kr(e.cm,c,t.primIndex):t}function Pi(e,t,n,i,c){var P=Ze(e,t.line);if(P.markedSpans)for(var V=0;V<P.markedSpans.length;++V){var Z=P.markedSpans[V],te=Z.marker,ne="selectLeft"in te?!te.selectLeft:te.inclusiveLeft,ye="selectRight"in te?!te.selectRight:te.inclusiveRight;if((Z.from==null||(ne?Z.from<=t.ch:Z.from<t.ch))&&(Z.to==null||(ye?Z.to>=t.ch:Z.to>t.ch))){if(c&&(he(te,"beforeCursorEnter"),te.explicitlyCleared))if(P.markedSpans){--V;continue}else break;if(!te.atomic)continue;if(n){var _e=te.find(i<0?1:-1),ke=void 0;if((i<0?ye:ne)&&(_e=zs(e,_e,-i,_e&&_e.line==t.line?P:null)),_e&&_e.line==t.line&&(ke=ft(_e,n))&&(i<0?ke<0:ke>0))return Pi(e,_e,t,i,c)}var Ie=te.find(i<0?-1:1);return(i<0?ne:ye)&&(Ie=zs(e,Ie,i,Ie.line==t.line?P:null)),Ie?Pi(e,Ie,t,i,c):null}}return t}function Jn(e,t,n,i,c){var P=i||1,V=Pi(e,t,n,P,c)||!c&&Pi(e,t,n,P,!0)||Pi(e,t,n,-P,c)||!c&&Pi(e,t,n,-P,!0);return V||(e.cantEdit=!0,je(e.first,0))}function zs(e,t,n,i){return n<0&&t.ch==0?t.line>e.first?gt(e,je(t.line-1)):null:n>0&&t.ch==(i||Ze(e,t.line)).text.length?t.line<e.first+e.size-1?je(t.line+1,0):null:new je(t.line,t.ch+n)}function Vs(e){e.setSelection(je(e.firstLine(),0),je(e.lastLine()),be)}function Ys(e,t,n){var i={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return i.canceled=!0}};return n&&(i.update=function(c,P,V,Z){c&&(i.from=gt(e,c)),P&&(i.to=gt(e,P)),V&&(i.text=V),Z!==void 0&&(i.origin=Z)}),he(e,"beforeChange",e,i),e.cm&&he(e.cm,"beforeChange",e.cm,i),i.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:i.from,to:i.to,text:i.text,origin:i.origin}}function Ni(e,t,n){if(e.cm){if(!e.cm.curOp)return Jt(e.cm,Ni)(e,t,n);if(e.cm.state.suppressEdits)return}if((ae(e,"beforeChange")||e.cm&&ae(e.cm,"beforeChange"))&&(t=Ys(e,t,!0),!t))return;var i=Ji&&!n&&kn(e,t.from,t.to);if(i)for(var c=i.length-1;c>=0;--c)Xs(e,{from:i[c].from,to:i[c].to,text:c?[""]:t.text,origin:t.origin});else Xs(e,t)}function Xs(e,t){if(t.text.length==1&&t.text[0]==""&&ft(t.from,t.to)==0)return;var n=Ia(e,t);Ns(e,t,n,e.cm?e.cm.curOp.id:NaN),pn(e,t,n,Ti(e,t));var i=[];Zr(e,function(c,P){!P&&le(i,c.history)==-1&&(Zs(c.history,t),i.push(c.history)),pn(c,t,null,Ti(c,t))})}function Qn(e,t,n){var i=e.cm&&e.cm.state.suppressEdits;if(i&&!n)return;for(var c=e.history,P,V=e.sel,Z=t=="undo"?c.done:c.undone,te=t=="undo"?c.undone:c.done,ne=0;ne<Z.length&&!(P=Z[ne],n?P.ranges&&!P.equals(e.sel):!P.ranges);ne++);if(ne==Z.length)return;for(c.lastOrigin=c.lastSelOrigin=null;;)if(P=Z.pop(),P.ranges){if(Yn(P,te),n&&!P.equals(e.sel)){nr(e,P,{clearRedo:!1});return}V=P}else if(i){Z.push(P);return}else break;var ye=[];Yn(V,te),te.push({changes:ye,generation:c.generation}),c.generation=P.generation||++c.maxGeneration;for(var _e=ae(e,"beforeChange")||e.cm&&ae(e.cm,"beforeChange"),ke=function(Be){var Ve=P.changes[Be];if(Ve.origin=t,_e&&!Ys(e,Ve,!1))return Z.length=0,{};ye.push(Ma(e,Ve));var $e=Be?Ia(e,Ve):_(Z);pn(e,Ve,$e,Bs(e,Ve)),!Be&&e.cm&&e.cm.scrollIntoView({from:Ve.from,to:Qr(Ve)});var tt=[];Zr(e,function(Je,nt){!nt&&le(tt,Je.history)==-1&&(Zs(Je.history,Ve),tt.push(Je.history)),pn(Je,Ve,null,Bs(Je,Ve))})},Ie=P.changes.length-1;Ie>=0;--Ie){var Fe=ke(Ie);if(Fe)return Fe.v}}function $s(e,t){if(t==0)return;if(e.first+=t,e.sel=new wr(k(e.sel.ranges,function(c){return new Dt(je(c.anchor.line+t,c.anchor.ch),je(c.head.line+t,c.head.ch))}),e.sel.primIndex),e.cm){pr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,i=n.viewFrom;i<n.viewTo;i++)Xr(e.cm,i,"gutter")}}function pn(e,t,n,i){if(e.cm&&!e.cm.curOp)return Jt(e.cm,pn)(e,t,n,i);if(t.to.line<e.first){$s(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 c=t.text.length-1-(e.first-t.from.line);$s(e,c),t={from:je(e.first,0),to:je(t.to.line+c,t.to.ch),text:[_(t.text)],origin:t.origin}}var P=e.lastLine();t.to.line>P&&(t={from:t.from,to:je(P,Ze(e,P).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Ct(e,t.from,t.to),n||(n=Ia(e,t)),e.cm?_l(e.cm,t,i):ka(e,t,i),$n(e,n,be),e.cantEdit&&Jn(e,je(e.firstLine(),0))&&(e.cantEdit=!1)}function _l(e,t,n){var i=e.doc,c=e.display,P=t.from,V=t.to,Z=!1,te=P.line;e.options.lineWrapping||(te=pt(xr(Ze(i,P.line))),i.iter(te,V.line+1,function(Ie){if(Ie==c.maxLine)return Z=!0,!0})),i.sel.contains(t.from,t.to)>-1&&re(e),ka(i,t,n,ds(e)),e.options.lineWrapping||(i.iter(te,P.line+t.text.length,function(Ie){var Fe=en(Ie);Fe>c.maxLineLength&&(c.maxLine=Ie,c.maxLineLength=Fe,c.maxLineChanged=!0,Z=!1)}),Z&&(e.curOp.updateMaxLine=!0)),aa(i,P.line),cn(e,400);var ne=t.text.length-(V.line-P.line)-1;t.full?pr(e):P.line==V.line&&t.text.length==1&&!Ds(e.doc,t)?Xr(e,P.line,"text"):pr(e,P.line,V.line+1,ne);var ye=ae(e,"changes"),_e=ae(e,"change");if(_e||ye){var ke={from:P,to:V,text:t.text,removed:t.removed,origin:t.origin};_e&&er(e,"change",e,ke),ye&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(ke)}e.display.selForContextMenu=null}function Fi(e,t,n,i,c){var P;i||(i=n),ft(i,n)<0&&(P=[i,n],n=P[0],i=P[1]),typeof t=="string"&&(t=e.splitLines(t)),Ni(e,{from:n,to:i,text:t,origin:c})}function Js(e,t,n,i){n<e.line?e.line+=i:t<e.line&&(e.line=t,e.ch=0)}function Qs(e,t,n,i){for(var c=0;c<e.length;++c){var P=e[c],V=!0;if(P.ranges){P.copied||(P=e[c]=P.deepCopy(),P.copied=!0);for(var Z=0;Z<P.ranges.length;Z++)Js(P.ranges[Z].anchor,t,n,i),Js(P.ranges[Z].head,t,n,i);continue}for(var te=0;te<P.changes.length;++te){var ne=P.changes[te];if(n<ne.from.line)ne.from=je(ne.from.line+i,ne.from.ch),ne.to=je(ne.to.line+i,ne.to.ch);else if(t<=ne.to.line){V=!1;break}}V||(e.splice(0,c+1),c=0)}}function Zs(e,t){var n=t.from.line,i=t.to.line,c=t.text.length-(i-n)-1;Qs(e.done,n,i,c),Qs(e.undone,n,i,c)}function mn(e,t,n,i){var c=t,P=t;return typeof t=="number"?P=Ze(e,Ei(e,t)):c=pt(t),c==null?null:(i(P,c)&&e.cm&&Xr(e.cm,c,n),P)}function gn(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}gn.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,i=e+t;n<i;++n){var c=this.lines[n];this.height-=c.height,st(c),er(c,"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 i=0;i<t.length;++i)t[i].parent=this},iterN:function(e,t,n){for(var i=e+t;e<i;++e)if(n(this.lines[e]))return!0}};function vn(e){this.children=e;for(var t=0,n=0,i=0;i<e.length;++i){var c=e[i];t+=c.chunkSize(),n+=c.height,c.parent=this}this.size=t,this.height=n,this.parent=null}vn.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var i=this.children[n],c=i.chunkSize();if(e<c){var P=Math.min(t,c-e),V=i.height;if(i.removeInner(e,P),this.height-=V-i.height,c==P&&(this.children.splice(n--,1),i.parent=null),(t-=P)==0)break;e=0}else e-=c}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof gn))){var Z=[];this.collapse(Z),this.children=[new gn(Z)],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 i=0;i<this.children.length;++i){var c=this.children[i],P=c.chunkSize();if(e<=P){if(c.insertInner(e,t,n),c.lines&&c.lines.length>50){for(var V=c.lines.length%25+25,Z=V;Z<c.lines.length;){var te=new gn(c.lines.slice(Z,Z+=25));c.height-=te.height,this.children.splice(++i,0,te),te.parent=this}c.lines=c.lines.slice(0,V),this.maybeSpill()}break}e-=P}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new vn(t);if(e.parent){e.size-=n.size,e.height-=n.height;var c=le(e.parent.children,e);e.parent.children.splice(c+1,0,n)}else{var i=new vn(e.children);i.parent=e,e.children=[i,n],e=i}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var i=0;i<this.children.length;++i){var c=this.children[i],P=c.chunkSize();if(e<P){var V=Math.min(t,P-e);if(c.iterN(e,V,n))return!0;if((t-=V)==0)break;e=0}else e-=P}}};var yn=function(e,t,n){if(n)for(var i in n)n.hasOwnProperty(i)&&(this[i]=n[i]);this.doc=e,this.node=t};yn.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,i=pt(n);if(i==null||!t)return;for(var c=0;c<t.length;++c)t[c]==this&&t.splice(c--,1);t.length||(n.widgets=null);var P=nn(this);dt(n,Math.max(0,n.height-P)),e&&(br(e,function(){qs(e,n,-P),Xr(e,i,"widget")}),er(e,"lineWidgetCleared",e,this,i))},yn.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,i=this.line;this.height=null;var c=nn(this)-t;if(!c)return;Pr(this.doc,i)||dt(i,i.height+c),n&&br(n,function(){n.curOp.forceUpdate=!0,qs(n,i,c),er(n,"lineWidgetChanged",n,e,pt(i))})},fe(yn);function qs(e,t,n){Ir(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Sa(e,n)}function El(e,t,n,i){var c=new yn(e,n,i),P=e.cm;return P&&c.noHScroll&&(P.display.alignWidgets=!0),mn(e,t,"widget",function(V){var Z=V.widgets||(V.widgets=[]);if(c.insertAt==null?Z.push(c):Z.splice(Math.min(Z.length-1,Math.max(0,c.insertAt)),0,c),c.line=V,P&&!Pr(e,V)){var te=Ir(V)<e.scrollTop;dt(V,V.height+nn(c)),te&&Sa(P,c.height),P.curOp.forceUpdate=!0}return!0}),P&&er(P,"lineWidgetAdded",P,c,typeof t=="number"?t:pt(t)),c}var eo=0,qr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++eo};qr.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&mi(e),ae(this,"clear")){var n=this.find();n&&er(this,"clear",n.from,n.to)}for(var i=null,c=null,P=0;P<this.lines.length;++P){var V=this.lines[P],Z=Lr(V.markedSpans,this);e&&!this.collapsed?Xr(e,pt(V),"text"):e&&(Z.to!=null&&(c=pt(V)),Z.from!=null&&(i=pt(V))),V.markedSpans=Qi(V.markedSpans,Z),Z.from==null&&this.collapsed&&!Pr(this.doc,V)&&e&&dt(V,Oi(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var te=0;te<this.lines.length;++te){var ne=xr(this.lines[te]),ye=en(ne);ye>e.display.maxLineLength&&(e.display.maxLine=ne,e.display.maxLineLength=ye,e.display.maxLineChanged=!0)}i!=null&&e&&this.collapsed&&pr(e,i,c+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Gs(e.doc)),e&&er(e,"markerCleared",e,this,i,c),t&&gi(e),this.parent&&this.parent.clear()},qr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,i,c=0;c<this.lines.length;++c){var P=this.lines[c],V=Lr(P.markedSpans,this);if(V.from!=null&&(n=je(t?P:pt(P),V.from),e==-1))return n;if(V.to!=null&&(i=je(t?P:pt(P),V.to),e==1))return i}return n&&{from:n,to:i}},qr.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,i=this.doc.cm;if(!t||!i)return;br(i,function(){var c=t.line,P=pt(t.line),V=fa(i,P);if(V&&(ns(V),i.curOp.selectionChanged=i.curOp.forceUpdate=!0),i.curOp.updateMaxLine=!0,!Pr(n.doc,c)&&n.height!=null){var Z=n.height;n.height=null;var te=nn(n)-Z;te&&dt(c,c.height+te)}er(i,"markerChanged",i,e)})},qr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||le(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},qr.prototype.detachLine=function(e){if(this.lines.splice(le(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},fe(qr);function Bi(e,t,n,i,c){if(i&&i.shared)return xl(e,t,n,i,c);if(e.cm&&!e.cm.curOp)return Jt(e.cm,Bi)(e,t,n,i,c);var P=new qr(e,c),V=ft(t,n);if(i&&g(i,P,!1),V>0||V==0&&P.clearWhenEmpty!==!1)return P;if(P.replacedWith&&(P.collapsed=!0,P.widgetNode=w("span",[P.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||P.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(P.widgetNode.insertLeft=!0)),P.collapsed){if(Mn(e,t.line,t,n,P)||t.line!=n.line&&Mn(e,n.line,t,n,P))throw new Error("Inserting collapsed marker partially overlapping an existing one");sa()}P.addToHistory&&Ns(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var Z=t.line,te=e.cm,ne;if(e.iter(Z,n.line+1,function(_e){te&&P.collapsed&&!te.options.lineWrapping&&xr(_e)==te.display.maxLine&&(ne=!0),P.collapsed&&Z!=t.line&&dt(_e,0),oa(_e,new ai(P,Z==t.line?t.ch:null,Z==n.line?n.ch:null)),++Z}),P.collapsed&&e.iter(t.line,n.line+1,function(_e){Pr(e,_e)&&dt(_e,0)}),P.clearOnEnter&&Me(P,"beforeCursorEnter",function(){return P.clear()}),P.readOnly&&(Vr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),P.collapsed&&(P.id=++eo,P.atomic=!0),te){if(ne&&(te.curOp.updateMaxLine=!0),P.collapsed)pr(te,t.line,n.line+1);else if(P.className||P.startStyle||P.endStyle||P.css||P.attributes||P.title)for(var ye=t.line;ye<=n.line;ye++)Xr(te,ye,"text");P.atomic&&Gs(te.doc),er(te,"markerAdded",te,P)}return P}var bn=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};bn.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();er(this,"clear")},bn.prototype.find=function(e,t){return this.primary.find(e,t)},fe(bn);function xl(e,t,n,i,c){i=g(i),i.shared=!1;var P=[Bi(e,t,n,i,c)],V=P[0],Z=i.widgetNode;return Zr(e,function(te){Z&&(i.widgetNode=Z.cloneNode(!0)),P.push(Bi(te,gt(te,t),gt(te,n),i,c));for(var ne=0;ne<te.linked.length;++ne)if(te.linked[ne].isParent)return;V=_(P)}),new bn(P,V)}function to(e){return e.findMarks(je(e.first,0),e.clipPos(je(e.lastLine())),function(t){return t.parent})}function Tl(e,t){for(var n=0;n<t.length;n++){var i=t[n],c=i.find(),P=e.clipPos(c.from),V=e.clipPos(c.to);if(ft(P,V)){var Z=Bi(e,P,V,i.primary,i.primary.type);i.markers.push(Z),Z.parent=i}}}function wl(e){for(var t=function(i){var c=e[i],P=[c.primary.doc];Zr(c.primary.doc,function(te){return P.push(te)});for(var V=0;V<c.markers.length;V++){var Z=c.markers[V];le(P,Z.doc)==-1&&(Z.parent=null,c.markers.splice(V--,1))}},n=0;n<e.length;n++)t(n)}var Sl=0,mr=function(e,t,n,i,c){if(!(this instanceof mr))return new mr(e,t,n,i,c);n==null&&(n=0),vn.call(this,[new gn([new li("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var P=je(n,0);this.sel=Jr(P),this.history=new Vn(null),this.id=++Sl,this.modeOption=t,this.lineSep=i,this.direction=c=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),ka(this,{from:P,to:P,text:e}),nr(this,Jr(P),be)};mr.prototype=K(vn.prototype,{constructor:mr,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,i=0;i<t.length;++i)n+=t[i].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Rt(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Qt(function(e){var t=je(this.first,0),n=this.first+this.size-1;Ni(this,{from:t,to:je(n,Ze(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&on(this.cm,0,0),nr(this,Jr(t),be)}),replaceRange:function(e,t,n,i){t=gt(this,t),n=n?gt(this,n):t,Fi(this,e,t,n,i)},getRange:function(e,t,n){var i=Ct(this,gt(this,e),gt(this,t));return n===!1?i:i.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(rr(this,e))return Ze(this,e)},getLineNumber:function(e){return pt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=Ze(this,e)),xr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return gt(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:Qt(function(e,t,n){js(this,gt(this,typeof e=="number"?je(e,t||0):e),null,n)}),setSelection:Qt(function(e,t,n){js(this,gt(this,e),gt(this,t||e),n)}),extendSelection:Qt(function(e,t,n){Xn(this,gt(this,e),t&>(this,t),n)}),extendSelections:Qt(function(e,t){Us(this,ze(this,e),t)}),extendSelectionsBy:Qt(function(e,t){var n=k(this.sel.ranges,e);Us(this,ze(this,n),t)}),setSelections:Qt(function(e,t,n){if(!e.length)return;for(var i=[],c=0;c<e.length;c++)i[c]=new Dt(gt(this,e[c].anchor),gt(this,e[c].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),nr(this,kr(this.cm,i,t),n)}),addSelection:Qt(function(e,t,n){var i=this.sel.ranges.slice(0);i.push(new Dt(gt(this,e),gt(this,t||e))),nr(this,kr(this.cm,i,i.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,i=0;i<t.length;i++){var c=Ct(this,t[i].from(),t[i].to());n=n?n.concat(c):c}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,i=0;i<n.length;i++){var c=Ct(this,n[i].from(),n[i].to());e!==!1&&(c=c.join(e||this.lineSeparator())),t[i]=c}return t},replaceSelection:function(e,t,n){for(var i=[],c=0;c<this.sel.ranges.length;c++)i[c]=e;this.replaceSelections(i,t,n||"+input")},replaceSelections:Qt(function(e,t,n){for(var i=[],c=this.sel,P=0;P<c.ranges.length;P++){var V=c.ranges[P];i[P]={from:V.from(),to:V.to(),text:this.splitLines(e[P]),origin:n}}for(var Z=t&&t!="end"&&dl(this,i,t),te=i.length-1;te>=0;te--)Ni(this,i[te]);Z?Hs(this,Z):this.cm&&Di(this.cm)}),undo:Qt(function(){Qn(this,"undo")}),redo:Qt(function(){Qn(this,"redo")}),undoSelection:Qt(function(){Qn(this,"undo",!0)}),redoSelection:Qt(function(){Qn(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,i=0;i<e.done.length;i++)e.done[i].ranges||++t;for(var c=0;c<e.undone.length;c++)e.undone[c].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new Vn(this.history.maxGeneration),Zr(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:Mi(this.history.done),undone:Mi(this.history.undone)}},setHistory:function(e){var t=this.history=new Vn(this.history.maxGeneration);t.done=Mi(e.done.slice(0),null,!0),t.undone=Mi(e.undone.slice(0),null,!0)},setGutterMarker:Qt(function(e,t,n){return mn(this,e,"gutter",function(i){var c=i.gutterMarkers||(i.gutterMarkers={});return c[t]=n,!n&&ue(c)&&(i.gutterMarkers=null),!0})}),clearGutter:Qt(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&mn(t,n,"gutter",function(){return n.gutterMarkers[e]=null,ue(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!rr(this,e))return null;if(t=e,e=Ze(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:Qt(function(e,t,n){return mn(this,e,t=="gutter"?"gutter":"class",function(i){var c=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!i[c])i[c]=n;else{if(L(n).test(i[c]))return!1;i[c]+=" "+n}return!0})}),removeLineClass:Qt(function(e,t,n){return mn(this,e,t=="gutter"?"gutter":"class",function(i){var c=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",P=i[c];if(P)if(n==null)i[c]=null;else{var V=P.match(L(n));if(!V)return!1;var Z=V.index+V[0].length;i[c]=P.slice(0,V.index)+(!V.index||Z==P.length?"":" ")+P.slice(Z)||null}else return!1;return!0})}),addLineWidget:Qt(function(e,t,n){return El(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return Bi(this,gt(this,e),gt(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=gt(this,e),Bi(this,e,e,n,"bookmark")},findMarksAt:function(e){e=gt(this,e);var t=[],n=Ze(this,e.line).markedSpans;if(n)for(var i=0;i<n.length;++i){var c=n[i];(c.from==null||c.from<=e.ch)&&(c.to==null||c.to>=e.ch)&&t.push(c.marker.parent||c.marker)}return t},findMarks:function(e,t,n){e=gt(this,e),t=gt(this,t);var i=[],c=e.line;return this.iter(e.line,t.line+1,function(P){var V=P.markedSpans;if(V)for(var Z=0;Z<V.length;Z++){var te=V[Z];!(te.to!=null&&c==e.line&&e.ch>=te.to||te.from==null&&c!=e.line||te.from!=null&&c==t.line&&te.from>=t.ch)&&(!n||n(te.marker))&&i.push(te.marker.parent||te.marker)}++c}),i},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var i=0;i<n.length;++i)n[i].from!=null&&e.push(n[i].marker)}),e},posFromIndex:function(e){var t,n=this.first,i=this.lineSeparator().length;return this.iter(function(c){var P=c.text.length+i;if(P>e)return t=e,!0;e-=P,++n}),gt(this,je(n,t))},indexFromPos:function(e){e=gt(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(i){t+=i.text.length+n}),t},copy:function(e){var t=new mr(Rt(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 i=new mr(Rt(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(i.history=this.history),(this.linked||(this.linked=[])).push({doc:i,sharedHist:e.sharedHist}),i.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Tl(i,to(this)),i},unlinkDoc:function(e){if(e instanceof jt&&(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),wl(to(this));break}if(e.history==this.history){var i=[e.id];Zr(e,function(c){return i.push(c.id)},!0),e.history=new Vn(null),e.history.done=Mi(this.history.done,i),e.history.undone=Mi(this.history.undone,i)}},iterLinkedDocs:function(e){Zr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):ot(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:Qt(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)})}),mr.prototype.eachLine=mr.prototype.iter;var ro=0;function Cl(e){var t=this;if(io(t),ee(t,e)||Gr(t.display,e))return;ie(e),z&&(ro=+new Date);var n=ci(t,e,!0),i=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(i&&i.length&&window.FileReader&&window.File)for(var c=i.length,P=Array(c),V=0,Z=function(){++V==c&&Jt(t,function(){n=gt(t.doc,n);var Ie={from:n,to:n,text:t.doc.splitLines(P.filter(function(Fe){return Fe!=null}).join(t.doc.lineSeparator())),origin:"paste"};Ni(t.doc,Ie),Hs(t.doc,Jr(gt(t.doc,n),gt(t.doc,Qr(Ie))))})()},te=function(Ie,Fe){if(t.options.allowDropFileTypes&&le(t.options.allowDropFileTypes,Ie.type)==-1){Z();return}var Be=new FileReader;Be.onerror=function(){return Z()},Be.onload=function(){var Ve=Be.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Ve)){Z();return}P[Fe]=Ve,Z()},Be.readAsText(Ie)},ne=0;ne<i.length;ne++)te(i[ne],ne);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 ye=e.dataTransfer.getData("Text");if(ye){var _e;if(t.state.draggingText&&!t.state.draggingText.copy&&(_e=t.listSelections()),$n(t.doc,Jr(n,n)),_e)for(var ke=0;ke<_e.length;++ke)Fi(t.doc,"",_e[ke].anchor,_e[ke].head,"drag");t.replaceSelection(ye,"around","paste"),t.display.input.focus()}}catch(Ie){}}}function Al(e,t){if(z&&(!e.state.draggingText||+new Date-ro<100)){me(t);return}if(ee(e,t)||Gr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!p){var n=d("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",m&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),m&&n.parentNode.removeChild(n)}}function Rl(e,t){var n=ci(e,t);if(!n)return;var i=document.createDocumentFragment();ms(e,n,i),e.display.dragCursor||(e.display.dragCursor=d("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),T(e.display.dragCursor,i)}function io(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function no(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],i=0;i<t.length;i++){var c=t[i].CodeMirror;c&&n.push(c)}n.length&&n[0].operation(function(){for(var P=0;P<n.length;P++)e(n[P])})}var ao=!1;function Ol(){if(ao)return;Ll(),ao=!0}function Ll(){var e;Me(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,no(Il)},100))}),Me(window,"blur",function(){return no(Ii)})}function Il(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var ei={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"},_n=0;_n<10;_n++)ei[_n+48]=ei[_n+96]=String(_n);for(var Zn=65;Zn<=90;Zn++)ei[Zn]=String.fromCharCode(Zn);for(var En=1;En<=12;En++)ei[En+111]=ei[En+63235]="F"+En;var Kr={};Kr.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"},Kr.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"},Kr.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"},Kr.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"]},Kr.default=s?Kr.macDefault:Kr.pcDefault;function Dl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,i,c,P,V=0;V<t.length-1;V++){var Z=t[V];if(/^(cmd|meta|m)$/i.test(Z))P=!0;else if(/^a(lt)?$/i.test(Z))n=!0;else if(/^(c|ctrl|control)$/i.test(Z))i=!0;else if(/^s(hift)?$/i.test(Z))c=!0;else throw new Error("Unrecognized modifier name: "+Z)}return n&&(e="Alt-"+e),i&&(e="Ctrl-"+e),P&&(e="Cmd-"+e),c&&(e="Shift-"+e),e}function kl(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(i=="..."){delete e[n];continue}for(var c=k(n.split(" "),Dl),P=0;P<c.length;P++){var V=void 0,Z=void 0;P==c.length-1?(Z=c.join(" "),V=i):(Z=c.slice(0,P+1).join(" "),V="...");var te=t[Z];if(!te)t[Z]=V;else if(te!=V)throw new Error("Inconsistent bindings for "+Z)}delete e[n]}for(var ne in t)e[ne]=t[ne];return e}function Ui(e,t,n,i){t=qn(t);var c=t.call?t.call(e,i):t[e];if(c===!1)return"nothing";if(c==="...")return"multi";if(c!=null&&n(c))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return Ui(e,t.fallthrough,n,i);for(var P=0;P<t.fallthrough.length;P++){var V=Ui(e,t.fallthrough[P],n,i);if(V)return V}}}function so(e){var t=typeof e=="string"?e:ei[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function oo(e,t,n){var i=e;return t.altKey&&i!="Alt"&&(e="Alt-"+e),(C?t.metaKey:t.ctrlKey)&&i!="Ctrl"&&(e="Ctrl-"+e),(C?t.ctrlKey:t.metaKey)&&i!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&i!="Shift"&&(e="Shift-"+e),e}function lo(e,t){if(m&&e.keyCode==34&&e.char)return!1;var n=ei[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),oo(n,e,t))}function qn(e){return typeof e=="string"?Kr[e]:e}function ji(e,t){for(var n=e.doc.sel.ranges,i=[],c=0;c<n.length;c++){for(var P=t(n[c]);i.length&&ft(P.from,_(i).to)<=0;){var V=i.pop();if(ft(V.from,P.from)<0){P.from=V.from;break}}i.push(P)}br(e,function(){for(var Z=i.length-1;Z>=0;Z--)Fi(e.doc,"",i[Z].from,i[Z].to,"+delete");Di(e)})}function Fa(e,t,n){var i=Oe(e.text,t+n,n);return i<0||i>e.text.length?null:i}function Ba(e,t,n){var i=Fa(e,t.ch,n);return i==null?null:new je(t.line,i,n<0?"after":"before")}function Ua(e,t,n,i,c){if(e){t.doc.direction=="rtl"&&(c=-c);var P=He(n,t.doc.direction);if(P){var V=c<0?_(P):P[0],Z=c<0==(V.level==1),te=Z?"after":"before",ne;if(V.level>0||t.doc.direction=="rtl"){var ye=Ri(t,n);ne=c<0?n.text.length-1:0;var _e=Fr(t,ye,ne).top;ne=Ne(function(ke){return Fr(t,ye,ke).top==_e},c<0==(V.level==1)?V.from:V.to-1,ne),te=="before"&&(ne=Fa(n,ne,1))}else ne=c<0?V.to:V.from;return new je(i,ne,te)}}return new je(i,c<0?n.text.length:0,c<0?"before":"after")}function Ml(e,t,n,i){var c=He(t,e.doc.direction);if(!c)return Ba(t,n,i);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var P=We(c,n.ch,n.sticky),V=c[P];if(e.doc.direction=="ltr"&&V.level%2==0&&(i>0?V.to>n.ch:V.from<n.ch))return Ba(t,n,i);var Z=function($e,tt){return Fa(t,$e instanceof je?$e.ch:$e,tt)},te,ne=function($e){return e.options.lineWrapping?(te=te||Ri(e,t),cs(e,t,te,$e)):{begin:0,end:t.text.length}},ye=ne(n.sticky=="before"?Z(n,-1):n.ch);if(e.doc.direction=="rtl"||V.level==1){var _e=V.level==1==i<0,ke=Z(n,_e?1:-1);if(ke!=null&&(_e?ke<=V.to&&ke<=ye.end:ke>=V.from&&ke>=ye.begin)){var Ie=_e?"before":"after";return new je(n.line,ke,Ie)}}var Fe=function($e,tt,Je){for(var nt=function(Nt,Zt){return Zt?new je(n.line,Z(Nt,1),"before"):new je(n.line,Nt,"after")};$e>=0&&$e<c.length;$e+=tt){var ht=c[$e],lt=tt>0==(ht.level!=1),bt=lt?Je.begin:Z(Je.end,-1);if(ht.from<=bt&&bt<ht.to)return nt(bt,lt);if(bt=lt?ht.from:Z(ht.to,-1),Je.begin<=bt&&bt<Je.end)return nt(bt,lt)}},Be=Fe(P+i,i,ye);if(Be)return Be;var Ve=i>0?ye.end:Z(ye.begin,-1);return Ve!=null&&!(i>0&&Ve==t.text.length)&&(Be=Fe(i>0?0:c.length-1,i,ne(Ve)),Be)?Be:null}var xn={selectAll:Vs,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),be)},killLine:function(e){return ji(e,function(t){if(t.empty()){var n=Ze(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:je(t.head.line+1,0)}:{from:t.head,to:je(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return ji(e,function(t){return{from:je(t.from().line,0),to:gt(e.doc,je(t.to().line+1,0))}})},delLineLeft:function(e){return ji(e,function(t){return{from:je(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return ji(e,function(t){var n=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:0,top:n},"div");return{from:i,to:t.from()}})},delWrappedLineRight:function(e){return ji(e,function(t){var n=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:i}})},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(je(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(je(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return uo(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ho(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Pl(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")},Se)},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")},Se)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,i=e.coordsChar({left:0,top:n},"div");return i.ch<e.getLine(i.line).search(/\S/)?ho(e,t.head):i},Se)},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(),i=e.options.tabSize,c=0;c<n.length;c++){var P=n[c].from(),V=W(e.getLine(P.line),P.ch,i);t.push(X(i-V%i))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return br(e,function(){for(var t=e.listSelections(),n=[],i=0;i<t.length;i++){if(!t[i].empty())continue;var c=t[i].head,P=Ze(e.doc,c.line).text;if(P){if(c.ch==P.length&&(c=new je(c.line,c.ch-1)),c.ch>0)c=new je(c.line,c.ch+1),e.replaceRange(P.charAt(c.ch-1)+P.charAt(c.ch-2),je(c.line,c.ch-2),c,"+transpose");else if(c.line>e.doc.first){var V=Ze(e.doc,c.line-1).text;V&&(c=new je(c.line,1),e.replaceRange(P.charAt(0)+e.doc.lineSeparator()+V.charAt(V.length-1),je(c.line-1,V.length-1),c,"+transpose"))}}n.push(new Dt(c,c))}e.setSelections(n)})},newlineAndIndent:function(e){return br(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 i=0;i<t.length;i++)e.indentLine(t[i].from().line,null,!0);Di(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function uo(e,t){var n=Ze(e.doc,t),i=xr(n);return i!=n&&(t=pt(i)),Ua(!0,e,i,t,1)}function Pl(e,t){var n=Ze(e.doc,t),i=Pn(n);return i!=n&&(t=pt(i)),Ua(!0,e,n,t,-1)}function ho(e,t){var n=uo(e,t.line),i=Ze(e.doc,n.line),c=He(i,e.doc.direction);if(!c||c[0].level==0){var P=Math.max(n.ch,i.text.search(/\S/)),V=t.line==n.line&&t.ch<=P&&t.ch;return je(n.line,V?0:P,n.sticky)}return n}function ea(e,t,n){if(typeof t=="string"&&(t=xn[t],!t))return!1;e.display.input.ensurePolled();var i=e.display.shift,c=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),c=t(e)!=Ce}finally{e.display.shift=i,e.state.suppressEdits=!1}return c}function Nl(e,t,n){for(var i=0;i<e.state.keyMaps.length;i++){var c=Ui(t,e.state.keyMaps[i],n,e);if(c)return c}return e.options.extraKeys&&Ui(t,e.options.extraKeys,n,e)||Ui(t,e.options.keyMap,n,e)}var Fl=new $;function Tn(e,t,n,i){var c=e.state.keySeq;if(c){if(so(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Fl.set(50,function(){e.state.keySeq==c&&(e.state.keySeq=null,e.display.input.reset())}),co(e,c+" "+t,n,i))return!0}return co(e,t,n,i)}function co(e,t,n,i){var c=Nl(e,t,i);return c=="multi"&&(e.state.keySeq=t),c=="handled"&&er(e,"keyHandled",e,t,n),(c=="handled"||c=="multi")&&(ie(n),xa(e)),!!c}function fo(e,t){var n=lo(t,!0);return n?t.shiftKey&&!e.state.keySeq?Tn(e,"Shift-"+n,t,function(i){return ea(e,i,!0)})||Tn(e,n,t,function(i){if(typeof i=="string"?/^go[A-Z]/.test(i):i.motion)return ea(e,i)}):Tn(e,n,t,function(i){return ea(e,i)}):!1}function Bl(e,t,n){return Tn(e,"'"+n+"'",t,function(i){return ea(e,i,!0)})}var ja=null;function po(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=j(),ee(t,e))return;z&&G<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var i=fo(t,e);m&&(ja=i?n:null,!i&&n==88&&!Lt&&(s?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),N&&!s&&!i&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Ul(t)}function Ul(e){var t=e.display.lineDiv;B(t,"CodeMirror-crosshair");function n(i){(i.keyCode==18||!i.altKey)&&(R(t,"CodeMirror-crosshair"),qe(document,"keyup",n),qe(document,"mouseover",n))}Me(document,"keyup",n),Me(document,"mouseover",n)}function mo(e){e.keyCode==16&&(this.doc.sel.shift=!1),ee(this,e)}function go(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Gr(t.display,e)||ee(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var n=e.keyCode,i=e.charCode;if(m&&n==ja){ja=null,ie(e);return}if(m&&(!e.which||e.which<10)&&fo(t,e))return;var c=String.fromCharCode(i==null?n:i);if(c=="\b")return;if(Bl(t,e,c))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 wn,Sn;function Hl(e,t){var n=+new Date;return Sn&&Sn.compare(n,e,t)?(wn=Sn=null,"triple"):wn&&wn.compare(n,e,t)?(Sn=new Ha(n,e,t),wn=null,"double"):(wn=new Ha(n,e,t),Sn=null,"single")}function vo(e){var t=this,n=t.display;if(ee(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,Gr(n,e)){r||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Wa(t,e))return;var i=ci(t,e),c=Le(e),P=i?Hl(i,c):"single";if(window.focus(),c==1&&t.state.selectingText&&t.state.selectingText(e),i&&Wl(t,c,i,P,e))return;c==1?i?Kl(t,i,P,e):Ee(e)==n.scroller&&ie(e):c==2?(i&&Xn(t.doc,i),setTimeout(function(){return n.input.focus()},20)):c==3&&(D?t.display.input.onContextMenu(e):vs(t))}function Wl(e,t,n,i,c){var P="Click";return i=="double"?P="Double"+P:i=="triple"&&(P="Triple"+P),P=(t==1?"Left":t==2?"Middle":"Right")+P,Tn(e,oo(P,c),c,function(V){if(typeof V=="string"&&(V=xn[V]),!V)return!1;var Z=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Z=V(e,n)!=Ce}finally{e.state.suppressEdits=!1}return Z})}function Gl(e,t,n){var i=e.getOption("configureMouse"),c=i?i(e,t,n):{};if(c.unit==null){var P=a?n.shiftKey&&n.metaKey:n.altKey;c.unit=P?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(c.extend==null||e.doc.extend)&&(c.extend=e.doc.extend||n.shiftKey),c.addNew==null&&(c.addNew=s?n.metaKey:n.ctrlKey),c.moveOnDrag==null&&(c.moveOnDrag=!(s?n.altKey:n.ctrlKey)),c}function Kl(e,t,n,i){z?setTimeout(I(gs,e),0):e.curOp.focus=j();var c=Gl(e,n,i),P=e.doc.sel,V;e.options.dragDrop&&Pe&&!e.isReadOnly()&&n=="single"&&(V=P.contains(t))>-1&&(ft((V=P.ranges[V]).from(),t)<0||t.xRel>0)&&(ft(V.to(),t)>0||t.xRel<0)?zl(e,i,t,c):Vl(e,i,t,c)}function zl(e,t,n,i){var c=e.display,P=!1,V=Jt(e,function(ne){r&&(c.scroller.draggable=!1),e.state.draggingText=!1,qe(c.wrapper.ownerDocument,"mouseup",V),qe(c.wrapper.ownerDocument,"mousemove",Z),qe(c.scroller,"dragstart",te),qe(c.scroller,"drop",V),P||(ie(ne),i.addNew||Xn(e.doc,n,null,null,i.extend),r&&!p||z&&G==9?setTimeout(function(){c.wrapper.ownerDocument.body.focus({preventScroll:!0}),c.input.focus()},20):c.input.focus())}),Z=function(ne){P=P||Math.abs(t.clientX-ne.clientX)+Math.abs(t.clientY-ne.clientY)>=10},te=function(){return P=!0};r&&(c.scroller.draggable=!0),e.state.draggingText=V,V.copy=!i.moveOnDrag,c.scroller.dragDrop&&c.scroller.dragDrop(),Me(c.wrapper.ownerDocument,"mouseup",V),Me(c.wrapper.ownerDocument,"mousemove",Z),Me(c.scroller,"dragstart",te),Me(c.scroller,"drop",V),vs(e),setTimeout(function(){return c.input.focus()},20)}function yo(e,t,n){if(n=="char")return new Dt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new Dt(je(t.line,0),gt(e.doc,je(t.line+1,0)));var i=n(e,t);return new Dt(i.from,i.to)}function Vl(e,t,n,i){var c=e.display,P=e.doc;ie(t);var V,Z,te=P.sel,ne=te.ranges;if(i.addNew&&!i.extend?(Z=P.sel.contains(n),Z>-1?V=ne[Z]:V=new Dt(n,n)):(V=P.sel.primary(),Z=P.sel.primIndex),i.unit=="rectangle")i.addNew||(V=new Dt(n,n)),n=ci(e,t,!0,!0),Z=-1;else{var ye=yo(e,n,i.unit);i.extend?V=Pa(V,ye.anchor,ye.head,i.extend):V=ye}i.addNew?Z==-1?(Z=ne.length,nr(P,kr(e,ne.concat([V]),Z),{scroll:!1,origin:"*mouse"})):ne.length>1&&ne[Z].empty()&&i.unit=="char"&&!i.extend?(nr(P,kr(e,ne.slice(0,Z).concat(ne.slice(Z+1)),0),{scroll:!1,origin:"*mouse"}),te=P.sel):Na(P,Z,V,Ae):(Z=0,nr(P,new wr([V],0),Ae),te=P.sel);var _e=n;function ke(Je){if(ft(_e,Je)==0)return;if(_e=Je,i.unit=="rectangle"){for(var nt=[],ht=e.options.tabSize,lt=W(Ze(P,n.line).text,n.ch,ht),bt=W(Ze(P,Je.line).text,Je.ch,ht),Nt=Math.min(lt,bt),Zt=Math.max(lt,bt),Wt=Math.min(n.line,Je.line),_r=Math.min(e.lastLine(),Math.max(n.line,Je.line));Wt<=_r;Wt++){var gr=Ze(P,Wt).text,Vt=Re(gr,Nt,ht);Nt==Zt?nt.push(new Dt(je(Wt,Vt),je(Wt,Vt))):gr.length>Vt&&nt.push(new Dt(je(Wt,Vt),je(Wt,Re(gr,Zt,ht))))}nt.length||nt.push(new Dt(n,n)),nr(P,kr(e,te.ranges.slice(0,Z).concat(nt),Z),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Je)}else{var vr=V,tr=yo(e,Je,i.unit),$t=vr.anchor,Yt;ft(tr.anchor,$t)>0?(Yt=tr.head,$t=ii(vr.from(),tr.anchor)):(Yt=tr.anchor,$t=_i(vr.to(),tr.head));var Gt=te.ranges.slice(0);Gt[Z]=Yl(e,new Dt(gt(P,$t),Yt)),nr(P,kr(e,Gt,Z),Ae)}}var Ie=c.wrapper.getBoundingClientRect(),Fe=0;function Be(Je){var nt=++Fe,ht=ci(e,Je,!0,i.unit=="rectangle");if(!ht)return;if(ft(ht,_e)!=0){e.curOp.focus=j(),ke(ht);var lt=Wn(c,P);(ht.line>=lt.to||ht.line<lt.from)&&setTimeout(Jt(e,function(){Fe==nt&&Be(Je)}),150)}else{var bt=Je.clientY<Ie.top?-20:Je.clientY>Ie.bottom?20:0;bt&&setTimeout(Jt(e,function(){if(Fe!=nt)return;c.scroller.scrollTop+=bt,Be(Je)}),50)}}function Ve(Je){e.state.selectingText=!1,Fe=Infinity,Je&&(ie(Je),c.input.focus()),qe(c.wrapper.ownerDocument,"mousemove",$e),qe(c.wrapper.ownerDocument,"mouseup",tt),P.history.lastSelOrigin=null}var $e=Jt(e,function(Je){Je.buttons===0||!Le(Je)?Ve(Je):Be(Je)}),tt=Jt(e,Ve);e.state.selectingText=tt,Me(c.wrapper.ownerDocument,"mousemove",$e),Me(c.wrapper.ownerDocument,"mouseup",tt)}function Yl(e,t){var n=t.anchor,i=t.head,c=Ze(e.doc,n.line);if(ft(n,i)==0&&n.sticky==i.sticky)return t;var P=He(c);if(!P)return t;var V=We(P,n.ch,n.sticky),Z=P[V];if(Z.from!=n.ch&&Z.to!=n.ch)return t;var te=V+(Z.from==n.ch==(Z.level!=1)?0:1);if(te==0||te==P.length)return t;var ne;if(i.line!=n.line)ne=(i.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ye=We(P,i.ch,i.sticky),_e=ye-V||(i.ch-n.ch)*(Z.level==1?-1:1);ye==te-1||ye==te?ne=_e<0:ne=_e>0}var ke=P[te+(ne?-1:0)],Ie=ne==(ke.level==1),Fe=Ie?ke.from:ke.to,Be=Ie?"after":"before";return n.ch==Fe&&n.sticky==Be?t:new Dt(new je(n.line,Fe,Be),i)}function bo(e,t,n,i){var c,P;if(t.touches)c=t.touches[0].clientX,P=t.touches[0].clientY;else try{c=t.clientX,P=t.clientY}catch(ke){return!1}if(c>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;i&&ie(t);var V=e.display,Z=V.lineDiv.getBoundingClientRect();if(P>Z.bottom||!ae(e,n))return pe(t);P-=Z.top-V.viewOffset;for(var te=0;te<e.display.gutterSpecs.length;++te){var ne=V.gutters.childNodes[te];if(ne&&ne.getBoundingClientRect().right>=c){var ye=wt(e.doc,P),_e=e.display.gutterSpecs[te];return he(e,n,e,ye,_e.className,t),pe(t)}}}function Wa(e,t){return bo(e,t,"gutterClick",!0)}function _o(e,t){if(Gr(e.display,t)||Xl(e,t))return;if(ee(e,t,"contextmenu"))return;D||e.display.input.onContextMenu(t)}function Xl(e,t){return ae(e,"gutterContextMenu")?bo(e,t,"gutterContextMenu",!1):!1}function Eo(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),an(e)}var Hi={toString:function(){return"CodeMirror.Init"}},xo={},ta={};function $l(e){var t=e.optionHandlers;function n(i,c,P,V){e.defaults[i]=c,P&&(t[i]=V?function(Z,te,ne){ne!=Hi&&P(Z,te,ne)}:P)}e.defineOption=n,e.Init=Hi,n("value","",function(i,c){return i.setValue(c)},!0),n("mode",null,function(i,c){i.doc.modeOption=c,Da(i)},!0),n("indentUnit",2,Da,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(i){fn(i),an(i),pr(i)},!0),n("lineSeparator",null,function(i,c){if(i.doc.lineSep=c,!c)return;var P=[],V=i.doc.first;i.doc.iter(function(te){for(var ne=0;;){var ye=te.text.indexOf(c,ne);if(ye==-1)break;ne=ye+c.length,P.push(je(V,ye))}V++});for(var Z=P.length-1;Z>=0;Z--)Fi(i.doc,c,P[Z],je(P[Z].line,P[Z].ch+c.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(i,c,P){i.state.specialChars=new RegExp(c.source+(c.test(" ")?"":"| "),"g"),P!=Hi&&i.refresh()}),n("specialCharPlaceholder",Pt,function(i){return i.refresh()},!0),n("electricChars",!0),n("inputStyle",l?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(i,c){return i.getInputField().spellcheck=c},!0),n("autocorrect",!1,function(i,c){return i.getInputField().autocorrect=c},!0),n("autocapitalize",!1,function(i,c){return i.getInputField().autocapitalize=c},!0),n("rtlMoveVisually",!S),n("wholeLineUpdateBefore",!0),n("theme","default",function(i){Eo(i),dn(i)},!0),n("keyMap","default",function(i,c,P){var V=qn(c),Z=P!=Hi&&qn(P);Z&&Z.detach&&Z.detach(i,V),V.attach&&V.attach(i,Z||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Ql,!0),n("gutters",[],function(i,c){i.display.gutterSpecs=La(c,i.options.lineNumbers),dn(i)},!0),n("fixedGutter",!0,function(i,c){i.display.gutters.style.left=c?_a(i.display)+"px":"0",i.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(i){return ki(i)},!0),n("scrollbarStyle","native",function(i){Ts(i),ki(i),i.display.scrollbars.setScrollTop(i.doc.scrollTop),i.display.scrollbars.setScrollLeft(i.doc.scrollLeft)},!0),n("lineNumbers",!1,function(i,c){i.display.gutterSpecs=La(i.options.gutters,c),dn(i)},!0),n("firstLineNumber",1,dn,!0),n("lineNumberFormatter",function(i){return i},dn,!0),n("showCursorWhenSelecting",!1,sn,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(i,c){c=="nocursor"&&(Ii(i),i.display.input.blur()),i.display.input.readOnlyChanged(c)}),n("screenReaderLabel",null,function(i,c){c=c===""?null:c,i.display.input.screenReaderLabelChanged(c)}),n("disableInput",!1,function(i,c){c||i.display.input.reset()},!0),n("dragDrop",!0,Jl),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,sn,!0),n("singleCursorHeightPerLine",!0,sn,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,fn,!0),n("addModeClass",!1,fn,!0),n("pollInterval",100),n("undoDepth",200,function(i,c){return i.doc.history.undoDepth=c}),n("historyEventDelay",1250),n("viewportMargin",10,function(i){return i.refresh()},!0),n("maxHighlightLength",1e4,fn,!0),n("moveInputWithCursor",!0,function(i,c){c||i.display.input.resetPosition()}),n("tabindex",null,function(i,c){return i.display.input.getField().tabIndex=c||""}),n("autofocus",null),n("direction","ltr",function(i,c){return i.doc.setDirection(c)},!0),n("phrases",null)}function Jl(e,t,n){var i=n&&n!=Hi;if(!t!=!i){var c=e.display.dragFunctions,P=t?Me:qe;P(e.display.scroller,"dragstart",c.start),P(e.display.scroller,"dragenter",c.enter),P(e.display.scroller,"dragover",c.over),P(e.display.scroller,"dragleave",c.leave),P(e.display.scroller,"drop",c.drop)}}function Ql(e){e.options.lineWrapping?(B(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(R(e.display.wrapper,"CodeMirror-wrap"),Nn(e)),Ea(e),pr(e),an(e),setTimeout(function(){return ki(e)},100)}function jt(e,t){var n=this;if(!(this instanceof jt))return new jt(e,t);this.options=t=t?g(t):{},g(xo,t,!1);var i=t.value;typeof i=="string"?i=new mr(i,t.mode,null,t.lineSeparator,t.direction):t.mode&&(i.modeOption=t.mode),this.doc=i;var c=new jt.inputStyles[t.inputStyle](this),P=this.display=new hl(e,i,c,t);P.wrapper.CodeMirror=this,Eo(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ts(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 $,keySeq:null,specialChars:null},t.autofocus&&!l&&P.input.focus(),z&&G<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),Ol(),mi(this),this.curOp.forceUpdate=!0,ks(this,i),t.autofocus&&!l||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Ta(n)},20):Ii(this);for(var V in ta)ta.hasOwnProperty(V)&&ta[V](this,t[V],Hi);Cs(this),t.finishInit&&t.finishInit(this);for(var Z=0;Z<Ga.length;++Z)Ga[Z](this);gi(this),r&&t.lineWrapping&&getComputedStyle(P.lineDiv).textRendering=="optimizelegibility"&&(P.lineDiv.style.textRendering="auto")}jt.defaults=xo,jt.optionHandlers=ta;function Zl(e){var t=e.display;Me(t.scroller,"mousedown",Jt(e,vo)),z&&G<11?Me(t.scroller,"dblclick",Jt(e,function(te){if(ee(e,te))return;var ne=ci(e,te);if(!ne||Wa(e,te)||Gr(e.display,te))return;ie(te);var ye=e.findWordAt(ne);Xn(e.doc,ye.anchor,ye.head)})):Me(t.scroller,"dblclick",function(te){return ee(e,te)||ie(te)}),Me(t.scroller,"contextmenu",function(te){return _o(e,te)}),Me(t.input.getField(),"contextmenu",function(te){t.scroller.contains(te.target)||_o(e,te)});var n,i={end:0};function c(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),i=t.activeTouch,i.end=+new Date)}function P(te){if(te.touches.length!=1)return!1;var ne=te.touches[0];return ne.radiusX<=1&&ne.radiusY<=1}function V(te,ne){if(ne.left==null)return!0;var ye=ne.left-te.left,_e=ne.top-te.top;return ye*ye+_e*_e>20*20}Me(t.scroller,"touchstart",function(te){if(!ee(e,te)&&!P(te)&&!Wa(e,te)){t.input.ensurePolled(),clearTimeout(n);var ne=+new Date;t.activeTouch={start:ne,moved:!1,prev:ne-i.end<=300?i:null},te.touches.length==1&&(t.activeTouch.left=te.touches[0].pageX,t.activeTouch.top=te.touches[0].pageY)}}),Me(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Me(t.scroller,"touchend",function(te){var ne=t.activeTouch;if(ne&&!Gr(t,te)&&ne.left!=null&&!ne.moved&&new Date-ne.start<300){var ye=e.coordsChar(t.activeTouch,"page"),_e;!ne.prev||V(ne,ne.prev)?_e=new Dt(ye,ye):!ne.prev.prev||V(ne,ne.prev.prev)?_e=e.findWordAt(ye):_e=new Dt(je(ye.line,0),gt(e.doc,je(ye.line+1,0))),e.setSelection(_e.anchor,_e.head),e.focus(),ie(te)}c()}),Me(t.scroller,"touchcancel",c),Me(t.scroller,"scroll",function(){t.scroller.clientHeight&&(ln(e,t.scroller.scrollTop),fi(e,t.scroller.scrollLeft,!0),he(e,"scroll",e))}),Me(t.scroller,"mousewheel",function(te){return Os(e,te)}),Me(t.scroller,"DOMMouseScroll",function(te){return Os(e,te)}),Me(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(te){ee(e,te)||me(te)},over:function(te){ee(e,te)||(Rl(e,te),me(te))},start:function(te){return Al(e,te)},drop:Jt(e,Cl),leave:function(te){ee(e,te)||io(e)}};var Z=t.input.getField();Me(Z,"keyup",function(te){return mo.call(e,te)}),Me(Z,"keydown",Jt(e,po)),Me(Z,"keypress",Jt(e,go)),Me(Z,"focus",function(te){return Ta(e,te)}),Me(Z,"blur",function(te){return Ii(e,te)})}var Ga=[];jt.defineInitHook=function(e){return Ga.push(e)};function Cn(e,t,n,i){var c=e.doc,P;n==null&&(n="add"),n=="smart"&&(c.mode.indent?P=Ar(e,t).state:n="prev");var V=e.options.tabSize,Z=Ze(c,t),te=W(Z.text,null,V);Z.stateAfter&&(Z.stateAfter=null);var ne=Z.text.match(/^\s*/)[0],ye;if(!i&&!/\S/.test(Z.text))ye=0,n="not";else if(n=="smart"&&(ye=c.mode.indent(P,Z.text.slice(ne.length),Z.text),ye==Ce||ye>150)){if(!i)return;n="prev"}n=="prev"?t>c.first?ye=W(Ze(c,t-1).text,null,V):ye=0:n=="add"?ye=te+e.options.indentUnit:n=="subtract"?ye=te-e.options.indentUnit:typeof n=="number"&&(ye=te+n),ye=Math.max(0,ye);var _e="",ke=0;if(e.options.indentWithTabs)for(var Ie=Math.floor(ye/V);Ie;--Ie)ke+=V,_e+=" ";if(ke<ye&&(_e+=X(ye-ke)),_e!=ne)return Fi(c,_e,je(t,0),je(t,ne.length),"+input"),Z.stateAfter=null,!0;for(var Fe=0;Fe<c.sel.ranges.length;Fe++){var Be=c.sel.ranges[Fe];if(Be.head.line==t&&Be.head.ch<ne.length){var Ve=je(t,ne.length);Na(c,Fe,new Dt(Ve,Ve));break}}}var Mr=null;function ra(e){Mr=e}function Ka(e,t,n,i,c){var P=e.doc;e.display.shift=!1,i||(i=P.sel);var V=+new Date-200,Z=c=="paste"||e.state.pasteIncoming>V,te=ot(t),ne=null;if(Z&&i.ranges.length>1)if(Mr&&Mr.text.join(`
|
|
`)==t){if(i.ranges.length%Mr.text.length==0){ne=[];for(var ye=0;ye<Mr.text.length;ye++)ne.push(P.splitLines(Mr.text[ye]))}}else te.length==i.ranges.length&&e.options.pasteLinesPerSelection&&(ne=k(te,function($e){return[$e]}));for(var _e=e.curOp.updateInput,ke=i.ranges.length-1;ke>=0;ke--){var Ie=i.ranges[ke],Fe=Ie.from(),Be=Ie.to();Ie.empty()&&(n&&n>0?Fe=je(Fe.line,Fe.ch-n):e.state.overwrite&&!Z?Be=je(Be.line,Math.min(Ze(P,Be.line).text.length,Be.ch+_(te).length)):Z&&Mr&&Mr.lineWise&&Mr.text.join(`
|
|
`)==te.join(`
|
|
`)&&(Fe=Be=je(Fe.line,0)));var Ve={from:Fe,to:Be,text:ne?ne[ke%ne.length]:te,origin:c||(Z?"paste":e.state.cutIncoming>V?"cut":"+input")};Ni(e.doc,Ve),er(e,"inputRead",e,Ve)}t&&!Z&&wo(e,t),Di(e),e.curOp.updateInput<2&&(e.curOp.updateInput=_e),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function To(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&br(t,function(){return Ka(t,n,0,null,"paste")}),!0}function wo(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,i=n.ranges.length-1;i>=0;i--){var c=n.ranges[i];if(c.head.ch>100||i&&n.ranges[i-1].head.line==c.head.line)continue;var P=e.getModeAt(c.head),V=!1;if(P.electricChars){for(var Z=0;Z<P.electricChars.length;Z++)if(t.indexOf(P.electricChars.charAt(Z))>-1){V=Cn(e,c.head.line,"smart");break}}else P.electricInput&&(P.electricInput.test(Ze(e.doc,c.head.line).text.slice(0,c.head.ch))&&(V=Cn(e,c.head.line,"smart")));V&&er(e,"electricInput",e,c.head.line)}}function So(e){for(var t=[],n=[],i=0;i<e.doc.sel.ranges.length;i++){var c=e.doc.sel.ranges[i].head.line,P={anchor:je(c,0),head:je(c+1,0)};n.push(P),t.push(e.getRange(P.anchor,P.head))}return{text:t,ranges:n}}function Co(e,t,n,i){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",i?"":"off"),e.setAttribute("spellcheck",!!t)}function Ao(){var e=d("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=d("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return r?e.style.width="1000px":e.setAttribute("wrap","off"),f&&(e.style.border="1px solid black"),Co(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(i,c){var P=this.options,V=P[i];if(P[i]==c&&i!="mode")return;P[i]=c,t.hasOwnProperty(i)&&Jt(this,t[i])(this,c,V),he(this,"optionChange",this,i)},getOption:function(i){return this.options[i]},getDoc:function(){return this.doc},addKeyMap:function(i,c){this.state.keyMaps[c?"push":"unshift"](qn(i))},removeKeyMap:function(i){for(var c=this.state.keyMaps,P=0;P<c.length;++P)if(c[P]==i||c[P].name==i)return c.splice(P,1),!0},addOverlay:ur(function(i,c){var P=i.token?i:e.getMode(this.options,i);if(P.startState)throw new Error("Overlays may not be stateful.");U(this.state.overlays,{mode:P,modeSpec:i,opaque:c&&c.opaque,priority:c&&c.priority||0},function(V){return V.priority}),this.state.modeGen++,pr(this)}),removeOverlay:ur(function(i){for(var c=this.state.overlays,P=0;P<c.length;++P){var V=c[P].modeSpec;if(V==i||typeof i=="string"&&V.name==i){c.splice(P,1),this.state.modeGen++,pr(this);return}}}),indentLine:ur(function(i,c,P){typeof c!="string"&&typeof c!="number"&&(c==null?c=this.options.smartIndent?"smart":"prev":c=c?"add":"subtract"),rr(this.doc,i)&&Cn(this,i,c,P)}),indentSelection:ur(function(i){for(var c=this.doc.sel.ranges,P=-1,V=0;V<c.length;V++){var Z=c[V];if(Z.empty())Z.head.line>P&&(Cn(this,Z.head.line,i,!0),P=Z.head.line,V==this.doc.sel.primIndex&&Di(this));else{var te=Z.from(),ne=Z.to(),ye=Math.max(P,te.line);P=Math.min(this.lastLine(),ne.line-(ne.ch?0:1))+1;for(var _e=ye;_e<P;++_e)Cn(this,_e,i);var ke=this.doc.sel.ranges;te.ch==0&&c.length==ke.length&&ke[V].from().ch>0&&Na(this.doc,V,new Dt(te,ke[V].to()),be)}}}),getTokenAt:function(i,c){return Rn(this,i,c)},getLineTokens:function(i,c){return Rn(this,je(i),c,!0)},getTokenTypeAt:function(i){i=gt(this.doc,i);var c=ni(this,Ze(this.doc,i.line)),P=0,V=(c.length-1)/2,Z=i.ch,te;if(Z==0)te=c[2];else for(;;){var ne=P+V>>1;if((ne?c[ne*2-1]:0)>=Z)V=ne;else if(c[ne*2+1]<Z)P=ne+1;else{te=c[ne*2+2];break}}var ye=te?te.indexOf("overlay "):-1;return ye<0?te:ye==0?null:te.slice(0,ye-1)},getModeAt:function(i){var c=this.doc.mode;return c.innerMode?e.innerMode(c,this.getTokenAt(i).state).mode:c},getHelper:function(i,c){return this.getHelpers(i,c)[0]},getHelpers:function(i,c){var P=[];if(!n.hasOwnProperty(c))return P;var V=n[c],Z=this.getModeAt(i);if(typeof Z[c]=="string")V[Z[c]]&&P.push(V[Z[c]]);else if(Z[c])for(var te=0;te<Z[c].length;te++){var ne=V[Z[c][te]];ne&&P.push(ne)}else Z.helperType&&V[Z.helperType]?P.push(V[Z.helperType]):V[Z.name]&&P.push(V[Z.name]);for(var ye=0;ye<V._global.length;ye++){var _e=V._global[ye];_e.pred(Z,this)&&le(P,_e.val)==-1&&P.push(_e.val)}return P},getStateAfter:function(i,c){var P=this.doc;return i=Ei(P,i==null?P.first+P.size-1:i),Ar(this,i+1,c).state},cursorCoords:function(i,c){var P,V=this.doc.sel.primary();return i==null?P=V.head:typeof i=="object"?P=gt(this.doc,i):P=i?V.from():V.to(),Dr(this,P,c||"page")},charCoords:function(i,c){return ma(this,gt(this.doc,i),c||"page")},coordsChar:function(i,c){return i=ls(this,i,c||"page"),va(this,i.left,i.top)},lineAtHeight:function(i,c){return i=ls(this,{top:i,left:0},c||"page").top,wt(this.doc,i+this.display.viewOffset)},heightAtLine:function(i,c,P){var V=!1,Z;if(typeof i=="number"){var te=this.doc.first+this.doc.size-1;i<this.doc.first?i=this.doc.first:i>te&&(i=te,V=!0),Z=Ze(this.doc,i)}else Z=i;return Bn(this,Z,{top:0,left:0},c||"page",P||V).top+(V?this.doc.height-Ir(Z):0)},defaultTextHeight:function(){return Oi(this.display)},defaultCharWidth:function(){return Li(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(i,c,P,V,Z){var te=this.display;i=Dr(this,gt(this.doc,i));var ne=i.bottom,ye=i.left;if(c.style.position="absolute",c.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(c),te.sizer.appendChild(c),V=="over")ne=i.top;else if(V=="above"||V=="near"){var _e=Math.max(te.wrapper.clientHeight,this.doc.height),ke=Math.max(te.sizer.clientWidth,te.lineSpace.clientWidth);(V=="above"||i.bottom+c.offsetHeight>_e)&&i.top>c.offsetHeight?ne=i.top-c.offsetHeight:i.bottom+c.offsetHeight<=_e&&(ne=i.bottom),ye+c.offsetWidth>ke&&(ye=ke-c.offsetWidth)}c.style.top=ne+"px",c.style.left=c.style.right="",Z=="right"?(ye=te.sizer.clientWidth-c.offsetWidth,c.style.right="0px"):(Z=="left"?ye=0:Z=="middle"&&(ye=(te.sizer.clientWidth-c.offsetWidth)/2),c.style.left=ye+"px"),P&&Jo(this,{left:ye,top:ne,right:ye+c.offsetWidth,bottom:ne+c.offsetHeight})},triggerOnKeyDown:ur(po),triggerOnKeyPress:ur(go),triggerOnKeyUp:mo,triggerOnMouseDown:ur(vo),execCommand:function(i){if(xn.hasOwnProperty(i))return xn[i].call(null,this)},triggerElectric:ur(function(i){wo(this,i)}),findPosH:function(i,c,P,V){var Z=1;c<0&&(Z=-1,c=-c);for(var te=gt(this.doc,i),ne=0;ne<c&&!(te=za(this.doc,te,Z,P,V),te.hitSide);++ne);return te},moveH:ur(function(i,c){var P=this;this.extendSelectionsBy(function(V){return P.display.shift||P.doc.extend||V.empty()?za(P.doc,V.head,i,c,P.options.rtlMoveVisually):i<0?V.from():V.to()},Se)}),deleteH:ur(function(i,c){var P=this.doc.sel,V=this.doc;P.somethingSelected()?V.replaceSelection("",null,"+delete"):ji(this,function(Z){var te=za(V,Z.head,i,c,!1);return i<0?{from:te,to:Z.head}:{from:Z.head,to:te}})}),findPosV:function(i,c,P,V){var Z=1,te=V;c<0&&(Z=-1,c=-c);for(var ne=gt(this.doc,i),ye=0;ye<c;++ye){var _e=Dr(this,ne,"div");if(te==null?te=_e.left:_e.left=te,ne=Ro(this,_e,Z,P),ne.hitSide)break}return ne},moveV:ur(function(i,c){var P=this,V=this.doc,Z=[],te=!this.display.shift&&!V.extend&&V.sel.somethingSelected();if(V.extendSelectionsBy(function(ye){if(te)return i<0?ye.from():ye.to();var _e=Dr(P,ye.head,"div");ye.goalColumn!=null&&(_e.left=ye.goalColumn),Z.push(_e.left);var ke=Ro(P,_e,i,c);return c=="page"&&ye==V.sel.primary()&&Sa(P,ma(P,ke,"div").top-_e.top),ke},Se),Z.length)for(var ne=0;ne<V.sel.ranges.length;ne++)V.sel.ranges[ne].goalColumn=Z[ne]}),findWordAt:function(i){var c=this.doc,P=Ze(c,i.line).text,V=i.ch,Z=i.ch;if(P){var te=this.getHelper(i,"wordChars");(i.sticky=="before"||Z==P.length)&&V?--V:++Z;for(var ne=P.charAt(V),ye=De(ne,te)?function(_e){return De(_e,te)}:/\s/.test(ne)?function(_e){return/\s/.test(_e)}:function(_e){return!/\s/.test(_e)&&!De(_e)};V>0&&ye(P.charAt(V-1));)--V;for(;Z<P.length&&ye(P.charAt(Z));)++Z}return new Dt(je(i.line,V),je(i.line,Z))},toggleOverwrite:function(i){if(i!=null&&i==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?B(this.display.cursorDiv,"CodeMirror-overwrite"):R(this.display.cursorDiv,"CodeMirror-overwrite"),he(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==j()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:ur(function(i,c){on(this,i,c)}),getScrollInfo:function(){var i=this.display.scroller;return{left:i.scrollLeft,top:i.scrollTop,height:i.scrollHeight-Nr(this)-this.display.barHeight,width:i.scrollWidth-Nr(this)-this.display.barWidth,clientHeight:da(this),clientWidth:ui(this)}},scrollIntoView:ur(function(i,c){i==null?(i={from:this.doc.sel.primary().head,to:null},c==null&&(c=this.options.cursorScrollMargin)):typeof i=="number"?i={from:je(i,0),to:null}:i.from==null&&(i={from:i,to:null}),i.to||(i.to=i.from),i.margin=c||0,i.from.line!=null?Qo(this,i):bs(this,i.from,i.to,i.margin)}),setSize:ur(function(i,c){var P=this,V=function(te){return typeof te=="number"||/^\d+$/.test(String(te))?te+"px":te};i!=null&&(this.display.wrapper.style.width=V(i)),c!=null&&(this.display.wrapper.style.height=V(c)),this.options.lineWrapping&&as(this);var Z=this.display.viewFrom;this.doc.iter(Z,this.display.viewTo,function(te){if(te.widgets){for(var ne=0;ne<te.widgets.length;ne++)if(te.widgets[ne].noHScroll){Xr(P,Z,"widget");break}}++Z}),this.curOp.forceUpdate=!0,he(this,"refresh",this)}),operation:function(i){return br(this,i)},startOperation:function(){return mi(this)},endOperation:function(){return gi(this)},refresh:ur(function(){var i=this.display.cachedTextHeight;pr(this),this.curOp.forceUpdate=!0,an(this),on(this,this.doc.scrollLeft,this.doc.scrollTop),Ra(this.display),(i==null||Math.abs(i-Oi(this.display))>.5||this.options.lineWrapping)&&Ea(this),he(this,"refresh",this)}),swapDoc:ur(function(i){var c=this.doc;return c.cm=null,this.state.selectingText&&this.state.selectingText(),ks(this,i),an(this),this.display.input.reset(),on(this,i.scrollLeft,i.scrollTop),this.curOp.forceScroll=!0,er(this,"swapDoc",this,c),c}),phrase:function(i){var c=this.options.phrases;return c&&Object.prototype.hasOwnProperty.call(c,i)?c[i]:i},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}},fe(e),e.registerHelper=function(i,c,P){n.hasOwnProperty(i)||(n[i]=e[i]={_global:[]}),n[i][c]=P},e.registerGlobalHelper=function(i,c,P,V){e.registerHelper(i,c,V),n[i]._global.push({pred:P,val:V})}}function za(e,t,n,i,c){var P=t,V=n,Z=Ze(e,t.line),te=c&&e.direction=="rtl"?-n:n;function ne(){var tt=t.line+te;return tt<e.first||tt>=e.first+e.size?!1:(t=new je(tt,t.ch,t.sticky),Z=Ze(e,tt))}function ye(tt){var Je;if(i=="codepoint"){var nt=Z.text.charCodeAt(t.ch+(i>0?0:-1));isNaN(nt)?Je=null:Je=new je(t.line,Math.max(0,Math.min(Z.text.length,t.ch+n*(nt>=55296&&nt<56320?2:1))),-n)}else c?Je=Ml(e.cm,Z,t,n):Je=Ba(Z,t,n);if(Je==null)if(!tt&&ne())t=Ua(c,e.cm,Z,t.line,te);else return!1;else t=Je;return!0}if(i=="char"||i=="codepoint")ye();else if(i=="column")ye(!0);else if(i=="word"||i=="group")for(var _e=null,ke=i=="group",Ie=e.cm&&e.cm.getHelper(t,"wordChars"),Fe=!0;!(n<0&&!ye(!Fe));Fe=!1){var Be=Z.text.charAt(t.ch)||`
|
|
`,Ve=De(Be,Ie)?"w":ke&&Be==`
|
|
`?"n":!ke||/\s/.test(Be)?null:"p";if(ke&&!Fe&&!Ve&&(Ve="s"),_e&&_e!=Ve){n<0&&(n=1,ye(),t.sticky="after");break}if(Ve&&(_e=Ve),n>0&&!ye(!Fe))break}var $e=Jn(e,t,P,V,!0);return ri(P,$e)&&($e.hitSide=!0),$e}function Ro(e,t,n,i){var c=e.doc,P=t.left,V;if(i=="page"){var Z=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),te=Math.max(Z-.5*Oi(e.display),3);V=(n>0?t.bottom:t.top)+n*te}else i=="line"&&(V=n>0?t.bottom+3:t.top-3);for(var ne;!(ne=va(e,P,V),!ne.outside);){if(n<0?V<=0:V>=c.height){ne.hitSide=!0;break}V+=n*5}return ne}var kt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new $,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};kt.prototype.init=function(e){var t=this,n=this,i=n.cm,c=n.div=e.lineDiv;Co(c,i.options.spellcheck,i.options.autocorrect,i.options.autocapitalize);function P(Z){for(var te=Z.target;te;te=te.parentNode){if(te==c)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(te.className))break}return!1}Me(c,"paste",function(Z){if(!P(Z)||ee(i,Z)||To(Z,i))return;G<=11&&setTimeout(Jt(i,function(){return t.updateFromDOM()}),20)}),Me(c,"compositionstart",function(Z){t.composing={data:Z.data,done:!1}}),Me(c,"compositionupdate",function(Z){t.composing||(t.composing={data:Z.data,done:!1})}),Me(c,"compositionend",function(Z){t.composing&&(Z.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Me(c,"touchstart",function(){return n.forceCompositionEnd()}),Me(c,"input",function(){t.composing||t.readFromDOMSoon()});function V(Z){if(!P(Z)||ee(i,Z))return;if(i.somethingSelected())ra({lineWise:!1,text:i.getSelections()}),Z.type=="cut"&&i.replaceSelection("",null,"cut");else if(i.options.lineWiseCopyCut){var te=So(i);ra({lineWise:!0,text:te.text}),Z.type=="cut"&&i.operation(function(){i.setSelections(te.ranges,0,be),i.replaceSelection("",null,"cut")})}else return;if(Z.clipboardData){Z.clipboardData.clearData();var ne=Mr.text.join(`
|
|
`);if(Z.clipboardData.setData("Text",ne),Z.clipboardData.getData("Text")==ne){Z.preventDefault();return}}var ye=Ao(),_e=ye.firstChild;i.display.lineSpace.insertBefore(ye,i.display.lineSpace.firstChild),_e.value=Mr.text.join(`
|
|
`);var ke=document.activeElement;F(_e),setTimeout(function(){i.display.lineSpace.removeChild(ye),ke.focus(),ke==c&&n.showPrimarySelection()},50)}Me(c,"copy",V),Me(c,"cut",V)},kt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},kt.prototype.prepareSelection=function(){var e=ps(this.cm,!1);return e.focus=document.activeElement==this.div,e},kt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},kt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},kt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),i=n.from(),c=n.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||c.line<t.display.viewFrom){e.removeAllRanges();return}var P=ia(t,e.anchorNode,e.anchorOffset),V=ia(t,e.focusNode,e.focusOffset);if(P&&!P.bad&&V&&!V.bad&&ft(ii(P,V),i)==0&&ft(_i(P,V),c)==0)return;var Z=t.display.view,te=i.line>=t.display.viewFrom&&Oo(t,i)||{node:Z[0].measure.map[2],offset:0},ne=c.line<t.display.viewTo&&Oo(t,c);if(!ne){var ye=Z[Z.length-1].measure,_e=ye.maps?ye.maps[ye.maps.length-1]:ye.map;ne={node:_e[_e.length-1],offset:_e[_e.length-2]-_e[_e.length-3]}}if(!te||!ne){e.removeAllRanges();return}var ke=e.rangeCount&&e.getRangeAt(0),Ie;try{Ie=y(te.node,te.offset,ne.offset,ne.node)}catch(Fe){}Ie&&(!N&&t.state.focused?(e.collapse(te.node,te.offset),Ie.collapsed||(e.removeAllRanges(),e.addRange(Ie))):(e.removeAllRanges(),e.addRange(Ie)),ke&&e.anchorNode==null?e.addRange(ke):N&&this.startGracePeriod()),this.rememberSelection()},kt.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)},kt.prototype.showMultipleSelections=function(e){T(this.cm.display.cursorDiv,e.cursors),T(this.cm.display.selectionDiv,e.selection)},kt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},kt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return b(this.div,t)},kt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},kt.prototype.blur=function(){this.div.blur()},kt.prototype.getField=function(){return this.div},kt.prototype.supportsTouch=function(){return!0},kt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():br(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)},kt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},kt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(o&&v&&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=ia(t,e.anchorNode,e.anchorOffset),i=ia(t,e.focusNode,e.focusOffset);n&&i&&br(t,function(){nr(t.doc,Jr(n,i),be),(n.bad||i.bad)&&(t.curOp.selectionChanged=!0)})},kt.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),i=n.from(),c=n.to();if(i.ch==0&&i.line>e.firstLine()&&(i=je(i.line-1,Ze(e.doc,i.line-1).length)),c.ch==Ze(e.doc,c.line).text.length&&c.line<e.lastLine()&&(c=je(c.line+1,0)),i.line<t.viewFrom||c.line>t.viewTo-1)return!1;var P,V,Z;i.line==t.viewFrom||(P=di(e,i.line))==0?(V=pt(t.view[0].line),Z=t.view[0].node):(V=pt(t.view[P].line),Z=t.view[P-1].node.nextSibling);var te=di(e,c.line),ne,ye;if(te==t.view.length-1?(ne=t.viewTo-1,ye=t.lineDiv.lastChild):(ne=pt(t.view[te+1].line)-1,ye=t.view[te+1].node.previousSibling),!Z)return!1;for(var _e=e.doc.splitLines(tu(e,Z,ye,V,ne)),ke=Ct(e.doc,je(V,0),je(ne,Ze(e.doc,ne).text.length));_e.length>1&&ke.length>1;)if(_(_e)==_(ke))_e.pop(),ke.pop(),ne--;else if(_e[0]==ke[0])_e.shift(),ke.shift(),V++;else break;for(var Ie=0,Fe=0,Be=_e[0],Ve=ke[0],$e=Math.min(Be.length,Ve.length);Ie<$e&&Be.charCodeAt(Ie)==Ve.charCodeAt(Ie);)++Ie;for(var tt=_(_e),Je=_(ke),nt=Math.min(tt.length-(_e.length==1?Ie:0),Je.length-(ke.length==1?Ie:0));Fe<nt&&tt.charCodeAt(tt.length-Fe-1)==Je.charCodeAt(Je.length-Fe-1);)++Fe;if(_e.length==1&&ke.length==1&&V==i.line)for(;Ie&&Ie>i.ch&&tt.charCodeAt(tt.length-Fe-1)==Je.charCodeAt(Je.length-Fe-1);)Ie--,Fe++;_e[_e.length-1]=tt.slice(0,tt.length-Fe).replace(/^\u200b+/,""),_e[0]=_e[0].slice(Ie).replace(/\u200b+$/,"");var ht=je(V,Ie),lt=je(ne,ke.length?_(ke).length-Fe:0);if(_e.length>1||_e[0]||ft(ht,lt))return Fi(e.doc,_e,ht,lt,"+input"),!0},kt.prototype.ensurePolled=function(){this.forceCompositionEnd()},kt.prototype.reset=function(){this.forceCompositionEnd()},kt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},kt.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)},kt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&br(this.cm,function(){return pr(e.cm)})},kt.prototype.setUneditable=function(e){e.contentEditable="false"},kt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Jt(this.cm,Ka)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},kt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},kt.prototype.onContextMenu=function(){},kt.prototype.resetPosition=function(){},kt.prototype.needsContentAttribute=!0;function Oo(e,t){var n=fa(e,t.line);if(!n||n.hidden)return null;var i=Ze(e.doc,t.line),c=es(n,i,t.line),P=He(i,e.doc.direction),V="left";if(P){var Z=We(P,t.ch);V=Z%2?"right":"left"}var te=is(c.map,t.ch,V);return te.offset=te.collapse=="right"?te.end:te.start,te}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Wi(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,i,c){var P="",V=!1,Z=e.doc.lineSeparator(),te=!1;function ne(Ie){return function(Fe){return Fe.id==Ie}}function ye(){V&&(P+=Z,te&&(P+=Z),V=te=!1)}function _e(Ie){Ie&&(ye(),P+=Ie)}function ke(Ie){if(Ie.nodeType==1){var Fe=Ie.getAttribute("cm-text");if(Fe){_e(Fe);return}var Be=Ie.getAttribute("cm-marker"),Ve;if(Be){var $e=e.findMarks(je(i,0),je(c+1,0),ne(+Be));$e.length&&(Ve=$e[0].find(0))&&_e(Ct(e.doc,Ve.from,Ve.to).join(Z));return}if(Ie.getAttribute("contenteditable")=="false")return;var tt=/^(pre|div|p|li|table|br)$/i.test(Ie.nodeName);if(!/^br$/i.test(Ie.nodeName)&&Ie.textContent.length==0)return;tt&&ye();for(var Je=0;Je<Ie.childNodes.length;Je++)ke(Ie.childNodes[Je]);/^(pre|p)$/i.test(Ie.nodeName)&&(te=!0),tt&&(V=!0)}else Ie.nodeType==3&&_e(Ie.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(ke(t),t==n);)t=t.nextSibling,te=!1;return P}function ia(e,t,n){var i;if(t==e.display.lineDiv){if(i=e.display.lineDiv.childNodes[n],!i)return Wi(e.clipPos(je(e.display.viewTo-1)),!0);t=null,n=0}else for(i=t;;i=i.parentNode){if(!i||i==e.display.lineDiv)return null;if(i.parentNode&&i.parentNode==e.display.lineDiv)break}for(var c=0;c<e.display.view.length;c++){var P=e.display.view[c];if(P.node==i)return ru(P,t,n)}}function ru(e,t,n){var i=e.text.firstChild,c=!1;if(!t||!b(i,t))return Wi(je(pt(e.line),0),!0);if(t==i&&(c=!0,t=i.childNodes[n],n=0,!t)){var P=e.rest?_(e.rest):e.line;return Wi(je(pt(P),P.text.length),c)}var V=t.nodeType==3?t:null,Z=t;for(!V&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(V=t.firstChild,n&&(n=V.nodeValue.length));Z.parentNode!=i;)Z=Z.parentNode;var te=e.measure,ne=te.maps;function ye(Ve,$e,tt){for(var Je=-1;Je<(ne?ne.length:0);Je++)for(var nt=Je<0?te.map:ne[Je],ht=0;ht<nt.length;ht+=3){var lt=nt[ht+2];if(lt==Ve||lt==$e){var bt=pt(Je<0?e.line:e.rest[Je]),Nt=nt[ht]+tt;return(tt<0||lt!=Ve)&&(Nt=nt[ht+(tt?1:0)]),je(bt,Nt)}}}var _e=ye(V,Z,n);if(_e)return Wi(_e,c);for(var ke=Z.nextSibling,Ie=V?V.nodeValue.length-n:0;ke;ke=ke.nextSibling){if(_e=ye(ke,ke.firstChild,0),_e)return Wi(je(_e.line,_e.ch-Ie),c);Ie+=ke.textContent.length}for(var Fe=Z.previousSibling,Be=n;Fe;Fe=Fe.previousSibling){if(_e=ye(Fe,Fe.firstChild,-1),_e)return Wi(je(_e.line,_e.ch+Be),c);Be+=Fe.textContent.length}}var Kt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new $,this.hasSelection=!1,this.composing=null};Kt.prototype.init=function(e){var t=this,n=this,i=this.cm;this.createField(e);var c=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),f&&(c.style.width="0px"),Me(c,"input",function(){z&&G>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Me(c,"paste",function(V){if(ee(i,V)||To(V,i))return;i.state.pasteIncoming=+new Date,n.fastPoll()});function P(V){if(ee(i,V))return;if(i.somethingSelected())ra({lineWise:!1,text:i.getSelections()});else if(i.options.lineWiseCopyCut){var Z=So(i);ra({lineWise:!0,text:Z.text}),V.type=="cut"?i.setSelections(Z.ranges,null,be):(n.prevInput="",c.value=Z.text.join(`
|
|
`),F(c))}else return;V.type=="cut"&&(i.state.cutIncoming=+new Date)}Me(c,"cut",P),Me(c,"copy",P),Me(e.scroller,"paste",function(V){if(Gr(e,V)||ee(i,V))return;if(!c.dispatchEvent){i.state.pasteIncoming=+new Date,n.focus();return}var Z=new Event("paste");Z.clipboardData=V.clipboardData,c.dispatchEvent(Z)}),Me(e.lineSpace,"selectstart",function(V){Gr(e,V)||ie(V)}),Me(c,"compositionstart",function(){var V=i.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:V,range:i.markText(V,i.getCursor("to"),{className:"CodeMirror-composing"})}}),Me(c,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Kt.prototype.createField=function(e){this.wrapper=Ao(),this.textarea=this.wrapper.firstChild},Kt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Kt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,i=ps(e);if(e.options.moveInputWithCursor){var c=Dr(e,n.sel.primary().head,"div"),P=t.wrapper.getBoundingClientRect(),V=t.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,c.top+V.top-P.top)),i.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,c.left+V.left-P.left))}return i},Kt.prototype.showSelection=function(e){var t=this.cm,n=t.display;T(n.cursorDiv,e.cursors),T(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Kt.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&&F(this.textarea),z&&G>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",z&&G>=9&&(this.hasSelection=null))},Kt.prototype.getField=function(){return this.textarea},Kt.prototype.supportsTouch=function(){return!1},Kt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!l||j()!=this.textarea))try{this.textarea.focus()}catch(e){}},Kt.prototype.blur=function(){this.textarea.blur()},Kt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Kt.prototype.receivedFocus=function(){this.slowPoll()},Kt.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()})},Kt.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var i=t.poll();!i&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},Kt.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,i=this.prevInput;if(this.contextMenuPending||!t.state.focused||at(n)&&!i&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var c=n.value;if(c==i&&!t.somethingSelected())return!1;if(z&&G>=9&&this.hasSelection===c||s&&/[\uf700-\uf7ff]/.test(c))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var P=c.charCodeAt(0);if(P==8203&&!i&&(i="\u200B"),P==8666)return this.reset(),this.cm.execCommand("undo")}for(var V=0,Z=Math.min(i.length,c.length);V<Z&&i.charCodeAt(V)==c.charCodeAt(V);)++V;return br(t,function(){Ka(t,c.slice(V),i.length-V,null,e.composing?"*compose":null),c.length>1e3||c.indexOf(`
|
|
`)>-1?n.value=e.prevInput="":e.prevInput=c,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Kt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Kt.prototype.onKeyPress=function(){z&&G>=9&&(this.hasSelection=null),this.fastPoll()},Kt.prototype.onContextMenu=function(e){var t=this,n=t.cm,i=n.display,c=t.textarea;t.contextMenuPending&&t.contextMenuPending();var P=ci(n,e),V=i.scroller.scrollTop;if(!P||m)return;var Z=n.options.resetSelectionOnContextMenu;Z&&n.doc.sel.contains(P)==-1&&Jt(n,nr)(n.doc,Jr(P),be);var te=c.style.cssText,ne=t.wrapper.style.cssText,ye=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",c.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-ye.top-5)+"px; left: "+(e.clientX-ye.left-5)+`px;
|
|
z-index: 1000; background: `+(z?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var _e;r&&(_e=window.scrollY),i.input.focus(),r&&window.scrollTo(null,_e),i.input.reset(),n.somethingSelected()||(c.value=t.prevInput=" "),t.contextMenuPending=Ie,i.selForContextMenu=n.doc.sel,clearTimeout(i.detectingSelectAll);function ke(){if(c.selectionStart!=null){var Be=n.somethingSelected(),Ve="\u200B"+(Be?c.value:"");c.value="\u21DA",c.value=Ve,t.prevInput=Be?"":"\u200B",c.selectionStart=1,c.selectionEnd=Ve.length,i.selForContextMenu=n.doc.sel}}function Ie(){if(t.contextMenuPending!=Ie)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=ne,c.style.cssText=te,z&&G<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=V),c.selectionStart!=null){(!z||z&&G<9)&&ke();var Be=0,Ve=function(){i.selForContextMenu==n.doc.sel&&c.selectionStart==0&&c.selectionEnd>0&&t.prevInput=="\u200B"?Jt(n,Vs)(n):Be++<10?i.detectingSelectAll=setTimeout(Ve,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(Ve,200)}}if(z&&G>=9&&ke(),D){me(e);var Fe=function(){qe(window,"mouseup",Fe),setTimeout(Ie,20)};Me(window,"mouseup",Fe)}else setTimeout(Ie,50)},Kt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Kt.prototype.setUneditable=function(){},Kt.prototype.needsContentAttribute=!1;function iu(e,t){if(t=t?g(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=j();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function i(){e.value=Z.getValue()}var c;if(e.form&&(Me(e.form,"submit",i),!t.leaveSubmitMethodAlone)){var P=e.form;c=P.submit;try{var V=P.submit=function(){i(),P.submit=c,P.submit(),P.submit=V}}catch(te){}}t.finishInit=function(te){te.save=i,te.getTextArea=function(){return e},te.toTextArea=function(){te.toTextArea=isNaN,i(),e.parentNode.removeChild(te.getWrapperElement()),e.style.display="",e.form&&(qe(e.form,"submit",i),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=c))}},e.style.display="none";var Z=jt(function(te){return e.parentNode.insertBefore(te,e.nextSibling)},t);return Z}function nu(e){e.off=qe,e.on=Me,e.wheelEventPixels=cl,e.Doc=mr,e.splitLines=ot,e.countColumn=W,e.findColumn=Re,e.isWordChar=xe,e.Pass=Ce,e.signal=he,e.Line=li,e.changeEnd=Qr,e.scrollbarModel=xs,e.Pos=je,e.cmpPos=ft,e.modes=Ft,e.mimeModes=Tt,e.resolveMode=zt,e.getMode=cr,e.modeExtensions=ct,e.extendMode=vt,e.copyState=Et,e.startState=or,e.innerMode=Ht,e.commands=xn,e.keyMap=Kr,e.keyName=lo,e.isModifierKey=so,e.lookupKey=Ui,e.normalizeKeyMap=kl,e.StringStream=Mt,e.SharedTextMarker=bn,e.TextMarker=qr,e.LineWidget=yn,e.e_preventDefault=ie,e.e_stopPropagation=se,e.e_stop=me,e.addClass=B,e.contains=b,e.rmClass=R,e.keyNames=ei}$l(jt),ql(jt);var au="iter insert remove copy getEditor constructor".split(" ");for(var na in mr.prototype)mr.prototype.hasOwnProperty(na)&&le(au,na)<0&&(jt.prototype[na]=function(e){return function(){return e.apply(this.doc,arguments)}}(mr.prototype[na]));return fe(mr),jt.inputStyles={textarea:Kt,contenteditable:kt},jt.defineMode=function(e){!jt.defaults.mode&&e!="null"&&(jt.defaults.mode=e),sr.apply(this,arguments)},jt.defineMIME=Er,jt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),jt.defineMIME("text/plain","null"),jt.defineExtension=function(e,t){jt.prototype[e]=t},jt.defineDocExtension=function(e,t){mr.prototype[e]=t},jt.fromTextArea=iu,nu(jt),jt.version="5.58.2",jt})},Y1PL:function(Qe,Te,q){"use strict";q.r(Te),q.d(Te,"ResizableTextArea",function(){return le});var oe=q("wx14"),Y=q("1OyB"),N=q("vuIU"),J=q("Ji7U"),H=q("LK+K"),M=q("q1tI"),z=q("VTBJ"),G=q("rePB"),r=q("Zm9Q"),O=q("Kwbf"),v=q("c+Xe"),m=q("m+aA"),p=q("bdgK"),h=new Map;function u(be){be.forEach(function(Ae){var Se,Re=Ae.target;(Se=h.get(Re))===null||Se===void 0||Se.forEach(function(ve){return ve(Re)})})}var f=new p.default(u),o=null,l=null;function s(be,Ae){h.has(be)||(h.set(be,new Set),f.observe(be)),h.get(be).add(Ae)}function a(be,Ae){h.has(be)&&(h.get(be).delete(Ae),h.get(be).size||(f.unobserve(be),h.delete(be)))}var S=function(be){Object(J.a)(Se,be);var Ae=Object(H.a)(Se);function Se(){return Object(Y.a)(this,Se),Ae.apply(this,arguments)}return Object(N.a)(Se,[{key:"render",value:function(){return this.props.children}}]),Se}(M.Component),x=M.createContext(null);function C(be){var Ae=be.children,Se=be.onBatchResize,Re=M.useRef(0),ve=M.useRef([]),X=M.useContext(x),_=M.useCallback(function(k,U,Q){Re.current+=1;var K=Re.current;ve.current.push({size:k,element:U,data:Q}),Promise.resolve().then(function(){K===Re.current&&(Se==null||Se(ve.current),ve.current=[])}),X==null||X(k,U,Q)},[Se,X]);return M.createElement(x.Provider,{value:_},Ae)}function D(be){var Ae=be.children,Se=be.disabled,Re=M.useRef(null),ve=M.useRef(null),X=M.useContext(x),_=M.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),k=M.isValidElement(Ae)&&Object(v.c)(Ae),U=k?Ae.ref:null,Q=M.useMemo(function(){return Object(v.a)(U,Re)},[U,Re]),K=M.useRef(be);K.current=be;var ce=M.useCallback(function(xe){var De=K.current,ue=De.onResize,ge=De.data,we=xe.getBoundingClientRect(),Oe=we.width,Ne=we.height,Ue=xe.offsetWidth,Ge=xe.offsetHeight,We=Math.floor(Oe),Xe=Math.floor(Ne);if(_.current.width!==We||_.current.height!==Xe||_.current.offsetWidth!==Ue||_.current.offsetHeight!==Ge){var He={width:We,height:Xe,offsetWidth:Ue,offsetHeight:Ge};_.current=He;var Ye=Ue===Math.round(Oe)?Oe:Ue,Me=Ge===Math.round(Ne)?Ne:Ge,it=Object(z.a)(Object(z.a)({},He),{},{offsetWidth:Ye,offsetHeight:Me});X==null||X(it,xe,ge),ue&&Promise.resolve().then(function(){ue(it,xe)})}},[]);return M.useEffect(function(){var xe=Object(m.a)(Re.current)||Object(m.a)(ve.current);return xe&&!Se&&s(xe,ce),function(){return a(xe,ce)}},[Re.current,Se]),M.createElement(S,{ref:ve},k?M.cloneElement(Ae,{ref:Q}):Ae)}var L="rc-observer-key";function R(be){var Ae=be.children,Se=Object(r.a)(Ae);return Se.map(function(Re,ve){var X=(Re==null?void 0:Re.key)||"".concat(L,"-").concat(ve);return M.createElement(D,Object(oe.a)({},be,{key:X}),Re)})}R.Collection=C;var A=R,T=q("bT9E"),d=q("TSYQ"),w=q.n(d),y=`
|
|
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
|
|
`,b=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],j={},B;function E(be){var Ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Se=be.getAttribute("id")||be.getAttribute("data-reactid")||be.getAttribute("name");if(Ae&&j[Se])return j[Se];var Re=window.getComputedStyle(be),ve=Re.getPropertyValue("box-sizing")||Re.getPropertyValue("-moz-box-sizing")||Re.getPropertyValue("-webkit-box-sizing"),X=parseFloat(Re.getPropertyValue("padding-bottom"))+parseFloat(Re.getPropertyValue("padding-top")),_=parseFloat(Re.getPropertyValue("border-bottom-width"))+parseFloat(Re.getPropertyValue("border-top-width")),k=b.map(function(Q){return"".concat(Q,":").concat(Re.getPropertyValue(Q))}).join(";"),U={sizingStyle:k,paddingSize:X,borderSize:_,boxSizing:ve};return Ae&&Se&&(j[Se]=U),U}function F(be){var Ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Se=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Re=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;B||(B=document.createElement("textarea"),B.setAttribute("tab-index","-1"),B.setAttribute("aria-hidden","true"),document.body.appendChild(B)),be.getAttribute("wrap")?B.setAttribute("wrap",be.getAttribute("wrap")):B.removeAttribute("wrap");var ve=E(be,Ae),X=ve.paddingSize,_=ve.borderSize,k=ve.boxSizing,U=ve.sizingStyle;B.setAttribute("style","".concat(U,";").concat(y)),B.value=be.value||be.placeholder||"";var Q=Number.MIN_SAFE_INTEGER,K=Number.MAX_SAFE_INTEGER,ce=B.scrollHeight,xe;if(k==="border-box"?ce+=_:k==="content-box"&&(ce-=X),Se!==null||Re!==null){B.value=" ";var De=B.scrollHeight-X;Se!==null&&(Q=De*Se,k==="border-box"&&(Q=Q+X+_),ce=Math.max(Q,ce)),Re!==null&&(K=De*Re,k==="border-box"&&(K=K+X+_),xe=ce>K?"":"hidden",ce=Math.min(K,ce))}return{height:ce,minHeight:Q,maxHeight:K,overflowY:xe,resize:"none"}}var I=q("Gytx"),g=q.n(I),W;(function(be){be[be.NONE=0]="NONE",be[be.RESIZING=1]="RESIZING",be[be.RESIZED=2]="RESIZED"})(W||(W={}));var $=function(be){Object(J.a)(Se,be);var Ae=Object(H.a)(Se);function Se(Re){var ve;return Object(Y.a)(this,Se),ve=Ae.call(this,Re),ve.nextFrameActionId=void 0,ve.resizeFrameId=void 0,ve.textArea=void 0,ve.saveTextArea=function(X){ve.textArea=X},ve.handleResize=function(X){var _=ve.state.resizeStatus,k=ve.props,U=k.autoSize,Q=k.onResize;if(_!==W.NONE)return;typeof Q=="function"&&Q(X),U&&ve.resizeOnNextFrame()},ve.resizeOnNextFrame=function(){cancelAnimationFrame(ve.nextFrameActionId),ve.nextFrameActionId=requestAnimationFrame(ve.resizeTextarea)},ve.resizeTextarea=function(){var X=ve.props.autoSize;if(!X||!ve.textArea)return;var _=X.minRows,k=X.maxRows,U=F(ve.textArea,!1,_,k);ve.setState({textareaStyles:U,resizeStatus:W.RESIZING},function(){cancelAnimationFrame(ve.resizeFrameId),ve.resizeFrameId=requestAnimationFrame(function(){ve.setState({resizeStatus:W.RESIZED},function(){ve.resizeFrameId=requestAnimationFrame(function(){ve.setState({resizeStatus:W.NONE}),ve.fixFirefoxAutoScroll()})})})})},ve.renderTextArea=function(){var X=ve.props,_=X.prefixCls,k=_===void 0?"rc-textarea":_,U=X.autoSize,Q=X.onResize,K=X.className,ce=X.disabled,xe=ve.state,De=xe.textareaStyles,ue=xe.resizeStatus,ge=Object(T.a)(ve.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),we=w()(k,K,Object(G.a)({},"".concat(k,"-disabled"),ce));"value"in ge&&(ge.value=ge.value||"");var Oe=Object(z.a)(Object(z.a)(Object(z.a)({},ve.props.style),De),ue===W.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return M.createElement(A,{onResize:ve.handleResize,disabled:!(U||Q)},M.createElement("textarea",Object(oe.a)({},ge,{className:we,style:Oe,ref:ve.saveTextArea})))},ve.state={textareaStyles:{},resizeStatus:W.NONE},ve}return Object(N.a)(Se,[{key:"componentDidUpdate",value:function(ve){(ve.value!==this.props.value||!g()(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,X=this.textArea.selectionEnd;this.textArea.setSelectionRange(ve,X)}}catch(_){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Se}(M.Component),le=$,de=function(be){Object(J.a)(Se,be);var Ae=Object(H.a)(Se);function Se(Re){var ve;Object(Y.a)(this,Se),ve=Ae.call(this,Re),ve.resizableTextArea=void 0,ve.focus=function(){ve.resizableTextArea.textArea.focus()},ve.saveTextArea=function(_){ve.resizableTextArea=_},ve.handleChange=function(_){var k=ve.props.onChange;ve.setValue(_.target.value,function(){ve.resizableTextArea.resizeTextarea()}),k&&k(_)},ve.handleKeyDown=function(_){var k=ve.props,U=k.onPressEnter,Q=k.onKeyDown;_.keyCode===13&&U&&U(_),Q&&Q(_)};var X=typeof Re.value=="undefined"||Re.value===null?Re.defaultValue:Re.value;return ve.state={value:X},ve}return Object(N.a)(Se,[{key:"setValue",value:function(ve,X){"value"in this.props||this.setState({value:ve},X)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return M.createElement(le,Object(oe.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}}]),Se}(M.Component),Ce=Te.default=de},YiJy:function(Qe,Te,q){Qe.exports={bg:"bg___2xkgh",flexRow:"flexRow___3_RB8",flexJustifyCenter:"flexJustifyCenter___3Rbeo",flexAlignEnd:"flexAlignEnd___Up4h1",flexAlignCenter:"flexAlignCenter___hv6Pr",flexColumn:"flexColumn___kNPED",formWrap:"formWrap___2LY7l",titleWrap:"titleWrap___1TXK0",fieldWrap:"fieldWrap___2Bk37",mdWrap:"mdWrap___3VsOd",backgroundFa:"backgroundFa___13msX",button:"button___2BNet"}},ZW9T:function(Qe,Te,q){"use strict";q.d(Te,"a",function(){return I});var oe=q("k1fw"),Y=q("oBTY"),N=q("miYZ"),J=q("tsqr"),H=q("rAM+"),M=q("tJVT"),z=q("PpiC"),G=q("q1tI"),r=q.n(G),O=q("bdgK"),v=q("9og8"),m=q("WmNS"),p=q.n(m),h={keywords:["print","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"]},u={quickKey:[{label:"main",content:["public static void main(String[] args) {"," $0","}"].join(`
|
|
`)},{label:"System.out.println",content:["System.out.println($0)"].join(`
|
|
`)},{label:"System.out.print",content:["System.out.print($0)"].join(`
|
|
`)}],keywords:["abstract","continue","for","new","switch","assert","default","goto","package","synchronized","boolean","do","if","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","true","false"]},f={keywords:["abstract","amp","array","auto","bool","break","case","catch","char","class","const","constexpr","const_cast","continue","cpu","decltype","default","delegate","delete","do","double","dynamic_cast","each","else","enum","event","explicit","export","extern","false","final","finally","float","friend","gcnew","generic","goto","in","initonly","inline","int","interface","interior_ptr","internal","literal","long","mutable","namespace","new","noexcept","nullptr","__nullptr","operator","override","partial","pascal","pin_ptr","private","property","protected","public","ref","register","reinterpret_cast","restrict","return","safe_cast","sealed","short","signed","sizeof","static","static_assert","static_cast","struct","switch","template","this","thread_local","throw","tile_static","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","where","while","_asm","_based","_cdecl","_declspec","_fastcall","_if_exists","_if_not_exists","_inline","_multiple_inheritance","_pascal","_single_inheritance","_stdcall","_virtual_inheritance","_w64","__abstract","__alignof","__asm","__assume","__based","__box","__builtin_alignof","__cdecl","__clrcall","__declspec","__delegate","__event","__except","__fastcall","__finally","__forceinline","__gc","__hook","__identifier","__if_exists","__if_not_exists","__inline","__int128","__int16","__int32","__int64","__int8","__interface","__leave","__m128","__m128d","__m128i","__m256","__m256d","__m256i","__m64","__multiple_inheritance","__newslot","__nogc","__noop","__nounwind","__novtordisp","__pascal","__pin","__pragma","__property","__ptr32","__ptr64","__raise","__restrict","__resume","__sealed","__single_inheritance","__stdcall","__super","__thiscall","__try","__try_cast","__typeof","__unaligned","__unhook","__uuidof","__value","__virtual_inheritance","__w64","__wchar_t"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],quickKey:[{label:"ifelse",content:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`)},{label:"include",content:"include<$0>"},{label:"printf",content:"printf($0)"},{label:"system",content:'system("$0")'},{label:"main",content:["int main () {"," $0","}"].join(`
|
|
`)},{label:"if",content:["if () {"," $0","}"].join(`
|
|
`)},{label:"for",content:["for(int j=0 ; j<10; j++){"," $0","}"].join(`
|
|
`)},{label:"trycatch",content:["try{"," $0","}catch(ExceptionName e){","}"].join(`
|
|
`)},{label:"using namespace std;",content:["using namespace std;"].join(`
|
|
`)},{label:"include <iostream>",content:["#include <iostream>"].join(`
|
|
`)},{label:"include <vector>",content:["#include <vector>"].join(`
|
|
`)},{label:"include <cstdio>",content:["#include <cstdio>"].join(`
|
|
`)},{label:"include <cstring>",content:["#include <cstring>"].join(`
|
|
`)},{label:"include <sstream>",content:["#include <sstream>"].join(`
|
|
`)},{label:"include <fstream>",content:["#include <fstream>"].join(`
|
|
`)},{label:"include <map>",content:["#include <map>"].join(`
|
|
`)},{label:"include <string>",content:["#include <string>"].join(`
|
|
`)},{label:"include <cmath>",content:["#include <cmath>"].join(`
|
|
`)}]},o={keywords:["and","as","assert","break","class","continue","def","del","elif","else","except","exec","finally","for","from","global","if","import","in","is","lambda","None","not","or","pass","raise","return","self","try","while","with","yield","int","float","long","complex","hex","abs","all","any","apply","basestring","bin","bool","buffer","bytearray","callable","chr","classmethod","cmp","coerce","compile","complex","delattr","dict","dir","divmod","enumerate","eval","execfile","file","filter","format","frozenset","getattr","globals","hasattr","hash","help","id","input","intern","isinstance","issubclass","iter","len","locals","list","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","reversed","range","raw_input","reduce","reload","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","unichr","unicode","vars","xrange","zip","True","False","__dict__","__methods__","__members__","__class__","__bases__","__name__","__mro__","__subclasses__","__init__","__import__"],quickKey:[{label:"print",content:["print($0)"].join(`
|
|
`)}]},l=q("5VLF"),s=q.n(l),a={languages:["c","abap","apex","azcli","bat","cameligo","clojure","coffee","cpp","csharp","csp","css","dockerfile","fsharp","go","graphql","handlebars","html","ini","java","javascript","json","kotlin","less","lua","markdown","mips","msdax","mysql","objective-c","pascal","pascaligo","perl","pgsql","php","postiats","powerquery","powershell","pug","python","r","razor","redis","redshift","restructuredtext","ruby","rust","sb","scheme","scss","shell","solidity","sophia","sql","st","swift","tcl","twig","vb","xml","yaml'"],tables:{users:["name","id","email","phone","password"],roles:["id","name","order","created_at","updated_at","deleted_at"]}},S=function(W,$){return $.map(function(le){return{label:le,kind:W.languages.CompletionItemKind.Keyword,insertText:le}})},x=function(W){return Object.keys(a.tables).map(function($){return{label:$,kind:W.languages.CompletionItemKind.Variable,insertText:$}})},C=function(W,$){var le=a.tables[W];return le?le.map(function(de){return{label:de,kind:$.languages.CompletionItemKind.Field,insertText:de}}):[]};function D(g,W,$,le,de){var Ce=W.getWordUntilPosition($),be={startLineNumber:$.lineNumber,endLineNumber:$.lineNumber,startColumn:Ce.startColumn,endColumn:Ce.endColumn},Ae=le.map(function(Se){return{label:Se,kind:g.languages.CompletionItemKind.Keyword,insertText:Se,insertTextRules:g.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:be}});return de.map(function(Se){Ae.push(Object(oe.a)(Object(oe.a)({},Se),{},{range:be}))}),Ae}var L=function(g){a.languages.map(function(de){return g.languages.registerDocumentFormattingEditProvider(de,{provideDocumentFormattingEdits:function(be,Ae,Se){return Object(v.a)(p.a.mark(function Re(){var ve;return p.a.wrap(function(_){for(;;)switch(_.prev=_.next){case 0:return ve=s()(be.getValue(),{indent_size:"2",indent_char:" ",max_preserve_newlines:"2",preserve_newlines:!0,keep_array_indentation:!0,break_chained_methods:!1,indent_scripts:"normal",brace_style:"collapse",space_before_conditional:!0,unescape_strings:!1,jslint_happy:!1,end_with_newline:!0,wrap_line_length:"0",indent_inner_html:!1,comma_first:!1,e4x:!1,indent_empty_lines:!1}),_.abrupt("return",[{range:be.getFullModelRange(),text:ve}]);case 2:case"end":return _.stop()}},Re)}))()}}),de});var W=f.quickKey.map(function(de){return{label:de.label,kind:g.languages.CompletionItemKind.Method,insertText:de.content,insertTextRules:g.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),$=o.quickKey.map(function(de){return{label:de.label,kind:g.languages.CompletionItemKind.Method,insertText:de.content,insertTextRules:g.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),le=u.quickKey.map(function(de){return{label:de.label,kind:g.languages.CompletionItemKind.Method,insertText:de.content,insertTextRules:g.languages.CompletionItemInsertTextRule.InsertAsSnippet}});g.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(Ce,be){var Ae=Ce.getWordUntilPosition(be),Se={startLineNumber:be.lineNumber,endLineNumber:be.lineNumber,startColumn:Ae.startColumn,endColumn:Ae.endColumn},Re=Ce.getLineContent(be.lineNumber).substring(Ae.startColumn-2,Ae.endColumn);return{suggestions:[].concat(Object(Y.a)(f.keywords.map(function(ve){return{label:ve,kind:g.languages.CompletionItemKind.Function,documentation:ve,insertText:ve,insertTextRules:g.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Se}})),Object(Y.a)(f.quickKey.map(function(ve){return{label:ve.label,kind:g.languages.CompletionItemKind.Function,documentation:ve.content,insertText:Re.startsWith("#")?ve.content.replace(/#/,""):ve.content,insertTextRules:g.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Se}})))}}}),g.languages.registerCompletionItemProvider("c",{provideCompletionItems:function(Ce,be){var Ae=Ce.getWordUntilPosition(be),Se={startLineNumber:be.lineNumber,endLineNumber:be.lineNumber,startColumn:Ae.startColumn,endColumn:Ae.endColumn};return{suggestions:Object(Y.a)(h.keywords.map(function(Re){return{label:Re,kind:g.languages.CompletionItemKind.Function,documentation:Re,insertText:Re,insertTextRules:g.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Se}}))}}}),g.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(Ce,be){var Ae=Ce.getWordUntilPosition(be),Se={startLineNumber:be.lineNumber,endLineNumber:be.lineNumber,startColumn:Ae.startColumn,endColumn:Ae.endColumn},Re=Ce.getLineContent(be.lineNumber).substring(Ae.startColumn-2,Ae.endColumn);return{suggestions:[].concat(Object(Y.a)(u.keywords.map(function(ve){return{label:ve,kind:g.languages.CompletionItemKind.Function,documentation:ve,insertText:ve,insertTextRules:g.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Se}})),Object(Y.a)(u.quickKey.map(function(ve){return{label:ve.label,kind:g.languages.CompletionItemKind.Function,documentation:ve.content,insertText:Re.startsWith("#")?ve.content.replace(/#/,""):ve.content,insertTextRules:g.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Se}})))}}}),g.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(Ce,be){var Ae=Ce.getWordUntilPosition(be),Se={startLineNumber:be.lineNumber,endLineNumber:be.lineNumber,startColumn:Ae.startColumn,endColumn:Ae.endColumn},Re=Ce.getLineContent(be.lineNumber).substring(Ae.startColumn-2,Ae.endColumn);return{suggestions:[].concat(Object(Y.a)(o.keywords.map(function(ve){return{label:ve,kind:g.languages.CompletionItemKind.Function,documentation:ve,insertText:ve,insertTextRules:g.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Se}})),Object(Y.a)(o.quickKey.map(function(ve){return{label:ve.label,kind:g.languages.CompletionItemKind.Function,documentation:ve.content,insertText:Re.startsWith("#")?ve.content.replace(/#/,""):ve.content,insertTextRules:g.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Se}})))}}})},R="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",A=q("fjLI"),T=q("LvDl"),d=q("+ua5");function w(g){return/^\d+$/.test(g)?"".concat(g,"px"):g}function y(){}var b=!1,j={"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"};function B(){var g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],W=g;if(Array.isArray(g)){for(var $=0;$<g.length;$++){var le=j[g[$]];if(le)return le}return W[0]}return j[W]||W}var E=null,F=Te.b=function(g){var W=g.width,$=W===void 0?"100%":W,le=g.height,de=le===void 0?"100%":le,Ce=g.value,be=g.language,Ae=be===void 0?"javascript":be,Se=g.style,Re=Se===void 0?{}:Se,ve=g.options,X=ve===void 0?{}:ve,_=g.overrideServices,k=_===void 0?{}:_,U=g.theme,Q=U===void 0?"vs-dark":U,K=g.onEditBlur,ce=g.onSave,xe=g.autoHeight,De=xe===void 0?!1:xe,ue=g.forbidCopy,ge=ue===void 0?!1:ue,we=g.onChange,Oe=we===void 0?y:we,Ne=g.editorDidMount,Ue=Ne===void 0?y:Ne,Ge=g.onFocus,We=Ge===void 0?y:Ge,Xe=g.filename,He=Xe===void 0?"educoder.txt":Xe,Ye=g.errorLine,Me=g.errorContent,it=Me===void 0?"":Me,qe=Object(z.a)(g,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),he=Object(G.useRef)(),ee=Object(G.useRef)({}),re=Object(G.useRef)(),ae=Object(G.useRef)(),fe=Object(G.useRef)(!1),ie=Object(G.useRef)(),se=Object(G.useState)(!1),pe=Object(M.a)(se,2),me=pe[0],Ee=pe[1];function Le(){var ct;return he.current&&(ct=new O.default(function(vt){var Et=Object(H.a)(vt),Ht;try{for(Et.s();!(Ht=Et.n()).done;){var or=Ht.value;(or.target.offsetHeight>0||or.target.offsetWidth>0)&&ee.current.instance.layout()}}catch(Mt){Et.e(Mt)}finally{Et.f()}}),ct.observe(he.current)),ct}function Pe(){J.b.warn(decodeURIComponent(R))}var Ke=function(){var vt=ee.current.instance;if(Ce!=null&&vt&&me){var Et=vt.getModel();Et&&Ce!==Et.getValue()&&(b=!0,Et.setValue(Ce),vt.layout(),b=!1)}};Object(G.useEffect)(function(){ae.current&&clearTimeout(ae.current),ae.current=setTimeout(function(){Ke()},500)},[Ce,me,ee.current]),Object(G.useEffect)(function(){if(Ye&&ee.current&&ee.current.instance){var ct=ee.current.instance;ct.changeViewZones(function(Et){var Ht=document.createElement("div");Ht.style.padding="10px 20px",Ht.style.width="calc(100% - 20px)",Ht.className="my-error-line-wrp",Ht.innerHTML=it,Et.addZone({afterLineNumber:Ye||11,heightInLines:3,domNode:Ht})});var vt={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};ct.addOverlayWidget(vt),ct.revealPositionInCenter({lineNumber:20,column:1})}},[Ye,ee.current,me]);function et(){var ct=ee.current.instance;if(ct){var vt=ct.getSelection(),Et=ee.current.pastePos||{},Ht=new E.Range(Et.startLineNumber||vt.endLineNumber,Et.startColumn||vt.endColumn,Et.endLineNumber||vt.endLineNumber,Et.endColumn||vt.endColumn);setTimeout(function(){ct.executeEdits("",[{range:Ht,text:""}])},300)}}function rt(ct){(window.navigator.platform.match("Mac")?ct.metaKey:ct.ctrlKey)&&ct.keyCode==83&&(ct.preventDefault(),ce())}var yt=function(){if(De&&ee.current.instance){var vt=ee.current.instance.getContentHeight();zt(vt<de?de:vt)}else zt(de)};function ot(ct){var vt=document.createEvent("MouseEvents");vt.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),ct.dispatchEvent(vt)}function at(ct,vt){var Et=window.URL||window.webkitURL||window,Ht=new Blob([vt]),or=document.createElementNS("http://www.w3.org/1999/xhtml","a");or.href=Et.createObjectURL(Ht),or.download=ct,ot(or)}Object(G.useEffect)(function(){yt()},[yt]),Object(G.useEffect)(function(){he.current&&!me&&Promise.all([q.e(18),q.e(29)]).then(q.t.bind(null,"M/lh",7)).then(function(ct){try{E=ct,ee.current.instance=E.editor.create(he.current,{value:Ce,language:B(Ae),theme:Q,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0},k);var vt=ee.current.instance,Et=A.d._menuItems,Ht=Object(Y.a)(Et).find(function(Rt){return Rt[0]._debugName=="EditorContext"}),or=Ht[1],Mt=["editor.action.clipboardCopyWithSyntaxHighlightingAction","editor.action.quickCommand","editor.action.clipboardCopyAction","editor.action.clipboardPasteAction","editor.action.clipboardCutAction"],Ze=function(dt,pt){var wt=dt._first;do{var rr,Ut,je=pt.includes((rr=wt.element)===null||rr===void 0||((Ut=rr.command)===null||Ut===void 0)?void 0:Ut.id);je&&dt._remove(wt)}while(wt=wt.next)};if(Ue(vt,E),setTimeout(function(){yt(),ee.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){at(He||"educoder.txt",vt.getValue())}}),vt.getDomNode().addEventListener("input",function(){re.current.autoFormat&&vt.getAction("editor.action.formatDocument").run()})},500),ee.current.subscription=vt.onDidChangeModelContent(function(Rt){fe.current?clearTimeout(ie.current):(yt(),Oe(vt.getValue(),Rt)),ie.current=setTimeout(function(){fe.current=!1},500)}),window.Monaco||L(E,B(Ae)),ge&&(Ze(or,Mt),he.current.classList.add("noCopyPaste"),vt.onKeyDown(function(Rt){var dt=Rt.keyCode,pt=Rt.ctrlKey,wt=Rt.metaKey;(dt===33||dt===52)&&(wt||pt)&&(Pe(),Rt.preventDefault())})),window.Monaco=E,K&&vt.onDidBlurEditorWidget(function(){K(vt.getValue())}),We&&vt.onDidFocusEditorText(function(){We(vt.getValue())}),ge){vt.addCommand(E.KeyMod.CtrlCmd|E.KeyCode.KEY_V,function(){return Pe(),null}),vt.onDidPaste(function(Rt){ee.current.pastePos=Rt});try{window.addEventListener("paste",et)}catch(Rt){}}var Ct=Le();return Ee(!0),function(){var Rt=ee.current.instance;Rt.dispose();var dt=Rt.getModel();dt&&dt.dispose(),ee.current.subscription&&ee.current.subscription.dispose(),ge&&window.removeEventListener("paste",et),Ct.unobserve(he.current)}}catch(Rt){}})},[]),Object(G.useEffect)(function(){var ct=ee.current.instance;if(ct&&me)return document.addEventListener("keydown",rt,!1),function(){document.removeEventListener("keydown",rt)}},[ce,me]),Object(G.useEffect)(function(){var ct=ee.current.instance;if(ct&&me){var vt=B(Ae);E.editor.setModelLanguage(ct.getModel(),vt),console.log("language:",Ae,ct.getModel(),vt)}},[Ae,me]),Object(G.useEffect)(function(){var ct=ee.current.instance;ct&&me&&E.editor.setTheme(Q)},[Q,me]),Object(G.useEffect)(function(){var ct=ee.current.instance;re.current=X,ct&&me&&(ct.updateOptions(Object(oe.a)({},X)),setTimeout(function(){ct.getModel().updateOptions(Object(oe.a)({},X))},200))},[JSON.stringify(X),me]),Object(G.useEffect)(function(){var ct=ee.current.instance;ct&&me&&ct.layout()},[$,de,me]);var Lt=Object(G.useState)(w($)),_t=Object(M.a)(Lt,2),Bt=_t[0],Ft=_t[1],Tt=Object(G.useState)(w(de)),sr=Object(M.a)(Tt,2),Er=sr[0],zt=sr[1],cr=Object(oe.a)(Object(oe.a)({},Re),{},{width:Bt,height:Er});return r.a.createElement("div",{className:"my-monaco-editor",ref:he,style:cr})};function I(g){var W=g.width,$=W===void 0?"100%":W,le=g.height,de=le===void 0?"100%":le,Ce=g.original,be=g.modified,Ae=g.language,Se=g.options,Re=Se===void 0?{}:Se,ve=Object(G.useRef)(),X=Object(G.useState)(null),_=Object(M.a)(X,2),k=_[0],U=_[1];function Q(De){var ue;return ve.current&&(ue=new O.default(function(ge){var we=Object(H.a)(ge),Oe;try{for(we.s();!(Oe=we.n()).done;){var Ne=Oe.value;(Ne.target.offsetHeight>0||Ne.target.offsetWidth>0)&&De.layout()}}catch(Ue){we.e(Ue)}finally{we.f()}}),ue.observe(ve.current)),ue}Object(G.useEffect)(function(){ve.current&&Promise.all([q.e(18),q.e(29)]).then(q.t.bind(null,"M/lh",7)).then(function(De){E=De;var ue=E.editor.createDiffEditor(ve.current,Object(oe.a)(Object(oe.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},Re),{},{wordWrap:!0}));U(ue);var ge=Q(ue);return function(){ue.dispose();var we=ue.getModel();we&&we.dispose(),ge.unobserve(ve.current)}})},[]),Object(G.useEffect)(function(){k&&k.setModel({original:E.editor.createModel(Ce,Ae),modified:E.editor.createModel(be,Ae)})},[Ce,be,Ae,k]);var K=w($),ce=w(de),xe={width:K,height:ce};return r.a.createElement("div",{className:"my-diff-editor",ref:ve,style:xe})}},Zss7:function(Qe,Te,q){var oe;(function(Y){var N=/^\s+/,J=/\s+$/,H=0,M=Y.round,z=Y.min,G=Y.max,r=Y.random;function O(_,k){if(_=_||"",k=k||{},_ instanceof O)return _;if(!(this instanceof O))return new O(_,k);var U=v(_);this._originalInput=_,this._r=U.r,this._g=U.g,this._b=U.b,this._a=U.a,this._roundA=M(100*this._a)/100,this._format=k.format||U.format,this._gradientType=k.gradientType,this._r<1&&(this._r=M(this._r)),this._g<1&&(this._g=M(this._g)),this._b<1&&(this._b=M(this._b)),this._ok=U.ok,this._tc_id=H++}O.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var _=this.toRgb();return(_.r*299+_.g*587+_.b*114)/1e3},getLuminance:function(){var _=this.toRgb(),k,U,Q,K,ce,xe;return k=_.r/255,U=_.g/255,Q=_.b/255,k<=.03928?K=k/12.92:K=Y.pow((k+.055)/1.055,2.4),U<=.03928?ce=U/12.92:ce=Y.pow((U+.055)/1.055,2.4),Q<=.03928?xe=Q/12.92:xe=Y.pow((Q+.055)/1.055,2.4),.2126*K+.7152*ce+.0722*xe},setAlpha:function(_){return this._a=F(_),this._roundA=M(100*this._a)/100,this},toHsv:function(){var _=u(this._r,this._g,this._b);return{h:_.h*360,s:_.s,v:_.v,a:this._a}},toHsvString:function(){var _=u(this._r,this._g,this._b),k=M(_.h*360),U=M(_.s*100),Q=M(_.v*100);return this._a==1?"hsv("+k+", "+U+"%, "+Q+"%)":"hsva("+k+", "+U+"%, "+Q+"%, "+this._roundA+")"},toHsl:function(){var _=p(this._r,this._g,this._b);return{h:_.h*360,s:_.s,l:_.l,a:this._a}},toHslString:function(){var _=p(this._r,this._g,this._b),k=M(_.h*360),U=M(_.s*100),Q=M(_.l*100);return this._a==1?"hsl("+k+", "+U+"%, "+Q+"%)":"hsla("+k+", "+U+"%, "+Q+"%, "+this._roundA+")"},toHex:function(_){return o(this._r,this._g,this._b,_)},toHexString:function(_){return"#"+this.toHex(_)},toHex8:function(_){return l(this._r,this._g,this._b,this._a,_)},toHex8String:function(_){return"#"+this.toHex8(_)},toRgb:function(){return{r:M(this._r),g:M(this._g),b:M(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+M(this._r)+", "+M(this._g)+", "+M(this._b)+")":"rgba("+M(this._r)+", "+M(this._g)+", "+M(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:M(I(this._r,255)*100)+"%",g:M(I(this._g,255)*100)+"%",b:M(I(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+M(I(this._r,255)*100)+"%, "+M(I(this._g,255)*100)+"%, "+M(I(this._b,255)*100)+"%)":"rgba("+M(I(this._r,255)*100)+"%, "+M(I(this._g,255)*100)+"%, "+M(I(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:B[o(this._r,this._g,this._b,!0)]||!1},toFilter:function(_){var k="#"+s(this._r,this._g,this._b,this._a),U=k,Q=this._gradientType?"GradientType = 1, ":"";if(_){var K=O(_);U="#"+s(K._r,K._g,K._b,K._a)}return"progid:DXImageTransform.Microsoft.gradient("+Q+"startColorstr="+k+",endColorstr="+U+")"},toString:function(_){var k=!!_;_=_||this._format;var U=!1,Q=this._a<1&&this._a>=0,K=!k&&Q&&(_==="hex"||_==="hex6"||_==="hex3"||_==="hex4"||_==="hex8"||_==="name");return K?_==="name"&&this._a===0?this.toName():this.toRgbString():(_==="rgb"&&(U=this.toRgbString()),_==="prgb"&&(U=this.toPercentageRgbString()),(_==="hex"||_==="hex6")&&(U=this.toHexString()),_==="hex3"&&(U=this.toHexString(!0)),_==="hex4"&&(U=this.toHex8String(!0)),_==="hex8"&&(U=this.toHex8String()),_==="name"&&(U=this.toName()),_==="hsl"&&(U=this.toHslString()),_==="hsv"&&(U=this.toHsvString()),U||this.toHexString())},clone:function(){return O(this.toString())},_applyModification:function(_,k){var U=_.apply(null,[this].concat([].slice.call(k)));return this._r=U._r,this._g=U._g,this._b=U._b,this.setAlpha(U._a),this},lighten:function(){return this._applyModification(C,arguments)},brighten:function(){return this._applyModification(D,arguments)},darken:function(){return this._applyModification(L,arguments)},desaturate:function(){return this._applyModification(a,arguments)},saturate:function(){return this._applyModification(S,arguments)},greyscale:function(){return this._applyModification(x,arguments)},spin:function(){return this._applyModification(R,arguments)},_applyCombination:function(_,k){return _.apply(null,[this].concat([].slice.call(k)))},analogous:function(){return this._applyCombination(y,arguments)},complement:function(){return this._applyCombination(A,arguments)},monochromatic:function(){return this._applyCombination(b,arguments)},splitcomplement:function(){return this._applyCombination(w,arguments)},triad:function(){return this._applyCombination(T,arguments)},tetrad:function(){return this._applyCombination(d,arguments)}},O.fromRatio=function(_,k){if(typeof _=="object"){var U={};for(var Q in _)_.hasOwnProperty(Q)&&(Q==="a"?U[Q]=_[Q]:U[Q]=Ce(_[Q]));_=U}return O(_,k)};function v(_){var k={r:0,g:0,b:0},U=1,Q=null,K=null,ce=null,xe=!1,De=!1;return typeof _=="string"&&(_=ve(_)),typeof _=="object"&&(Re(_.r)&&Re(_.g)&&Re(_.b)?(k=m(_.r,_.g,_.b),xe=!0,De=String(_.r).substr(-1)==="%"?"prgb":"rgb"):Re(_.h)&&Re(_.s)&&Re(_.v)?(Q=Ce(_.s),K=Ce(_.v),k=f(_.h,Q,K),xe=!0,De="hsv"):Re(_.h)&&Re(_.s)&&Re(_.l)&&(Q=Ce(_.s),ce=Ce(_.l),k=h(_.h,Q,ce),xe=!0,De="hsl"),_.hasOwnProperty("a")&&(U=_.a)),U=F(U),{ok:xe,format:_.format||De,r:z(255,G(k.r,0)),g:z(255,G(k.g,0)),b:z(255,G(k.b,0)),a:U}}function m(_,k,U){return{r:I(_,255)*255,g:I(k,255)*255,b:I(U,255)*255}}function p(_,k,U){_=I(_,255),k=I(k,255),U=I(U,255);var Q=G(_,k,U),K=z(_,k,U),ce,xe,De=(Q+K)/2;if(Q==K)ce=xe=0;else{var ue=Q-K;xe=De>.5?ue/(2-Q-K):ue/(Q+K);switch(Q){case _:ce=(k-U)/ue+(k<U?6:0);break;case k:ce=(U-_)/ue+2;break;case U:ce=(_-k)/ue+4;break}ce/=6}return{h:ce,s:xe,l:De}}function h(_,k,U){var Q,K,ce;_=I(_,360),k=I(k,100),U=I(U,100);function xe(ge,we,Oe){return Oe<0&&(Oe+=1),Oe>1&&(Oe-=1),Oe<1/6?ge+(we-ge)*6*Oe:Oe<1/2?we:Oe<2/3?ge+(we-ge)*(2/3-Oe)*6:ge}if(k===0)Q=K=ce=U;else{var De=U<.5?U*(1+k):U+k-U*k,ue=2*U-De;Q=xe(ue,De,_+1/3),K=xe(ue,De,_),ce=xe(ue,De,_-1/3)}return{r:Q*255,g:K*255,b:ce*255}}function u(_,k,U){_=I(_,255),k=I(k,255),U=I(U,255);var Q=G(_,k,U),K=z(_,k,U),ce,xe,De=Q,ue=Q-K;if(xe=Q===0?0:ue/Q,Q==K)ce=0;else{switch(Q){case _:ce=(k-U)/ue+(k<U?6:0);break;case k:ce=(U-_)/ue+2;break;case U:ce=(_-k)/ue+4;break}ce/=6}return{h:ce,s:xe,v:De}}function f(_,k,U){_=I(_,360)*6,k=I(k,100),U=I(U,100);var Q=Y.floor(_),K=_-Q,ce=U*(1-k),xe=U*(1-K*k),De=U*(1-(1-K)*k),ue=Q%6,ge=[U,xe,ce,ce,De,U][ue],we=[De,U,U,xe,ce,ce][ue],Oe=[ce,ce,De,U,U,xe][ue];return{r:ge*255,g:we*255,b:Oe*255}}function o(_,k,U,Q){var K=[de(M(_).toString(16)),de(M(k).toString(16)),de(M(U).toString(16))];return Q&&K[0].charAt(0)==K[0].charAt(1)&&K[1].charAt(0)==K[1].charAt(1)&&K[2].charAt(0)==K[2].charAt(1)?K[0].charAt(0)+K[1].charAt(0)+K[2].charAt(0):K.join("")}function l(_,k,U,Q,K){var ce=[de(M(_).toString(16)),de(M(k).toString(16)),de(M(U).toString(16)),de(be(Q))];return K&&ce[0].charAt(0)==ce[0].charAt(1)&&ce[1].charAt(0)==ce[1].charAt(1)&&ce[2].charAt(0)==ce[2].charAt(1)&&ce[3].charAt(0)==ce[3].charAt(1)?ce[0].charAt(0)+ce[1].charAt(0)+ce[2].charAt(0)+ce[3].charAt(0):ce.join("")}function s(_,k,U,Q){var K=[de(be(Q)),de(M(_).toString(16)),de(M(k).toString(16)),de(M(U).toString(16))];return K.join("")}O.equals=function(_,k){return!_||!k?!1:O(_).toRgbString()==O(k).toRgbString()},O.random=function(){return O.fromRatio({r:r(),g:r(),b:r()})};function a(_,k){k=k===0?0:k||10;var U=O(_).toHsl();return U.s-=k/100,U.s=g(U.s),O(U)}function S(_,k){k=k===0?0:k||10;var U=O(_).toHsl();return U.s+=k/100,U.s=g(U.s),O(U)}function x(_){return O(_).desaturate(100)}function C(_,k){k=k===0?0:k||10;var U=O(_).toHsl();return U.l+=k/100,U.l=g(U.l),O(U)}function D(_,k){k=k===0?0:k||10;var U=O(_).toRgb();return U.r=G(0,z(255,U.r-M(255*-(k/100)))),U.g=G(0,z(255,U.g-M(255*-(k/100)))),U.b=G(0,z(255,U.b-M(255*-(k/100)))),O(U)}function L(_,k){k=k===0?0:k||10;var U=O(_).toHsl();return U.l-=k/100,U.l=g(U.l),O(U)}function R(_,k){var U=O(_).toHsl(),Q=(U.h+k)%360;return U.h=Q<0?360+Q:Q,O(U)}function A(_){var k=O(_).toHsl();return k.h=(k.h+180)%360,O(k)}function T(_){var k=O(_).toHsl(),U=k.h;return[O(_),O({h:(U+120)%360,s:k.s,l:k.l}),O({h:(U+240)%360,s:k.s,l:k.l})]}function d(_){var k=O(_).toHsl(),U=k.h;return[O(_),O({h:(U+90)%360,s:k.s,l:k.l}),O({h:(U+180)%360,s:k.s,l:k.l}),O({h:(U+270)%360,s:k.s,l:k.l})]}function w(_){var k=O(_).toHsl(),U=k.h;return[O(_),O({h:(U+72)%360,s:k.s,l:k.l}),O({h:(U+216)%360,s:k.s,l:k.l})]}function y(_,k,U){k=k||6,U=U||30;var Q=O(_).toHsl(),K=360/U,ce=[O(_)];for(Q.h=(Q.h-(K*k>>1)+720)%360;--k;)Q.h=(Q.h+K)%360,ce.push(O(Q));return ce}function b(_,k){k=k||6;for(var U=O(_).toHsv(),Q=U.h,K=U.s,ce=U.v,xe=[],De=1/k;k--;)xe.push(O({h:Q,s:K,v:ce})),ce=(ce+De)%1;return xe}O.mix=function(_,k,U){U=U===0?0:U||50;var Q=O(_).toRgb(),K=O(k).toRgb(),ce=U/100,xe={r:(K.r-Q.r)*ce+Q.r,g:(K.g-Q.g)*ce+Q.g,b:(K.b-Q.b)*ce+Q.b,a:(K.a-Q.a)*ce+Q.a};return O(xe)},O.readability=function(_,k){var U=O(_),Q=O(k);return(Y.max(U.getLuminance(),Q.getLuminance())+.05)/(Y.min(U.getLuminance(),Q.getLuminance())+.05)},O.isReadable=function(_,k,U){var Q=O.readability(_,k),K,ce;ce=!1,K=X(U);switch(K.level+K.size){case"AAsmall":case"AAAlarge":ce=Q>=4.5;break;case"AAlarge":ce=Q>=3;break;case"AAAsmall":ce=Q>=7;break}return ce},O.mostReadable=function(_,k,U){var Q=null,K=0,ce,xe,De,ue;U=U||{},xe=U.includeFallbackColors,De=U.level,ue=U.size;for(var ge=0;ge<k.length;ge++)ce=O.readability(_,k[ge]),ce>K&&(K=ce,Q=O(k[ge]));return O.isReadable(_,Q,{level:De,size:ue})||!xe?Q:(U.includeFallbackColors=!1,O.mostReadable(_,["#fff","#000"],U))};var j=O.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},B=O.hexNames=E(j);function E(_){var k={};for(var U in _)_.hasOwnProperty(U)&&(k[_[U]]=U);return k}function F(_){return _=parseFloat(_),(isNaN(_)||_<0||_>1)&&(_=1),_}function I(_,k){$(_)&&(_="100%");var U=le(_);return _=z(k,G(0,parseFloat(_))),U&&(_=parseInt(_*k,10)/100),Y.abs(_-k)<1e-6?1:_%k/parseFloat(k)}function g(_){return z(1,G(0,_))}function W(_){return parseInt(_,16)}function $(_){return typeof _=="string"&&_.indexOf(".")!=-1&&parseFloat(_)===1}function le(_){return typeof _=="string"&&_.indexOf("%")!=-1}function de(_){return _.length==1?"0"+_:""+_}function Ce(_){return _<=1&&(_=_*100+"%"),_}function be(_){return Y.round(parseFloat(_)*255).toString(16)}function Ae(_){return W(_)/255}var Se=function(){var _="[-\\+]?\\d+%?",k="[-\\+]?\\d*\\.\\d+%?",U="(?:"+k+")|(?:"+_+")",Q="[\\s|\\(]+("+U+")[,|\\s]+("+U+")[,|\\s]+("+U+")\\s*\\)?",K="[\\s|\\(]+("+U+")[,|\\s]+("+U+")[,|\\s]+("+U+")[,|\\s]+("+U+")\\s*\\)?";return{CSS_UNIT:new RegExp(U),rgb:new RegExp("rgb"+Q),rgba:new RegExp("rgba"+K),hsl:new RegExp("hsl"+Q),hsla:new RegExp("hsla"+K),hsv:new RegExp("hsv"+Q),hsva:new RegExp("hsva"+K),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function Re(_){return!!Se.CSS_UNIT.exec(_)}function ve(_){_=_.replace(N,"").replace(J,"").toLowerCase();var k=!1;if(j[_])_=j[_],k=!0;else if(_=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var U;return(U=Se.rgb.exec(_))?{r:U[1],g:U[2],b:U[3]}:(U=Se.rgba.exec(_))?{r:U[1],g:U[2],b:U[3],a:U[4]}:(U=Se.hsl.exec(_))?{h:U[1],s:U[2],l:U[3]}:(U=Se.hsla.exec(_))?{h:U[1],s:U[2],l:U[3],a:U[4]}:(U=Se.hsv.exec(_))?{h:U[1],s:U[2],v:U[3]}:(U=Se.hsva.exec(_))?{h:U[1],s:U[2],v:U[3],a:U[4]}:(U=Se.hex8.exec(_))?{r:W(U[1]),g:W(U[2]),b:W(U[3]),a:Ae(U[4]),format:k?"name":"hex8"}:(U=Se.hex6.exec(_))?{r:W(U[1]),g:W(U[2]),b:W(U[3]),format:k?"name":"hex"}:(U=Se.hex4.exec(_))?{r:W(U[1]+""+U[1]),g:W(U[2]+""+U[2]),b:W(U[3]+""+U[3]),a:Ae(U[4]+""+U[4]),format:k?"name":"hex8"}:(U=Se.hex3.exec(_))?{r:W(U[1]+""+U[1]),g:W(U[2]+""+U[2]),b:W(U[3]+""+U[3]),format:k?"name":"hex"}:!1}function X(_){var k,U;return _=_||{level:"AA",size:"small"},k=(_.level||"AA").toUpperCase(),U=(_.size||"small").toLowerCase(),k!=="AA"&&k!=="AAA"&&(k="AA"),U!=="small"&&U!=="large"&&(U="small"),{level:k,size:U}}Qe.exports?Qe.exports=O:!(oe=function(){return O}.call(Te,q,Te,Qe),oe!==void 0&&(Qe.exports=oe))})(Math)},bT9E:function(Qe,Te,q){"use strict";q.d(Te,"a",function(){return Y});var oe=q("VTBJ");function Y(N,J){var H=Object(oe.a)({},N);return Array.isArray(J)&&J.forEach(function(M){delete H[M]}),H}},c5Ni:function(Qe,Te,q){},dejd:function(Qe,Te,q){},dmUQ:function(Qe,Te,q){"use strict";var oe=q("Ff2n"),Y=q("rePB"),N=q("1OyB"),J=q("vuIU"),H=q("Ji7U"),M=q("md7G"),z=q("foSv"),G=q("q1tI"),r=q.n(G),O=q("TSYQ"),v=q.n(O),m=q("4IlW");function p(T,d){var w=Object.keys(T);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(T);d&&(y=y.filter(function(b){return Object.getOwnPropertyDescriptor(T,b).enumerable})),w.push.apply(w,y)}return w}function h(T){for(var d=1;d<arguments.length;d++){var w=arguments[d]!=null?arguments[d]:{};d%2?p(Object(w),!0).forEach(function(y){Object(Y.a)(T,y,w[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(T,Object.getOwnPropertyDescriptors(w)):p(Object(w)).forEach(function(y){Object.defineProperty(T,y,Object.getOwnPropertyDescriptor(w,y))})}return T}function u(T){var d=f();return function(){var y=Object(z.a)(T),b;if(d){var j=Object(z.a)(this).constructor;b=Reflect.construct(y,arguments,j)}else b=y.apply(this,arguments);return Object(M.a)(this,b)}}function f(){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(T){return!1}}function o(){}function l(T){T.preventDefault()}var s=function(d){return d.replace(/[^\w.-]+/g,"")},a=200,S=600,x=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,C=function(d){return d!=null},D=function(d,w){return w===d||typeof w=="number"&&typeof d=="number"&&isNaN(w)&&isNaN(d)},L=function(T){Object(H.a)(w,T);var d=u(w);function w(y){var b;Object(N.a)(this,w),b=d.call(this,y),b.onKeyDown=function(E){var F=b.props,I=F.onKeyDown,g=F.onPressEnter;if(E.keyCode===m.a.UP){var W=b.getRatio(E);b.up(E,W,null),b.stop()}else if(E.keyCode===m.a.DOWN){var $=b.getRatio(E);b.down(E,$,null),b.stop()}else E.keyCode===m.a.ENTER&&g&&g(E);if(b.recordCursorPosition(),b.lastKeyCode=E.keyCode,I){for(var le=arguments.length,de=new Array(le>1?le-1:0),Ce=1;Ce<le;Ce++)de[Ce-1]=arguments[Ce];I.apply(void 0,[E].concat(de))}},b.onKeyUp=function(E){var F=b.props.onKeyUp;if(b.stop(),b.recordCursorPosition(),F){for(var I=arguments.length,g=new Array(I>1?I-1:0),W=1;W<I;W++)g[W-1]=arguments[W];F.apply(void 0,[E].concat(g))}},b.onChange=function(E){var F=b.props.onChange;b.state.focused&&(b.inputting=!0),b.rawInput=b.props.parser(b.getValueFromEvent(E)),b.setState({inputValue:b.rawInput}),F(b.toNumber(b.rawInput))},b.onMouseUp=function(){var E=b.props.onMouseUp;b.recordCursorPosition(),E&&E.apply(void 0,arguments)},b.onFocus=function(){var E;b.setState({focused:!0}),(E=b.props).onFocus.apply(E,arguments)},b.onBlur=function(){var E=b.props.onBlur;b.inputting=!1,b.setState({focused:!1});var F=b.getCurrentValidValue(b.state.inputValue),I=b.setValue(F,o);if(E){var g=b.input.value,W=b.getInputDisplayValue({focus:!1,value:I});b.input.value=W&&Number(W),E.apply(void 0,arguments),b.input.value=g}},b.getRatio=function(E){var F=1;return E.metaKey||E.ctrlKey?F=.1:E.shiftKey&&(F=10),F},b.getFullNum=function(E){return isNaN(E)?E:/e/i.test(String(E))?Number(E).toFixed(18).replace(/\.?0+$/,""):E},b.getPrecision=function(E){if(C(b.props.precision))return b.props.precision;var F=String(E);if(F.indexOf("e-")>=0)return parseInt(F.slice(F.indexOf("e-")+2),10);var I=0;return F.indexOf(".")>=0&&(I=F.length-F.indexOf(".")-1),I},b.getInputDisplayValue=function(E){var F=E||b.state,I=F.focused,g=F.inputValue,W=F.value,$;I?$=g:$=b.toPrecisionAsStep(W),$==null&&($="");var le=b.formatWrapper($);return C(b.props.decimalSeparator)&&(le=le.toString().replace(".",b.props.decimalSeparator)),le},b.recordCursorPosition=function(){try{b.cursorStart=b.input.selectionStart,b.cursorEnd=b.input.selectionEnd,b.currentValue=b.input.value,b.cursorBefore=b.input.value.substring(0,b.cursorStart),b.cursorAfter=b.input.value.substring(b.cursorEnd)}catch(E){}},b.restoreByAfter=function(E){if(E===void 0)return!1;var F=b.input.value,I=F.lastIndexOf(E);if(I===-1)return!1;var g=b.cursorBefore.length;return b.lastKeyCode===m.a.DELETE&&b.cursorBefore.charAt(g-1)===E[0]?(b.fixCaret(g,g),!0):I+E.length===F.length?(b.fixCaret(I,I),!0):!1},b.partRestoreByAfter=function(E){return E===void 0?!1:Array.prototype.some.call(E,function(F,I){var g=E.substring(I);return b.restoreByAfter(g)})},b.isNotCompleteNumber=function(E){return isNaN(E)||E===""||E===null||E&&E.toString().indexOf(".")===E.toString().length-1},b.stop=function(){b.autoStepTimer&&clearTimeout(b.autoStepTimer)},b.down=function(E,F,I){b.pressingUpOrDown=!0,b.step("down",E,F,I)},b.up=function(E,F,I){b.pressingUpOrDown=!0,b.step("up",E,F,I)},b.saveInput=function(E){b.input=E};var j=y.value;j===void 0&&(j=y.defaultValue),b.state={focused:y.autoFocus};var B=b.getValidValue(b.toNumber(j));return b.state=h(h({},b.state),{},{inputValue:b.toPrecisionAsStep(B),value:B}),b}return Object(J.a)(w,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(b){var j=this.props,B=j.value,E=j.onChange,F=j.max,I=j.min,g=this.state.focused;if(b){if(!D(b.value,B)||!D(b.max,F)||!D(b.min,I)){var W=g?B:this.getValidValue(B),$;this.pressingUpOrDown?$=W:this.inputting?$=this.rawInput:$=this.toPrecisionAsStep(W),this.setState({value:W,inputValue:$})}var le="value"in this.props?B:this.state.value;"max"in this.props&&b.max!==F&&typeof le=="number"&&le>F&&E&&E(F),"min"in this.props&&b.min!==I&&typeof le=="number"&&le<I&&E&&E(I)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var de=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===m.a.BACKSPACE?de=this.cursorStart-1:this.lastKeyCode===m.a.DELETE&&(de=this.cursorStart):de=this.input.value.length,this.fixCaret(de,de)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case m.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case m.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Ce){}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(b){var j=b;return j===""?j="":this.isNotCompleteNumber(parseFloat(j))?j=this.state.value:j=this.getValidValue(j),this.toNumber(j)}},{key:"getValueFromEvent",value:function(b){var j=b.target.value.trim().replace(/。/g,".");return C(this.props.decimalSeparator)&&(j=j.replace(this.props.decimalSeparator,".")),j}},{key:"getValidValue",value:function(b){var j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,E=parseFloat(b);return isNaN(E)?b:(E<j&&(E=j),E>B&&(E=B),E)}},{key:"setValue",value:function(b,j){var B=this.props.precision,E=this.isNotCompleteNumber(parseFloat(b))?null:parseFloat(b),F=this.state.value,I=F===void 0?null:F,g=this.state.inputValue,W=g===void 0?null:g,$=typeof E=="number"?E.toFixed(B):"".concat(E),le=E!==I||$!=="".concat(W);return"value"in this.props?(W=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:W},j)):this.setState({value:E,inputValue:this.toPrecisionAsStep(b)},j),le&&this.props.onChange(E),E}},{key:"getMaxPrecision",value:function(b){var j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,B=this.props,E=B.precision,F=B.step;if(C(E))return E;var I=this.getPrecision(j),g=this.getPrecision(F),W=this.getPrecision(b);return b?Math.max(W,I+g):I+g}},{key:"getPrecisionFactor",value:function(b){var j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,B=this.getMaxPrecision(b,j);return Math.pow(10,B)}},{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(b){return this.props.formatter?this.props.formatter(b):b}},{key:"toPrecisionAsStep",value:function(b){if(this.isNotCompleteNumber(b)||b==="")return b;var j=Math.abs(this.getMaxPrecision(b));return isNaN(j)?b.toString():Number(b).toFixed(j)}},{key:"toNumber",value:function(b){var j=this.props.precision,B=this.state.focused,E=b&&b.length>16&&B;return this.isNotCompleteNumber(b)||E?b:C(j)?Math.round(b*Math.pow(10,j))/Math.pow(10,j):Number(b)}},{key:"upStep",value:function(b,j){var B=this.props.step,E=this.getPrecisionFactor(b,j),F=Math.abs(this.getMaxPrecision(b,j)),I=((E*b+E*B*j)/E).toFixed(F);return this.toNumber(I)}},{key:"downStep",value:function(b,j){var B=this.props.step,E=this.getPrecisionFactor(b,j),F=Math.abs(this.getMaxPrecision(b,j)),I=((E*b-E*B*j)/E).toFixed(F);return this.toNumber(I)}},{key:"step",value:function(b,j){var B=this,E=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,F=arguments.length>3?arguments[3]:void 0;this.stop(),j&&(j.persist(),j.preventDefault());var I=this.props;if(I.disabled)return;var g=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(g))return;var W=this["".concat(b,"Step")](g,E),$=W>I.max||W<I.min;if(W>I.max?W=I.max:W<I.min&&(W=I.min),this.setValue(W,null),this.setState({focused:!0},function(){B.pressingUpOrDown=!1}),$)return;this.autoStepTimer=setTimeout(function(){B[b](j,E,!0)},F?a:S)}},{key:"fixCaret",value:function(b,j){if(b===void 0||j===void 0||!this.input||!this.input.value)return;try{var B=this.input.selectionStart,E=this.input.selectionEnd;(b!==B||j!==E)&&this.input.setSelectionRange(b,j)}catch(F){}}},{key:"render",value:function(){var b,j=this.props,B=j.prefixCls,E=j.disabled,F=j.readOnly,I=j.useTouch,g=j.autoComplete,W=j.upHandler,$=j.downHandler,le=j.className,de=j.max,Ce=j.min,be=j.style,Ae=j.title,Se=j.onMouseEnter,Re=j.onMouseLeave,ve=j.onMouseOver,X=j.onMouseOut,_=j.required,k=j.onClick,U=j.tabIndex,Q=j.type,K=j.placeholder,ce=j.id,xe=j.inputMode,De=j.pattern,ue=j.step,ge=j.maxLength,we=j.autoFocus,Oe=j.name,Ne=j.onPaste,Ue=j.onInput,Ge=Object(oe.a)(j,["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"]),We=this.state,Xe=We.value,He=We.focused,Ye=v()(B,(b={},Object(Y.a)(b,le,!!le),Object(Y.a)(b,"".concat(B,"-disabled"),E),Object(Y.a)(b,"".concat(B,"-focused"),He),b)),Me={};Object.keys(Ge).forEach(function(me){(me.substr(0,5)==="data-"||me.substr(0,5)==="aria-"||me==="role")&&(Me[me]=Ge[me])});var it=!F&&!E,qe=this.getInputDisplayValue(null),he=(Xe||Xe===0)&&(isNaN(Xe)||Number(Xe)>=de),ee=(Xe||Xe===0)&&(isNaN(Xe)||Number(Xe)<=Ce),re=he||E||F,ae=ee||E||F,fe=v()("".concat(B,"-handler"),"".concat(B,"-handler-up"),Object(Y.a)({},"".concat(B,"-handler-up-disabled"),re)),ie=v()("".concat(B,"-handler"),"".concat(B,"-handler-down"),Object(Y.a)({},"".concat(B,"-handler-down-disabled"),ae)),se=I?{onTouchStart:re?o:this.up,onTouchEnd:this.stop}:{onMouseDown:re?o:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},pe=I?{onTouchStart:ae?o:this.down,onTouchEnd:this.stop}:{onMouseDown:ae?o:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return r.a.createElement("div",{className:Ye,style:be,title:Ae,onMouseEnter:Se,onMouseLeave:Re,onMouseOver:ve,onMouseOut:X,onFocus:function(){return null},onBlur:function(){return null}},r.a.createElement("div",{className:"".concat(B,"-handler-wrap")},r.a.createElement("span",Object.assign({unselectable:"on"},se,{role:"button","aria-label":"Increase Value","aria-disabled":re,className:fe}),W||r.a.createElement("span",{unselectable:"on",className:"".concat(B,"-handler-up-inner"),onClick:l})),r.a.createElement("span",Object.assign({unselectable:"on"},pe,{role:"button","aria-label":"Decrease Value","aria-disabled":ae,className:ie}),$||r.a.createElement("span",{unselectable:"on",className:"".concat(B,"-handler-down-inner"),onClick:l}))),r.a.createElement("div",{className:"".concat(B,"-input-wrap")},r.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Ce,"aria-valuemax":de,"aria-valuenow":Xe,required:_,type:Q,placeholder:K,onPaste:Ne,onClick:k,onMouseUp:this.onMouseUp,className:"".concat(B,"-input"),tabIndex:U,autoComplete:g,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:it?this.onKeyDown:o,onKeyUp:it?this.onKeyUp:o,autoFocus:we,maxLength:ge,readOnly:F,disabled:E,max:de,min:Ce,step:ue,name:Oe,title:Ae,id:ce,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(qe),pattern:De,inputMode:xe,onInput:Ue},Me))))}}]),w}(r.a.Component);L.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:x,min:-x,step:1,style:{},onChange:o,onKeyDown:o,onPressEnter:o,onFocus:o,onBlur:o,parser:s,required:!1,autoComplete:"off"};var R=L,A=Te.a=R},fjLI:function(Qe,Te,q){"use strict";q.d(Te,"f",function(){return p}),q.d(Te,"b",function(){return h}),q.d(Te,"a",function(){return u}),q.d(Te,"d",function(){return f}),q.d(Te,"e",function(){return o}),q.d(Te,"c",function(){return l});var oe=q("8HAY"),Y=q("Vhoy"),N=q("MI8n"),J=q("JYp7"),H=q("pmY6"),M=q("24hK"),z=q("nnTU"),G=q("T8No"),r=q("Cg/j"),O=q("t9D7"),v=function(s,a,S,x){var C=arguments.length,D=C<3?a:x===null?x=Object.getOwnPropertyDescriptor(a,S):x,L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(s,a,S,x);else for(var R=s.length-1;R>=0;R--)(L=s[R])&&(D=(C<3?L(D):C>3?L(a,S,D):L(a,S))||D);return C>3&&D&&Object.defineProperty(a,S,D),D},m=function(s,a){return function(S,x){a(S,x,s)}};function p(s){return s.command!==void 0}class h{constructor(s){this.id=h._idPool++,this._debugName=s}}h._idPool=0,h.CommandPalette=new h("CommandPalette"),h.EditorContext=new h("EditorContext"),h.SimpleEditorContext=new h("SimpleEditorContext"),h.EditorContextCopy=new h("EditorContextCopy"),h.EditorContextPeek=new h("EditorContextPeek"),h.MenubarEditMenu=new h("MenubarEditMenu"),h.MenubarCopy=new h("MenubarCopy"),h.MenubarGoMenu=new h("MenubarGoMenu"),h.MenubarSelectionMenu=new h("MenubarSelectionMenu"),h.InlineCompletionsActions=new h("InlineCompletionsActions");const u=Object(r.c)("menuService"),f=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new N.b,this.onDidChangeMenu=this._onDidChangeMenu.event,this._commandPaletteChangeEvent={has:s=>s===h.CommandPalette}}addCommand(s){return this.addCommands(J.a.single(s))}addCommands(s){for(const a of s)this._commands.set(a.id,a);return this._onDidChangeMenu.fire(this._commandPaletteChangeEvent),Object(H.i)(()=>{let a=!1;for(const S of s)a=this._commands.delete(S.id)||a;a&&this._onDidChangeMenu.fire(this._commandPaletteChangeEvent)})}getCommand(s){return this._commands.get(s)}getCommands(){const s=new Map;return this._commands.forEach((a,S)=>s.set(S,a)),s}appendMenuItem(s,a){return this.appendMenuItems(J.a.single({id:s,item:a}))}appendMenuItems(s){const a=new Set,S=new M.a;for(const{id:x,item:C}of s){let D=this._menuItems.get(x);D||(D=new M.a,this._menuItems.set(x,D)),S.push(D.push(C)),a.add(x)}return this._onDidChangeMenu.fire(a),Object(H.i)(()=>{if(S.size>0){for(let x of S)x();this._onDidChangeMenu.fire(a),S.clear()}})}getMenuItems(s){let a;return this._menuItems.has(s)?a=[...this._menuItems.get(s)]:a=[],s===h.CommandPalette&&this._appendImplicitItems(a),a}_appendImplicitItems(s){const a=new Set;for(const S of s)p(S)&&(a.add(S.command.id),S.alt&&a.add(S.alt.id));this._commands.forEach((S,x)=>{a.has(x)||s.push({command:S})})}};class o extends oe.e{constructor(s,a,S,x){super(`submenuitem.${s.submenu.id}`,typeof s.title=="string"?s.title:s.title.value,[],"submenu");this.item=s,this._menuService=a,this._contextKeyService=S,this._options=x}get actions(){const s=[],a=this._menuService.createMenu(this.item.submenu,this._contextKeyService),S=a.getActions(this._options);a.dispose();for(const[,x]of S)x.length>0&&(s.push(...x),s.push(new oe.d));return s.length&&s.pop(),s}}let l=class s{constructor(a,S,x,C,D){var L,R;if(this._commandService=D,this.id=a.id,this.label=(x==null?void 0:x.renderShortTitle)&&a.shortTitle?typeof a.shortTitle=="string"?a.shortTitle:a.shortTitle.value:typeof a.title=="string"?a.title:a.title.value,this.tooltip=(R=typeof a.tooltip=="string"?a.tooltip:(L=a.tooltip)===null||L===void 0?void 0:L.value)!==null&&R!==void 0?R:"",this.enabled=!a.precondition||C.contextMatchesRules(a.precondition),this.checked=void 0,a.toggled){const A=a.toggled.condition?a.toggled:{condition:a.toggled};this.checked=C.contextMatchesRules(A.condition),this.checked&&A.tooltip&&(this.tooltip=typeof A.tooltip=="string"?A.tooltip:A.tooltip.value),A.title&&(this.label=typeof A.title=="string"?A.title:A.title.value)}this.item=a,this.alt=S?new s(S,void 0,x,C,D):void 0,this._options=x,O.d.isThemeIcon(a.icon)&&(this.class=Y.a.asClassName(a.icon))}dispose(){}run(...a){var S,x;let C=[];return((S=this._options)===null||S===void 0?void 0:S.arg)&&(C=[...C,this._options.arg]),((x=this._options)===null||x===void 0?void 0:x.shouldForwardArgs)&&(C=[...C,...a]),this._commandService.executeCommand(this.id,...C)}};l=v([m(3,G.b),m(4,z.b)],l)},h78n:function(Qe,Te,q){"use strict";q.d(Te,"a",function(){return b});var oe=q("q1tI"),Y=q.n(oe),N=q("TSYQ"),J=q.n(N),H={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},M=function(E){var F=E.map(function(){return Object(oe.useRef)()}),I=Object(oe.useRef)();return Object(oe.useEffect)(function(){var g=Date.now(),W=!1;Object.keys(F).forEach(function($){var le=F[$].current;if(!le)return;W=!0;var de=le.style;de.transitionDuration=".3s, .3s, .3s, .06s",I.current&&g-I.current<100&&(de.transitionDuration="0s, 0s")}),W&&(I.current=Date.now())}),[F]};function z(){return z=Object.assign||function(B){for(var E=1;E<arguments.length;E++){var F=arguments[E];for(var I in F)Object.prototype.hasOwnProperty.call(F,I)&&(B[I]=F[I])}return B},z.apply(this,arguments)}function G(B,E){return p(B)||m(B,E)||O(B,E)||r()}function r(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function O(B,E){if(!B)return;if(typeof B=="string")return v(B,E);var F=Object.prototype.toString.call(B).slice(8,-1);if(F==="Object"&&B.constructor&&(F=B.constructor.name),F==="Map"||F==="Set")return Array.from(B);if(F==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(F))return v(B,E)}function v(B,E){(E==null||E>B.length)&&(E=B.length);for(var F=0,I=new Array(E);F<E;F++)I[F]=B[F];return I}function m(B,E){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(B)))return;var F=[],I=!0,g=!1,W=void 0;try{for(var $=B[Symbol.iterator](),le;!(I=(le=$.next()).done)&&!(F.push(le.value),E&&F.length===E);I=!0);}catch(de){g=!0,W=de}finally{try{!I&&$.return!=null&&$.return()}finally{if(g)throw W}}return F}function p(B){if(Array.isArray(B))return B}function h(B,E){if(B==null)return{};var F=u(B,E),I,g;if(Object.getOwnPropertySymbols){var W=Object.getOwnPropertySymbols(B);for(g=0;g<W.length;g++){if(I=W[g],E.indexOf(I)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(B,I))continue;F[I]=B[I]}}return F}function u(B,E){if(B==null)return{};var F={},I=Object.keys(B),g,W;for(W=0;W<I.length;W++){if(g=I[W],E.indexOf(g)>=0)continue;F[g]=B[g]}return F}var f=function(E){var F=E.className,I=E.percent,g=E.prefixCls,W=E.strokeColor,$=E.strokeLinecap,le=E.strokeWidth,de=E.style,Ce=E.trailColor,be=E.trailWidth,Ae=E.transition,Se=h(E,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete Se.gapPosition;var Re=Array.isArray(I)?I:[I],ve=Array.isArray(W)?W:[W],X=M(Re),_=G(X,1),k=_[0],U=le/2,Q=100-le/2,K="M ".concat($==="round"?U:0,",").concat(U,`
|
|
L `).concat($==="round"?Q:100,",").concat(U),ce="0 0 100 ".concat(le),xe=0;return Y.a.createElement("svg",z({className:J()("".concat(g,"-line"),F),viewBox:ce,preserveAspectRatio:"none",style:de},Se),Y.a.createElement("path",{className:"".concat(g,"-line-trail"),d:K,strokeLinecap:$,stroke:Ce,strokeWidth:be||le,fillOpacity:"0"}),Re.map(function(De,ue){var ge={strokeDasharray:"".concat(De,"px, 100px"),strokeDashoffset:"-".concat(xe,"px"),transition:Ae||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},we=ve[ue]||ve[ve.length-1];return xe+=De,Y.a.createElement("path",{key:ue,className:"".concat(g,"-line-path"),d:K,strokeLinecap:$,stroke:we,strokeWidth:le,fillOpacity:"0",ref:k[ue],style:ge})}))};f.defaultProps=H;var o=f;function l(){return l=Object.assign||function(B){for(var E=1;E<arguments.length;E++){var F=arguments[E];for(var I in F)Object.prototype.hasOwnProperty.call(F,I)&&(B[I]=F[I])}return B},l.apply(this,arguments)}function s(B,E){return D(B)||C(B,E)||S(B,E)||a()}function a(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function S(B,E){if(!B)return;if(typeof B=="string")return x(B,E);var F=Object.prototype.toString.call(B).slice(8,-1);if(F==="Object"&&B.constructor&&(F=B.constructor.name),F==="Map"||F==="Set")return Array.from(B);if(F==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(F))return x(B,E)}function x(B,E){(E==null||E>B.length)&&(E=B.length);for(var F=0,I=new Array(E);F<E;F++)I[F]=B[F];return I}function C(B,E){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(B)))return;var F=[],I=!0,g=!1,W=void 0;try{for(var $=B[Symbol.iterator](),le;!(I=(le=$.next()).done)&&!(F.push(le.value),E&&F.length===E);I=!0);}catch(de){g=!0,W=de}finally{try{!I&&$.return!=null&&$.return()}finally{if(g)throw W}}return F}function D(B){if(Array.isArray(B))return B}function L(B,E){if(B==null)return{};var F=R(B,E),I,g;if(Object.getOwnPropertySymbols){var W=Object.getOwnPropertySymbols(B);for(g=0;g<W.length;g++){if(I=W[g],E.indexOf(I)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(B,I))continue;F[I]=B[I]}}return F}function R(B,E){if(B==null)return{};var F={},I=Object.keys(B),g,W;for(W=0;W<I.length;W++){if(g=I[W],E.indexOf(g)>=0)continue;F[g]=B[g]}return F}var A=0;function T(B){return+B.replace("%","")}function d(B){return Array.isArray(B)?B:[B]}function w(B,E,F,I){var g=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,W=arguments.length>5?arguments[5]:void 0,$=50-I/2,le=0,de=-$,Ce=0,be=-2*$;switch(W){case"left":le=-$,de=0,Ce=2*$,be=0;break;case"right":le=$,de=0,Ce=-2*$,be=0;break;case"bottom":de=$,be=2*$;break;default:}var Ae="M 50,50 m ".concat(le,",").concat(de,`
|
|
a `).concat($,",").concat($," 0 1 1 ").concat(Ce,",").concat(-be,`
|
|
a `).concat($,",").concat($," 0 1 1 ").concat(-Ce,",").concat(be),Se=Math.PI*2*$,Re={stroke:F,strokeDasharray:"".concat(E/100*(Se-g),"px ").concat(Se,"px"),strokeDashoffset:"-".concat(g/2+B/100*(Se-g),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:Ae,pathStyle:Re}}var y=function(E){var F=E.prefixCls,I=E.strokeWidth,g=E.trailWidth,W=E.gapDegree,$=E.gapPosition,le=E.trailColor,de=E.strokeLinecap,Ce=E.style,be=E.className,Ae=E.strokeColor,Se=E.percent,Re=L(E,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ve=Object(oe.useMemo)(function(){return A+=1,A},[]),X=w(0,100,le,I,W,$),_=X.pathString,k=X.pathStyle,U=d(Se),Q=d(Ae),K=Q.find(function(ge){return Object.prototype.toString.call(ge)==="[object Object]"}),ce=M(U),xe=s(ce,1),De=xe[0],ue=function(){var we=0;return U.map(function(Oe,Ne){var Ue=Q[Ne]||Q[Q.length-1],Ge=Object.prototype.toString.call(Ue)==="[object Object]"?"url(#".concat(F,"-gradient-").concat(ve,")"):"",We=w(we,Oe,Ue,I,W,$);return we+=Oe,Y.a.createElement("path",{key:Ne,className:"".concat(F,"-circle-path"),d:We.pathString,stroke:Ge,strokeLinecap:de,strokeWidth:I,opacity:Oe===0?0:1,fillOpacity:"0",style:We.pathStyle,ref:De[Ne]})})};return Y.a.createElement("svg",l({className:J()("".concat(F,"-circle"),be),viewBox:"0 0 100 100",style:Ce},Re),K&&Y.a.createElement("defs",null,Y.a.createElement("linearGradient",{id:"".concat(F,"-gradient-").concat(ve),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(K).sort(function(ge,we){return T(ge)-T(we)}).map(function(ge,we){return Y.a.createElement("stop",{key:we,offset:ge,stopColor:K[ge]})}))),Y.a.createElement("path",{className:"".concat(F,"-circle-trail"),d:_,stroke:le,strokeLinecap:de,strokeWidth:g||I,fillOpacity:"0",style:k}),ue().reverse())};y.defaultProps=H;var b=y,j={Line:o,Circle:b}},ic2d:function(Qe,Te,q){"use strict";q.d(Te,"a",function(){return J});var oe=q("FWmy"),Y=q("746U");class N{constructor(){this.data=new Map}add(H,M){oe.a(Y.l(H)),oe.a(Y.k(M)),oe.a(!this.data.has(H),"There is already an extension with this id"),this.data.set(H,M)}as(H){return this.data.get(H)||null}}const J=new N},kSUc:function(Qe,Te,q){},lZu9:function(Qe,Te,q){(function(oe){oe(q("VrN/"),q("1eCo"),q("8EBN"))})(function(oe){"use strict";oe.defineMode("markdown",function(Y,N){var J=oe.getMode(Y,"text/html"),H=J.name=="null";function M(I){if(oe.findModeByName){var g=oe.findModeByName(I);g&&(I=g.mime||g.mimes[0])}var W=oe.getMode(Y,I);return W.name=="null"?null:W}N.highlightFormatting===void 0&&(N.highlightFormatting=!1),N.maxBlockquoteDepth===void 0&&(N.maxBlockquoteDepth=0),N.taskLists===void 0&&(N.taskLists=!1),N.strikethrough===void 0&&(N.strikethrough=!1),N.emoji===void 0&&(N.emoji=!1),N.fencedCodeBlockHighlighting===void 0&&(N.fencedCodeBlockHighlighting=!0),N.fencedCodeBlockDefaultMode===void 0&&(N.fencedCodeBlockDefaultMode="text/plain"),N.xml===void 0&&(N.xml=!0),N.tokenTypeOverrides===void 0&&(N.tokenTypeOverrides={});var z={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 G in z)z.hasOwnProperty(G)&&N.tokenTypeOverrides[G]&&(z[G]=N.tokenTypeOverrides[G]);var r=/^([*\-_])(?:\s*\1){2,}\s*$/,O=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,v=/^\[(x| )\](?=\s)/i,m=N.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,p=/^ {0,3}(?:\={1,}|-{2,})\s*$/,h=/^[^#!\[\]*_\\<>` "'(~:]+/,u=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,f=/^\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]/,l=" ";function s(I,g,W){return g.f=g.inline=W,W(I,g)}function a(I,g,W){return g.f=g.block=W,W(I,g)}function S(I){return!I||!/\S/.test(I.string)}function x(I){if(I.linkTitle=!1,I.linkHref=!1,I.linkText=!1,I.em=!1,I.strong=!1,I.strikethrough=!1,I.quote=0,I.indentedCode=!1,I.f==D){var g=H;if(!g){var W=oe.innerMode(J,I.htmlState);g=W.mode.name=="xml"&&W.state.tagStart===null&&!W.state.context&&W.state.tokenize.isInText}g&&(I.f=T,I.block=C,I.htmlState=null)}return I.trailingSpace=0,I.trailingSpaceNewLine=!1,I.prevLine=I.thisLine,I.thisLine={stream:null},null}function C(I,g){var W=I.column()===g.indentation,$=S(g.prevLine.stream),le=g.indentedCode,de=g.prevLine.hr,Ce=g.list!==!1,be=(g.listStack[g.listStack.length-1]||0)+3;g.indentedCode=!1;var Ae=g.indentation;if(g.indentationDiff===null&&(g.indentationDiff=g.indentation,Ce)){for(g.list=null;Ae<g.listStack[g.listStack.length-1];)g.listStack.pop(),g.listStack.length?g.indentation=g.listStack[g.listStack.length-1]:g.list=!1;g.list!==!1&&(g.indentationDiff=Ae-g.listStack[g.listStack.length-1])}var Se=!$&&!de&&!g.prevLine.header&&(!Ce||!le)&&!g.prevLine.fencedCodeEnd,Re=(g.list===!1||de||$)&&g.indentation<=be&&I.match(r),ve=null;if(g.indentationDiff>=4&&(le||g.prevLine.fencedCodeEnd||g.prevLine.header||$))return I.skipToEnd(),g.indentedCode=!0,z.code;if(I.eatSpace())return null;if(W&&g.indentation<=be&&(ve=I.match(m))&&ve[1].length<=6)return g.quote=0,g.header=ve[1].length,g.thisLine.header=!0,N.highlightFormatting&&(g.formatting="header"),g.f=g.inline,R(g);if(g.indentation<=be&&I.eat(">"))return g.quote=W?1:g.quote+1,N.highlightFormatting&&(g.formatting="quote"),I.eatSpace(),R(g);if(!Re&&!g.setext&&W&&g.indentation<=be&&(ve=I.match(O))){var X=ve[1]?"ol":"ul";return g.indentation=Ae+I.current().length,g.list=!0,g.quote=0,g.listStack.push(g.indentation),g.em=!1,g.strong=!1,g.code=!1,g.strikethrough=!1,N.taskLists&&I.match(v,!1)&&(g.taskList=!0),g.f=g.inline,N.highlightFormatting&&(g.formatting=["list","list-"+X]),R(g)}else{if(W&&g.indentation<=be&&(ve=I.match(u,!0)))return g.quote=0,g.fencedEndRE=new RegExp(ve[1]+"+ *$"),g.localMode=N.fencedCodeBlockHighlighting&&M(ve[2]||N.fencedCodeBlockDefaultMode),g.localMode&&(g.localState=oe.startState(g.localMode)),g.f=g.block=L,N.highlightFormatting&&(g.formatting="code-block"),g.code=-1,R(g);if(g.setext||(!Se||!Ce)&&!g.quote&&g.list===!1&&!g.code&&!Re&&!f.test(I.string)&&(ve=I.lookAhead(1))&&(ve=ve.match(p)))return g.setext?(g.header=g.setext,g.setext=0,I.skipToEnd(),N.highlightFormatting&&(g.formatting="header")):(g.header=ve[0].charAt(0)=="="?1:2,g.setext=g.header),g.thisLine.header=!0,g.f=g.inline,R(g);if(Re)return I.skipToEnd(),g.hr=!0,g.thisLine.hr=!0,z.hr;if(I.peek()==="[")return s(I,g,j)}return s(I,g,g.inline)}function D(I,g){var W=J.token(I,g.htmlState);if(!H){var $=oe.innerMode(J,g.htmlState);($.mode.name=="xml"&&$.state.tagStart===null&&!$.state.context&&$.state.tokenize.isInText||g.md_inside&&I.current().indexOf(">")>-1)&&(g.f=T,g.block=C,g.htmlState=null)}return W}function L(I,g){var W=g.listStack[g.listStack.length-1]||0,$=g.indentation<W,le=W+3;if(g.fencedEndRE&&g.indentation<=le&&($||I.match(g.fencedEndRE))){N.highlightFormatting&&(g.formatting="code-block");var de;return $||(de=R(g)),g.localMode=g.localState=null,g.block=C,g.f=T,g.fencedEndRE=null,g.code=0,g.thisLine.fencedCodeEnd=!0,$?a(I,g,g.block):de}else return g.localMode?g.localMode.token(I,g.localState):(I.skipToEnd(),z.code)}function R(I){var g=[];if(I.formatting){g.push(z.formatting),typeof I.formatting=="string"&&(I.formatting=[I.formatting]);for(var W=0;W<I.formatting.length;W++)g.push(z.formatting+"-"+I.formatting[W]),I.formatting[W]==="header"&&g.push(z.formatting+"-"+I.formatting[W]+"-"+I.header),I.formatting[W]==="quote"&&(!N.maxBlockquoteDepth||N.maxBlockquoteDepth>=I.quote?g.push(z.formatting+"-"+I.formatting[W]+"-"+I.quote):g.push("error"))}if(I.taskOpen)return g.push("meta"),g.length?g.join(" "):null;if(I.taskClosed)return g.push("property"),g.length?g.join(" "):null;if(I.linkHref?g.push(z.linkHref,"url"):(I.strong&&g.push(z.strong),I.em&&g.push(z.em),I.strikethrough&&g.push(z.strikethrough),I.emoji&&g.push(z.emoji),I.linkText&&g.push(z.linkText),I.code&&g.push(z.code),I.image&&g.push(z.image),I.imageAltText&&g.push(z.imageAltText,"link"),I.imageMarker&&g.push(z.imageMarker)),I.header&&g.push(z.header,z.header+"-"+I.header),I.quote&&(g.push(z.quote),!N.maxBlockquoteDepth||N.maxBlockquoteDepth>=I.quote?g.push(z.quote+"-"+I.quote):g.push(z.quote+"-"+N.maxBlockquoteDepth)),I.list!==!1){var $=(I.listStack.length-1)%3;$?$===1?g.push(z.list2):g.push(z.list3):g.push(z.list1)}return I.trailingSpaceNewLine?g.push("trailing-space-new-line"):I.trailingSpace&&g.push("trailing-space-"+(I.trailingSpace%2?"a":"b")),g.length?g.join(" "):null}function A(I,g){return I.match(h,!0)?R(g):void 0}function T(I,g){var W=g.text(I,g);if(typeof W!="undefined")return W;if(g.list)return g.list=null,R(g);if(g.taskList){var $=I.match(v,!0)[1]===" ";return $?g.taskOpen=!0:g.taskClosed=!0,N.highlightFormatting&&(g.formatting="task"),g.taskList=!1,R(g)}if(g.taskOpen=!1,g.taskClosed=!1,g.header&&I.match(/^#+$/,!0))return N.highlightFormatting&&(g.formatting="header"),R(g);var le=I.next();if(g.linkTitle){g.linkTitle=!1;var de=le;le==="("&&(de=")"),de=(de+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Ce="^\\s*(?:[^"+de+"\\\\]+|\\\\\\\\|\\\\.)"+de;if(I.match(new RegExp(Ce),!0))return z.linkHref}if(le==="`"){var be=g.formatting;N.highlightFormatting&&(g.formatting="code"),I.eatWhile("`");var Ae=I.current().length;if(g.code==0&&(!g.quote||Ae==1))return g.code=Ae,R(g);if(Ae==g.code){var Se=R(g);return g.code=0,Se}else return g.formatting=be,R(g)}else if(g.code)return R(g);if(le==="\\"&&(I.next(),N.highlightFormatting)){var Re=R(g),ve=z.formatting+"-escape";return Re?Re+" "+ve:ve}if(le==="!"&&I.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return g.imageMarker=!0,g.image=!0,N.highlightFormatting&&(g.formatting="image"),R(g);if(le==="["&&g.imageMarker&&I.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return g.imageMarker=!1,g.imageAltText=!0,N.highlightFormatting&&(g.formatting="image"),R(g);if(le==="]"&&g.imageAltText){N.highlightFormatting&&(g.formatting="image");var Re=R(g);return g.imageAltText=!1,g.image=!1,g.inline=g.f=w,Re}if(le==="["&&!g.image)return g.linkText&&I.match(/^.*?\]/)||(g.linkText=!0,N.highlightFormatting&&(g.formatting="link")),R(g);if(le==="]"&&g.linkText){N.highlightFormatting&&(g.formatting="link");var Re=R(g);return g.linkText=!1,g.inline=g.f=I.match(/\(.*?\)| ?\[.*?\]/,!1)?w:T,Re}if(le==="<"&&I.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){g.f=g.inline=d,N.highlightFormatting&&(g.formatting="link");var Re=R(g);return Re?Re+=" ":Re="",Re+z.linkInline}if(le==="<"&&I.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){g.f=g.inline=d,N.highlightFormatting&&(g.formatting="link");var Re=R(g);return Re?Re+=" ":Re="",Re+z.linkEmail}if(N.xml&&le==="<"&&I.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var X=I.string.indexOf(">",I.pos);if(X!=-1){var _=I.string.substring(I.start,X);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(_)&&(g.md_inside=!0)}return I.backUp(1),g.htmlState=oe.startState(J),a(I,g,D)}if(N.xml&&le==="<"&&I.match(/^\/\w*?>/))return g.md_inside=!1,"tag";if(le==="*"||le==="_"){for(var k=1,U=I.pos==1?" ":I.string.charAt(I.pos-2);k<3&&I.eat(le);)k++;var Q=I.peek()||" ",K=!/\s/.test(Q)&&(!o.test(Q)||/\s/.test(U)||o.test(U)),ce=!/\s/.test(U)&&(!o.test(U)||/\s/.test(Q)||o.test(Q)),xe=null,De=null;if(k%2&&(!g.em&&K&&(le==="*"||!ce||o.test(U))?xe=!0:g.em==le&&ce&&(le==="*"||!K||o.test(Q))&&(xe=!1)),k>1&&(!g.strong&&K&&(le==="*"||!ce||o.test(U))?De=!0:g.strong==le&&ce&&(le==="*"||!K||o.test(Q))&&(De=!1)),De!=null||xe!=null){N.highlightFormatting&&(g.formatting=xe==null?"strong":De==null?"em":"strong em"),xe===!0&&(g.em=le),De===!0&&(g.strong=le);var Se=R(g);return xe===!1&&(g.em=!1),De===!1&&(g.strong=!1),Se}}else if(le===" "&&(I.eat("*")||I.eat("_"))){if(I.peek()===" ")return R(g);I.backUp(1)}if(N.strikethrough){if(le==="~"&&I.eatWhile(le)){if(g.strikethrough){N.highlightFormatting&&(g.formatting="strikethrough");var Se=R(g);return g.strikethrough=!1,Se}else if(I.match(/^[^\s]/,!1))return g.strikethrough=!0,N.highlightFormatting&&(g.formatting="strikethrough"),R(g)}else if(le===" "&&I.match(/^~~/,!0)){if(I.peek()===" ")return R(g);I.backUp(2)}}if(N.emoji&&le===":"&&I.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){g.emoji=!0,N.highlightFormatting&&(g.formatting="emoji");var ue=R(g);return g.emoji=!1,ue}return le===" "&&(I.match(/^ +$/,!1)?g.trailingSpace++:g.trailingSpace&&(g.trailingSpaceNewLine=!0)),R(g)}function d(I,g){var W=I.next();if(W===">"){g.f=g.inline=T,N.highlightFormatting&&(g.formatting="link");var $=R(g);return $?$+=" ":$="",$+z.linkInline}return I.match(/^[^>]+/,!0),z.linkInline}function w(I,g){if(I.eatSpace())return null;var W=I.next();return W==="("||W==="["?(g.f=g.inline=b(W==="("?")":"]"),N.highlightFormatting&&(g.formatting="link-string"),g.linkHref=!0,R(g)):"error"}var y={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function b(I){return function(g,W){var $=g.next();if($===I){W.f=W.inline=T,N.highlightFormatting&&(W.formatting="link-string");var le=R(W);return W.linkHref=!1,le}return g.match(y[I]),W.linkHref=!0,R(W)}}function j(I,g){return I.match(/^([^\]\\]|\\.)*\]:/,!1)?(g.f=B,I.next(),N.highlightFormatting&&(g.formatting="link"),g.linkText=!0,R(g)):s(I,g,T)}function B(I,g){if(I.match(/^\]:/,!0)){g.f=g.inline=E,N.highlightFormatting&&(g.formatting="link");var W=R(g);return g.linkText=!1,W}return I.match(/^([^\]\\]|\\.)+/,!0),z.linkText}function E(I,g){return I.eatSpace()?null:(I.match(/^[^\s]+/,!0),I.peek()===void 0?g.linkTitle=!0:I.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),g.f=g.inline=T,z.linkHref+" url")}var F={startState:function(){return{f:C,prevLine:{stream:null},thisLine:{stream:null},block:C,htmlState:null,indentation:0,inline:T,text:A,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(I){return{f:I.f,prevLine:I.prevLine,thisLine:I.thisLine,block:I.block,htmlState:I.htmlState&&oe.copyState(J,I.htmlState),indentation:I.indentation,localMode:I.localMode,localState:I.localMode?oe.copyState(I.localMode,I.localState):null,inline:I.inline,text:I.text,formatting:!1,linkText:I.linkText,linkTitle:I.linkTitle,linkHref:I.linkHref,code:I.code,em:I.em,strong:I.strong,strikethrough:I.strikethrough,emoji:I.emoji,header:I.header,setext:I.setext,hr:I.hr,taskList:I.taskList,list:I.list,listStack:I.listStack.slice(0),quote:I.quote,indentedCode:I.indentedCode,trailingSpace:I.trailingSpace,trailingSpaceNewLine:I.trailingSpaceNewLine,md_inside:I.md_inside,fencedEndRE:I.fencedEndRE}},token:function(I,g){if(g.formatting=!1,I!=g.thisLine.stream){if(g.header=0,g.hr=!1,I.match(/^\s*$/,!0))return x(g),null;if(g.prevLine=g.thisLine,g.thisLine={stream:I},g.taskList=!1,g.trailingSpace=0,g.trailingSpaceNewLine=!1,!g.localState&&(g.f=g.block,g.f!=D)){var W=I.match(/^\s*/,!0)[0].replace(/\t/g,l).length;if(g.indentation=W,g.indentationDiff=null,W>0)return null}}return g.f(I,g)},innerMode:function(I){return I.block==D?{state:I.htmlState,mode:J}:I.localState?{state:I.localState,mode:I.localMode}:{state:I,mode:F}},indent:function(I,g,W){return I.block==D&&J.indent?J.indent(I.htmlState,g,W):I.localState&&I.localMode.indent?I.localMode.indent(I.localState,g,W):oe.Pass},blankLine:x,getType:R,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return F},"xml"),oe.defineMIME("text/markdown","markdown"),oe.defineMIME("text/x-markdown","markdown")})},nEHx:function(Qe,Te,q){"use strict";q.d(Te,"a",function(){return oe});var oe;(function(Y){Y.DARK="dark",Y.LIGHT="light",Y.HIGH_CONTRAST="hc"})(oe||(oe={}))},nnTU:function(Qe,Te,q){"use strict";q.d(Te,"b",function(){return z}),q.d(Te,"a",function(){return G});var oe=q("MI8n"),Y=q("JYp7"),N=q("pmY6"),J=q("24hK"),H=q("746U"),M=q("Cg/j");const z=Object(M.c)("commandService"),G=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new oe.b,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(r,O){if(!r)throw new Error("invalid command");if(typeof r=="string"){if(!O)throw new Error("invalid command");return this.registerCommand({id:r,handler:O})}if(r.description){const u=[];for(let o of r.description.args)u.push(o.constraint);const f=r.handler;r.handler=function(o,...l){return Object(H.o)(l,u),f(o,...l)}}const{id:v}=r;let m=this._commands.get(v);m||(m=new J.a,this._commands.set(v,m));let p=m.unshift(r),h=Object(N.i)(()=>{p();const u=this._commands.get(v);(u==null?void 0:u.isEmpty())&&this._commands.delete(v)});return this._onDidRegisterCommand.fire(v),h}registerCommandAlias(r,O){return G.registerCommand(r,(v,...m)=>v.get(z).executeCommand(O,...m))}getCommand(r){const O=this._commands.get(r);return!O||O.isEmpty()?void 0:Y.a.first(O)}getCommands(){const r=new Map;for(const O of this._commands.keys()){const v=this.getCommand(O);v&&r.set(O,v)}return r}};G.registerCommand("noop",()=>{})},osHv:function(Qe,Te,q){(function(oe){oe(q("VrN/"))})(function(oe){"use strict";var Y=oe.Pos;function N(o,l){return o.line-l.line||o.ch-l.ch}var J="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",H=J+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",M=new RegExp("<(/?)(["+J+"]["+H+"]*)","g");function z(o,l,s,a){this.line=l,this.ch=s,this.cm=o,this.text=o.getLine(l),this.min=a?Math.max(a.from,o.firstLine()):o.firstLine(),this.max=a?Math.min(a.to-1,o.lastLine()):o.lastLine()}function G(o,l){var s=o.cm.getTokenTypeAt(Y(o.line,l));return s&&/\btag\b/.test(s)}function r(o){return o.line>=o.max?void 0:(o.ch=0,o.text=o.cm.getLine(++o.line),!0)}function O(o){return o.line<=o.min?void 0:(o.text=o.cm.getLine(--o.line),o.ch=o.text.length,!0)}function v(o){for(;;){var l=o.text.indexOf(">",o.ch);if(l==-1){if(r(o))continue;return}if(!G(o,l+1)){o.ch=l+1;continue}var s=o.text.lastIndexOf("/",l),a=s>-1&&!/\S/.test(o.text.slice(s+1,l));return o.ch=l+1,a?"selfClose":"regular"}}function m(o){for(;;){var l=o.ch?o.text.lastIndexOf("<",o.ch-1):-1;if(l==-1){if(O(o))continue;return}if(!G(o,l+1)){o.ch=l;continue}M.lastIndex=l,o.ch=l;var s=M.exec(o.text);if(s&&s.index==l)return s}}function p(o){for(;;){M.lastIndex=o.ch;var l=M.exec(o.text);if(!l){if(r(o))continue;return}if(!G(o,l.index+1)){o.ch=l.index+1;continue}return o.ch=l.index+l[0].length,l}}function h(o){for(;;){var l=o.ch?o.text.lastIndexOf(">",o.ch-1):-1;if(l==-1){if(O(o))continue;return}if(!G(o,l+1)){o.ch=l;continue}var s=o.text.lastIndexOf("/",l),a=s>-1&&!/\S/.test(o.text.slice(s+1,l));return o.ch=l+1,a?"selfClose":"regular"}}function u(o,l){for(var s=[];;){var a=p(o),S,x=o.line,C=o.ch-(a?a[0].length:0);if(!a||!(S=v(o)))return;if(S=="selfClose")continue;if(a[1]){for(var D=s.length-1;D>=0;--D)if(s[D]==a[2]){s.length=D;break}if(D<0&&(!l||l==a[2]))return{tag:a[2],from:Y(x,C),to:Y(o.line,o.ch)}}else s.push(a[2])}}function f(o,l){for(var s=[];;){var a=h(o);if(!a)return;if(a=="selfClose"){m(o);continue}var S=o.line,x=o.ch,C=m(o);if(!C)return;if(C[1])s.push(C[2]);else{for(var D=s.length-1;D>=0;--D)if(s[D]==C[2]){s.length=D;break}if(D<0&&(!l||l==C[2]))return{tag:C[2],from:Y(o.line,o.ch),to:Y(S,x)}}}}oe.registerHelper("fold","xml",function(o,l){for(var s=new z(o,l.line,0);;){var a=p(s);if(!a||s.line!=l.line)return;var S=v(s);if(!S)return;if(!a[1]&&S!="selfClose"){var x=Y(s.line,s.ch),C=u(s,a[2]);return C&&N(C.from,x)>0?{from:x,to:C.from}:null}}}),oe.findMatchingTag=function(o,l,s){var a=new z(o,l.line,l.ch,s);if(a.text.indexOf(">")==-1&&a.text.indexOf("<")==-1)return;var S=v(a),x=S&&Y(a.line,a.ch),C=S&&m(a);if(!S||!C||N(a,l)>0)return;var D={from:Y(a.line,a.ch),to:x,tag:C[2]};return S=="selfClose"?{open:D,close:null,at:"open"}:C[1]?{open:f(a,C[2]),close:D,at:"close"}:(a=new z(o,x.line,x.ch,s),{open:D,close:u(a,C[2]),at:"open"})},oe.findEnclosingTag=function(o,l,s,a){for(var S=new z(o,l.line,l.ch,s);;){var x=f(S,a);if(!x)break;var C=new z(o,l.line,l.ch,s),D=u(C,x.tag);if(D)return{open:x,close:D}}},oe.scanForClosingTag=function(o,l,s,a){var S=new z(o,l.line,l.ch,a?{from:0,to:a}:null);return u(S,s)}})},p5ED:function(Qe,Te,q){"use strict";var oe=q("+L6B"),Y=q("2/Rp"),N=q("5Dmo"),J=q("3S7+"),H=q("k1fw"),M=q("9og8"),z=q("tJVT"),G=q("WmNS"),r=q.n(G),O=q("q1tI"),v=q.n(O),m=q("vHTk"),p=q.n(m),h=q("yEEn"),u=q("ZW9T"),f=q("1vsH"),o=q("V0Rq"),l=q("m3rI");Te.a=function(s){var a,S,x,C,D,L,R,A=s.editOffice,T=A===void 0?"view":A,d=s.data,w=s.theme,y=s.type,b=s.filename,j=s.monacoEditor,B=s.className,E=s.style,F=s.close,I=s.onClose,g=s.hasMask,W=s.disabledDownload,$=Object(O.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),le=Object(z.a)($,2),de=le[0],Ce=le[1],be=Object(O.useState)(""),Ae=Object(z.a)(be,2),Se=Ae[0],Re=Ae[1],ve=Object(O.useState)(),X=Object(z.a)(ve,2),_=X[0],k=X[1],U=window.ENV==="build"?"/react/build":"",Q=l.a.PROXY_SERVER||location.origin,K,ce=1024*1024,xe=10*ce,De=Object(O.useRef)();(a=d)!==null&&a!==void 0&&a.startsWith("/api")&&y!=="txt"&&(d=(l.a.API_SERVER||location.origin)+d),y==="office"&&(K=Object(f.T)(d).filesize,K>xe&&(y="other")),b&&j&&(j.filename=b),Object(O.useEffect)(function(){var Oe,Ne,Ue=(Oe=document.cookie)===null||Oe===void 0||((Ne=Oe.replace(/\s/g,""))===null||Ne===void 0)?void 0:Ne.split(";");Ue==null||Ue.map(function(Ge){var We=Ge.split("=");We[0]==="_educoder_session"&&Re(We[1])})},[]),Object(O.useEffect)(function(){y==="office"&&ue()},[y,d]);var ue=function(){var Oe=Object(M.a)(r.a.mark(function Ne(){var Ue,Ge,We;return r.a.wrap(function(He){for(;;)switch(He.prev=He.next){case 0:return console.log("data:",d),Ue=d,d.startsWith("http")||(Ue=location.origin+Ue),Ge=new URL(Ue).pathname.split("/").pop(),He.next=6,Object(o.V)({attachment_id:Ge});case 6:We=He.sent,k(We);case 8:case"end":return He.stop()}},Ne)}));return function(){return Oe.apply(this,arguments)}}(),ge=function(){if(d.startsWith("http")||d.startsWith("blob:")){we();return}Object(f.z)(b||"educoder",d,b)},we=function(){Object(f.x)(b||"educoder",decodeURIComponent(d))};return v.a.createElement("div",{style:Object(H.a)({},E||{}),className:"".concat(g&&p.a.bgBlack," ").concat(y?p.a.wrp:"hide")},F&&v.a.createElement("div",{className:p.a.close,ref:De},!W&&v.a.createElement(J.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return De.current}},v.a.createElement("span",{onClick:we},v.a.createElement("i",{className:"icon-quxiaozhiding"}))),v.a.createElement(J.a,{title:"\u5173\u95ED",getPopupContainer:function(){return De.current}},v.a.createElement("span",{className:"",onClick:I},v.a.createElement("i",{className:"icon-guanbi1"})))),v.a.createElement("div",{className:"".concat(p.a[B]," ").concat(B," ").concat(p.a.monaco," ").concat(y==="txt"?"show":"hide")},y==="txt"&&v.a.createElement(u.b,j)),y==="audio"&&v.a.createElement("audio",{src:"".concat(((S=d)===null||S===void 0?void 0:S.indexOf("http://"))>-1||((x=d)===null||x===void 0?void 0:x.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(d),autoPlay:!0}),y==="video"&&v.a.createElement(v.a.Fragment,null,((C=d)===null||C===void 0?void 0:C.indexOf("http"))>-1?v.a.createElement("video",{controls:!0,src:"".concat(d),autoPlay:!0}):v.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(d),autoPlay:!0})),y==="office"&&_&&v.a.createElement("iframe",{src:"".concat(U,"/office.html?key=").concat(_.key,"&url=").concat(Q+_.url,"&callbackUrl=").concat(Q+_.callbackUrl,"&fileType=").concat(_.fileType,"&title=").concat(_.title,"&model=").concat(T,"&officeServer=").concat(l.a.OFFICE_SERVER,"&disabledDownload=").concat(!!W)}),y==="html"&&v.a.createElement("iframe",{src:d+"&disposition=inline"}),y==="pdf"&&v.a.createElement("iframe",{src:"".concat(U,"/js/pdfview/index.html?url=").concat(d,"&disabledDownload=").concat(!!W)}),y==="image"&&v.a.createElement("img",{src:"".concat(((D=d)===null||D===void 0?void 0:D.indexOf("http://"))>-1||((L=d)===null||L===void 0?void 0:L.indexOf("https://"))>-1||(R=d)!==null&&R!==void 0&&R.startsWith("/api")?"":"data:image/png;base64,").concat(d)}),y==="other"&&v.a.createElement("div",null,v.a.createElement(Y.a,{type:"primary",size:"large",onClick:ge},v.a.createElement(h.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),y==="download"&&v.a.createElement(Y.a,{type:"primary",size:"large",onClick:ge},v.a.createElement(h.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(Qe,Te,q){},pmY6:function(Qe,Te,q){"use strict";q.d(Te,"h",function(){return O}),q.d(Te,"g",function(){return m}),q.d(Te,"f",function(){return p}),q.d(Te,"e",function(){return h}),q.d(Te,"i",function(){return u}),q.d(Te,"b",function(){return f}),q.d(Te,"a",function(){return o}),q.d(Te,"d",function(){return l}),q.d(Te,"c",function(){return s});var oe=q("C/vA"),Y=q("JYp7");const N=!1;let J=null;function H(a){J=a}if(N){const a="__is_disposable_tracked__";H(new class{trackDisposable(S){const x=new Error("Potentially leaked disposable").stack;setTimeout(()=>{S[a]||console.log(x)},3e3)}setParent(S,x){if(S&&S!==o.None)try{S[a]=!0}catch(C){}}markAsDisposed(S){if(S&&S!==o.None)try{S[a]=!0}catch(x){}}markAsSingleton(S){}})}function M(a){return J==null||J.trackDisposable(a),a}function z(a){J==null||J.markAsDisposed(a)}function G(a,S){J==null||J.setParent(a,S)}function r(a,S){if(!J)return;for(const x of a)J.setParent(x,S)}function O(a){return J==null||J.markAsSingleton(a),a}class v extends Error{constructor(a){super(`Encountered errors while disposing of store. Errors: [${a.join(", ")}]`);this.errors=a}}function m(a){return typeof a.dispose=="function"&&a.dispose.length===0}function p(a){if(Y.a.is(a)){let S=[];for(const x of a)if(x)try{x.dispose()}catch(C){S.push(C)}if(S.length===1)throw S[0];if(S.length>1)throw new v(S);return Array.isArray(a)?[]:a}else if(a)return a.dispose(),a}function h(...a){const S=u(()=>p(a));return r(a,S),S}function u(a){const S=M({dispose:Object(oe.a)(()=>{z(S),a()})});return S}class f{constructor(){this._toDispose=new Set,this._isDisposed=!1,M(this)}dispose(){if(this._isDisposed)return;z(this),this._isDisposed=!0,this.clear()}clear(){try{p(this._toDispose.values())}finally{this._toDispose.clear()}}add(a){if(!a)return a;if(a===this)throw new Error("Cannot register a disposable on itself!");return G(a,this),this._isDisposed?f.DISABLE_DISPOSED_WARNING||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(a),a}}f.DISABLE_DISPOSED_WARNING=!1;class o{constructor(){this._store=new f,M(this),G(this._store,this)}dispose(){z(this),this._store.dispose()}_register(a){if(a===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(a)}}o.None=Object.freeze({dispose(){}});class l{constructor(){this._isDisposed=!1,M(this)}get value(){return this._isDisposed?void 0:this._value}set value(a){var S;if(this._isDisposed||a===this._value)return;(S=this._value)===null||S===void 0||S.dispose(),a&&G(a,this),this._value=a}clear(){this.value=void 0}dispose(){var a;this._isDisposed=!0,z(this),(a=this._value)===null||a===void 0||a.dispose(),this._value=void 0}clearAndLeak(){const a=this._value;return this._value=void 0,a&&G(a,null),a}}class s{constructor(a){this.object=a}dispose(){}}},psGv:function(Qe,Te,q){var oe,Y;(function(){var N;(function(){"use strict";var z=[,,function(v){function m(u){this.__parent=u,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}m.prototype.clone_empty=function(){var u=new m(this.__parent);return u.set_indent(this.__indent_count,this.__alignment_count),u},m.prototype.item=function(u){return u<0?this.__items[this.__items.length+u]:this.__items[u]},m.prototype.has_match=function(u){for(var f=this.__items.length-1;f>=0;f--)if(this.__items[f].match(u))return!0;return!1},m.prototype.set_indent=function(u,f){this.is_empty()&&(this.__indent_count=u||0,this.__alignment_count=f||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},m.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},m.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},m.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var u=this.__parent.current_line;return u.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),u.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),u.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,u.__items[0]===" "&&(u.__items.splice(0,1),u.__character_count-=1),!0}return!1},m.prototype.is_empty=function(){return this.__items.length===0},m.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},m.prototype.push=function(u){this.__items.push(u);var f=u.lastIndexOf(`
|
|
`);f!==-1?this.__character_count=u.length-f:this.__character_count+=u.length},m.prototype.pop=function(){var u=null;return this.is_empty()||(u=this.__items.pop(),this.__character_count-=u.length),u},m.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},m.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},m.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},m.prototype.toString=function(){var u="";return this.is_empty()?this.__parent.indent_empty_lines&&(u=this.__parent.get_indent_string(this.__indent_count)):(u=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),u+=this.__items.join("")),u};function p(u,f){this.__cache=[""],this.__indent_size=u.indent_size,this.__indent_string=u.indent_char,u.indent_with_tabs||(this.__indent_string=new Array(u.indent_size+1).join(u.indent_char)),f=f||"",u.indent_level>0&&(f=new Array(u.indent_level+1).join(this.__indent_string)),this.__base_string=f,this.__base_string_length=f.length}p.prototype.get_indent_size=function(u,f){var o=this.__base_string_length;return f=f||0,u<0&&(o=0),o+=u*this.__indent_size,o+=f,o},p.prototype.get_indent_string=function(u,f){var o=this.__base_string;return f=f||0,u<0&&(u=0,o=""),f+=u*this.__indent_size,this.__ensure_cache(f),o+=this.__cache[f],o},p.prototype.__ensure_cache=function(u){for(;u>=this.__cache.length;)this.__add_column()},p.prototype.__add_column=function(){var u=this.__cache.length,f=0,o="";this.__indent_size&&u>=this.__indent_size&&(f=Math.floor(u/this.__indent_size),u-=f*this.__indent_size,o=new Array(f+1).join(this.__indent_string)),u&&(o+=new Array(u+1).join(" ")),this.__cache.push(o)};function h(u,f){this.__indent_cache=new p(u,f),this.raw=!1,this._end_with_newline=u.end_with_newline,this.indent_size=u.indent_size,this.wrap_line_length=u.wrap_line_length,this.indent_empty_lines=u.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new m(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}h.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},h.prototype.get_line_number=function(){return this.__lines.length},h.prototype.get_indent_string=function(u,f){return this.__indent_cache.get_indent_string(u,f)},h.prototype.get_indent_size=function(u,f){return this.__indent_cache.get_indent_size(u,f)},h.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},h.prototype.add_new_line=function(u){return this.is_empty()||!u&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},h.prototype.get_code=function(u){this.trim(!0);var f=this.current_line.pop();f&&(f[f.length-1]===`
|
|
`&&(f=f.replace(/\n+$/g,"")),this.current_line.push(f)),this._end_with_newline&&this.__add_outputline();var o=this.__lines.join(`
|
|
`);return u!==`
|
|
`&&(o=o.replace(/[\n]/g,u)),o},h.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},h.prototype.set_indent=function(u,f){return u=u||0,f=f||0,this.next_line.set_indent(u,f),this.__lines.length>1?(this.current_line.set_indent(u,f),!0):(this.current_line.set_indent(),!1)},h.prototype.add_raw_token=function(u){for(var f=0;f<u.newlines;f++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(u.whitespace_before),this.current_line.push(u.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},h.prototype.add_token=function(u){this.__add_space_before_token(),this.current_line.push(u),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},h.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},h.prototype.remove_indent=function(u){for(var f=this.__lines.length;u<f;)this.__lines[u]._remove_indent(),u++;this.current_line._remove_wrap_indent()},h.prototype.trim=function(u){for(u=u===void 0?!1:u,this.current_line.trim();u&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},h.prototype.just_added_newline=function(){return this.current_line.is_empty()},h.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},h.prototype.ensure_empty_line_above=function(u,f){for(var o=this.__lines.length-2;o>=0;){var l=this.__lines[o];if(l.is_empty())break;if(l.item(0).indexOf(u)!==0&&l.item(-1)!==f){this.__lines.splice(o+1,0,new m(this)),this.previous_line=this.__lines[this.__lines.length-2];break}o--}},v.exports.Output=h},function(v){function m(p,h,u,f){this.type=p,this.text=h,this.comments_before=null,this.newlines=u||0,this.whitespace_before=f||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}v.exports.Token=m},,,function(v){function m(u,f){this.raw_options=p(u,f),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}m.prototype._get_array=function(u,f){var o=this.raw_options[u],l=f||[];return typeof o=="object"?o!==null&&typeof o.concat=="function"&&(l=o.concat()):typeof o=="string"&&(l=o.split(/[^a-zA-Z0-9_\/\-]+/)),l},m.prototype._get_boolean=function(u,f){var o=this.raw_options[u],l=o===void 0?!!f:!!o;return l},m.prototype._get_characters=function(u,f){var o=this.raw_options[u],l=f||"";return typeof o=="string"&&(l=o.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),l},m.prototype._get_number=function(u,f){var o=this.raw_options[u];f=parseInt(f,10),isNaN(f)&&(f=0);var l=parseInt(o,10);return isNaN(l)&&(l=f),l},m.prototype._get_selection=function(u,f,o){var l=this._get_selection_list(u,f,o);if(l.length!==1)throw new Error("Invalid Option Value: The option '"+u+`' can only be one of the following values:
|
|
`+f+`
|
|
You passed in: '`+this.raw_options[u]+"'");return l[0]},m.prototype._get_selection_list=function(u,f,o){if(!f||f.length===0)throw new Error("Selection list cannot be empty.");if(o=o||[f[0]],!this._is_valid_selection(o,f))throw new Error("Invalid Default Value!");var l=this._get_array(u,o);if(!this._is_valid_selection(l,f))throw new Error("Invalid Option Value: The option '"+u+`' can contain only the following values:
|
|
`+f+`
|
|
You passed in: '`+this.raw_options[u]+"'");return l},m.prototype._is_valid_selection=function(u,f){return u.length&&f.length&&!u.some(function(o){return f.indexOf(o)===-1})};function p(u,f){var o={};u=h(u);var l;for(l in u)l!==f&&(o[l]=u[l]);if(f&&u[f])for(l in u[f])o[l]=u[f][l];return o}function h(u){var f={},o;for(o in u){var l=o.replace(/-/g,"_");f[l]=u[o]}return f}v.exports.Options=m,v.exports.normalizeOpts=h,v.exports.mergeOpts=p},,function(v){var m=RegExp.prototype.hasOwnProperty("sticky");function p(h){this.__input=h||"",this.__input_length=this.__input.length,this.__position=0}p.prototype.restart=function(){this.__position=0},p.prototype.back=function(){this.__position>0&&(this.__position-=1)},p.prototype.hasNext=function(){return this.__position<this.__input_length},p.prototype.next=function(){var h=null;return this.hasNext()&&(h=this.__input.charAt(this.__position),this.__position+=1),h},p.prototype.peek=function(h){var u=null;return h=h||0,h+=this.__position,h>=0&&h<this.__input_length&&(u=this.__input.charAt(h)),u},p.prototype.__match=function(h,u){h.lastIndex=u;var f=h.exec(this.__input);return f&&!(m&&h.sticky)&&(f.index!==u&&(f=null)),f},p.prototype.test=function(h,u){return u=u||0,u+=this.__position,u>=0&&u<this.__input_length?!!this.__match(h,u):!1},p.prototype.testChar=function(h,u){var f=this.peek(u);return h.lastIndex=0,f!==null&&h.test(f)},p.prototype.match=function(h){var u=this.__match(h,this.__position);return u?this.__position+=u[0].length:u=null,u},p.prototype.read=function(h,u,f){var o="",l;return h&&(l=this.match(h),l&&(o+=l[0])),u&&(l||!h)&&(o+=this.readUntil(u,f)),o},p.prototype.readUntil=function(h,u){var f="",o=this.__position;h.lastIndex=this.__position;var l=h.exec(this.__input);return l?(o=l.index,u&&(o+=l[0].length)):o=this.__input_length,f=this.__input.substring(this.__position,o),this.__position=o,f},p.prototype.readUntilAfter=function(h){return this.readUntil(h,!0)},p.prototype.get_regexp=function(h,u){var f=null,o="g";return u&&m&&(o="y"),typeof h=="string"&&h!==""?f=new RegExp(h,o):h&&(f=new RegExp(h.source,o)),f},p.prototype.get_literal_regexp=function(h){return RegExp(h.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},p.prototype.peekUntilAfter=function(h){var u=this.__position,f=this.readUntilAfter(h);return this.__position=u,f},p.prototype.lookBack=function(h){var u=this.__position-1;return u>=h.length&&this.__input.substring(u-h.length,u).toLowerCase()===h},v.exports.InputScanner=p},function(v,m,p){var h=p(8).InputScanner,u=p(3).Token,f=p(10).TokenStream,o=p(11).WhitespacePattern,l={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},s=function(a,S){this._input=new h(a),this._options=S||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new o(this._input)};s.prototype.tokenize=function(){this._input.restart(),this.__tokens=new f,this._reset();for(var a,S=new u(l.START,""),x=null,C=[],D=new f;S.type!==l.EOF;){for(a=this._get_next_token(S,x);this._is_comment(a);)D.add(a),a=this._get_next_token(S,x);D.isEmpty()||(a.comments_before=D,D=new f),a.parent=x,this._is_opening(a)?(C.push(x),x=a):x&&this._is_closing(a,x)&&(a.opened=x,x.closed=a,x=C.pop(),a.parent=x),a.previous=S,S.next=a,this.__tokens.add(a),S=a}return this.__tokens},s.prototype._is_first_token=function(){return this.__tokens.isEmpty()},s.prototype._reset=function(){},s.prototype._get_next_token=function(a,S){this._readWhitespace();var x=this._input.read(/.+/g);return x?this._create_token(l.RAW,x):this._create_token(l.EOF,"")},s.prototype._is_comment=function(a){return!1},s.prototype._is_opening=function(a){return!1},s.prototype._is_closing=function(a,S){return!1},s.prototype._create_token=function(a,S){var x=new u(a,S,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return x},s.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},v.exports.Tokenizer=s,v.exports.TOKEN=l},function(v){function m(p){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=p}m.prototype.restart=function(){this.__position=0},m.prototype.isEmpty=function(){return this.__tokens_length===0},m.prototype.hasNext=function(){return this.__position<this.__tokens_length},m.prototype.next=function(){var p=null;return this.hasNext()&&(p=this.__tokens[this.__position],this.__position+=1),p},m.prototype.peek=function(p){var h=null;return p=p||0,p+=this.__position,p>=0&&p<this.__tokens_length&&(h=this.__tokens[p]),h},m.prototype.add=function(p){this.__parent_token&&(p.parent=this.__parent_token),this.__tokens.push(p),this.__tokens_length+=1},v.exports.TokenStream=m},function(v,m,p){var h=p(12).Pattern;function u(f,o){h.call(this,f,o),o?this._line_regexp=this._input.get_regexp(o._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}u.prototype=new h,u.prototype.__set_whitespace_patterns=function(f,o){f+="\\t ",o+="\\n\\r",this._match_pattern=this._input.get_regexp("["+f+o+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+o+"]")},u.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var f=this._input.read(this._match_pattern);if(f===" ")this.whitespace_before_token=" ";else if(f){var o=this.__split(this._newline_regexp,f);this.newline_count=o.length-1,this.whitespace_before_token=o[this.newline_count]}return f},u.prototype.matching=function(f,o){var l=this._create();return l.__set_whitespace_patterns(f,o),l._update(),l},u.prototype._create=function(){return new u(this._input,this)},u.prototype.__split=function(f,o){f.lastIndex=0;for(var l=0,s=[],a=f.exec(o);a;)s.push(o.substring(l,a.index)),l=a.index+a[0].length,a=f.exec(o);return l<o.length?s.push(o.substring(l,o.length)):s.push(""),s},v.exports.WhitespacePattern=u},function(v){function m(p,h){this._input=p,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,h&&(this._starting_pattern=this._input.get_regexp(h._starting_pattern,!0),this._match_pattern=this._input.get_regexp(h._match_pattern,!0),this._until_pattern=this._input.get_regexp(h._until_pattern),this._until_after=h._until_after)}m.prototype.read=function(){var p=this._input.read(this._starting_pattern);return(!this._starting_pattern||p)&&(p+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),p},m.prototype.read_match=function(){return this._input.match(this._match_pattern)},m.prototype.until_after=function(p){var h=this._create();return h._until_after=!0,h._until_pattern=this._input.get_regexp(p),h._update(),h},m.prototype.until=function(p){var h=this._create();return h._until_after=!1,h._until_pattern=this._input.get_regexp(p),h._update(),h},m.prototype.starting_with=function(p){var h=this._create();return h._starting_pattern=this._input.get_regexp(p,!0),h._update(),h},m.prototype.matching=function(p){var h=this._create();return h._match_pattern=this._input.get_regexp(p,!0),h._update(),h},m.prototype._create=function(){return new m(this._input,this)},m.prototype._update=function(){},v.exports.Pattern=m},function(v){function m(p,h){p=typeof p=="string"?p:p.source,h=typeof h=="string"?h:h.source,this.__directives_block_pattern=new RegExp(p+/ beautify( \w+[:]\w+)+ /.source+h,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(p+/\sbeautify\signore:end\s/.source+h,"g")}m.prototype.get_directives=function(p){if(!p.match(this.__directives_block_pattern))return null;var h={};this.__directive_pattern.lastIndex=0;for(var u=this.__directive_pattern.exec(p);u;)h[u[1]]=u[2],u=this.__directive_pattern.exec(p);return h},m.prototype.readIgnored=function(p){return p.readUntilAfter(this.__directives_end_ignore_pattern)},v.exports.Directives=m},function(v,m,p){var h=p(12).Pattern,u={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function f(o,l){h.call(this,o,l),this.__template_pattern=null,this._disabled=Object.assign({},u),this._excluded=Object.assign({},u),l&&(this.__template_pattern=this._input.get_regexp(l.__template_pattern),this._excluded=Object.assign(this._excluded,l._excluded),this._disabled=Object.assign(this._disabled,l._disabled));var s=new h(o);this.__patterns={handlebars_comment:s.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:s.starting_with(/{{{/).until_after(/}}}/),handlebars:s.starting_with(/{{/).until_after(/}}/),php:s.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:s.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:s.starting_with(/{%/).until_after(/%}/),django_value:s.starting_with(/{{/).until_after(/}}/),django_comment:s.starting_with(/{#/).until_after(/#}/),smarty:s.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:s.starting_with(/{\*/).until_after(/\*}/),smarty_literal:s.starting_with(/{literal}/).until_after(/{\/literal}/)}}f.prototype=new h,f.prototype._create=function(){return new f(this._input,this)},f.prototype._update=function(){this.__set_templated_pattern()},f.prototype.disable=function(o){var l=this._create();return l._disabled[o]=!0,l._update(),l},f.prototype.read_options=function(o){var l=this._create();for(var s in u)l._disabled[s]=o.templating.indexOf(s)===-1;return l._update(),l},f.prototype.exclude=function(o){var l=this._create();return l._excluded[o]=!0,l._update(),l},f.prototype.read=function(){var o="";this._match_pattern?o=this._input.read(this._starting_pattern):o=this._input.read(this._starting_pattern,this.__template_pattern);for(var l=this._read_template();l;)this._match_pattern?l+=this._input.read(this._match_pattern):l+=this._input.readUntil(this.__template_pattern),o+=l,l=this._read_template();return this._until_after&&(o+=this._input.readUntilAfter(this._until_pattern)),o},f.prototype.__set_templated_pattern=function(){var o=[];this._disabled.php||o.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||o.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||o.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(o.push(this.__patterns.django._starting_pattern.source),o.push(this.__patterns.django_value._starting_pattern.source),o.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||o.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&o.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+o.join("|")+")")},f.prototype._read_template=function(){var o="",l=this._input.peek();if(l==="<"){var s=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&s==="?"&&(o=o||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&s==="%"&&(o=o||this.__patterns.erb.read())}else l==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(o=o||this.__patterns.handlebars_comment.read(),o=o||this.__patterns.handlebars_unescaped.read(),o=o||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(o=o||this.__patterns.django_value.read()),this._excluded.django||(o=o||this.__patterns.django_comment.read(),o=o||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(o=o||this.__patterns.smarty_comment.read(),o=o||this.__patterns.smarty_literal.read(),o=o||this.__patterns.smarty.read()));return o},v.exports.TemplatablePattern=f},,,,function(v,m,p){var h=p(19).Beautifier,u=p(20).Options;function f(o,l,s,a){var S=new h(o,l,s,a);return S.beautify()}v.exports=f,v.exports.defaultOptions=function(){return new u}},function(v,m,p){var h=p(20).Options,u=p(2).Output,f=p(21).Tokenizer,o=p(21).TOKEN,l=/\r\n|[\r\n]/,s=/\r\n|[\r\n]/g,a=function(w,y){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=w.max_preserve_newlines,this.preserve_newlines=w.preserve_newlines,this._output=new u(w,y)};a.prototype.current_line_has_match=function(w){return this._output.current_line.has_match(w)},a.prototype.set_space_before_token=function(w,y){this._output.space_before_token=w,this._output.non_breaking_space=y},a.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},a.prototype.add_raw_token=function(w){this._output.add_raw_token(w)},a.prototype.print_preserved_newlines=function(w){var y=0;w.type!==o.TEXT&&w.previous.type!==o.TEXT&&(y=w.newlines?1:0),this.preserve_newlines&&(y=w.newlines<this.max_preserve_newlines+1?w.newlines:this.max_preserve_newlines+1);for(var b=0;b<y;b++)this.print_newline(b>0);return y!==0},a.prototype.traverse_whitespace=function(w){return w.whitespace_before||w.newlines?(this.print_preserved_newlines(w)||(this._output.space_before_token=!0),!0):!1},a.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},a.prototype.print_newline=function(w){this._output.add_new_line(w)},a.prototype.print_token=function(w){w.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(w.text))},a.prototype.indent=function(){this.indent_level++},a.prototype.get_full_indent=function(w){return w=this.indent_level+(w||0),w<1?"":this._output.get_indent_string(w)};var S=function(w){for(var y=null,b=w.next;b.type!==o.EOF&&w.closed!==b;){if(b.type===o.ATTRIBUTE&&b.text==="type"){b.next&&b.next.type===o.EQUALS&&b.next.next&&b.next.next.type===o.VALUE&&(y=b.next.next.text);break}b=b.next}return y},x=function(w,y){var b=null,j=null;return y.closed?(w==="script"?b="text/javascript":w==="style"&&(b="text/css"),b=S(y)||b,b.search("text/css")>-1?j="css":b.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?j="javascript":b.search(/(text|application|dojo)\/(x-)?(html)/)>-1?j="html":b.search(/test\/null/)>-1&&(j="null"),j):null};function C(w,y){return y.indexOf(w)!==-1}function D(w,y,b){this.parent=w||null,this.tag=y?y.tag_name:"",this.indent_level=b||0,this.parser_token=y||null}function L(w){this._printer=w,this._current_frame=null}L.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},L.prototype.record_tag=function(w){var y=new D(this._current_frame,w,this._printer.indent_level);this._current_frame=y},L.prototype._try_pop_frame=function(w){var y=null;return w&&(y=w.parser_token,this._printer.indent_level=w.indent_level,this._current_frame=w.parent),y},L.prototype._get_frame=function(w,y){for(var b=this._current_frame;b&&!(w.indexOf(b.tag)!==-1);){if(y&&y.indexOf(b.tag)!==-1){b=null;break}b=b.parent}return b},L.prototype.try_pop=function(w,y){var b=this._get_frame([w],y);return this._try_pop_frame(b)},L.prototype.indent_to_tag=function(w){var y=this._get_frame(w);y&&(this._printer.indent_level=y.indent_level)};function R(w,y,b,j){this._source_text=w||"",y=y||{},this._js_beautify=b,this._css_beautify=j,this._tag_stack=null;var B=new h(y,"html");this._options=B,this._is_wrap_attributes_force=this._options.wrap_attributes.substr(0,"force".length)==="force",this._is_wrap_attributes_force_expand_multiline=this._options.wrap_attributes==="force-expand-multiline",this._is_wrap_attributes_force_aligned=this._options.wrap_attributes==="force-aligned",this._is_wrap_attributes_aligned_multiple=this._options.wrap_attributes==="aligned-multiple",this._is_wrap_attributes_preserve=this._options.wrap_attributes.substr(0,"preserve".length)==="preserve",this._is_wrap_attributes_preserve_aligned=this._options.wrap_attributes==="preserve-aligned"}R.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var w=this._source_text,y=this._options.eol;this._options.eol==="auto"&&(y=`
|
|
`,w&&l.test(w)&&(y=w.match(l)[0])),w=w.replace(s,`
|
|
`);var b=w.match(/^[\t ]*/)[0],j={text:"",type:""},B=new A,E=new a(this._options,b),F=new f(w,this._options).tokenize();this._tag_stack=new L(E);for(var I=null,g=F.next();g.type!==o.EOF;)g.type===o.TAG_OPEN||g.type===o.COMMENT?(I=this._handle_tag_open(E,g,B,j),B=I):g.type===o.ATTRIBUTE||g.type===o.EQUALS||g.type===o.VALUE||g.type===o.TEXT&&!B.tag_complete?I=this._handle_inside_tag(E,g,B,F):g.type===o.TAG_CLOSE?I=this._handle_tag_close(E,g,B):g.type===o.TEXT?I=this._handle_text(E,g,B):E.add_raw_token(g),j=I,g=F.next();var W=E._output.get_code(y);return W},R.prototype._handle_tag_close=function(w,y,b){var j={text:y.text,type:y.type};return w.alignment_size=0,b.tag_complete=!0,w.set_space_before_token(y.newlines||y.whitespace_before!=="",!0),b.is_unformatted?w.add_raw_token(y):(b.tag_start_char==="<"&&(w.set_space_before_token(y.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&b.has_wrapped_attrs&&w.print_newline(!1)),w.print_token(y)),b.indent_content&&!(b.is_unformatted||b.is_content_unformatted)&&(w.indent(),b.indent_content=!1),!b.is_inline_element&&!(b.is_unformatted||b.is_content_unformatted)&&w.set_wrap_point(),j},R.prototype._handle_inside_tag=function(w,y,b,j){var B=b.has_wrapped_attrs,E={text:y.text,type:y.type};if(w.set_space_before_token(y.newlines||y.whitespace_before!=="",!0),b.is_unformatted)w.add_raw_token(y);else if(b.tag_start_char==="{"&&y.type===o.TEXT)w.print_preserved_newlines(y)?(y.newlines=0,w.add_raw_token(y)):w.print_token(y);else{if(y.type===o.ATTRIBUTE?(w.set_space_before_token(!0),b.attr_count+=1):(y.type===o.EQUALS||y.type===o.VALUE&&y.previous.type===o.EQUALS)&&w.set_space_before_token(!1),y.type===o.ATTRIBUTE&&b.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(w.traverse_whitespace(y),B=B||y.newlines!==0),this._is_wrap_attributes_force)){var F=b.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&b.attr_count===1){var I=!0,g=0,W;do{if(W=j.peek(g),W.type===o.ATTRIBUTE){I=!1;break}g+=1}while(g<4&&W.type!==o.EOF&&W.type!==o.TAG_CLOSE);F=!I}F&&(w.print_newline(!1),B=!0)}w.print_token(y),B=B||w.previous_token_wrapped(),b.has_wrapped_attrs=B}return E},R.prototype._handle_text=function(w,y,b){var j={text:y.text,type:"TK_CONTENT"};return b.custom_beautifier_name?this._print_custom_beatifier_text(w,y,b):b.is_unformatted||b.is_content_unformatted?w.add_raw_token(y):(w.traverse_whitespace(y),w.print_token(y)),j},R.prototype._print_custom_beatifier_text=function(w,y,b){var j=this;if(y.text!==""){var B=y.text,E,F=1,I="",g="";b.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?E=this._js_beautify:b.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?E=this._css_beautify:b.custom_beautifier_name==="html"&&(E=function(be,Ae){var Se=new R(be,Ae,j._js_beautify,j._css_beautify);return Se.beautify()}),this._options.indent_scripts==="keep"?F=0:this._options.indent_scripts==="separate"&&(F=-w.indent_level);var W=w.get_full_indent(F);if(B=B.replace(/\n[ \t]*$/,""),b.custom_beautifier_name!=="html"&&B[0]==="<"&&B.match(/^(<!--|<!\[CDATA\[)/)){var $=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(B);if(!$){w.add_raw_token(y);return}I=W+$[1]+`
|
|
`,B=$[4],$[5]&&(g=W+$[5]),B=B.replace(/\n[ \t]*$/,""),($[2]||$[3].indexOf(`
|
|
`)!==-1)&&($=$[3].match(/[ \t]+$/),$&&(y.whitespace_before=$[0]))}if(B)if(E){var le=function(){this.eol=`
|
|
`};le.prototype=this._options.raw_options;var de=new le;B=E(W+B,de)}else{var Ce=y.whitespace_before;Ce&&(B=B.replace(new RegExp(`
|
|
(`+Ce+")?","g"),`
|
|
`)),B=W+B.replace(/\n/g,`
|
|
`+W)}I&&(B?B=I+B+`
|
|
`+g:B=I+g),w.print_newline(!1),B&&(y.text=B,y.whitespace_before="",y.newlines=0,w.add_raw_token(y),w.print_newline(!0))}},R.prototype._handle_tag_open=function(w,y,b,j){var B=this._get_tag_open_token(y);return(b.is_unformatted||b.is_content_unformatted)&&!b.is_empty_element&&y.type===o.TAG_OPEN&&y.text.indexOf("</")===0?(w.add_raw_token(y),B.start_tag_token=this._tag_stack.try_pop(B.tag_name)):(w.traverse_whitespace(y),this._set_tag_position(w,y,B,b,j),B.is_inline_element||w.set_wrap_point(),w.print_token(y)),(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(B.alignment_size=y.text.length+1),!B.tag_complete&&!B.is_unformatted&&(w.alignment_size=B.alignment_size),B};var A=function(w,y){if(this.parent=w||null,this.text="",this.type="TK_TAG_OPEN",this.tag_name="",this.is_inline_element=!1,this.is_unformatted=!1,this.is_content_unformatted=!1,this.is_empty_element=!1,this.is_start_tag=!1,this.is_end_tag=!1,this.indent_content=!1,this.multiline_content=!1,this.custom_beautifier_name=null,this.start_tag_token=null,this.attr_count=0,this.has_wrapped_attrs=!1,this.alignment_size=0,this.tag_complete=!1,this.tag_start_char="",this.tag_check="",!y)this.tag_complete=!0;else{var b;this.tag_start_char=y.text[0],this.text=y.text,this.tag_start_char==="<"?(b=y.text.match(/^<([^\s>]*)/),this.tag_check=b?b[1]:""):(b=y.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=b?b[1]:"",(y.text.startsWith("{{#>")||y.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&y.next!==null?this.tag_check=y.next.text.split(" ")[0]:this.tag_check=y.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),y.type===o.COMMENT&&(this.tag_complete=!0),this.is_start_tag=this.tag_check.charAt(0)!=="/",this.tag_name=this.is_start_tag?this.tag_check:this.tag_check.substr(1),this.is_end_tag=!this.is_start_tag||y.closed&&y.closed.text==="/>";var j=2;this.tag_start_char==="{"&&this.text.length>=3&&(this.text.charAt(2)==="~"&&(j=3)),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(j)))}};R.prototype._get_tag_open_token=function(w){var y=new A(this._tag_stack.get_parser_token(),w);return y.alignment_size=this._options.wrap_attributes_indent_size,y.is_end_tag=y.is_end_tag||C(y.tag_check,this._options.void_elements),y.is_empty_element=y.tag_complete||y.is_start_tag&&y.is_end_tag,y.is_unformatted=!y.tag_complete&&C(y.tag_check,this._options.unformatted),y.is_content_unformatted=!y.is_empty_element&&C(y.tag_check,this._options.content_unformatted),y.is_inline_element=C(y.tag_name,this._options.inline)||y.tag_name.includes("-")||y.tag_start_char==="{",y},R.prototype._set_tag_position=function(w,y,b,j,B){if(b.is_empty_element||(b.is_end_tag?b.start_tag_token=this._tag_stack.try_pop(b.tag_name):(this._do_optional_end_element(b)&&(b.is_inline_element||w.print_newline(!1)),this._tag_stack.record_tag(b),(b.tag_name==="script"||b.tag_name==="style")&&!(b.is_unformatted||b.is_content_unformatted)&&(b.custom_beautifier_name=x(b.tag_check,y)))),C(b.tag_check,this._options.extra_liners)&&(w.print_newline(!1),w._output.just_added_blankline()||w.print_newline(!0)),b.is_empty_element){if(b.tag_start_char==="{"&&b.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),b.indent_content=!0;var E=w.current_line_has_match(/{{#if/);E||w.print_newline(!1)}b.tag_name==="!--"&&B.type===o.TAG_CLOSE&&j.is_end_tag&&b.text.indexOf(`
|
|
`)===-1||(b.is_inline_element||b.is_unformatted||w.print_newline(!1),this._calcluate_parent_multiline(w,b))}else if(b.is_end_tag){var F=!1;F=b.start_tag_token&&b.start_tag_token.multiline_content,F=F||!b.is_inline_element&&!(j.is_inline_element||j.is_unformatted)&&!(B.type===o.TAG_CLOSE&&b.start_tag_token===j)&&B.type!=="TK_CONTENT",(b.is_content_unformatted||b.is_unformatted)&&(F=!1),F&&w.print_newline(!1)}else b.indent_content=!b.custom_beautifier_name,b.tag_start_char==="<"&&(b.tag_name==="html"?b.indent_content=this._options.indent_inner_html:b.tag_name==="head"?b.indent_content=this._options.indent_head_inner_html:b.tag_name==="body"&&(b.indent_content=this._options.indent_body_inner_html)),!(b.is_inline_element||b.is_unformatted)&&(B.type!=="TK_CONTENT"||b.is_content_unformatted)&&w.print_newline(!1),this._calcluate_parent_multiline(w,b)},R.prototype._calcluate_parent_multiline=function(w,y){y.parent&&w._output.just_added_newline()&&!((y.is_inline_element||y.is_unformatted)&&y.parent.is_inline_element)&&(y.parent.multiline_content=!0)};var T=["address","article","aside","blockquote","details","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","main","nav","ol","p","pre","section","table","ul"],d=["a","audio","del","ins","map","noscript","video"];R.prototype._do_optional_end_element=function(w){var y=null;if(w.is_empty_element||!w.is_start_tag||!w.parent)return;if(w.tag_name==="body")y=y||this._tag_stack.try_pop("head");else if(w.tag_name==="li")y=y||this._tag_stack.try_pop("li",["ol","ul"]);else if(w.tag_name==="dd"||w.tag_name==="dt")y=y||this._tag_stack.try_pop("dt",["dl"]),y=y||this._tag_stack.try_pop("dd",["dl"]);else if(w.parent.tag_name==="p"&&T.indexOf(w.tag_name)!==-1){var b=w.parent.parent;(!b||d.indexOf(b.tag_name)===-1)&&(y=y||this._tag_stack.try_pop("p"))}else w.tag_name==="rp"||w.tag_name==="rt"?(y=y||this._tag_stack.try_pop("rt",["ruby","rtc"]),y=y||this._tag_stack.try_pop("rp",["ruby","rtc"])):w.tag_name==="optgroup"?y=y||this._tag_stack.try_pop("optgroup",["select"]):w.tag_name==="option"?y=y||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):w.tag_name==="colgroup"?y=y||this._tag_stack.try_pop("caption",["table"]):w.tag_name==="thead"?(y=y||this._tag_stack.try_pop("caption",["table"]),y=y||this._tag_stack.try_pop("colgroup",["table"])):w.tag_name==="tbody"||w.tag_name==="tfoot"?(y=y||this._tag_stack.try_pop("caption",["table"]),y=y||this._tag_stack.try_pop("colgroup",["table"]),y=y||this._tag_stack.try_pop("thead",["table"]),y=y||this._tag_stack.try_pop("tbody",["table"])):w.tag_name==="tr"?(y=y||this._tag_stack.try_pop("caption",["table"]),y=y||this._tag_stack.try_pop("colgroup",["table"]),y=y||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(w.tag_name==="th"||w.tag_name==="td")&&(y=y||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),y=y||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return w.parent=this._tag_stack.get_parser_token(),y},v.exports.Beautifier=R},function(v,m,p){var h=p(6).Options;function u(f){h.call(this,f,"html"),this.templating.length===1&&this.templating[0]==="auto"&&(this.templating=["django","erb","handlebars","php"]),this.indent_inner_html=this._get_boolean("indent_inner_html"),this.indent_body_inner_html=this._get_boolean("indent_body_inner_html",!0),this.indent_head_inner_html=this._get_boolean("indent_head_inner_html",!0),this.indent_handlebars=this._get_boolean("indent_handlebars",!0),this.wrap_attributes=this._get_selection("wrap_attributes",["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"]),this.wrap_attributes_indent_size=this._get_number("wrap_attributes_indent_size",this.indent_size),this.extra_liners=this._get_array("extra_liners",["head","body","/html"]),this.inline=this._get_array("inline",["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","big","strike","tt"]),this.void_elements=this._get_array("void_elements",["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr","!doctype","?xml","basefont","isindex"]),this.unformatted=this._get_array("unformatted",[]),this.content_unformatted=this._get_array("content_unformatted",["pre","textarea"]),this.unformatted_content_delimiter=this._get_characters("unformatted_content_delimiter"),this.indent_scripts=this._get_selection("indent_scripts",["normal","keep","separate"])}u.prototype=new h,v.exports.Options=u},function(v,m,p){var h=p(9).Tokenizer,u=p(9).TOKEN,f=p(13).Directives,o=p(14).TemplatablePattern,l=p(12).Pattern,s={TAG_OPEN:"TK_TAG_OPEN",TAG_CLOSE:"TK_TAG_CLOSE",ATTRIBUTE:"TK_ATTRIBUTE",EQUALS:"TK_EQUALS",VALUE:"TK_VALUE",COMMENT:"TK_COMMENT",TEXT:"TK_TEXT",UNKNOWN:"TK_UNKNOWN",START:u.START,RAW:u.RAW,EOF:u.EOF},a=new f(/<\!--/,/-->/),S=function(x,C){h.call(this,x,C),this._current_tag_name="";var D=new o(this._input).read_options(this._options),L=new l(this._input);if(this.__patterns={word:D.until(/[\n\r\t <]/),single_quote:D.until_after(/'/),double_quote:D.until_after(/"/),attribute:D.until(/[\n\r\t =>]|\/>/),element_name:D.until(/[\n\r\t >\/]/),handlebars_comment:L.starting_with(/{{!--/).until_after(/--}}/),handlebars:L.starting_with(/{{/).until_after(/}}/),handlebars_open:L.until(/[\n\r\t }]/),handlebars_raw_close:L.until(/}}/),comment:L.starting_with(/<!--/).until_after(/-->/),cdata:L.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:L.starting_with(/<!\[/).until_after(/]>/),processing:L.starting_with(/<\?/).until_after(/\?>/)},this._options.indent_handlebars&&(this.__patterns.word=this.__patterns.word.exclude("handlebars")),this._unformatted_content_delimiter=null,this._options.unformatted_content_delimiter){var R=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=L.matching(R).until_after(R)}};S.prototype=new h,S.prototype._is_comment=function(x){return!1},S.prototype._is_opening=function(x){return x.type===s.TAG_OPEN},S.prototype._is_closing=function(x,C){return x.type===s.TAG_CLOSE&&C&&((x.text===">"||x.text==="/>")&&C.text[0]==="<"||x.text==="}}"&&C.text[0]==="{"&&C.text[1]==="{")},S.prototype._reset=function(){this._current_tag_name=""},S.prototype._get_next_token=function(x,C){var D=null;this._readWhitespace();var L=this._input.peek();return L===null?this._create_token(s.EOF,""):(D=D||this._read_open_handlebars(L,C),D=D||this._read_attribute(L,x,C),D=D||this._read_close(L,C),D=D||this._read_raw_content(L,x,C),D=D||this._read_content_word(L),D=D||this._read_comment_or_cdata(L),D=D||this._read_processing(L),D=D||this._read_open(L,C),D=D||this._create_token(s.UNKNOWN,this._input.next()),D)},S.prototype._read_comment_or_cdata=function(x){var C=null,D=null,L=null;if(x==="<"){var R=this._input.peek(1);R==="!"&&(D=this.__patterns.comment.read(),D?(L=a.get_directives(D),L&&L.ignore==="start"&&(D+=a.readIgnored(this._input))):D=this.__patterns.cdata.read()),D&&(C=this._create_token(s.COMMENT,D),C.directives=L)}return C},S.prototype._read_processing=function(x){var C=null,D=null,L=null;if(x==="<"){var R=this._input.peek(1);(R==="!"||R==="?")&&(D=this.__patterns.conditional_comment.read(),D=D||this.__patterns.processing.read()),D&&(C=this._create_token(s.COMMENT,D),C.directives=L)}return C},S.prototype._read_open=function(x,C){var D=null,L=null;return C||x==="<"&&(D=this._input.next(),this._input.peek()==="/"&&(D+=this._input.next()),D+=this.__patterns.element_name.read(),L=this._create_token(s.TAG_OPEN,D)),L},S.prototype._read_open_handlebars=function(x,C){var D=null,L=null;return C||this._options.indent_handlebars&&x==="{"&&this._input.peek(1)==="{"&&(this._input.peek(2)==="!"?(D=this.__patterns.handlebars_comment.read(),D=D||this.__patterns.handlebars.read(),L=this._create_token(s.COMMENT,D)):(D=this.__patterns.handlebars_open.read(),L=this._create_token(s.TAG_OPEN,D))),L},S.prototype._read_close=function(x,C){var D=null,L=null;return C&&(C.text[0]==="<"&&(x===">"||x==="/"&&this._input.peek(1)===">")?(D=this._input.next(),x==="/"&&(D+=this._input.next()),L=this._create_token(s.TAG_CLOSE,D)):C.text[0]==="{"&&x==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),L=this._create_token(s.TAG_CLOSE,"}}"))),L},S.prototype._read_attribute=function(x,C,D){var L=null,R="";if(D&&D.text[0]==="<")if(x==="=")L=this._create_token(s.EQUALS,this._input.next());else if(x==='"'||x==="'"){var A=this._input.next();x==='"'?A+=this.__patterns.double_quote.read():A+=this.__patterns.single_quote.read(),L=this._create_token(s.VALUE,A)}else R=this.__patterns.attribute.read(),R&&(C.type===s.EQUALS?L=this._create_token(s.VALUE,R):L=this._create_token(s.ATTRIBUTE,R));return L},S.prototype._is_content_unformatted=function(x){return this._options.void_elements.indexOf(x)===-1&&(this._options.content_unformatted.indexOf(x)!==-1||this._options.unformatted.indexOf(x)!==-1)},S.prototype._read_raw_content=function(x,C,D){var L="";if(D&&D.text[0]==="{")L=this.__patterns.handlebars_raw_close.read();else if(C.type===s.TAG_CLOSE&&C.opened.text[0]==="<"&&C.text[0]!=="/"){var R=C.opened.text.substr(1).toLowerCase();if(R==="script"||R==="style"){var A=this._read_comment_or_cdata(x);if(A)return A.type=s.TEXT,A;L=this._input.readUntil(new RegExp("</"+R+"[\\n\\r\\t ]*?>","ig"))}else this._is_content_unformatted(R)&&(L=this._input.readUntil(new RegExp("</"+R+"[\\n\\r\\t ]*?>","ig")))}return L?this._create_token(s.TEXT,L):null},S.prototype._read_content_word=function(x){var C="";if(this._options.unformatted_content_delimiter&&(x===this._options.unformatted_content_delimiter[0]&&(C=this.__patterns.unformatted_content_delimiter.read())),C||(C=this.__patterns.word.read()),C)return this._create_token(s.TEXT,C)},v.exports.Tokenizer=S,v.exports.TOKEN=s}],G={};function r(v){var m=G[v];if(m!==void 0)return m.exports;var p=G[v]={exports:{}};return z[v](p,p.exports,r),p.exports}var O=r(18);N=O})();var J=N;if(!0)!(oe=[q,q("6UM0"),q("TXwP")],Y=function(z){var G=q("6UM0"),r=q("TXwP");return{html_beautify:function(O,v){return J(O,v,G.js_beautify,r.css_beautify)}}}.apply(Te,oe),Y!==void 0&&(Qe.exports=Y));else var H,M})()},"rAM+":function(Qe,Te,q){"use strict";q.d(Te,"a",function(){return Y});var oe=q("Qw5x");function Y(N,J){var H;if(typeof Symbol=="undefined"||N[Symbol.iterator]==null){if(Array.isArray(N)||(H=Object(oe.a)(N))||J&&N&&typeof N.length=="number"){H&&(N=H);var M=0,z=function(){};return{s:z,n:function(){return M>=N.length?{done:!0}:{done:!1,value:N[M++]}},e:function(m){throw m},f:z}}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 G=!0,r=!1,O;return{s:function(){H=N[Symbol.iterator]()},n:function(){var m=H.next();return G=m.done,m},e:function(m){r=!0,O=m},f:function(){try{!G&&H.return!=null&&H.return()}finally{if(r)throw O}}}}},rUJ1:function(Qe,Te){const q=/[&<>"']/,oe=/[&<>"']/g,Y=/[<>"']|&(?!#?\w+;)/,N=/[<>"']|&(?!#?\w+;)/g,J={"&":"&","<":"<",">":">",'"':""","'":"'"},H=L=>J[L];function M(L,R){if(R){if(q.test(L))return L.replace(oe,H)}else if(Y.test(L))return L.replace(N,H);return L}const z=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function G(L){return L.replace(z,(R,A)=>(A=A.toLowerCase(),A==="colon"?":":A.charAt(0)==="#"?A.charAt(1)==="x"?String.fromCharCode(parseInt(A.substring(2),16)):String.fromCharCode(+A.substring(1)):""))}const r=/(^|[^\[])\^/g;function O(L,R){L=L.source||L,R=R||"";const A={replace:(T,d)=>(d=d.source||d,d=d.replace(r,"$1"),L=L.replace(T,d),A),getRegex:()=>new RegExp(L,R)};return A}const v=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function p(L,R,A){if(L){let T;try{T=decodeURIComponent(G(A)).replace(v,"").toLowerCase()}catch(d){return null}if(T.indexOf("javascript:")===0||T.indexOf("vbscript:")===0||T.indexOf("data:")===0)return null}R&&!m.test(A)&&(A=l(R,A));try{A=encodeURI(A).replace(/%25/g,"%")}catch(T){return null}return A}const h={},u=/^[^:]+:\/*[^/]*$/,f=/^([^:]+:)[\s\S]*$/,o=/^([^:]+:\/*[^/]*)[\s\S]*$/;function l(L,R){h[" "+L]||(u.test(L)?h[" "+L]=L+"/":h[" "+L]=x(L,"/",!0)),L=h[" "+L];const A=L.indexOf(":")===-1;return R.substring(0,2)==="//"?A?R:L.replace(f,"$1")+R:R.charAt(0)==="/"?A?R:L.replace(o,"$1")+R:L+R}const s={exec:function(){}};function a(L){let R=1,A,T;for(;R<arguments.length;R++){A=arguments[R];for(T in A)Object.prototype.hasOwnProperty.call(A,T)&&(L[T]=A[T])}return L}function S(L,R){const A=L.replace(/\|/g,(w,y,b)=>{let j=!1,B=y;for(;--B>=0&&b[B]==="\\";)j=!j;return j?"|":" |"}),T=A.split(/ \|/);let d=0;if(T.length>R)T.splice(R);else for(;T.length<R;)T.push("");for(;d<T.length;d++)T[d]=T[d].trim().replace(/\\\|/g,"|");return T}function x(L,R,A){const T=L.length;if(T===0)return"";let d=0;for(;d<T;){const w=L.charAt(T-d-1);if(w===R&&!A)d++;else if(w!==R&&A)d++;else break}return L.substr(0,T-d)}function C(L,R){if(L.indexOf(R[1])===-1)return-1;const A=L.length;let T=0,d=0;for(;d<A;d++)if(L[d]==="\\")d++;else if(L[d]===R[0])T++;else if(L[d]===R[1]&&(T--,T<0))return d;return-1}function D(L){L&&L.sanitize&&!L.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}Qe.exports={escape:M,unescape:G,edit:O,cleanUrl:p,resolveUrl:l,noopTest:s,merge:a,splitCells:S,rtrim:x,findClosingBracket:C,checkSanitizeDeprecation:D}},t9D7:function(Qe,Te,q){"use strict";q.d(Te,"b",function(){return z}),q.d(Te,"g",function(){return r}),q.d(Te,"d",function(){return O}),q.d(Te,"e",function(){return v}),q.d(Te,"a",function(){return m}),q.d(Te,"f",function(){return u}),q.d(Te,"c",function(){return f});var oe=q("Vhoy"),Y=q("MI8n"),N=q("pmY6"),J=q("Cg/j"),H=q("ic2d"),M=q("nEHx");const z=Object(J.c)("themeService");var G;(function(o){function l(s){return s&&typeof s=="object"&&typeof s.id=="string"}o.isThemeColor=l})(G||(G={}));function r(o){return{id:o}}var O;(function(o){function l(D){return D&&typeof D=="object"&&typeof D.id=="string"&&(typeof D.color=="undefined"||G.isThemeColor(D.color))}o.isThemeIcon=l;const s=new RegExp(`^\\$\\((${oe.a.iconNameExpression}(?:${oe.a.iconModifierExpression})?)\\)$`);function a(D){const L=s.exec(D);if(!L)return;let[,R]=L;return{id:R}}o.fromString=a;function S(D,L){let R=D.id;const A=R.lastIndexOf("~");return A!==-1&&(R=R.substring(0,A)),L&&(R=`${R}~${L}`),{id:R}}o.modify=S;function x(D,L){var R,A;return D.id===L.id&&((R=D.color)===null||R===void 0?void 0:R.id)===((A=L.color)===null||A===void 0?void 0:A.id)}o.isEqual=x;function C(D,L){return{id:D.id,color:L?r(L):void 0}}o.asThemeIcon=C,o.asClassNameArray=oe.a.asClassNameArray,o.asClassName=oe.a.asClassName,o.asCSSSelector=oe.a.asCSSSelector})(O||(O={}));function v(o){switch(o){case M.a.DARK:return"vs-dark";case M.a.HIGH_CONTRAST:return"hc-black";default:return"vs"}}const m={ThemingContribution:"base.contributions.theming"};class p{constructor(){this.themingParticipants=[],this.themingParticipants=[],this.onThemingParticipantAddedEmitter=new Y.b}onColorThemeChange(o){return this.themingParticipants.push(o),this.onThemingParticipantAddedEmitter.fire(o),Object(N.i)(()=>{const l=this.themingParticipants.indexOf(o);this.themingParticipants.splice(l,1)})}getThemingParticipants(){return this.themingParticipants}}let h=new p;H.a.add(m.ThemingContribution,h);function u(o){return h.onColorThemeChange(o)}class f extends N.a{constructor(o){super();this.themeService=o,this.theme=o.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(l=>this.onThemeChange(l)))}onThemeChange(o){this.theme=o,this.updateStyles()}updateStyles(){}}},ulZh:function(Qe,Te,q){typeof window!="undefined"&&function(Y,N){Qe.exports=N()}(this,function(){return function(oe){var Y={};function N(J){if(Y[J])return Y[J].exports;var H=Y[J]={i:J,l:!1,exports:{}};return oe[J].call(H.exports,H,H.exports,N),H.l=!0,H.exports}return N.m=oe,N.c=Y,N.d=function(J,H,M){N.o(J,H)||Object.defineProperty(J,H,{enumerable:!0,get:M})},N.r=function(J){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(J,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(J,"__esModule",{value:!0})},N.t=function(J,H){if(H&1&&(J=N(J)),H&8)return J;if(H&4&&typeof J=="object"&&J&&J.__esModule)return J;var M=Object.create(null);if(N.r(M),Object.defineProperty(M,"default",{enumerable:!0,value:J}),H&2&&typeof J!="string")for(var z in J)N.d(M,z,function(G){return J[G]}.bind(null,z));return M},N.n=function(J){var H=J&&J.__esModule?function(){return J.default}:function(){return J};return N.d(H,"a",H),H},N.o=function(J,H){return Object.prototype.hasOwnProperty.call(J,H)},N.p="/dist/",N(N.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(oe,Y,N){"use strict";var J=Object.prototype.hasOwnProperty,H="~";function M(){}Object.create&&(M.prototype=Object.create(null),new M().__proto__||(H=!1));function z(v,m,p){this.fn=v,this.context=m,this.once=p||!1}function G(v,m,p,h,u){if(typeof p!="function")throw new TypeError("The listener must be a function");var f=new z(p,h||v,u),o=H?H+m:m;return v._events[o]?v._events[o].fn?v._events[o]=[v._events[o],f]:v._events[o].push(f):(v._events[o]=f,v._eventsCount++),v}function r(v,m){--v._eventsCount===0?v._events=new M:delete v._events[m]}function O(){this._events=new M,this._eventsCount=0}O.prototype.eventNames=function(){var m=[],p,h;if(this._eventsCount===0)return m;for(h in p=this._events)J.call(p,h)&&m.push(H?h.slice(1):h);return Object.getOwnPropertySymbols?m.concat(Object.getOwnPropertySymbols(p)):m},O.prototype.listeners=function(m){var p=H?H+m:m,h=this._events[p];if(!h)return[];if(h.fn)return[h.fn];for(var u=0,f=h.length,o=new Array(f);u<f;u++)o[u]=h[u].fn;return o},O.prototype.listenerCount=function(m){var p=H?H+m:m,h=this._events[p];return h?h.fn?1:h.length:0},O.prototype.emit=function(m,p,h,u,f,o){var l=H?H+m:m;if(!this._events[l])return!1;var s=this._events[l],a=arguments.length,S,x;if(s.fn){s.once&&this.removeListener(m,s.fn,void 0,!0);switch(a){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,p),!0;case 3:return s.fn.call(s.context,p,h),!0;case 4:return s.fn.call(s.context,p,h,u),!0;case 5:return s.fn.call(s.context,p,h,u,f),!0;case 6:return s.fn.call(s.context,p,h,u,f,o),!0}for(x=1,S=new Array(a-1);x<a;x++)S[x-1]=arguments[x];s.fn.apply(s.context,S)}else{var C=s.length,D;for(x=0;x<C;x++){s[x].once&&this.removeListener(m,s[x].fn,void 0,!0);switch(a){case 1:s[x].fn.call(s[x].context);break;case 2:s[x].fn.call(s[x].context,p);break;case 3:s[x].fn.call(s[x].context,p,h);break;case 4:s[x].fn.call(s[x].context,p,h,u);break;default:if(!S)for(D=1,S=new Array(a-1);D<a;D++)S[D-1]=arguments[D];s[x].fn.apply(s[x].context,S)}}}return!0},O.prototype.on=function(m,p,h){return G(this,m,p,h,!1)},O.prototype.once=function(m,p,h){return G(this,m,p,h,!0)},O.prototype.removeListener=function(m,p,h,u){var f=H?H+m:m;if(!this._events[f])return this;if(!p)return r(this,f),this;var o=this._events[f];if(o.fn)o.fn===p&&(!u||o.once)&&(!h||o.context===h)&&r(this,f);else{for(var l=0,s=[],a=o.length;l<a;l++)(o[l].fn!==p||u&&!o[l].once||h&&o[l].context!==h)&&s.push(o[l]);s.length?this._events[f]=s.length===1?s[0]:s:r(this,f)}return this},O.prototype.removeAllListeners=function(m){var p;return m?(p=H?H+m:m,this._events[p]&&r(this,p)):(this._events=new M,this._eventsCount=0),this},O.prototype.off=O.prototype.removeListener,O.prototype.addListener=O.prototype.on,O.prefixed=H,O.EventEmitter=O,oe.exports=O},"./node_modules/url-toolkit/src/url-toolkit.js":function(oe,Y,N){(function(J){var H=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,M=/^([^\/?#]*)([^]*)$/,z=/(?:\/|^)\.(?=\/)/g,G=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,r={buildAbsoluteURL:function(O,v,m){if(m=m||{},O=O.trim(),v=v.trim(),!v){if(!m.alwaysNormalize)return O;var p=r.parseURL(O);if(!p)throw new Error("Error trying to parse base URL.");return p.path=r.normalizePath(p.path),r.buildURLFromParts(p)}var h=r.parseURL(v);if(!h)throw new Error("Error trying to parse relative URL.");if(h.scheme)return m.alwaysNormalize?(h.path=r.normalizePath(h.path),r.buildURLFromParts(h)):v;var u=r.parseURL(O);if(!u)throw new Error("Error trying to parse base URL.");if(!u.netLoc&&u.path&&u.path[0]!=="/"){var f=M.exec(u.path);u.netLoc=f[1],u.path=f[2]}u.netLoc&&!u.path&&(u.path="/");var o={scheme:u.scheme,netLoc:h.netLoc,path:null,params:h.params,query:h.query,fragment:h.fragment};if(!h.netLoc&&(o.netLoc=u.netLoc,h.path[0]!=="/"))if(!h.path)o.path=u.path,h.params||(o.params=u.params,h.query||(o.query=u.query));else{var l=u.path,s=l.substring(0,l.lastIndexOf("/")+1)+h.path;o.path=r.normalizePath(s)}return o.path===null&&(o.path=m.alwaysNormalize?r.normalizePath(h.path):h.path),r.buildURLFromParts(o)},parseURL:function(O){var v=H.exec(O);return v?{scheme:v[1]||"",netLoc:v[2]||"",path:v[3]||"",params:v[4]||"",query:v[5]||"",fragment:v[6]||""}:null},normalizePath:function(O){for(O=O.split("").reverse().join("").replace(z,"");O.length!==(O=O.replace(G,"")).length;);return O.split("").reverse().join("")},buildURLFromParts:function(O){return O.scheme+O.netLoc+O.path+O.params+O.query+O.fragment}};oe.exports=r})(this)},"./node_modules/webworkify-webpack/index.js":function(oe,Y,N){function J(m){var p={};function h(f){if(p[f])return p[f].exports;var o=p[f]={i:f,l:!1,exports:{}};return m[f].call(o.exports,o,o.exports,h),o.l=!0,o.exports}h.m=m,h.c=p,h.i=function(f){return f},h.d=function(f,o,l){h.o(f,o)||Object.defineProperty(f,o,{configurable:!1,enumerable:!0,get:l})},h.r=function(f){Object.defineProperty(f,"__esModule",{value:!0})},h.n=function(f){var o=f&&f.__esModule?function(){return f.default}:function(){return f};return h.d(o,"a",o),o},h.o=function(f,o){return Object.prototype.hasOwnProperty.call(f,o)},h.p="/",h.oe=function(f){throw console.error(f),f};var u=h(h.s=ENTRY_MODULE);return u.default||u}var H="[\\.|\\-|\\+|\\w|/|@]+",M="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+H+").*?\\)";function z(m){return(m+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function G(m){return!isNaN(1*m)}function r(m,p,h){var u={};u[h]=[];var f=p.toString(),o=f.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!o)return u;for(var l=o[1],s=new RegExp("(\\\\n|\\W)"+z(l)+M,"g"),a;a=s.exec(f);){if(a[3]==="dll-reference")continue;u[h].push(a[3])}for(s=new RegExp("\\("+z(l)+'\\("(dll-reference\\s('+H+'))"\\)\\)'+M,"g");a=s.exec(f);)m[a[2]]||(u[h].push(a[1]),m[a[2]]=N(a[1]).m),u[a[2]]=u[a[2]]||[],u[a[2]].push(a[4]);for(var S=Object.keys(u),x=0;x<S.length;x++)for(var C=0;C<u[S[x]].length;C++)G(u[S[x]][C])&&(u[S[x]][C]=1*u[S[x]][C]);return u}function O(m){var p=Object.keys(m);return p.reduce(function(h,u){return h||m[u].length>0},!1)}function v(m,p){for(var h={main:[p]},u={main:[]},f={main:{}};O(h);)for(var o=Object.keys(h),l=0;l<o.length;l++){var s=o[l],a=h[s],S=a.pop();if(f[s]=f[s]||{},f[s][S]||!m[s][S])continue;f[s][S]=!0,u[s]=u[s]||[],u[s].push(S);for(var x=r(m,m[s][S],s),C=Object.keys(x),D=0;D<C.length;D++)h[C[D]]=h[C[D]]||[],h[C[D]]=h[C[D]].concat(x[C[D]])}return u}oe.exports=function(m,p){p=p||{};var h={main:N.m},u=p.all?{main:Object.keys(h.main)}:v(h,m),f="";Object.keys(u).filter(function(S){return S!=="main"}).forEach(function(S){for(var x=0;u[S][x];)x++;u[S].push(x),h[S][x]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",f=f+"var "+S+" = ("+J.toString().replace("ENTRY_MODULE",JSON.stringify(x))+")({"+u[S].map(function(C){return""+JSON.stringify(C)+": "+h[S][C].toString()}).join(",")+`});
|
|
`}),f=f+"new (("+J.toString().replace("ENTRY_MODULE",JSON.stringify(m))+")({"+u.main.map(function(S){return""+JSON.stringify(S)+": "+h.main[S].toString()}).join(",")+"}))(self);";var o=new window.Blob([f],{type:"text/javascript"});if(p.bare)return o;var l=window.URL||window.webkitURL||window.mozURL||window.msURL,s=l.createObjectURL(o),a=new window.Worker(s);return a.objectURL=s,a}},"./src/config.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"hlsDefaultConfig",function(){return D}),N.d(Y,"mergeConfig",function(){return R}),N.d(Y,"enableStreamingMode",function(){return A});var J=N("./src/controller/abr-controller.ts"),H=N("./src/controller/audio-stream-controller.ts"),M=N("./src/controller/audio-track-controller.ts"),z=N("./src/controller/subtitle-stream-controller.ts"),G=N("./src/controller/subtitle-track-controller.ts"),r=N("./src/controller/buffer-controller.ts"),O=N("./src/controller/timeline-controller.ts"),v=N("./src/controller/cap-level-controller.ts"),m=N("./src/controller/fps-controller.ts"),p=N("./src/controller/eme-controller.ts"),h=N("./src/controller/cmcd-controller.ts"),u=N("./src/utils/xhr-loader.ts"),f=N("./src/utils/fetch-loader.ts"),o=N("./src/utils/cues.ts"),l=N("./src/utils/mediakeys-helper.ts"),s=N("./src/utils/logger.ts");function a(){return a=Object.assign||function(T){for(var d=1;d<arguments.length;d++){var w=arguments[d];for(var y in w)Object.prototype.hasOwnProperty.call(w,y)&&(T[y]=w[y])}return T},a.apply(this,arguments)}function S(T,d){var w=Object.keys(T);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(T);d&&(y=y.filter(function(b){return Object.getOwnPropertyDescriptor(T,b).enumerable})),w.push.apply(w,y)}return w}function x(T){for(var d=1;d<arguments.length;d++){var w=arguments[d]!=null?arguments[d]:{};d%2?S(Object(w),!0).forEach(function(y){C(T,y,w[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(T,Object.getOwnPropertyDescriptors(w)):S(Object(w)).forEach(function(y){Object.defineProperty(T,y,Object.getOwnPropertyDescriptor(w,y))})}return T}function C(T,d,w){return d in T?Object.defineProperty(T,d,{value:w,enumerable:!0,configurable:!0,writable:!0}):T[d]=w,T}var D=x(x({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:u.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:J.default,bufferController:r.default,capLevelController:v.default,fpsController:m.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:l.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},L()),{},{subtitleStreamController:z.SubtitleStreamController,subtitleTrackController:G.default,timelineController:O.TimelineController,audioStreamController:H.default,audioTrackController:M.default,emeController:p.default,cmcdController:h.default});function L(){return{cueHandler:o.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function R(T,d){if((d.liveSyncDurationCount||d.liveMaxLatencyDurationCount)&&(d.liveSyncDuration||d.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(d.liveMaxLatencyDurationCount!==void 0&&(d.liveSyncDurationCount===void 0||d.liveMaxLatencyDurationCount<=d.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(d.liveMaxLatencyDuration!==void 0&&(d.liveSyncDuration===void 0||d.liveMaxLatencyDuration<=d.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return a({},T,d)}function A(T){var d=T.loader;if(d!==f.default&&d!==u.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),T.progressive=!1;else{var w=Object(f.fetchSupported)();w&&(T.loader=f.default,T.progressive=!0,T.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(oe,Y,N){"use strict";N.r(Y);var J=N("./src/polyfills/number.ts"),H=N("./src/utils/ewma-bandwidth-estimator.ts"),M=N("./src/events.ts"),z=N("./src/utils/buffer-helper.ts"),G=N("./src/errors.ts"),r=N("./src/types/loader.ts"),O=N("./src/utils/logger.ts");function v(h,u){for(var f=0;f<u.length;f++){var o=u[f];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(h,o.key,o)}}function m(h,u,f){return u&&v(h.prototype,u),f&&v(h,f),h}var p=function(){function h(f){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=f;var o=f.config;this.bwEstimator=new H.default(o.abrEwmaSlowVoD,o.abrEwmaFastVoD,o.abrEwmaDefaultEstimate),this.registerListeners()}var u=h.prototype;return u.registerListeners=function(){var o=this.hls;o.on(M.Events.FRAG_LOADING,this.onFragLoading,this),o.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),o.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this),o.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.on(M.Events.ERROR,this.onError,this)},u.unregisterListeners=function(){var o=this.hls;o.off(M.Events.FRAG_LOADING,this.onFragLoading,this),o.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),o.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this),o.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.off(M.Events.ERROR,this.onError,this)},u.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},u.onFragLoading=function(o,l){var s=l.frag;if(s.type===r.PlaylistLevelType.MAIN&&!this.timer){var a;this.fragCurrent=s,this.partCurrent=(a=l.part)!=null?a:null,this.timer=self.setInterval(this.onCheck,100)}},u.onLevelLoaded=function(o,l){var s=this.hls.config;l.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},u._abandonRulesCheck=function(){var o=this.fragCurrent,l=this.partCurrent,s=this.hls,a=s.autoLevelEnabled,S=s.config,x=s.media;if(!o||!x)return;var C=l?l.stats:o.stats,D=l?l.duration:o.duration;if(C.aborted){O.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!a||x.paused||!x.playbackRate||!x.readyState)return;var L=performance.now()-C.loading.start,R=Math.abs(x.playbackRate);if(L<=500*D/R)return;var A=s.levels,T=s.minAutoLevel,d=A[o.level],w=C.total||Math.max(C.loaded,Math.round(D*d.maxBitrate/8)),y=Math.max(1,C.bwEstimate?C.bwEstimate/8:C.loaded*1e3/L),b=(w-C.loaded)/y,j=x.currentTime,B=(z.BufferHelper.bufferInfo(x,j,S.maxBufferHole).end-j)/R;if(B>=2*D/R||b<=B)return;var E=Number.POSITIVE_INFINITY,F;for(F=o.level-1;F>T;F--){var I=A[F].maxBitrate;if(E=D*I/(8*.8*y),E<B)break}if(E>=b)return;var g=this.bwEstimator.getEstimate();O.logger.warn("Fragment "+o.sn+(l?" part "+l.index:"")+" of level "+o.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+F+`
|
|
Current BW estimate: `+(Object(J.isFiniteNumber)(g)?(g/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+b.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+E.toFixed(3)+` s
|
|
Time to underbuffer: `+B.toFixed(3)+" s"),s.nextLoadLevel=F,this.bwEstimator.sample(L,C.loaded),this.clearTimer(),o.loader&&(this.fragCurrent=this.partCurrent=null,o.loader.abort()),s.trigger(M.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:o,part:l,stats:C})},u.onFragLoaded=function(o,l){var s=l.frag,a=l.part;if(s.type===r.PlaylistLevelType.MAIN&&Object(J.isFiniteNumber)(s.sn)){var S=a?a.stats:s.stats,x=a?a.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var C=this.hls.levels[s.level],D=(C.loaded?C.loaded.bytes:0)+S.loaded,L=(C.loaded?C.loaded.duration:0)+x;C.loaded={bytes:D,duration:L},C.realBitrate=Math.round(8*D/L)}if(s.bitrateTest){var R={stats:S,frag:s,part:a,id:s.type};this.onFragBuffered(M.Events.FRAG_BUFFERED,R),s.bitrateTest=!1}}},u.onFragBuffered=function(o,l){var s=l.frag,a=l.part,S=a?a.stats:s.stats;if(S.aborted)return;if(s.type!==r.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var x=S.parsing.end-S.loading.start;this.bwEstimator.sample(x,S.loaded),S.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=x/1e3:this.bitrateTestDelay=0},u.onError=function(o,l){switch(l.details){case G.ErrorDetails.FRAG_LOAD_ERROR:case G.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},u.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},u.getNextABRAutoLevel=function(){var o=this.fragCurrent,l=this.partCurrent,s=this.hls,a=s.maxAutoLevel,S=s.config,x=s.minAutoLevel,C=s.media,D=l?l.duration:o?o.duration:0,L=C?C.currentTime:0,R=C&&C.playbackRate!==0?Math.abs(C.playbackRate):1,A=this.bwEstimator?this.bwEstimator.getEstimate():S.abrEwmaDefaultEstimate,T=(z.BufferHelper.bufferInfo(C,L,S.maxBufferHole).end-L)/R,d=this.findBestLevel(A,x,a,T,S.abrBandWidthFactor,S.abrBandWidthUpFactor);if(d>=0)return d;O.logger.trace((T?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var w=D?Math.min(D,S.maxStarvationDelay):S.maxStarvationDelay,y=S.abrBandWidthFactor,b=S.abrBandWidthUpFactor;if(!T){var j=this.bitrateTestDelay;if(j){var B=D?Math.min(D,S.maxLoadingDelay):S.maxLoadingDelay;w=B-j,O.logger.trace("bitrate test took "+Math.round(1e3*j)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*w)+" ms"),y=b=1}}return d=this.findBestLevel(A,x,a,T+w,y,b),Math.max(d,0)},u.findBestLevel=function(o,l,s,a,S,x){for(var C,D=this.fragCurrent,L=this.partCurrent,R=this.lastLoadedFragLevel,A=this.hls.levels,T=A[R],d=!!(T!=null&&(C=T.details)!==null&&C!==void 0&&C.live),w=T==null?void 0:T.codecSet,y=L?L.duration:D?D.duration:0,b=s;b>=l;b--){var j=A[b];if(!j||w&&j.codecSet!==w)continue;var B=j.details,E=(L?B==null?void 0:B.partTarget:B==null?void 0:B.averagetargetduration)||y,F=void 0;b<=R?F=S*o:F=x*o;var I=A[b].maxBitrate,g=I*E/F;if(O.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+b+"/"+Math.round(F)+"/"+I+"/"+E+"/"+a+"/"+g),F>I&&(!g||d&&!this.bitrateTestDelay||g<a))return b}return-1},m(h,[{key:"nextAutoLevel",get:function(){var o=this._nextAutoLevel,l=this.bwEstimator;if(o!==-1&&(!l||!l.canEstimate()))return o;var s=this.getNextABRAutoLevel();return o!==-1&&(s=Math.min(o,s)),s},set:function(o){this._nextAutoLevel=o}}]),h}();Y.default=p},"./src/controller/audio-stream-controller.ts":function(oe,Y,N){"use strict";N.r(Y);var J=N("./src/polyfills/number.ts"),H=N("./src/controller/base-stream-controller.ts"),M=N("./src/events.ts"),z=N("./src/utils/buffer-helper.ts"),G=N("./src/controller/fragment-tracker.ts"),r=N("./src/types/level.ts"),O=N("./src/types/loader.ts"),v=N("./src/loader/fragment.ts"),m=N("./src/demux/chunk-cache.ts"),p=N("./src/demux/transmuxer-interface.ts"),h=N("./src/types/transmuxer.ts"),u=N("./src/controller/fragment-finders.ts"),f=N("./src/utils/discontinuities.ts"),o=N("./src/errors.ts"),l=N("./src/utils/logger.ts");function s(){return s=Object.assign||function(D){for(var L=1;L<arguments.length;L++){var R=arguments[L];for(var A in R)Object.prototype.hasOwnProperty.call(R,A)&&(D[A]=R[A])}return D},s.apply(this,arguments)}function a(D,L){D.prototype=Object.create(L.prototype),D.prototype.constructor=D,S(D,L)}function S(D,L){return S=Object.setPrototypeOf||function(A,T){return A.__proto__=T,A},S(D,L)}var x=100,C=function(D){a(L,D);function L(A,T){var d;return d=D.call(this,A,T,"[audio-stream-controller]")||this,d.videoBuffer=null,d.videoTrackCC=-1,d.waitingVideoCC=-1,d.audioSwitch=!1,d.trackId=-1,d.waitingData=null,d.mainDetails=null,d.bufferFlushed=!1,d._registerListeners(),d}var R=L.prototype;return R.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},R._registerListeners=function(){var T=this.hls;T.on(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),T.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),T.on(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),T.on(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),T.on(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),T.on(M.Events.ERROR,this.onError,this),T.on(M.Events.BUFFER_RESET,this.onBufferReset,this),T.on(M.Events.BUFFER_CREATED,this.onBufferCreated,this),T.on(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),T.on(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),T.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},R._unregisterListeners=function(){var T=this.hls;T.off(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),T.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),T.off(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),T.off(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),T.off(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),T.off(M.Events.ERROR,this.onError,this),T.off(M.Events.BUFFER_RESET,this.onBufferReset,this),T.off(M.Events.BUFFER_CREATED,this.onBufferCreated,this),T.off(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),T.off(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),T.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},R.onInitPtsFound=function(T,d){var w=d.frag,y=d.id,b=d.initPTS;if(y==="main"){var j=w.cc;this.initPTS[w.cc]=b,this.log("InitPTS for cc: "+j+" found from main: "+b),this.videoTrackCC=j,this.state===H.State.WAITING_INIT_PTS&&this.tick()}},R.startLoad=function(T){if(!this.levels){this.startPosition=T,this.state=H.State.STOPPED;return}var d=this.lastCurrentTime;this.stopLoad(),this.setInterval(x),this.fragLoadError=0,d>0&&T===-1?(this.log("Override startPosition with lastCurrentTime @"+d.toFixed(3)),this.state=H.State.IDLE):(this.loadedmetadata=!1,this.state=H.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=T,this.tick()},R.doTick=function(){switch(this.state){case H.State.IDLE:this.doTickIdle();break;case H.State.WAITING_TRACK:{var T,d=this.levels,w=this.trackId,y=d==null||((T=d[w])===null||T===void 0)?void 0:T.details;if(y){if(this.waitForCdnTuneIn(y))break;this.state=H.State.WAITING_INIT_PTS}break}case H.State.FRAG_LOADING_WAITING_RETRY:{var b,j=performance.now(),B=this.retryDate;(!B||j>=B||(b=this.media)!==null&&b!==void 0&&b.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=H.State.IDLE);break}case H.State.WAITING_INIT_PTS:{var E=this.waitingData;if(E){var F=E.frag,I=E.part,g=E.cache,W=E.complete;if(this.initPTS[F.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=H.State.FRAG_LOADING;var $=g.flush(),le={frag:F,part:I,payload:$,networkDetails:null};this._handleFragmentLoadProgress(le),W&&D.prototype._handleFragmentLoadComplete.call(this,le)}else if(this.videoTrackCC!==this.waitingVideoCC)l.logger.log("Waiting fragment cc ("+F.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var de=this.getLoadPosition(),Ce=z.BufferHelper.bufferInfo(this.mediaBuffer,de,this.config.maxBufferHole),be=Object(u.fragmentWithinToleranceTest)(Ce.end,this.config.maxFragLookUpTolerance,F);be<0&&(l.logger.log("Waiting fragment cc ("+F.cc+") @ "+F.start+" cancelled because another fragment at "+Ce.end+" is needed"),this.clearWaitingFragment())}}else this.state=H.State.IDLE}}this.onTickEnd()},R.clearWaitingFragment=function(){var T=this.waitingData;T&&(this.fragmentTracker.removeFragment(T.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=H.State.IDLE)},R.onTickEnd=function(){var T=this.media;if(!T||!T.readyState)return;var d=this.mediaBuffer?this.mediaBuffer:T,w=d.buffered;!this.loadedmetadata&&w.length&&(this.loadedmetadata=!0),this.lastCurrentTime=T.currentTime},R.doTickIdle=function(){var T,d,w=this.hls,y=this.levels,b=this.media,j=this.trackId,B=w.config;if(!y||!y[j])return;if(!b&&(this.startFragRequested||!B.startFragPrefetch))return;var E=y[j],F=E.details;if(!F||F.live&&this.levelLastLoaded!==j||this.waitForCdnTuneIn(F)){this.state=H.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,v.ElementaryStreamTypes.AUDIO,O.PlaylistLevelType.AUDIO));var I=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,O.PlaylistLevelType.AUDIO);if(I===null)return;var g=I.len,W=this.getMaxBufferLength(),$=this.audioSwitch;if(g>=W&&!$)return;if(!$&&this._streamEnded(I,F)){w.trigger(M.Events.BUFFER_EOS,{type:"audio"}),this.state=H.State.ENDED;return}var le=F.fragments,de=le[0].start,Ce=I.end;if($){var be=this.getLoadPosition();Ce=be,F.PTSKnown&&be<de&&((I.end>de||I.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),b.currentTime=de+.05))}var Ae=this.getNextFragment(Ce,F);if(!Ae){this.bufferFlushed=!0;return}((T=Ae.decryptdata)===null||T===void 0?void 0:T.keyFormat)==="identity"&&!((d=Ae.decryptdata)!==null&&d!==void 0&&d.key)?this.loadKey(Ae,F):this.loadFragment(Ae,F,Ce)},R.getMaxBufferLength=function(){var T=D.prototype.getMaxBufferLength.call(this),d=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,O.PlaylistLevelType.MAIN);return d===null?T:Math.max(T,d.len)},R.onMediaDetaching=function(){this.videoBuffer=null,D.prototype.onMediaDetaching.call(this)},R.onAudioTracksUpdated=function(T,d){var w=d.audioTracks;this.resetTransmuxer(),this.levels=w.map(function(y){return new r.Level(y)})},R.onAudioTrackSwitching=function(T,d){var w=!!d.url;this.trackId=d.id;var y=this.fragCurrent;y!=null&&y.loader&&y.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),w?this.setInterval(x):this.resetTransmuxer(),w?(this.audioSwitch=!0,this.state=H.State.IDLE):this.state=H.State.STOPPED,this.tick()},R.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},R.onLevelLoaded=function(T,d){this.mainDetails=d.details},R.onAudioTrackLoaded=function(T,d){var w,y=this.levels,b=d.details,j=d.id;if(!y){this.warn("Audio tracks were reset while loading level "+j);return}this.log("Track "+j+" loaded ["+b.startSN+","+b.endSN+"],duration:"+b.totalduration);var B=y[j],E=0;if(b.live||(w=B.details)!==null&&w!==void 0&&w.live){var F=this.mainDetails;if(b.fragments[0]||(b.deltaUpdateFailed=!0),b.deltaUpdateFailed||!F)return;!B.details&&b.hasProgramDateTime&&F.hasProgramDateTime?(Object(f.alignMediaPlaylistByPDT)(b,F),E=b.fragments[0].start):E=this.alignPlaylists(b,B.details)}B.details=b,this.levelLastLoaded=j,!this.startFragRequested&&(this.mainDetails||!b.live)&&this.setStartPosition(B.details,E),this.state===H.State.WAITING_TRACK&&!this.waitForCdnTuneIn(b)&&(this.state=H.State.IDLE),this.tick()},R._handleFragmentLoadProgress=function(T){var d,w=T.frag,y=T.part,b=T.payload,j=this.config,B=this.trackId,E=this.levels;if(!E){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+w.sn+" of level "+w.level+" will not be buffered");return}var F=E[B];console.assert(F,"Audio track is defined on fragment load progress");var I=F.details;console.assert(I,"Audio track details are defined on fragment load progress");var g=j.defaultAudioCodec||F.audioCodec||"mp4a.40.2",W=this.transmuxer;W||(W=this.transmuxer=new p.default(this.hls,O.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var $=this.initPTS[w.cc],le=(d=w.initSegment)===null||d===void 0?void 0:d.data;if($!==void 0){var de=!1,Ce=y?y.index:-1,be=Ce!==-1,Ae=new h.ChunkMetadata(w.level,w.sn,w.stats.chunkCount,b.byteLength,Ce,be);W.push(b,le,g,"",w,y,I.totalduration,de,Ae,$)}else{l.logger.log("Unknown video PTS for cc "+w.cc+", waiting for video PTS before demuxing audio frag "+w.sn+" of ["+I.startSN+" ,"+I.endSN+"],track "+B);var Se=this.waitingData=this.waitingData||{frag:w,part:y,cache:new m.default,complete:!1},Re=Se.cache;Re.push(new Uint8Array(b)),this.waitingVideoCC=this.videoTrackCC,this.state=H.State.WAITING_INIT_PTS}},R._handleFragmentLoadComplete=function(T){if(this.waitingData){this.waitingData.complete=!0;return}D.prototype._handleFragmentLoadComplete.call(this,T)},R.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},R.onBufferCreated=function(T,d){var w=d.tracks.audio;w&&(this.mediaBuffer=w.buffer),d.tracks.video&&(this.videoBuffer=d.tracks.video.buffer)},R.onFragBuffered=function(T,d){var w=d.frag,y=d.part;if(w.type!==O.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(w)){this.warn("Fragment "+w.sn+(y?" p: "+y.index:"")+" of level "+w.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}w.sn!=="initSegment"&&(this.fragPrevious=w,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(M.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(w,y)},R.onError=function(T,d){switch(d.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(O.PlaylistLevelType.AUDIO,d);break;case o.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case o.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==H.State.ERROR&&this.state!==H.State.STOPPED&&(this.state=d.fatal?H.State.ERROR:H.State.IDLE,this.warn(d.details+" while loading frag, switching to "+this.state+" state"));break;case o.ErrorDetails.BUFFER_FULL_ERROR:if(d.parent==="audio"&&(this.state===H.State.PARSING||this.state===H.State.PARSED)){var w=!0,y=this.getFwdBufferInfo(this.mediaBuffer,O.PlaylistLevelType.AUDIO);y&&y.len>.5&&(w=!this.reduceMaxBufferLength(y.len)),w&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,D.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},R.onBufferFlushed=function(T,d){var w=d.type;w===v.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},R._handleTransmuxComplete=function(T){var d,w="audio",y=this.hls,b=T.remuxResult,j=T.chunkMeta,B=this.getCurrentContext(j);if(!B){this.warn("The loading context changed while buffering fragment "+j.sn+" of level "+j.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(j.level);return}var E=B.frag,F=B.part,I=b.audio,g=b.text,W=b.id3,$=b.initSegment;if(this.fragContextChanged(E))return;if(this.state=H.State.PARSING,this.audioSwitch&&I&&this.completeAudioSwitch(),$!=null&&$.tracks&&(this._bufferInitSegment($.tracks,E,j),y.trigger(M.Events.FRAG_PARSING_INIT_SEGMENT,{frag:E,id:w,tracks:$.tracks})),I){var le=I.startPTS,de=I.endPTS,Ce=I.startDTS,be=I.endDTS;F&&(F.elementaryStreams[v.ElementaryStreamTypes.AUDIO]={startPTS:le,endPTS:de,startDTS:Ce,endDTS:be}),E.setElementaryStreamInfo(v.ElementaryStreamTypes.AUDIO,le,de,Ce,be),this.bufferFragmentData(I,E,F,j)}if(W!=null&&(d=W.samples)!==null&&d!==void 0&&d.length){var Ae=s({frag:E,id:w},W);y.trigger(M.Events.FRAG_PARSING_METADATA,Ae)}if(g){var Se=s({frag:E,id:w},g);y.trigger(M.Events.FRAG_PARSING_USERDATA,Se)}},R._bufferInitSegment=function(T,d,w){if(this.state!==H.State.PARSING)return;T.video&&delete T.video;var y=T.audio;if(!y)return;y.levelCodec=y.codec,y.id="audio",this.log("Init audio buffer, container:"+y.container+", codecs[parsed]=["+y.codec+"]"),this.hls.trigger(M.Events.BUFFER_CODECS,T);var b=y.initSegment;if(b!=null&&b.byteLength){var j={type:"audio",frag:d,part:null,chunkMeta:w,parent:d.type,data:b};this.hls.trigger(M.Events.BUFFER_APPENDING,j)}this.tick()},R.loadFragment=function(T,d,w){var y=this.fragmentTracker.getState(T);this.fragCurrent=T,(this.audioSwitch||y===G.FragmentState.NOT_LOADED||y===G.FragmentState.PARTIAL)&&(T.sn==="initSegment"?this._loadInitSegment(T):d.live&&!Object(J.isFiniteNumber)(this.initPTS[T.cc])?(this.log("Waiting for video PTS in continuity counter "+T.cc+" of live stream before loading audio fragment "+T.sn+" of level "+this.trackId),this.state=H.State.WAITING_INIT_PTS):(this.startFragRequested=!0,D.prototype.loadFragment.call(this,T,d,w)))},R.completeAudioSwitch=function(){var T=this.hls,d=this.media,w=this.trackId;d&&(this.log("Switching audio track : flushing all audio"),D.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,T.trigger(M.Events.AUDIO_TRACK_SWITCHED,{id:w})},L}(H.default);Y.default=C},"./src/controller/audio-track-controller.ts":function(oe,Y,N){"use strict";N.r(Y);var J=N("./src/events.ts"),H=N("./src/errors.ts"),M=N("./src/controller/base-playlist-controller.ts"),z=N("./src/types/loader.ts");function G(p,h){for(var u=0;u<h.length;u++){var f=h[u];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(p,f.key,f)}}function r(p,h,u){return h&&G(p.prototype,h),u&&G(p,u),p}function O(p,h){p.prototype=Object.create(h.prototype),p.prototype.constructor=p,v(p,h)}function v(p,h){return v=Object.setPrototypeOf||function(f,o){return f.__proto__=o,f},v(p,h)}var m=function(p){O(h,p);function h(f){var o;return o=p.call(this,f,"[audio-track-controller]")||this,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.trackName="",o.selectDefaultTrack=!0,o.registerListeners(),o}var u=h.prototype;return u.registerListeners=function(){var o=this.hls;o.on(J.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(J.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(J.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(J.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(J.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),o.on(J.Events.ERROR,this.onError,this)},u.unregisterListeners=function(){var o=this.hls;o.off(J.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(J.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(J.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(J.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(J.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),o.off(J.Events.ERROR,this.onError,this)},u.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,p.prototype.destroy.call(this)},u.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},u.onManifestParsed=function(o,l){this.tracks=l.audioTracks||[]},u.onAudioTrackLoaded=function(o,l){var s=l.id,a=l.details,S=this.tracksInGroup[s];if(!S){this.warn("Invalid audio track id "+s);return}var x=S.details;S.details=l.details,this.log("audioTrack "+s+" loaded ["+a.startSN+"-"+a.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,l,x))},u.onLevelLoading=function(o,l){this.switchLevel(l.level)},u.onLevelSwitching=function(o,l){this.switchLevel(l.level)},u.switchLevel=function(o){var l=this.hls.levels[o];if(!(l!=null&&l.audioGroupIds))return;var s=l.audioGroupIds[l.urlId];if(this.groupId!==s){this.groupId=s;var a=this.tracks.filter(function(x){return!s||x.groupId===s});this.selectDefaultTrack&&!a.some(function(x){return x.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=a;var S={audioTracks:a};this.log("Updating audio tracks, "+a.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(J.Events.AUDIO_TRACKS_UPDATED,S),this.selectInitialTrack()}},u.onError=function(o,l){if(p.prototype.onError.call(this,o,l),l.fatal||!l.context)return;l.context.type===z.PlaylistContextType.AUDIO_TRACK&&l.context.id===this.trackId&&l.context.groupId===this.groupId&&this.retryLoadingOrFail(l)},u.setAudioTrack=function(o){var l=this.tracksInGroup;if(o<0||o>=l.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=l[this.trackId];this.log("Now switching to audio-track index "+o);var a=l[o],S=a.id,x=a.groupId,C=x===void 0?"":x,D=a.name,L=a.type,R=a.url;if(this.trackId=o,this.trackName=D,this.selectDefaultTrack=!1,this.hls.trigger(J.Events.AUDIO_TRACK_SWITCHING,{id:S,groupId:C,name:D,type:L,url:R}),a.details&&!a.details.live)return;var A=this.switchParams(a.url,s==null?void 0:s.details);this.loadPlaylist(A)},u.selectInitialTrack=function(){var o=this.tracksInGroup;console.assert(o.length,"Initial audio track should be selected when tracks are known");var l=this.trackName,s=this.findTrackId(l)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(J.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},u.findTrackId=function(o){for(var l=this.tracksInGroup,s=0;s<l.length;s++){var a=l[s];if((!this.selectDefaultTrack||a.default)&&(!o||o===a.name))return a.id}return-1},u.loadPlaylist=function(o){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var s=l.id,a=l.groupId,S=l.url;if(o)try{S=o.addDirectives(S)}catch(x){this.warn("Could not construct new URL with HLS Delivery Directives: "+x)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(J.Events.AUDIO_TRACK_LOADING,{url:S,id:s,groupId:a,deliveryDirectives:o||null})}},r(h,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1,this.setAudioTrack(o)}}]),h}(M.default);Y.default=m},"./src/controller/base-playlist-controller.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return r});var J=N("./src/polyfills/number.ts"),H=N("./src/types/level.ts"),M=N("./src/controller/level-helper.ts"),z=N("./src/utils/logger.ts"),G=N("./src/errors.ts"),r=function(){function O(m,p){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=z.logger.log.bind(z.logger,p+":"),this.warn=z.logger.warn.bind(z.logger,p+":"),this.hls=m}var v=O.prototype;return v.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},v.onError=function(p,h){h.fatal&&h.type===G.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},v.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},v.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},v.stopLoad=function(){this.canLoad=!1,this.clearTimer()},v.switchParams=function(p,h){var u=h==null?void 0:h.renditionReports;if(u)for(var f=0;f<u.length;f++){var o=u[f],l=""+o.URI;if(l===p.substr(-l.length)){var s=parseInt(o["LAST-MSN"]),a=parseInt(o["LAST-PART"]);if(h&&this.hls.config.lowLatencyMode){var S=Math.min(h.age-h.partTarget,h.targetduration);a!==void 0&&S>h.partTarget&&(a+=1)}if(Object(J.isFiniteNumber)(s))return new H.HlsUrlParameters(s,Object(J.isFiniteNumber)(a)?a:void 0,H.HlsSkip.No)}}},v.loadPlaylist=function(p){},v.shouldLoadTrack=function(p){return this.canLoad&&p&&!!p.url&&(!p.details||p.details.live)},v.playlistLoaded=function(p,h,u){var f=this,o=h.details,l=h.stats,s=l.loading.end?Math.max(0,self.performance.now()-l.loading.end):0;if(o.advancedDateTime=Date.now()-s,o.live||u!=null&&u.live){if(o.reloaded(u),u&&this.log("live playlist "+p+" "+(o.advanced?"REFRESHED "+o.lastPartSn+"-"+o.lastPartIndex:"MISSED")),u&&o.fragments.length>0&&Object(M.mergeDetails)(u,o),!this.canLoad||!o.live)return;var a,S=void 0,x=void 0;if(o.canBlockReload&&o.endSN&&o.advanced){var C=this.hls.config.lowLatencyMode,D=o.lastPartSn,L=o.endSN,R=o.lastPartIndex,A=R!==-1,T=D===L,d=C?0:R;A?(S=T?L+1:D,x=T?d:R+1):S=L+1;var w=o.age,y=w+o.ageHeader,b=Math.min(y-o.partTarget,o.targetduration*1.5);if(b>0){if(u&&b>u.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+u.tuneInGoal+" to: "+b+" with playlist age: "+o.age),b=0;else{var j=Math.floor(b/o.targetduration);if(S+=j,x!==void 0){var B=Math.round(b%o.targetduration/o.partTarget);x+=B}this.log("CDN Tune-in age: "+o.ageHeader+"s last advanced "+w.toFixed(2)+"s goal: "+b+" skip sn "+j+" to part "+x)}o.tuneInGoal=b}if(a=this.getDeliveryDirectives(o,h.deliveryDirectives,S,x),C||!T){this.loadPlaylist(a);return}}else a=this.getDeliveryDirectives(o,h.deliveryDirectives,S,x);var E=Object(M.computeReloadInterval)(o,l);S!==void 0&&o.canBlockReload&&(E-=o.partTarget||1),this.log("reload live playlist "+p+" in "+Math.round(E)+" ms"),this.timer=self.setTimeout(function(){return f.loadPlaylist(a)},E)}else this.clearTimer()},v.getDeliveryDirectives=function(p,h,u,f){var o=Object(H.getSkipValue)(p,u);return h!=null&&h.skip&&p.deltaUpdateFailed&&(u=h.msn,f=h.part,o=H.HlsSkip.No),new H.HlsUrlParameters(u,f,o)},v.retryLoadingOrFail=function(p){var h=this,u=this.hls.config,f=this.retryCount<u.levelLoadingMaxRetry;if(f){var o;if(this.retryCount++,p.details.indexOf("LoadTimeOut")>-1&&(o=p.context)!==null&&o!==void 0&&o.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+p.details+'"'),this.loadPlaylist();else{var l=Math.min(Math.pow(2,this.retryCount)*u.levelLoadingRetryDelay,u.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return h.loadPlaylist()},l),this.warn("retry playlist loading #"+this.retryCount+" in "+l+' ms after "'+p.details+'"')}}else this.warn('cannot recover from error "'+p.details+'"'),this.clearTimer(),p.fatal=!0;return f},O}()},"./src/controller/base-stream-controller.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"State",function(){return L}),N.d(Y,"default",function(){return R});var J=N("./src/polyfills/number.ts"),H=N("./src/task-loop.ts"),M=N("./src/controller/fragment-tracker.ts"),z=N("./src/utils/buffer-helper.ts"),G=N("./src/utils/logger.ts"),r=N("./src/events.ts"),O=N("./src/errors.ts"),v=N("./src/types/transmuxer.ts"),m=N("./src/utils/mp4-tools.ts"),p=N("./src/utils/discontinuities.ts"),h=N("./src/controller/fragment-finders.ts"),u=N("./src/controller/level-helper.ts"),f=N("./src/loader/fragment-loader.ts"),o=N("./src/crypt/decrypter.ts"),l=N("./src/utils/time-ranges.ts"),s=N("./src/types/loader.ts");function a(A,T){for(var d=0;d<T.length;d++){var w=T[d];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(A,w.key,w)}}function S(A,T,d){return T&&a(A.prototype,T),d&&a(A,d),A}function x(A){if(A===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return A}function C(A,T){A.prototype=Object.create(T.prototype),A.prototype.constructor=A,D(A,T)}function D(A,T){return D=Object.setPrototypeOf||function(w,y){return w.__proto__=y,w},D(A,T)}var L={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},R=function(A){C(T,A);function T(w,y,b){var j;return j=A.call(this)||this,j.hls=void 0,j.fragPrevious=null,j.fragCurrent=null,j.fragmentTracker=void 0,j.transmuxer=null,j._state=L.STOPPED,j.media=void 0,j.mediaBuffer=void 0,j.config=void 0,j.bitrateTest=!1,j.lastCurrentTime=0,j.nextLoadPosition=0,j.startPosition=0,j.loadedmetadata=!1,j.fragLoadError=0,j.retryDate=0,j.levels=null,j.fragmentLoader=void 0,j.levelLastLoaded=null,j.startFragRequested=!1,j.decrypter=void 0,j.initPTS=[],j.onvseeking=null,j.onvended=null,j.logPrefix="",j.log=void 0,j.warn=void 0,j.logPrefix=b,j.log=G.logger.log.bind(G.logger,b+":"),j.warn=G.logger.warn.bind(G.logger,b+":"),j.hls=w,j.fragmentLoader=new f.default(w.config),j.fragmentTracker=y,j.config=w.config,j.decrypter=new o.default(w,w.config),w.on(r.Events.KEY_LOADED,j.onKeyLoaded,x(j)),j}var d=T.prototype;return d.doTick=function(){this.onTickEnd()},d.onTickEnd=function(){},d.startLoad=function(y){},d.stopLoad=function(){this.fragmentLoader.abort();var y=this.fragCurrent;y&&this.fragmentTracker.removeFragment(y),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=L.STOPPED},d._streamEnded=function(y,b){var j=this.fragCurrent,B=this.fragmentTracker;if(!b.live&&j&&j.sn===b.endSN&&!y.nextStart){var E=B.getState(j);return E===M.FragmentState.PARTIAL||E===M.FragmentState.OK}return!1},d.onMediaAttached=function(y,b){var j=this.media=this.mediaBuffer=b.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),j.addEventListener("seeking",this.onvseeking),j.addEventListener("ended",this.onvended);var B=this.config;this.levels&&B.autoStartLoad&&this.state===L.STOPPED&&this.startLoad(B.startPosition)},d.onMediaDetaching=function(){var y=this.media;y!=null&&y.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),y&&(y.removeEventListener("seeking",this.onvseeking),y.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},d.onMediaSeeking=function(){var y=this.config,b=this.fragCurrent,j=this.media,B=this.mediaBuffer,E=this.state,F=j?j.currentTime:0,I=z.BufferHelper.bufferInfo(B||j,F,y.maxBufferHole);if(this.log("media seeking to "+(Object(J.isFiniteNumber)(F)?F.toFixed(3):F)+", state: "+E),E===L.ENDED)this.resetLoadingState();else if(b&&!I.len){var g=y.maxFragLookUpTolerance,W=b.start-g,$=b.start+b.duration+g,le=F>$;(F<W||le)&&(le&&b.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),b.loader.abort()),this.resetLoadingState())}j&&(this.lastCurrentTime=F),!this.loadedmetadata&&!I.len&&(this.nextLoadPosition=this.startPosition=F),this.tickImmediate()},d.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},d.onKeyLoaded=function(y,b){if(this.state!==L.KEY_LOADING||b.frag!==this.fragCurrent||!this.levels)return;this.state=L.IDLE;var j=this.levels[b.frag.level].details;j&&this.loadFragment(b.frag,j,b.frag.start)},d.onHandlerDestroying=function(){this.stopLoad(),A.prototype.onHandlerDestroying.call(this)},d.onHandlerDestroyed=function(){this.state=L.STOPPED,this.hls.off(r.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,A.prototype.onHandlerDestroyed.call(this)},d.loadKey=function(y,b){this.log("Loading key for "+y.sn+" of ["+b.startSN+"-"+b.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level),this.state=L.KEY_LOADING,this.fragCurrent=y,this.hls.trigger(r.Events.KEY_LOADING,{frag:y})},d.loadFragment=function(y,b,j){this._loadFragForPlayback(y,b,j)},d._loadFragForPlayback=function(y,b,j){var B=this,E=function(I){if(B.fragContextChanged(y)){B.warn("Fragment "+y.sn+(I.part?" p: "+I.part.index:"")+" of level "+y.level+" was dropped during download."),B.fragmentTracker.removeFragment(y);return}y.stats.chunkCount++,B._handleFragmentLoadProgress(I)};this._doFragLoad(y,b,j,E).then(function(F){if(!F)return;B.fragLoadError=0;var I=B.state;if(B.fragContextChanged(y)){(I===L.FRAG_LOADING||I===L.BACKTRACKING||!B.fragCurrent&&I===L.PARSING)&&(B.fragmentTracker.removeFragment(y),B.state=L.IDLE);return}if("payload"in F&&(B.log("Loaded fragment "+y.sn+" of level "+y.level),B.hls.trigger(r.Events.FRAG_LOADED,F),B.state===L.BACKTRACKING)){B.fragmentTracker.backtrack(y,F),B.resetFragmentLoading(y);return}B._handleFragmentLoadComplete(F)}).catch(function(F){B.warn(F),B.resetFragmentLoading(y)})},d.flushMainBuffer=function(y,b,j){if(j===void 0&&(j=null),!(y-b))return;var B={startOffset:y,endOffset:b,type:j};this.fragLoadError=0,this.hls.trigger(r.Events.BUFFER_FLUSHING,B)},d._loadInitSegment=function(y){var b=this;this._doFragLoad(y).then(function(j){if(!j||b.fragContextChanged(y)||!b.levels)throw new Error("init load aborted");return j}).then(function(j){var B=b.hls,E=j.payload,F=y.decryptdata;if(E&&E.byteLength>0&&F&&F.key&&F.iv&&F.method==="AES-128"){var I=self.performance.now();return b.decrypter.webCryptoDecrypt(new Uint8Array(E),F.key.buffer,F.iv.buffer).then(function(g){var W=self.performance.now();return B.trigger(r.Events.FRAG_DECRYPTED,{frag:y,payload:g,stats:{tstart:I,tdecrypt:W}}),j.payload=g,j})}return j}).then(function(j){var B=b.fragCurrent,E=b.hls,F=b.levels;if(!F)throw new Error("init load aborted, missing levels");var I=F[y.level].details;console.assert(I,"Level details are defined when init segment is loaded");var g=y.stats;b.state=L.IDLE,b.fragLoadError=0,y.data=new Uint8Array(j.payload),g.parsing.start=g.buffering.start=self.performance.now(),g.parsing.end=g.buffering.end=self.performance.now(),j.frag===B&&E.trigger(r.Events.FRAG_BUFFERED,{stats:g,frag:B,part:null,id:y.type}),b.tick()}).catch(function(j){b.warn(j),b.resetFragmentLoading(y)})},d.fragContextChanged=function(y){var b=this.fragCurrent;return!y||!b||y.level!==b.level||y.sn!==b.sn||y.urlId!==b.urlId},d.fragBufferedComplete=function(y,b){var j=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+y.type+" sn: "+y.sn+(b?" part: "+b.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level+" "+l.default.toString(z.BufferHelper.getBuffered(j))),this.state=L.IDLE,this.tick()},d._handleFragmentLoadComplete=function(y){var b=this.transmuxer;if(!b)return;var j=y.frag,B=y.part,E=y.partsLoaded,F=!E||E.length===0||E.some(function(g){return!g}),I=new v.ChunkMetadata(j.level,j.sn,j.stats.chunkCount+1,0,B?B.index:-1,!F);b.flush(I)},d._handleFragmentLoadProgress=function(y){},d._doFragLoad=function(y,b,j,B){var E=this;if(j===void 0&&(j=null),!this.levels)throw new Error("frag load aborted, missing levels");if(j=Math.max(y.start,j||0),this.config.lowLatencyMode&&b){var F=b.partList;if(F&&B){j>y.end&&b.fragmentHint&&(y=b.fragmentHint);var I=this.getNextPart(F,y,j);if(I>-1){var g=F[I];return this.log("Loading part sn: "+y.sn+" p: "+g.index+" cc: "+y.cc+" of playlist ["+b.startSN+"-"+b.endSN+"] parts [0-"+I+"-"+(F.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(j.toFixed(3))),this.nextLoadPosition=g.start+g.duration,this.state=L.FRAG_LOADING,this.hls.trigger(r.Events.FRAG_LOADING,{frag:y,part:F[I],targetBufferTime:j}),this.doFragPartsLoad(y,F,I,B).catch(function(W){return E.handleFragLoadError(W)})}else if(!y.url||this.loadedEndOfParts(F,j))return Promise.resolve(null)}}return this.log("Loading fragment "+y.sn+" cc: "+y.cc+" "+(b?"of ["+b.startSN+"-"+b.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(j.toFixed(3))),Object(J.isFiniteNumber)(y.sn)&&!this.bitrateTest&&(this.nextLoadPosition=y.start+y.duration),this.state=L.FRAG_LOADING,this.hls.trigger(r.Events.FRAG_LOADING,{frag:y,targetBufferTime:j}),this.fragmentLoader.load(y,B).catch(function(W){return E.handleFragLoadError(W)})},d.doFragPartsLoad=function(y,b,j,B){var E=this;return new Promise(function(F,I){var g=[],W=function $(le){var de=b[le];E.fragmentLoader.loadPart(y,de,B).then(function(Ce){g[de.index]=Ce;var be=Ce.part;E.hls.trigger(r.Events.FRAG_LOADED,Ce);var Ae=b[le+1];if(Ae&&Ae.fragment===y)$(le+1);else return F({frag:y,part:be,partsLoaded:g})}).catch(I)};W(j)})},d.handleFragLoadError=function(y){var b=y.data;return b&&b.details===O.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(b.frag,b.part):this.hls.trigger(r.Events.ERROR,b),null},d._handleTransmuxerFlush=function(y){var b=this.getCurrentContext(y);if(!b||this.state!==L.PARSING){this.fragCurrent||(this.state=L.IDLE);return}var j=b.frag,B=b.part,E=b.level,F=self.performance.now();j.stats.parsing.end=F,B&&(B.stats.parsing.end=F),this.updateLevelTiming(j,B,E,y.partial)},d.getCurrentContext=function(y){var b=this.levels,j=y.level,B=y.sn,E=y.part;if(!b||!b[j])return this.warn("Levels object was unset while buffering fragment "+B+" of level "+j+". The current chunk will not be buffered."),null;var F=b[j],I=E>-1?Object(u.getPartWith)(F,B,E):null,g=I?I.fragment:Object(u.getFragmentWithSN)(F,B,this.fragCurrent);return g?{frag:g,part:I,level:F}:null},d.bufferFragmentData=function(y,b,j,B){if(!y||this.state!==L.PARSING)return;var E=y.data1,F=y.data2,I=E;if(E&&F&&(I=Object(m.appendUint8Array)(E,F)),!I||!I.length)return;var g={type:y.type,frag:b,part:j,chunkMeta:B,parent:b.type,data:I};this.hls.trigger(r.Events.BUFFER_APPENDING,g),y.dropped&&y.independent&&!j&&this.flushBufferGap(b)},d.flushBufferGap=function(y){var b=this.media;if(!b)return;if(!z.BufferHelper.isBuffered(b,b.currentTime)){this.flushMainBuffer(0,y.start);return}var j=b.currentTime,B=z.BufferHelper.bufferInfo(b,j,0),E=y.duration,F=Math.min(this.config.maxFragLookUpTolerance*2,E*.25),I=Math.max(Math.min(y.start-F,B.end-F),j+F);y.start-I>F&&this.flushMainBuffer(I,y.start)},d.getFwdBufferInfo=function(y,b){var j=this.config,B=this.getLoadPosition();if(!Object(J.isFiniteNumber)(B))return null;var E=z.BufferHelper.bufferInfo(y,B,j.maxBufferHole);if(E.len===0&&E.nextStart!==void 0){var F=this.fragmentTracker.getBufferedFrag(B,b);if(F&&E.nextStart<F.end)return z.BufferHelper.bufferInfo(y,B,Math.max(E.nextStart,j.maxBufferHole))}return E},d.getMaxBufferLength=function(y){var b=this.config,j;return y?j=Math.max(8*b.maxBufferSize/y,b.maxBufferLength):j=b.maxBufferLength,Math.min(j,b.maxMaxBufferLength)},d.reduceMaxBufferLength=function(y){var b=this.config,j=y||b.maxBufferLength;return b.maxMaxBufferLength>=j?(b.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+b.maxMaxBufferLength+"s"),!0):!1},d.getNextFragment=function(y,b){var j,B,E=b.fragments,F=E.length;if(!F)return null;var I=this.config,g=E[0].start,W;if(b.live){var $=I.initialLiveManifestSize;if(F<$)return this.warn("Not enough fragments to start playback (have: "+F+", need: "+$+")"),null;!b.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(W=this.getInitialLiveFragment(b,E),this.startPosition=W?this.hls.liveSyncPosition||W.start:y)}else y<=g&&(W=E[0]);if(!W){var le=I.lowLatencyMode?b.partEnd:b.fragmentEnd;W=this.getFragmentAtPosition(y,le,b)}return(j=W)!==null&&j!==void 0&&j.initSegment&&!((B=W)!==null&&B!==void 0&&B.initSegment.data)&&!this.bitrateTest&&(W=W.initSegment),W},d.getNextPart=function(y,b,j){for(var B=-1,E=!1,F=!0,I=0,g=y.length;I<g;I++){var W=y[I];if(F=F&&!W.independent,B>-1&&j<W.start)break;var $=W.loaded;!$&&(E||W.independent||F)&&W.fragment===b&&(B=I),E=$}return B},d.loadedEndOfParts=function(y,b){var j=y[y.length-1];return j&&b>j.start&&j.loaded},d.getInitialLiveFragment=function(y,b){var j=this.fragPrevious,B=null;if(j){if(y.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+j.programDateTime),B=Object(h.findFragmentByPDT)(b,j.endProgramDateTime,this.config.maxFragLookUpTolerance)),!B){var E=j.sn+1;if(E>=y.startSN&&E<=y.endSN){var F=b[E-y.startSN];j.cc===F.cc&&(B=F,this.log("Live playlist, switching playlist, load frag with next SN: "+B.sn))}B||(B=Object(h.findFragWithCC)(b,j.cc),B&&this.log("Live playlist, switching playlist, load frag with same CC: "+B.sn))}}else{var I=this.hls.liveSyncPosition;I!==null&&(B=this.getFragmentAtPosition(I,this.bitrateTest?y.fragmentEnd:y.edge,y))}return B},d.getFragmentAtPosition=function(y,b,j){var B=this.config,E=this.fragPrevious,F=j.fragments,I=j.endSN,g=j.fragmentHint,W=B.maxFragLookUpTolerance,$=!!(B.lowLatencyMode&&j.partList&&g);$&&g&&!this.bitrateTest&&(F=F.concat(g),I=g.sn);var le;if(y<b){var de=y>b-W?0:W;le=Object(h.findFragmentByPTS)(E,F,y,de)}else le=F[F.length-1];if(le){var Ce=le.sn-j.startSN,be=E&&le.level===E.level,Ae=F[Ce+1],Se=this.fragmentTracker.getState(le);if(Se===M.FragmentState.BACKTRACKED){le=null;for(var Re=Ce;F[Re]&&this.fragmentTracker.getState(F[Re])===M.FragmentState.BACKTRACKED;)E?le=F[Re--]:le=F[--Re];le||(le=Ae)}else E&&le.sn===E.sn&&!$&&(be&&(le.sn<I&&this.fragmentTracker.getState(Ae)!==M.FragmentState.OK?(this.log("SN "+le.sn+" just loaded, load next one: "+Ae.sn),le=Ae):le=null))}return le},d.synchronizeToLiveEdge=function(y){var b=this.config,j=this.media;if(!j)return;var B=this.hls.liveSyncPosition,E=j.currentTime,F=y.fragments[0].start,I=y.edge,g=E>=F-b.maxFragLookUpTolerance&&E<=I;if(B!==null&&j.duration>B&&(E<B||!g)){var W=b.liveMaxLatencyDuration!==void 0?b.liveMaxLatencyDuration:b.liveMaxLatencyDurationCount*y.targetduration;(!g&&j.readyState<4||E<I-W)&&(this.loadedmetadata||(this.nextLoadPosition=B),j.readyState&&(this.warn("Playback: "+E.toFixed(3)+" is located too far from the end of live sliding playlist: "+I+", reset currentTime to : "+B.toFixed(3)),j.currentTime=B))}},d.alignPlaylists=function(y,b){var j=this.levels,B=this.levelLastLoaded,E=this.fragPrevious,F=B!==null?j[B]:null,I=y.fragments.length;if(!I)return this.warn("No fragments in live playlist"),0;var g=y.fragments[0].start,W=!b,$=y.alignedSliding&&Object(J.isFiniteNumber)(g);if(W||!$&&!g){Object(p.alignStream)(E,F,y);var le=y.fragments[0].start;return this.log("Live playlist sliding: "+le.toFixed(2)+" start-sn: "+(b?b.startSN:"na")+"->"+y.startSN+" prev-sn: "+(E?E.sn:"na")+" fragments: "+I),le}return g},d.waitForCdnTuneIn=function(y){var b=3;return y.live&&y.canBlockReload&&y.tuneInGoal>Math.max(y.partHoldBack,y.partTarget*b)},d.setStartPosition=function(y,b){var j=this.startPosition;if(j<b&&(j=-1),j===-1||this.lastCurrentTime===-1){var B=y.startTimeOffset;Object(J.isFiniteNumber)(B)?(j=b+B,B<0&&(j+=y.totalduration),j=Math.min(Math.max(b,j),b+y.totalduration),this.log("Start time offset "+B+" found in playlist, adjust startPosition to "+j),this.startPosition=j):y.live?j=this.hls.liveSyncPosition||b:this.startPosition=j=0,this.lastCurrentTime=j}this.nextLoadPosition=j},d.getLoadPosition=function(){var y=this.media,b=0;return this.loadedmetadata&&y?b=y.currentTime:this.nextLoadPosition&&(b=this.nextLoadPosition),b},d.handleFragLoadAborted=function(y,b){this.transmuxer&&y.sn!=="initSegment"&&y.stats.aborted&&(this.warn("Fragment "+y.sn+(b?" part"+b.index:"")+" of level "+y.level+" was aborted"),this.resetFragmentLoading(y))},d.resetFragmentLoading=function(y){(!this.fragCurrent||!this.fragContextChanged(y))&&(this.state=L.IDLE)},d.onFragmentOrKeyLoadError=function(y,b){if(b.fatal)return;var j=b.frag;if(!j||j.type!==y)return;var B=this.fragCurrent;console.assert(B&&j.sn===B.sn&&j.level===B.level&&j.urlId===B.urlId,"Frag load error must match current frag to retry");var E=this.config;if(this.fragLoadError+1<=E.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(j.level))return;var F=Math.min(Math.pow(2,this.fragLoadError)*E.fragLoadingRetryDelay,E.fragLoadingMaxRetryTimeout);this.warn("Fragment "+j.sn+" of "+y+" "+j.level+" failed to load, retrying in "+F+"ms"),this.retryDate=self.performance.now()+F,this.fragLoadError++,this.state=L.FRAG_LOADING_WAITING_RETRY}else b.levelRetry?(y===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=L.IDLE):(G.logger.error(b.details+" reaches max retry, redispatch as fatal ..."),b.fatal=!0,this.hls.stopLoad(),this.state=L.ERROR)},d.afterBufferFlushed=function(y,b,j){if(!y)return;var B=z.BufferHelper.getBuffered(y);this.fragmentTracker.detectEvictedFragments(b,B,j),this.state===L.ENDED&&this.resetLoadingState()},d.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=L.IDLE},d.resetLiveStartWhenNotLoaded=function(y){if(!this.loadedmetadata){this.startFragRequested=!1;var b=this.levels?this.levels[y].details:null;if(b!=null&&b.live)return this.startPosition=-1,this.setStartPosition(b,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},d.updateLevelTiming=function(y,b,j,B){var E=this,F=j.details;console.assert(!!F,"level.details must be defined");var I=Object.keys(y.elementaryStreams).reduce(function(g,W){var $=y.elementaryStreams[W];if($){var le=$.endPTS-$.startPTS;if(le<=0)return E.warn("Could not parse fragment "+y.sn+" "+W+" duration reliably ("+le+") resetting transmuxer to fallback to playlist timing"),E.resetTransmuxer(),g||!1;var de=B?0:Object(u.updateFragPTSDTS)(F,y,$.startPTS,$.endPTS,$.startDTS,$.endDTS);return E.hls.trigger(r.Events.LEVEL_PTS_UPDATED,{details:F,level:j,drift:de,type:W,frag:y,start:$.startPTS,end:$.endPTS}),!0}return g},!1);I?(this.state=L.PARSED,this.hls.trigger(r.Events.FRAG_PARSED,{frag:y,part:b})):this.resetLoadingState()},d.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},S(T,[{key:"state",get:function(){return this._state},set:function(y){var b=this._state;b!==y&&(this._state=y,this.log(b+"->"+y))}}]),T}(H.default)},"./src/controller/buffer-controller.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return h});var J=N("./src/polyfills/number.ts"),H=N("./src/events.ts"),M=N("./src/utils/logger.ts"),z=N("./src/errors.ts"),G=N("./src/utils/buffer-helper.ts"),r=N("./src/utils/mediasource-helper.ts"),O=N("./src/loader/fragment.ts"),v=N("./src/controller/buffer-operation-queue.ts"),m=Object(r.getMediaSource)(),p=/([ha]vc.)(?:\.[^.,]+)+/,h=function(){function u(o){var l=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=l.hls,a=l.media,S=l.mediaSource;M.logger.log("[buffer-controller]: Media source opened"),a&&(l.updateMediaElementDuration(),s.trigger(H.Events.MEDIA_ATTACHED,{media:a})),S&&S.removeEventListener("sourceopen",l._onMediaSourceOpen),l.checkPendingTracks()},this._onMediaSourceClose=function(){M.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){M.logger.log("[buffer-controller]: Media source ended")},this.hls=o,this._initSourceBuffer(),this.registerListeners()}var f=u.prototype;return f.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},f.destroy=function(){this.unregisterListeners(),this.details=null},f.registerListeners=function(){var l=this.hls;l.on(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.on(H.Events.BUFFER_RESET,this.onBufferReset,this),l.on(H.Events.BUFFER_APPENDING,this.onBufferAppending,this),l.on(H.Events.BUFFER_CODECS,this.onBufferCodecs,this),l.on(H.Events.BUFFER_EOS,this.onBufferEos,this),l.on(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),l.on(H.Events.LEVEL_UPDATED,this.onLevelUpdated,this),l.on(H.Events.FRAG_PARSED,this.onFragParsed,this),l.on(H.Events.FRAG_CHANGED,this.onFragChanged,this)},f.unregisterListeners=function(){var l=this.hls;l.off(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.off(H.Events.BUFFER_RESET,this.onBufferReset,this),l.off(H.Events.BUFFER_APPENDING,this.onBufferAppending,this),l.off(H.Events.BUFFER_CODECS,this.onBufferCodecs,this),l.off(H.Events.BUFFER_EOS,this.onBufferEos,this),l.off(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),l.off(H.Events.LEVEL_UPDATED,this.onLevelUpdated,this),l.off(H.Events.FRAG_PARSED,this.onFragParsed,this),l.off(H.Events.FRAG_CHANGED,this.onFragChanged,this)},f._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new v.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},f.onManifestParsed=function(l,s){var a=2;(s.audio&&!s.video||!s.altAudio)&&(a=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=a,this.details=null,M.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},f.onMediaAttaching=function(l,s){var a=this.media=s.media;if(a&&m){var S=this.mediaSource=new m;S.addEventListener("sourceopen",this._onMediaSourceOpen),S.addEventListener("sourceended",this._onMediaSourceEnded),S.addEventListener("sourceclose",this._onMediaSourceClose),a.src=self.URL.createObjectURL(S),this._objectUrl=a.src}},f.onMediaDetaching=function(){var l=this.media,s=this.mediaSource,a=this._objectUrl;if(s){if(M.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(S){M.logger.warn("[buffer-controller]: onMediaDetaching: "+S.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),l&&(a&&self.URL.revokeObjectURL(a),l.src===a?(l.removeAttribute("src"),l.load()):M.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(H.Events.MEDIA_DETACHED,void 0)},f.onBufferReset=function(){var l=this;this.getSourceBufferTypes().forEach(function(s){var a=l.sourceBuffer[s];try{a&&(l.removeBufferListeners(s),l.mediaSource&&l.mediaSource.removeSourceBuffer(a),l.sourceBuffer[s]=void 0)}catch(S){M.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",S)}}),this._initSourceBuffer()},f.onBufferCodecs=function(l,s){var a=this,S=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(x){if(S){var C=a.tracks[x];if(C&&typeof C.buffer.changeType=="function"){var D=s[x],L=D.codec,R=D.levelCodec,A=D.container,T=(C.levelCodec||C.codec).replace(p,"$1"),d=(R||L).replace(p,"$1");if(T!==d){var w=A+";codecs="+(R||L);a.appendChangeType(x,w)}}}else a.pendingTracks[x]=s[x]}),S)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},f.appendChangeType=function(l,s){var a=this,S=this.operationQueue,x={execute:function(){var D=a.sourceBuffer[l];D&&(M.logger.log("[buffer-controller]: changing "+l+" sourceBuffer type to "+s),D.changeType(s)),S.shiftAndExecuteNext(l)},onStart:function(){},onComplete:function(){},onError:function(D){M.logger.warn("[buffer-controller]: Failed to change "+l+" SourceBuffer type",D)}};S.append(x,l)},f.onBufferAppending=function(l,s){var a=this,S=this.hls,x=this.operationQueue,C=this.tracks,D=s.data,L=s.type,R=s.frag,A=s.part,T=s.chunkMeta,d=T.buffering[L],w=self.performance.now();d.start=w;var y=R.stats.buffering,b=A?A.stats.buffering:null;y.start===0&&(y.start=w),b&&b.start===0&&(b.start=w);var j=C.audio,B=L==="audio"&&T.id===1&&(j==null?void 0:j.container)==="audio/mpeg",E={execute:function(){if(d.executeStart=self.performance.now(),B){var I=a.sourceBuffer[L];if(I){var g=R.start-I.timestampOffset;Math.abs(g)>=.1&&(M.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+R.start+" (delta: "+g+") sn: "+R.sn+")"),I.timestampOffset=R.start)}}a.appendExecutor(D,L)},onStart:function(){},onComplete:function(){var I=self.performance.now();d.executeEnd=d.end=I,y.first===0&&(y.first=I),b&&b.first===0&&(b.first=I);var g=a.sourceBuffer,W={};for(var $ in g)W[$]=G.BufferHelper.getBuffered(g[$]);a.appendError=0,a.hls.trigger(H.Events.BUFFER_APPENDED,{type:L,frag:R,part:A,chunkMeta:T,parent:R.type,timeRanges:W})},onError:function(I){M.logger.error("[buffer-controller]: Error encountered while trying to append to the "+L+" SourceBuffer",I);var g={type:z.ErrorTypes.MEDIA_ERROR,parent:R.type,details:z.ErrorDetails.BUFFER_APPEND_ERROR,err:I,fatal:!1};I.code===DOMException.QUOTA_EXCEEDED_ERR?g.details=z.ErrorDetails.BUFFER_FULL_ERROR:(a.appendError++,g.details=z.ErrorDetails.BUFFER_APPEND_ERROR,a.appendError>S.config.appendErrorMaxRetry&&(M.logger.error("[buffer-controller]: Failed "+S.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),g.fatal=!0)),S.trigger(H.Events.ERROR,g)}};x.append(E,L)},f.onBufferFlushing=function(l,s){var a=this,S=this.operationQueue,x=function(D){return{execute:a.removeExecutor.bind(a,D,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){a.hls.trigger(H.Events.BUFFER_FLUSHED,{type:D})},onError:function(R){M.logger.warn("[buffer-controller]: Failed to remove from "+D+" SourceBuffer",R)}}};s.type?S.append(x(s.type),s.type):this.getSourceBufferTypes().forEach(function(C){S.append(x(C),C)})},f.onFragParsed=function(l,s){var a=this,S=s.frag,x=s.part,C=[],D=x?x.elementaryStreams:S.elementaryStreams;D[O.ElementaryStreamTypes.AUDIOVIDEO]?C.push("audiovideo"):(D[O.ElementaryStreamTypes.AUDIO]&&C.push("audio"),D[O.ElementaryStreamTypes.VIDEO]&&C.push("video"));var L=function(){var A=self.performance.now();S.stats.buffering.end=A,x&&(x.stats.buffering.end=A);var T=x?x.stats:S.stats;a.hls.trigger(H.Events.FRAG_BUFFERED,{frag:S,part:x,stats:T,id:S.type})};C.length===0&&M.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+S.type+" level: "+S.level+" sn: "+S.sn),this.blockBuffers(L,C)},f.onFragChanged=function(l,s){this.flushBackBuffer()},f.onBufferEos=function(l,s){var a=this,S=this.getSourceBufferTypes().reduce(function(x,C){var D=a.sourceBuffer[C];return(!s.type||s.type===C)&&(D&&!D.ended&&(D.ended=!0,M.logger.log("[buffer-controller]: "+C+" sourceBuffer now EOS"))),x&&!!(!D||D.ended)},!0);S&&this.blockBuffers(function(){var x=a.mediaSource;if(!x||x.readyState!=="open")return;x.endOfStream()})},f.onLevelUpdated=function(l,s){var a=s.details;if(!a.fragments.length)return;this.details=a,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},f.flushBackBuffer=function(){var l=this.hls,s=this.details,a=this.media,S=this.sourceBuffer;if(!a||s===null)return;var x=this.getSourceBufferTypes();if(!x.length)return;var C=s.live&&l.config.liveBackBufferLength!==null?l.config.liveBackBufferLength:l.config.backBufferLength;if(!Object(J.isFiniteNumber)(C)||C<0)return;var D=a.currentTime,L=s.levelTargetDuration,R=Math.max(C,L),A=Math.floor(D/L)*L-R;x.forEach(function(T){var d=S[T];if(d){var w=G.BufferHelper.getBuffered(d);w.length>0&&A>w.start(0)&&(l.trigger(H.Events.BACK_BUFFER_REACHED,{bufferEnd:A}),s.live&&l.trigger(H.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:A}),l.trigger(H.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:A,type:T}))}})},f.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var l=this.details,s=this.hls,a=this.media,S=this.mediaSource,x=l.fragments[0].start+l.totalduration,C=a.duration,D=Object(J.isFiniteNumber)(S.duration)?S.duration:0;l.live&&s.config.liveDurationInfinity?(M.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),S.duration=Infinity,this.updateSeekableRange(l)):(x>D&&x>C||!Object(J.isFiniteNumber)(C))&&(M.logger.log("[buffer-controller]: Updating Media Source duration to "+x.toFixed(3)),S.duration=x)},f.updateSeekableRange=function(l){var s=this.mediaSource,a=l.fragments,S=a.length;if(S&&l.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var x=Math.max(0,a[0].start),C=Math.max(x,x+l.totalduration);s.setLiveSeekableRange(x,C)}},f.checkPendingTracks=function(){var l=this.bufferCodecEventsExpected,s=this.operationQueue,a=this.pendingTracks,S=Object.keys(a).length;if(S&&!l||S===2){this.createSourceBuffers(a),this.pendingTracks={};var x=this.getSourceBufferTypes();if(x.length===0){this.hls.trigger(H.Events.ERROR,{type:z.ErrorTypes.MEDIA_ERROR,details:z.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}x.forEach(function(C){s.executeNext(C)})}},f.createSourceBuffers=function(l){var s=this.sourceBuffer,a=this.mediaSource;if(!a)throw Error("createSourceBuffers called when mediaSource was null");var S=0;for(var x in l)if(!s[x]){var C=l[x];if(!C)throw Error("source buffer exists for track "+x+", however track does not");var D=C.levelCodec||C.codec,L=C.container+";codecs="+D;M.logger.log("[buffer-controller]: creating sourceBuffer("+L+")");try{var R=s[x]=a.addSourceBuffer(L),A=x;this.addBufferListener(A,"updatestart",this._onSBUpdateStart),this.addBufferListener(A,"updateend",this._onSBUpdateEnd),this.addBufferListener(A,"error",this._onSBUpdateError),this.tracks[x]={buffer:R,codec:D,container:C.container,levelCodec:C.levelCodec,id:C.id},S++}catch(T){M.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+T.message),this.hls.trigger(H.Events.ERROR,{type:z.ErrorTypes.MEDIA_ERROR,details:z.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:T,mimeType:L})}}S&&this.hls.trigger(H.Events.BUFFER_CREATED,{tracks:this.tracks})},f._onSBUpdateStart=function(l){var s=this.operationQueue,a=s.current(l);a.onStart()},f._onSBUpdateEnd=function(l){var s=this.operationQueue,a=s.current(l);a.onComplete(),s.shiftAndExecuteNext(l)},f._onSBUpdateError=function(l,s){M.logger.error("[buffer-controller]: "+l+" SourceBuffer error",s),this.hls.trigger(H.Events.ERROR,{type:z.ErrorTypes.MEDIA_ERROR,details:z.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var a=this.operationQueue.current(l);a&&a.onError(s)},f.removeExecutor=function(l,s,a){var S=this.media,x=this.mediaSource,C=this.operationQueue,D=this.sourceBuffer,L=D[l];if(!S||!x||!L){M.logger.warn("[buffer-controller]: Attempting to remove from the "+l+" SourceBuffer, but it does not exist"),C.shiftAndExecuteNext(l);return}var R=Object(J.isFiniteNumber)(S.duration)?S.duration:Infinity,A=Object(J.isFiniteNumber)(x.duration)?x.duration:Infinity,T=Math.max(0,s),d=Math.min(a,R,A);d>T?(M.logger.log("[buffer-controller]: Removing ["+T+","+d+"] from the "+l+" SourceBuffer"),console.assert(!L.updating,l+" sourceBuffer must not be updating"),L.remove(T,d)):C.shiftAndExecuteNext(l)},f.appendExecutor=function(l,s){var a=this.operationQueue,S=this.sourceBuffer,x=S[s];if(!x){M.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),a.shiftAndExecuteNext(s);return}x.ended=!1,console.assert(!x.updating,s+" sourceBuffer must not be updating"),x.appendBuffer(l)},f.blockBuffers=function(l,s){var a=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){M.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(l);return}var S=this.operationQueue,x=s.map(function(C){return S.appendBlocker(C)});Promise.all(x).then(function(){l(),s.forEach(function(C){var D=a.sourceBuffer[C];(!D||!D.updating)&&S.shiftAndExecuteNext(C)})})},f.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},f.addBufferListener=function(l,s,a){var S=this.sourceBuffer[l];if(!S)return;var x=a.bind(this,l);this.listeners[l].push({event:s,listener:x}),S.addEventListener(s,x)},f.removeBufferListeners=function(l){var s=this.sourceBuffer[l];if(!s)return;this.listeners[l].forEach(function(a){s.removeEventListener(a.event,a.listener)})},u}()},"./src/controller/buffer-operation-queue.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return H});var J=N("./src/utils/logger.ts"),H=function(){function M(G){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=G}var z=M.prototype;return z.append=function(r,O){var v=this.queues[O];v.push(r),v.length===1&&this.buffers[O]&&this.executeNext(O)},z.insertAbort=function(r,O){var v=this.queues[O];v.unshift(r),this.executeNext(O)},z.appendBlocker=function(r){var O,v=new Promise(function(p){O=p}),m={execute:O,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(m,r),v},z.executeNext=function(r){var O=this.buffers,v=this.queues,m=O[r],p=v[r];if(p.length){var h=p[0];try{h.execute()}catch(u){J.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),h.onError(u),(!m||!m.updating)&&(p.shift(),this.executeNext(r))}}},z.shiftAndExecuteNext=function(r){this.queues[r].shift(),this.executeNext(r)},z.current=function(r){return this.queues[r][0]},M}()},"./src/controller/cap-level-controller.ts":function(oe,Y,N){"use strict";N.r(Y);var J=N("./src/events.ts");function H(G,r){for(var O=0;O<r.length;O++){var v=r[O];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(G,v.key,v)}}function M(G,r,O){return r&&H(G.prototype,r),O&&H(G,O),G}var z=function(){function G(O){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=O,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var r=G.prototype;return r.setStreamController=function(v){this.streamController=v},r.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},r.registerListeners=function(){var v=this.hls;v.on(J.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),v.on(J.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),v.on(J.Events.MANIFEST_PARSED,this.onManifestParsed,this),v.on(J.Events.BUFFER_CODECS,this.onBufferCodecs,this),v.on(J.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},r.unregisterListener=function(){var v=this.hls;v.off(J.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),v.off(J.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),v.off(J.Events.MANIFEST_PARSED,this.onManifestParsed,this),v.off(J.Events.BUFFER_CODECS,this.onBufferCodecs,this),v.off(J.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},r.onFpsDropLevelCapping=function(v,m){G.isLevelAllowed(m.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(m.droppedLevel)},r.onMediaAttaching=function(v,m){this.media=m.media instanceof HTMLVideoElement?m.media:null},r.onManifestParsed=function(v,m){var p=this.hls;this.restrictedLevels=[],this.firstLevel=m.firstLevel,p.config.capLevelToPlayerSize&&m.video&&this.startCapping()},r.onBufferCodecs=function(v,m){var p=this.hls;p.config.capLevelToPlayerSize&&m.video&&this.startCapping()},r.onMediaDetaching=function(){this.stopCapping()},r.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var v=this.hls.levels;if(v.length){var m=this.hls;m.autoLevelCapping=this.getMaxLevel(v.length-1),m.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=m.autoLevelCapping}}},r.getMaxLevel=function(v){var m=this,p=this.hls.levels;if(!p.length)return-1;var h=p.filter(function(u,f){return G.isLevelAllowed(f,m.restrictedLevels)&&f<=v});return this.clientRect=null,G.getMaxLevelByMediaSize(h,this.mediaWidth,this.mediaHeight)},r.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()},r.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},r.getDimensions=function(){if(this.clientRect)return this.clientRect;var v=this.media,m={width:0,height:0};if(v){var p=v.getBoundingClientRect();m.width=p.width,m.height=p.height,!m.width&&!m.height&&(m.width=p.right-p.left||v.width||0,m.height=p.bottom-p.top||v.height||0)}return this.clientRect=m,m},G.isLevelAllowed=function(v,m){return m===void 0&&(m=[]),m.indexOf(v)===-1},G.getMaxLevelByMediaSize=function(v,m,p){if(!v||!v.length)return-1;for(var h=function(s,a){return a?s.width!==a.width||s.height!==a.height:!0},u=v.length-1,f=0;f<v.length;f+=1){var o=v[f];if((o.width>=m||o.height>=p)&&h(o,v[f+1])){u=f;break}}return u},M(G,[{key:"mediaWidth",get:function(){return this.getDimensions().width*G.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*G.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var v=1;try{v=self.devicePixelRatio}catch(m){}return v}}]),G}();Y.default=z},"./src/controller/cmcd-controller.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return h});var J=N("./src/events.ts"),H=N("./src/types/cmcd.ts"),M=N("./src/utils/buffer-helper.ts"),z=N("./src/utils/logger.ts");function G(u,f){for(var o=0;o<f.length;o++){var l=f[o];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(u,l.key,l)}}function r(u,f,o){return f&&G(u.prototype,f),o&&G(u,o),u}function O(u,f){var o=typeof Symbol!="undefined"&&u[Symbol.iterator]||u["@@iterator"];if(o)return(o=o.call(u)).next.bind(o);if(Array.isArray(u)||(o=v(u))||f&&u&&typeof u.length=="number"){o&&(u=o);var l=0;return function(){return l>=u.length?{done:!0}:{done:!1,value:u[l++]}}}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 v(u,f){if(!u)return;if(typeof u=="string")return m(u,f);var o=Object.prototype.toString.call(u).slice(8,-1);if(o==="Object"&&u.constructor&&(o=u.constructor.name),o==="Map"||o==="Set")return Array.from(u);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return m(u,f)}function m(u,f){(f==null||f>u.length)&&(f=u.length);for(var o=0,l=new Array(f);o<f;o++)l[o]=u[o];return l}function p(){return p=Object.assign||function(u){for(var f=1;f<arguments.length;f++){var o=arguments[f];for(var l in o)Object.prototype.hasOwnProperty.call(o,l)&&(u[l]=o[l])}return u},p.apply(this,arguments)}var h=function(){function u(o){var l=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(){l.initialized&&(l.starved=!0),l.buffering=!0},this.onPlaying=function(){l.initialized||(l.initialized=!0),l.buffering=!1},this.applyPlaylistData=function(S){try{l.apply(S,{ot:H.CMCDObjectType.MANIFEST,su:!l.initialized})}catch(x){z.logger.warn("Could not generate manifest CMCD data.",x)}},this.applyFragmentData=function(S){try{var x=S.frag,C=l.hls.levels[x.level],D=l.getObjectType(x),L={d:x.duration*1e3,ot:D};(D===H.CMCDObjectType.VIDEO||D===H.CMCDObjectType.AUDIO||D==H.CMCDObjectType.MUXED)&&(L.br=C.bitrate/1e3,L.tb=l.getTopBandwidth(D),L.bl=l.getBufferLength(D)),l.apply(S,L)}catch(R){z.logger.warn("Could not generate segment CMCD data.",R)}},this.hls=o;var s=this.config=o.config,a=s.cmcd;a!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=a.sessionId||u.uuid(),this.cid=a.contentId,this.useHeaders=a.useHeaders===!0,this.registerListeners())}var f=u.prototype;return f.registerListeners=function(){var l=this.hls;l.on(J.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.on(J.Events.MEDIA_DETACHED,this.onMediaDetached,this),l.on(J.Events.BUFFER_CREATED,this.onBufferCreated,this)},f.unregisterListeners=function(){var l=this.hls;l.off(J.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.off(J.Events.MEDIA_DETACHED,this.onMediaDetached,this),l.off(J.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},f.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},f.onMediaAttached=function(l,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},f.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},f.onBufferCreated=function(l,s){var a,S;this.audioBuffer=(a=s.tracks.audio)===null||a===void 0?void 0:a.buffer,this.videoBuffer=(S=s.tracks.video)===null||S===void 0?void 0:S.buffer},f.createData=function(){var l;return{v:H.CMCDVersion,sf:H.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(l=this.media)===null||l===void 0?void 0:l.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},f.apply=function(l,s){s===void 0&&(s={}),p(s,this.createData());var a=s.ot===H.CMCDObjectType.INIT||s.ot===H.CMCDObjectType.VIDEO||s.ot===H.CMCDObjectType.MUXED;if(this.starved&&a&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var S=u.toHeaders(s);if(!Object.keys(S).length)return;l.headers||(l.headers={}),p(l.headers,S)}else{var x=u.toQuery(s);if(!x)return;l.url=u.appendQueryToUri(l.url,x)}},f.getObjectType=function(l){var s=l.type;return s==="subtitle"?H.CMCDObjectType.TIMED_TEXT:l.sn==="initSegment"?H.CMCDObjectType.INIT:s==="audio"?H.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?H.CMCDObjectType.VIDEO:H.CMCDObjectType.MUXED:void 0},f.getTopBandwidth=function(l){for(var s=0,a=l===H.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,S=O(a),x;!(x=S()).done;){var C=x.value;C.bitrate>s&&(s=C.bitrate)}return s>0?s:NaN},f.getBufferLength=function(l){var s=this.hls.media,a=l===H.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!a||!s)return NaN;var S=M.BufferHelper.bufferInfo(a,s.currentTime,this.config.maxBufferHole);return S.len*1e3},f.createPlaylistLoader=function(){var l=this.config.pLoader,s=this.applyPlaylistData,a=l||this.config.loader;return function(){function S(C){this.loader=void 0,this.loader=new a(C)}var x=S.prototype;return x.destroy=function(){this.loader.destroy()},x.abort=function(){this.loader.abort()},x.load=function(D,L,R){s(D),this.loader.load(D,L,R)},r(S,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),S}()},f.createFragmentLoader=function(){var l=this.config.fLoader,s=this.applyFragmentData,a=l||this.config.loader;return function(){function S(C){this.loader=void 0,this.loader=new a(C)}var x=S.prototype;return x.destroy=function(){this.loader.destroy()},x.abort=function(){this.loader.abort()},x.load=function(D,L,R){s(D),this.loader.load(D,L,R)},r(S,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),S}()},u.uuid=function(){var l=URL.createObjectURL(new Blob),s=l.toString();return URL.revokeObjectURL(l),s.substr(s.lastIndexOf("/")+1)},u.serialize=function(l){for(var s=[],a=function(B){return!Number.isNaN(B)&&B!=null&&B!==""&&B!==!1},S=function(B){return Math.round(B)},x=function(B){return S(B/100)*100},C=function(B){return encodeURIComponent(B)},D={br:S,d:S,bl:x,dl:x,mtp:x,nor:C,rtp:x,tb:S},L=Object.keys(l||{}).sort(),R=O(L),A;!(A=R()).done;){var T=A.value,d=l[T];if(!a(d))continue;if(T==="v"&&d===1)continue;if(T=="pr"&&d===1)continue;var w=D[T];w&&(d=w(d));var y=typeof d,b=void 0;T==="ot"||T==="sf"||T==="st"?b=T+"="+d:y==="boolean"?b=T:y==="number"?b=T+"="+d:b=T+"="+JSON.stringify(d),s.push(b)}return s.join(",")},u.toHeaders=function(l){for(var s=Object.keys(l),a={},S=["Object","Request","Session","Status"],x=[{},{},{},{}],C={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},D=0,L=s;D<L.length;D++){var R=L[D],A=C[R]!=null?C[R]:1;x[A][R]=l[R]}for(var T=0;T<x.length;T++){var d=u.serialize(x[T]);d&&(a["CMCD-"+S[T]]=d)}return a},u.toQuery=function(l){return"CMCD="+encodeURIComponent(u.serialize(l))},u.appendQueryToUri=function(l,s){if(!s)return l;var a=l.includes("?")?"&":"?";return""+l+a+s},u}()},"./src/controller/eme-controller.ts":function(oe,Y,N){"use strict";N.r(Y);var J=N("./src/events.ts"),H=N("./src/errors.ts"),M=N("./src/utils/logger.ts"),z=N("./src/utils/mediakeys-helper.ts");function G(h,u){for(var f=0;f<u.length;f++){var o=u[f];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(h,o.key,o)}}function r(h,u,f){return u&&G(h.prototype,u),f&&G(h,f),h}var O=3,v=function(u,f,o){var l={audioCapabilities:[],videoCapabilities:[]};return u.forEach(function(s){l.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:o.audioRobustness||""})}),f.forEach(function(s){l.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:o.videoRobustness||""})}),[l]},m=function(u,f,o,l){switch(u){case z.KeySystems.WIDEVINE:return v(f,o,l);default:throw new Error("Unknown key-system: "+u)}},p=function(){function h(f){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=f,this._config=f.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 u=h.prototype;return u.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},u._registerListeners=function(){this.hls.on(J.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(J.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(J.Events.MANIFEST_PARSED,this.onManifestParsed,this)},u._unregisterListeners=function(){this.hls.off(J.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(J.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(J.Events.MANIFEST_PARSED,this.onManifestParsed,this)},u.getLicenseServerUrl=function(o){switch(o){case z.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+o+'"')},u._attemptKeySystemAccess=function(o,l,s){var a=this,S=m(o,l,s,this._drmSystemOptions);M.logger.log("Requesting encrypted media key-system access");var x=this.requestMediaKeySystemAccess(o,S);this.mediaKeysPromise=x.then(function(C){return a._onMediaKeySystemAccessObtained(o,C)}),x.catch(function(C){M.logger.error('Failed to obtain key-system "'+o+'" access:',C)})},u._onMediaKeySystemAccessObtained=function(o,l){var s=this;M.logger.log('Access for key-system "'+o+'" obtained');var a={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:l,mediaKeySystemDomain:o};this._mediaKeysList.push(a);var S=Promise.resolve().then(function(){return l.createMediaKeys()}).then(function(x){return a.mediaKeys=x,M.logger.log('Media-keys created for key-system "'+o+'"'),s._onMediaKeysCreated(),x});return S.catch(function(x){M.logger.error("Failed to create media-keys:",x)}),S},u._onMediaKeysCreated=function(){var o=this;this._mediaKeysList.forEach(function(l){l.mediaKeysSession||(l.mediaKeysSession=l.mediaKeys.createSession(),o._onNewMediaKeySession(l.mediaKeysSession))})},u._onNewMediaKeySession=function(o){var l=this;M.logger.log("New key-system session "+o.sessionId),o.addEventListener("message",function(s){l._onKeySessionMessage(o,s.message)},!1)},u._onKeySessionMessage=function(o,l){M.logger.log("Got EME message event, creating license request"),this._requestLicense(l,function(s){M.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),o.update(s)})},u.onMediaEncrypted=function(o){var l=this;if(M.logger.log('Media is encrypted using "'+o.initDataType+'" init data type'),!this.mediaKeysPromise){M.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(J.Events.ERROR,{type:H.ErrorTypes.KEY_SYSTEM_ERROR,details:H.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(S){if(!l._media)return;l._attemptSetMediaKeys(S),l._generateRequestWithPreferredKeySession(o.initDataType,o.initData)};this.mediaKeysPromise.then(s).catch(s)},u._attemptSetMediaKeys=function(o){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var l=this._mediaKeysList[0];if(!l||!l.mediaKeys){M.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(J.Events.ERROR,{type:H.ErrorTypes.KEY_SYSTEM_ERROR,details:H.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}M.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(l.mediaKeys),this._hasSetMediaKeys=!0}},u._generateRequestWithPreferredKeySession=function(o,l){var s=this,a=this._mediaKeysList[0];if(!a){M.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(J.Events.ERROR,{type:H.ErrorTypes.KEY_SYSTEM_ERROR,details:H.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(a.mediaKeysSessionInitialized){M.logger.warn("Key-Session already initialized but requested again");return}var S=a.mediaKeysSession;if(!S){M.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(J.Events.ERROR,{type:H.ErrorTypes.KEY_SYSTEM_ERROR,details:H.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!l){M.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(J.Events.ERROR,{type:H.ErrorTypes.KEY_SYSTEM_ERROR,details:H.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}M.logger.log('Generating key-session request for "'+o+'" init data type'),a.mediaKeysSessionInitialized=!0,S.generateRequest(o,l).then(function(){M.logger.debug("Key-session generation succeeded")}).catch(function(x){M.logger.error("Error generating key-session request:",x),s.hls.trigger(J.Events.ERROR,{type:H.ErrorTypes.KEY_SYSTEM_ERROR,details:H.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},u._createLicenseXhr=function(o,l,s){var a=new XMLHttpRequest;a.responseType="arraybuffer",a.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,a,o,l,s);var S=this._licenseXhrSetup;if(S)try{S.call(this.hls,a,o),S=void 0}catch(x){M.logger.error(x)}try{a.readyState||a.open("POST",o,!0),S&&S.call(this.hls,a,o)}catch(x){throw new Error("issue setting up KeySystem license XHR "+x)}return a},u._onLicenseRequestReadyStageChange=function(o,l,s,a){switch(o.readyState){case 4:if(o.status===200){this._requestLicenseFailureCount=0,M.logger.log("License request succeeded");var S=o.response,x=this._licenseResponseCallback;if(x)try{S=x.call(this.hls,o,l)}catch(D){M.logger.error(D)}a(S)}else{if(M.logger.error("License Request XHR failed ("+l+"). Status: "+o.status+" ("+o.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>O){this.hls.trigger(J.Events.ERROR,{type:H.ErrorTypes.KEY_SYSTEM_ERROR,details:H.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var C=O-this._requestLicenseFailureCount+1;M.logger.warn("Retrying license request, "+C+" attempts left"),this._requestLicense(s,a)}break}},u._generateLicenseRequestChallenge=function(o,l){switch(o.mediaKeySystemDomain){case z.KeySystems.WIDEVINE:return l}throw new Error("unsupported key-system: "+o.mediaKeySystemDomain)},u._requestLicense=function(o,l){M.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){M.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(J.Events.ERROR,{type:H.ErrorTypes.KEY_SYSTEM_ERROR,details:H.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var a=this.getLicenseServerUrl(s.mediaKeySystemDomain),S=this._createLicenseXhr(a,o,l);M.logger.log("Sending license request to URL: "+a);var x=this._generateLicenseRequestChallenge(s,o);S.send(x)}catch(C){M.logger.error("Failure requesting DRM license: "+C),this.hls.trigger(J.Events.ERROR,{type:H.ErrorTypes.KEY_SYSTEM_ERROR,details:H.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},u.onMediaAttached=function(o,l){if(!this._emeEnabled)return;var s=l.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},u.onMediaDetached=function(){var o=this._media,l=this._mediaKeysList;if(!o)return;o.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(l.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return o.setMediaKeys(null)}).catch(function(){})},u.onManifestParsed=function(o,l){if(!this._emeEnabled)return;var s=l.levels.map(function(S){return S.audioCodec}).filter(function(S){return!!S}),a=l.levels.map(function(S){return S.videoCodec}).filter(function(S){return!!S});this._attemptKeySystemAccess(z.KeySystems.WIDEVINE,s,a)},r(h,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),h}();Y.default=p},"./src/controller/fps-controller.ts":function(oe,Y,N){"use strict";N.r(Y);var J=N("./src/events.ts"),H=N("./src/utils/logger.ts"),M=function(){function z(r){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=r,this.registerListeners()}var G=z.prototype;return G.setStreamController=function(O){this.streamController=O},G.registerListeners=function(){this.hls.on(J.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},G.unregisterListeners=function(){this.hls.off(J.Events.MEDIA_ATTACHING,this.onMediaAttaching)},G.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},G.onMediaAttaching=function(O,v){var m=this.hls.config;if(m.capLevelOnFPSDrop){var p=v.media instanceof self.HTMLVideoElement?v.media:null;this.media=p,p&&typeof p.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),m.fpsDroppedMonitoringPeriod)}},G.checkFPS=function(O,v,m){var p=performance.now();if(v){if(this.lastTime){var h=p-this.lastTime,u=m-this.lastDroppedFrames,f=v-this.lastDecodedFrames,o=1e3*u/h,l=this.hls;if(l.trigger(J.Events.FPS_DROP,{currentDropped:u,currentDecoded:f,totalDroppedFrames:m}),o>0&&u>l.config.fpsDroppedMonitoringThreshold*f){var s=l.currentLevel;H.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(l.autoLevelCapping===-1||l.autoLevelCapping>=s)&&(s=s-1,l.trigger(J.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:l.currentLevel}),l.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=p,this.lastDroppedFrames=m,this.lastDecodedFrames=v}},G.checkFPSInterval=function(){var O=this.media;if(O)if(this.isVideoPlaybackQualityAvailable){var v=O.getVideoPlaybackQuality();this.checkFPS(O,v.totalVideoFrames,v.droppedVideoFrames)}else this.checkFPS(O,O.webkitDecodedFrameCount,O.webkitDroppedFrameCount)},z}();Y.default=M},"./src/controller/fragment-finders.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"findFragmentByPDT",function(){return M}),N.d(Y,"findFragmentByPTS",function(){return z}),N.d(Y,"fragmentWithinToleranceTest",function(){return G}),N.d(Y,"pdtWithinToleranceTest",function(){return r}),N.d(Y,"findFragWithCC",function(){return O});var J=N("./src/polyfills/number.ts"),H=N("./src/utils/binary-search.ts");function M(v,m,p){if(m===null||!Array.isArray(v)||!v.length||!Object(J.isFiniteNumber)(m))return null;var h=v[0].programDateTime;if(m<(h||0))return null;var u=v[v.length-1].endProgramDateTime;if(m>=(u||0))return null;p=p||0;for(var f=0;f<v.length;++f){var o=v[f];if(r(m,p,o))return o}return null}function z(v,m,p,h){p===void 0&&(p=0),h===void 0&&(h=0);var u=null;if(v?u=m[v.sn-m[0].sn+1]||null:p===0&&m[0].start===0&&(u=m[0]),u&&G(p,h,u)===0)return u;var f=H.default.search(m,G.bind(null,p,h));return f||u}function G(v,m,p){v===void 0&&(v=0),m===void 0&&(m=0);var h=Math.min(m,p.duration+(p.deltaPTS?p.deltaPTS:0));return p.start+p.duration-h<=v?1:p.start-h>v&&p.start?-1:0}function r(v,m,p){var h=Math.min(m,p.duration+(p.deltaPTS?p.deltaPTS:0))*1e3,u=p.endProgramDateTime||0;return u-h>v}function O(v,m){return H.default.search(v,function(p){return p.cc<m?1:p.cc>m?-1:0})}},"./src/controller/fragment-tracker.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"FragmentState",function(){return M}),N.d(Y,"FragmentTracker",function(){return z});var J=N("./src/events.ts"),H=N("./src/types/loader.ts"),M;(function(O){O.NOT_LOADED="NOT_LOADED",O.BACKTRACKED="BACKTRACKED",O.APPENDING="APPENDING",O.PARTIAL="PARTIAL",O.OK="OK"})(M||(M={}));var z=function(){function O(m){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=m,this._registerListeners()}var v=O.prototype;return v._registerListeners=function(){var p=this.hls;p.on(J.Events.BUFFER_APPENDED,this.onBufferAppended,this),p.on(J.Events.FRAG_BUFFERED,this.onFragBuffered,this),p.on(J.Events.FRAG_LOADED,this.onFragLoaded,this)},v._unregisterListeners=function(){var p=this.hls;p.off(J.Events.BUFFER_APPENDED,this.onBufferAppended,this),p.off(J.Events.FRAG_BUFFERED,this.onFragBuffered,this),p.off(J.Events.FRAG_LOADED,this.onFragLoaded,this)},v.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},v.getAppendedFrag=function(p,h){if(h===H.PlaylistLevelType.MAIN){var u=this.activeFragment,f=this.activeParts;if(!u)return null;if(f)for(var o=f.length;o--;){var l=f[o],s=l?l.end:u.appendedPTS;if(l.start<=p&&s!==void 0&&p<=s)return o>9&&(this.activeParts=f.slice(o-9)),l}else if(u.start<=p&&u.appendedPTS!==void 0&&p<=u.appendedPTS)return u}return this.getBufferedFrag(p,h)},v.getBufferedFrag=function(p,h){for(var u=this.fragments,f=Object.keys(u),o=f.length;o--;){var l=u[f[o]];if((l==null?void 0:l.body.type)===h&&l.buffered){var s=l.body;if(s.start<=p&&p<=s.end)return s}}return null},v.detectEvictedFragments=function(p,h,u){var f=this;Object.keys(this.fragments).forEach(function(o){var l=f.fragments[o];if(!l)return;if(!l.buffered){l.body.type===u&&f.removeFragment(l.body);return}var s=l.range[p];if(!s)return;s.time.some(function(a){var S=!f.isTimeBuffered(a.startPTS,a.endPTS,h);return S&&f.removeFragment(l.body),S})})},v.detectPartialFragments=function(p){var h=this,u=this.timeRanges,f=p.frag,o=p.part;if(!u||f.sn==="initSegment")return;var l=r(f),s=this.fragments[l];if(!s)return;Object.keys(u).forEach(function(a){var S=f.elementaryStreams[a];if(!S)return;var x=u[a],C=o!==null||S.partial===!0;s.range[a]=h.getBufferedTimes(f,o,C,x)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},v.fragBuffered=function(p){var h=r(p),u=this.fragments[h];u&&(u.backtrack=u.loaded=null,u.buffered=!0)},v.getBufferedTimes=function(p,h,u,f){for(var o={time:[],partial:u},l=h?h.start:p.start,s=h?h.end:p.end,a=p.minEndPTS||s,S=p.maxStartPTS||l,x=0;x<f.length;x++){var C=f.start(x)-this.bufferPadding,D=f.end(x)+this.bufferPadding;if(S>=C&&a<=D){o.time.push({startPTS:Math.max(l,f.start(x)),endPTS:Math.min(s,f.end(x))});break}else if(l<D&&s>C)o.partial=!0,o.time.push({startPTS:Math.max(l,f.start(x)),endPTS:Math.min(s,f.end(x))});else if(s<=C)break}return o},v.getPartialFragment=function(p){var h=null,u,f,o,l=0,s=this.bufferPadding,a=this.fragments;return Object.keys(a).forEach(function(S){var x=a[S];if(!x)return;G(x)&&(f=x.body.start-s,o=x.body.end+s,p>=f&&p<=o&&(u=Math.min(p-f,o-p),l<=u&&(h=x.body,l=u)))}),h},v.getState=function(p){var h=r(p),u=this.fragments[h];return u?u.buffered?G(u)?M.PARTIAL:M.OK:u.backtrack?M.BACKTRACKED:M.APPENDING:M.NOT_LOADED},v.backtrack=function(p,h){var u=r(p),f=this.fragments[u];if(!f||f.backtrack)return null;var o=f.backtrack=h||f.loaded;return f.loaded=null,o},v.getBacktrackData=function(p){var h=r(p),u=this.fragments[h];if(u){var f,o=u.backtrack;if(o!=null&&(f=o.payload)!==null&&f!==void 0&&f.byteLength)return o;this.removeFragment(p)}return null},v.isTimeBuffered=function(p,h,u){for(var f,o,l=0;l<u.length;l++){if(f=u.start(l)-this.bufferPadding,o=u.end(l)+this.bufferPadding,p>=f&&h<=o)return!0;if(h<=f)return!1}return!1},v.onFragLoaded=function(p,h){var u=h.frag,f=h.part;if(u.sn==="initSegment"||u.bitrateTest||f)return;var o=r(u);this.fragments[o]={body:u,loaded:h,backtrack:null,buffered:!1,range:Object.create(null)}},v.onBufferAppended=function(p,h){var u=this,f=h.frag,o=h.part,l=h.timeRanges;if(f.type===H.PlaylistLevelType.MAIN)if(this.activeFragment=f,o){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(o)}else this.activeParts=null;this.timeRanges=l,Object.keys(l).forEach(function(a){var S=l[a];if(u.detectEvictedFragments(a,S),!o)for(var x=0;x<S.length;x++)f.appendedPTS=Math.max(S.end(x),f.appendedPTS||0)})},v.onFragBuffered=function(p,h){this.detectPartialFragments(h)},v.hasFragment=function(p){var h=r(p);return!!this.fragments[h]},v.removeFragmentsInRange=function(p,h,u){var f=this;Object.keys(this.fragments).forEach(function(o){var l=f.fragments[o];if(!l)return;if(l.buffered){var s=l.body;s.type===u&&s.start<h&&s.end>p&&f.removeFragment(s)}})},v.removeFragment=function(p){var h=r(p);p.stats.loaded=0,p.clearElementaryStreamInfo(),delete this.fragments[h]},v.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},O}();function G(O){var v,m;return O.buffered&&(((v=O.range.video)===null||v===void 0?void 0:v.partial)||((m=O.range.audio)===null||m===void 0?void 0:m.partial))}function r(O){return O.type+"_"+O.level+"_"+O.urlId+"_"+O.sn}},"./src/controller/gap-controller.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"STALL_MINIMUM_DURATION_MS",function(){return G}),N.d(Y,"MAX_START_GAP_JUMP",function(){return r}),N.d(Y,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return O}),N.d(Y,"SKIP_BUFFER_RANGE_START",function(){return v}),N.d(Y,"default",function(){return m});var J=N("./src/utils/buffer-helper.ts"),H=N("./src/errors.ts"),M=N("./src/events.ts"),z=N("./src/utils/logger.ts"),G=250,r=2,O=.1,v=.05,m=function(){function p(u,f,o,l){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=u,this.media=f,this.fragmentTracker=o,this.hls=l}var h=p.prototype;return h.destroy=function(){this.hls=this.fragmentTracker=this.media=null},h.poll=function(f){var o=this.config,l=this.media,s=this.stalled,a=l.currentTime,S=l.seeking,x=this.seeking&&!S,C=!this.seeking&&S;if(this.seeking=S,a!==f){if(this.moved=!0,s!==null){if(this.stallReported){var D=self.performance.now()-s;z.logger.warn("playback not stuck anymore @"+a+", after "+Math.round(D)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((C||x)&&(this.stalled=null),l.paused||l.ended||l.playbackRate===0||!J.BufferHelper.getBuffered(l).length)return;var L=J.BufferHelper.bufferInfo(l,a,0),R=L.len>0,A=L.nextStart||0;if(!R&&!A)return;if(S){var T=L.len>r,d=!A||A-a>r&&!this.fragmentTracker.getPartialFragment(a);if(T||d)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var w,y=Math.max(A,L.start||0)-a,b=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,j=b==null||((w=b.details)===null||w===void 0)?void 0:w.live,B=j?b.details.targetduration*2:r;if(y>0&&y<=B){this._trySkipBufferHole(null);return}}var E=self.performance.now();if(s===null){this.stalled=E;return}var F=E-s;!S&&F>=G&&this._reportStall(L.len);var I=J.BufferHelper.bufferInfo(l,a,o.maxBufferHole);this._tryFixBufferStall(I,F)},h._tryFixBufferStall=function(f,o){var l=this.config,s=this.fragmentTracker,a=this.media,S=a.currentTime,x=s.getPartialFragment(S);if(x){var C=this._trySkipBufferHole(x);if(C)return}f.len>l.maxBufferHole&&o>l.highBufferWatchdogPeriod*1e3&&(z.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},h._reportStall=function(f){var o=this.hls,l=this.media,s=this.stallReported;s||(this.stallReported=!0,z.logger.warn("Playback stalling at @"+l.currentTime+" due to low buffer (buffer="+f+")"),o.trigger(M.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:f}))},h._trySkipBufferHole=function(f){for(var o=this.config,l=this.hls,s=this.media,a=s.currentTime,S=0,x=J.BufferHelper.getBuffered(s),C=0;C<x.length;C++){var D=x.start(C);if(a+o.maxBufferHole>=S&&a<D){var L=Math.max(D+v,s.currentTime+O);return z.logger.warn("skipping hole, adjusting currentTime from "+a+" to "+L),this.moved=!0,this.stalled=null,s.currentTime=L,f&&l.trigger(M.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+a+" to "+L,frag:f}),L}S=x.end(C)}return 0},h._tryNudgeBuffer=function(){var f=this.config,o=this.hls,l=this.media,s=l.currentTime,a=(this.nudgeRetry||0)+1;if(this.nudgeRetry=a,a<f.nudgeMaxRetry){var S=s+a*f.nudgeOffset;z.logger.warn("Nudging 'currentTime' from "+s+" to "+S),l.currentTime=S,o.trigger(M.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else z.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+f.nudgeMaxRetry+" nudges"),o.trigger(M.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},p}()},"./src/controller/id3-track-controller.ts":function(oe,Y,N){"use strict";N.r(Y);var J=N("./src/events.ts"),H=N("./src/utils/texttrack-utils.ts"),M=N("./src/demux/id3.ts"),z=.25,G=function(){function r(v){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=v,this._registerListeners()}var O=r.prototype;return O.destroy=function(){this._unregisterListeners()},O._registerListeners=function(){var m=this.hls;m.on(J.Events.MEDIA_ATTACHED,this.onMediaAttached,this),m.on(J.Events.MEDIA_DETACHING,this.onMediaDetaching,this),m.on(J.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),m.on(J.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},O._unregisterListeners=function(){var m=this.hls;m.off(J.Events.MEDIA_ATTACHED,this.onMediaAttached,this),m.off(J.Events.MEDIA_DETACHING,this.onMediaDetaching,this),m.off(J.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),m.off(J.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},O.onMediaAttached=function(m,p){this.media=p.media},O.onMediaDetaching=function(){if(!this.id3Track)return;Object(H.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},O.getID3Track=function(m){if(!this.media)return;for(var p=0;p<m.length;p++){var h=m[p];if(h.kind==="metadata"&&h.label==="id3")return Object(H.sendAddTrackEvent)(h,this.media),h}return this.media.addTextTrack("metadata","id3")},O.onFragParsingMetadata=function(m,p){if(!this.media)return;var h=p.frag,u=p.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var f=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,o=0;o<u.length;o++){var l=M.getID3Frames(u[o].data);if(l){var s=u[o].pts,a=o<u.length-1?u[o+1].pts:h.end,S=a-s;S<=0&&(a=s+z);for(var x=0;x<l.length;x++){var C=l[x];if(!M.isTimeStampFrame(C)){var D=new f(s,a,"");D.value=C,this.id3Track.addCue(D)}}}}},O.onBufferFlushing=function(m,p){var h=p.startOffset,u=p.endOffset,f=p.type;if(!f||f==="audio"){var o=this.id3Track;o&&Object(H.removeCuesInRange)(o,h,u)}},r}();Y.default=G},"./src/controller/latency-controller.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return r});var J=N("./src/errors.ts"),H=N("./src/events.ts"),M=N("./src/utils/logger.ts");function z(O,v){for(var m=0;m<v.length;m++){var p=v[m];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(O,p.key,p)}}function G(O,v,m){return v&&z(O.prototype,v),m&&z(O,m),O}var r=function(){function O(m){var p=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 p.timeupdate()},this.hls=m,this.config=m.config,this.registerListeners()}var v=O.prototype;return v.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},v.registerListeners=function(){this.hls.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(H.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(H.Events.ERROR,this.onError,this)},v.unregisterListeners=function(){this.hls.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(H.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(H.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(H.Events.ERROR,this.onError)},v.onMediaAttached=function(p,h){this.media=h.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},v.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},v.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},v.onLevelUpdated=function(p,h){var u=h.details;this.levelDetails=u,u.advanced&&this.timeupdate(),!u.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},v.onError=function(p,h){if(h.details!==J.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,M.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},v.timeupdate=function(){var p=this.media,h=this.levelDetails;if(!p||!h)return;this.currentTime=p.currentTime;var u=this.computeLatency();if(u===null)return;this._latency=u;var f=this.config,o=f.lowLatencyMode,l=f.maxLiveSyncPlaybackRate;if(!o||l===1)return;var s=this.targetLatency;if(s===null)return;var a=u-s,S=Math.min(this.maxLatency,s+h.targetduration),x=a<S;if(h.live&&x&&a>.05&&this.forwardBufferLength>1){var C=Math.min(2,Math.max(1,l)),D=Math.round(2/(1+Math.exp(-.75*a-this.edgeStalled))*20)/20;p.playbackRate=Math.min(C,Math.max(1,D))}else p.playbackRate!==1&&p.playbackRate!==0&&(p.playbackRate=1)},v.estimateLiveEdge=function(){var p=this.levelDetails;return p===null?null:p.edge+p.age},v.computeLatency=function(){var p=this.estimateLiveEdge();return p===null?null:p-this.currentTime},G(O,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var p=this.config,h=this.levelDetails;return p.liveMaxLatencyDuration!==void 0?p.liveMaxLatencyDuration:h?p.liveMaxLatencyDurationCount*h.targetduration:0}},{key:"targetLatency",get:function(){var p=this.levelDetails;if(p===null)return null;var h=p.holdBack,u=p.partHoldBack,f=p.targetduration,o=this.config,l=o.liveSyncDuration,s=o.liveSyncDurationCount,a=o.lowLatencyMode,S=this.hls.userConfig,x=a&&u||h;(S.liveSyncDuration||S.liveSyncDurationCount||x===0)&&(x=l!==void 0?l:s*f);var C=f,D=1;return x+Math.min(this.stallCount*D,C)}},{key:"liveSyncPosition",get:function(){var p=this.estimateLiveEdge(),h=this.targetLatency,u=this.levelDetails;if(p===null||h===null||u===null)return null;var f=u.edge,o=p-h-this.edgeStalled,l=f-u.totalduration,s=f-(this.config.lowLatencyMode&&u.partTarget||u.targetduration);return Math.min(Math.max(l,o),s)}},{key:"drift",get:function(){var p=this.levelDetails;return p===null?1:p.drift}},{key:"edgeStalled",get:function(){var p=this.levelDetails;if(p===null)return 0;var h=(this.config.lowLatencyMode&&p.partTarget||p.targetduration)*3;return Math.max(p.age-h,0)}},{key:"forwardBufferLength",get:function(){var p=this.media,h=this.levelDetails;if(!p||!h)return 0;var u=p.buffered.length;return u?p.buffered.end(u-1):h.edge-this.currentTime}}]),O}()},"./src/controller/level-controller.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return o});var J=N("./src/types/level.ts"),H=N("./src/events.ts"),M=N("./src/errors.ts"),z=N("./src/utils/codecs.ts"),G=N("./src/controller/level-helper.ts"),r=N("./src/controller/base-playlist-controller.ts"),O=N("./src/types/loader.ts");function v(){return v=Object.assign||function(l){for(var s=1;s<arguments.length;s++){var a=arguments[s];for(var S in a)Object.prototype.hasOwnProperty.call(a,S)&&(l[S]=a[S])}return l},v.apply(this,arguments)}function m(l,s){for(var a=0;a<s.length;a++){var S=s[a];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(l,S.key,S)}}function p(l,s,a){return s&&m(l.prototype,s),a&&m(l,a),l}function h(l,s){l.prototype=Object.create(s.prototype),l.prototype.constructor=l,u(l,s)}function u(l,s){return u=Object.setPrototypeOf||function(S,x){return S.__proto__=x,S},u(l,s)}var f=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),o=function(l){h(s,l);function s(S){var x;return x=l.call(this,S,"[level-controller]")||this,x._levels=[],x._firstLevel=-1,x._startLevel=void 0,x.currentLevelIndex=-1,x.manualLevelIndex=-1,x.onParsedComplete=void 0,x._registerListeners(),x}var a=s.prototype;return a._registerListeners=function(){var x=this.hls;x.on(H.Events.MANIFEST_LOADED,this.onManifestLoaded,this),x.on(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),x.on(H.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),x.on(H.Events.FRAG_LOADED,this.onFragLoaded,this),x.on(H.Events.ERROR,this.onError,this)},a._unregisterListeners=function(){var x=this.hls;x.off(H.Events.MANIFEST_LOADED,this.onManifestLoaded,this),x.off(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),x.off(H.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),x.off(H.Events.FRAG_LOADED,this.onFragLoaded,this),x.off(H.Events.ERROR,this.onError,this)},a.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,l.prototype.destroy.call(this)},a.startLoad=function(){var x=this._levels;x.forEach(function(C){C.loadError=0}),l.prototype.startLoad.call(this)},a.onManifestLoaded=function(x,C){var D=[],L=[],R=[],A,T={},d,w=!1,y=!1,b=!1;if(C.levels.forEach(function(F){var I=F.attrs;w=w||!!(F.width&&F.height),y=y||!!F.videoCodec,b=b||!!F.audioCodec,f&&F.audioCodec&&F.audioCodec.indexOf("mp4a.40.34")!==-1&&(F.audioCodec=void 0);var g=F.bitrate+"-"+F.attrs.RESOLUTION+"-"+F.attrs.CODECS;d=T[g],d?d.url.push(F.url):(d=new J.Level(F),T[g]=d,D.push(d)),I&&(I.AUDIO&&Object(G.addGroupId)(d,"audio",I.AUDIO),I.SUBTITLES&&Object(G.addGroupId)(d,"text",I.SUBTITLES))}),(w||y)&&b&&(D=D.filter(function(F){var I=F.videoCodec,g=F.width,W=F.height;return!!I||!!(g&&W)})),D=D.filter(function(F){var I=F.audioCodec,g=F.videoCodec;return(!I||Object(z.isCodecSupportedInMp4)(I,"audio"))&&(!g||Object(z.isCodecSupportedInMp4)(g,"video"))}),C.audioTracks&&(L=C.audioTracks.filter(function(F){return!F.audioCodec||Object(z.isCodecSupportedInMp4)(F.audioCodec,"audio")}),Object(G.assignTrackIdsByGroup)(L)),C.subtitles&&(R=C.subtitles,Object(G.assignTrackIdsByGroup)(R)),D.length>0){A=D[0].bitrate,D.sort(function(F,I){return F.bitrate-I.bitrate}),this._levels=D;for(var j=0;j<D.length;j++)if(D[j].bitrate===A){this._firstLevel=j,this.log("manifest loaded, "+D.length+" level(s) found, first bitrate: "+A);break}var B=b&&!y,E={levels:D,audioTracks:L,subtitleTracks:R,firstLevel:this._firstLevel,stats:C.stats,audio:b,video:y,altAudio:!B&&L.some(function(F){return!!F.url})};this.hls.trigger(H.Events.MANIFEST_PARSED,E),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(H.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:C.url,reason:"no level with compatible codecs found in manifest"})},a.onError=function(x,C){if(l.prototype.onError.call(this,x,C),C.fatal)return;var D=C.context,L=this._levels[this.currentLevelIndex];if(D&&(D.type===O.PlaylistContextType.AUDIO_TRACK&&L.audioGroupIds&&D.groupId===L.audioGroupIds[L.urlId]||D.type===O.PlaylistContextType.SUBTITLE_TRACK&&L.textGroupIds&&D.groupId===L.textGroupIds[L.urlId])){this.redundantFailover(this.currentLevelIndex);return}var R=!1,A=!0,T;switch(C.details){case M.ErrorDetails.FRAG_LOAD_ERROR:case M.ErrorDetails.FRAG_LOAD_TIMEOUT:case M.ErrorDetails.KEY_LOAD_ERROR:case M.ErrorDetails.KEY_LOAD_TIMEOUT:if(C.frag){var d=this._levels[C.frag.level];d?(d.fragmentError++,d.fragmentError>this.hls.config.fragLoadingMaxRetry&&(T=C.frag.level)):T=C.frag.level}break;case M.ErrorDetails.LEVEL_LOAD_ERROR:case M.ErrorDetails.LEVEL_LOAD_TIMEOUT:D&&(D.deliveryDirectives&&(A=!1),T=D.level),R=!0;break;case M.ErrorDetails.REMUX_ALLOC_ERROR:T=C.level,R=!0;break}T!==void 0&&this.recoverLevel(C,T,R,A)},a.recoverLevel=function(x,C,D,L){var R=x.details,A=this._levels[C];if(A.loadError++,D){var T=this.retryLoadingOrFail(x);if(T)x.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(L){var d=A.url.length;if(d>1&&A.loadError<d)x.levelRetry=!0,this.redundantFailover(C);else if(this.manualLevelIndex===-1){var w=C===0?this._levels.length-1:C-1;this.currentLevelIndex!==w&&this._levels[w].loadError===0&&(this.warn(R+": switch to "+w),x.levelRetry=!0,this.hls.nextAutoLevel=w)}}},a.redundantFailover=function(x){var C=this._levels[x],D=C.url.length;if(D>1){var L=(C.urlId+1)%D;this.warn("Switching to redundant URL-id "+L),this._levels.forEach(function(R){R.urlId=L}),this.level=x}},a.onFragLoaded=function(x,C){var D=C.frag;if(D!==void 0&&D.type===O.PlaylistLevelType.MAIN){var L=this._levels[D.level];L!==void 0&&(L.fragmentError=0,L.loadError=0)}},a.onLevelLoaded=function(x,C){var D,L=C.level,R=C.details,A=this._levels[L];if(!A){var T;this.warn("Invalid level index "+L),(T=C.deliveryDirectives)!==null&&T!==void 0&&T.skip&&(R.deltaUpdateFailed=!0);return}L===this.currentLevelIndex?(A.fragmentError===0&&(A.loadError=0,this.retryCount=0),this.playlistLoaded(L,C,A.details)):(D=C.deliveryDirectives)!==null&&D!==void 0&&D.skip&&(R.deltaUpdateFailed=!0)},a.onAudioTrackSwitched=function(x,C){var D=this.hls.levels[this.currentLevelIndex];if(!D)return;if(D.audioGroupIds){for(var L=-1,R=this.hls.audioTracks[C.id].groupId,A=0;A<D.audioGroupIds.length;A++)if(D.audioGroupIds[A]===R){L=A;break}L!==D.urlId&&(D.urlId=L,this.startLoad())}},a.loadPlaylist=function(x){var C=this.currentLevelIndex,D=this._levels[C];if(this.canLoad&&D&&D.url.length>0){var L=D.urlId,R=D.url[L];if(x)try{R=x.addDirectives(R)}catch(A){this.warn("Could not construct new URL with HLS Delivery Directives: "+A)}this.log("Attempt loading level index "+C+(x?" at sn "+x.msn+" part "+x.part:"")+" with URL-id "+L+" "+R),this.clearTimer(),this.hls.trigger(H.Events.LEVEL_LOADING,{url:R,level:C,id:L,deliveryDirectives:x||null})}},a.removeLevel=function(x,C){var D=function(A,T){return T!==C},L=this._levels.filter(function(R,A){return A!==x?!0:R.url.length>1&&C!==void 0?(R.url=R.url.filter(D),R.audioGroupIds&&(R.audioGroupIds=R.audioGroupIds.filter(D)),R.textGroupIds&&(R.textGroupIds=R.textGroupIds.filter(D)),R.urlId=0,!0):!1}).map(function(R,A){var T=R.details;return T!=null&&T.fragments&&T.fragments.forEach(function(d){d.level=A}),R});this._levels=L,this.hls.trigger(H.Events.LEVELS_UPDATED,{levels:L})},p(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(x){var C,D=this._levels;if(D.length===0)return;if(this.currentLevelIndex===x&&(C=D[x])!==null&&C!==void 0&&C.details)return;if(x<0||x>=D.length){var L=x<0;if(this.hls.trigger(H.Events.ERROR,{type:M.ErrorTypes.OTHER_ERROR,details:M.ErrorDetails.LEVEL_SWITCH_ERROR,level:x,fatal:L,reason:"invalid level idx"}),L)return;x=Math.min(x,D.length-1)}this.clearTimer();var R=this.currentLevelIndex,A=D[R],T=D[x];this.log("switching to level "+x+" from "+R),this.currentLevelIndex=x;var d=v({},T,{level:x,maxBitrate:T.maxBitrate,uri:T.uri,urlId:T.urlId});delete d._urlId,this.hls.trigger(H.Events.LEVEL_SWITCHING,d);var w=T.details;if(!w||w.live){var y=this.switchParams(T.uri,A==null?void 0:A.details);this.loadPlaylist(y)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(x){this.manualLevelIndex=x,this._startLevel===void 0&&(this._startLevel=x),x!==-1&&(this.level=x)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(x){this._firstLevel=x}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var x=this.hls.config.startLevel;return x!==void 0?x:this._firstLevel}else return this._startLevel},set:function(x){this._startLevel=x}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(x){this.level=x,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=x)}}]),s}(r.default)},"./src/controller/level-helper.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"addGroupId",function(){return M}),N.d(Y,"assignTrackIdsByGroup",function(){return z}),N.d(Y,"updatePTS",function(){return G}),N.d(Y,"updateFragPTSDTS",function(){return O}),N.d(Y,"mergeDetails",function(){return v}),N.d(Y,"mapPartIntersection",function(){return m}),N.d(Y,"mapFragmentIntersection",function(){return p}),N.d(Y,"adjustSliding",function(){return h}),N.d(Y,"addSliding",function(){return u}),N.d(Y,"computeReloadInterval",function(){return f}),N.d(Y,"getFragmentWithSN",function(){return o}),N.d(Y,"getPartWith",function(){return l});var J=N("./src/polyfills/number.ts"),H=N("./src/utils/logger.ts");function M(s,a,S){switch(a){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(S);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(S);break}}function z(s){var a={};s.forEach(function(S){var x=S.groupId||"";S.id=a[x]=a[x]||0,a[x]++})}function G(s,a,S){var x=s[a],C=s[S];r(x,C)}function r(s,a){var S=a.startPTS;if(Object(J.isFiniteNumber)(S)){var x=0,C;a.sn>s.sn?(x=S-s.start,C=s):(x=s.start-S,C=a),C.duration!==x&&(C.duration=x)}else if(a.sn>s.sn){var D=s.cc===a.cc;D&&s.minEndPTS?a.start=s.start+(s.minEndPTS-s.start):a.start=s.start+s.duration}else a.start=Math.max(s.start-a.duration,0)}function O(s,a,S,x,C,D){var L=x-S;L<=0&&(H.logger.warn("Fragment should have a positive duration",a),x=S+a.duration,D=C+a.duration);var R=S,A=x,T=a.startPTS,d=a.endPTS;if(Object(J.isFiniteNumber)(T)){var w=Math.abs(T-S);Object(J.isFiniteNumber)(a.deltaPTS)?a.deltaPTS=Math.max(w,a.deltaPTS):a.deltaPTS=w,R=Math.max(S,T),S=Math.min(S,T),C=Math.min(C,a.startDTS),A=Math.min(x,d),x=Math.max(x,d),D=Math.max(D,a.endDTS)}a.duration=x-S;var y=S-a.start;a.appendedPTS=x,a.start=a.startPTS=S,a.maxStartPTS=R,a.startDTS=C,a.endPTS=x,a.minEndPTS=A,a.endDTS=D;var b=a.sn;if(!s||b<s.startSN||b>s.endSN)return 0;var j,B=b-s.startSN,E=s.fragments;for(E[B]=a,j=B;j>0;j--)r(E[j],E[j-1]);for(j=B;j<E.length-1;j++)r(E[j],E[j+1]);return s.fragmentHint&&r(E[E.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,y}function v(s,a){for(var S=null,x=s.fragments,C=x.length-1;C>=0;C--){var D=x[C].initSegment;if(D){S=D;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var L=0,R;if(p(s,a,function(j,B){j.relurl&&(L=j.cc-B.cc),Object(J.isFiniteNumber)(j.startPTS)&&Object(J.isFiniteNumber)(j.endPTS)&&(B.start=B.startPTS=j.startPTS,B.startDTS=j.startDTS,B.appendedPTS=j.appendedPTS,B.maxStartPTS=j.maxStartPTS,B.endPTS=j.endPTS,B.endDTS=j.endDTS,B.minEndPTS=j.minEndPTS,B.duration=j.endPTS-j.startPTS,B.duration&&(R=B),a.PTSKnown=a.alignedSliding=!0),B.elementaryStreams=j.elementaryStreams,B.loader=j.loader,B.stats=j.stats,B.urlId=j.urlId,j.initSegment&&(B.initSegment=j.initSegment,S=j.initSegment)}),S){var A=a.fragmentHint?a.fragments.concat(a.fragmentHint):a.fragments;A.forEach(function(j){var B;(!j.initSegment||j.initSegment.relurl===((B=S)===null||B===void 0?void 0:B.relurl))&&(j.initSegment=S)})}if(a.skippedSegments&&(a.deltaUpdateFailed=a.fragments.some(function(j){return!j}),a.deltaUpdateFailed)){H.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var T=a.skippedSegments;T--;)a.fragments.shift();a.startSN=a.fragments[0].sn,a.startCC=a.fragments[0].cc}var d=a.fragments;if(L){H.logger.warn("discontinuity sliding from playlist, take drift into account");for(var w=0;w<d.length;w++)d[w].cc+=L}a.skippedSegments&&(a.startCC=a.fragments[0].cc),m(s.partList,a.partList,function(j,B){B.elementaryStreams=j.elementaryStreams,B.stats=j.stats}),R?O(a,R,R.startPTS,R.endPTS,R.startDTS,R.endDTS):h(s,a),d.length&&(a.totalduration=a.edge-d[0].start),a.driftStartTime=s.driftStartTime,a.driftStart=s.driftStart;var y=a.advancedDateTime;if(a.advanced&&y){var b=a.edge;a.driftStart||(a.driftStartTime=y,a.driftStart=b),a.driftEndTime=y,a.driftEnd=b}else a.driftEndTime=s.driftEndTime,a.driftEnd=s.driftEnd,a.advancedDateTime=s.advancedDateTime}function m(s,a,S){if(s&&a)for(var x=0,C=0,D=s.length;C<=D;C++){var L=s[C],R=a[C+x];L&&R&&L.index===R.index&&L.fragment.sn===R.fragment.sn?S(L,R):x--}}function p(s,a,S){for(var x=a.skippedSegments,C=Math.max(s.startSN,a.startSN)-a.startSN,D=(s.fragmentHint?1:0)+(x?a.endSN:Math.min(s.endSN,a.endSN))-a.startSN,L=a.startSN-s.startSN,R=a.fragmentHint?a.fragments.concat(a.fragmentHint):a.fragments,A=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,T=C;T<=D;T++){var d=A[L+T],w=R[T];x&&!w&&T<x&&(w=a.fragments[T]=d),d&&w&&S(d,w)}}function h(s,a){var S=a.startSN+a.skippedSegments-s.startSN,x=s.fragments;if(S<0||S>=x.length)return;u(a,x[S].start)}function u(s,a){if(a){for(var S=s.fragments,x=s.skippedSegments;x<S.length;x++)S[x].start+=a;s.fragmentHint&&(s.fragmentHint.start+=a)}}function f(s,a){var S=1e3*s.levelTargetDuration,x=S/2,C=s.age,D=C>0&&C<S*3,L=a.loading.end-a.loading.start,R,A=s.availabilityDelay;if(s.updated===!1)if(D){var T=333*s.misses;R=Math.max(Math.min(x,L*2),T),s.availabilityDelay=(s.availabilityDelay||0)+R}else R=x;else D?(A=Math.min(A||S/2,C),s.availabilityDelay=A,R=A+S-C):R=S-L;return Math.round(R)}function o(s,a,S){if(!s||!s.details)return null;var x=s.details,C=x.fragments[a-x.startSN];return C||(C=x.fragmentHint,C&&C.sn===a?C:a<x.startSN&&S&&S.sn===a?S:null)}function l(s,a,S){if(!s||!s.details)return null;var x=s.details.partList;if(x)for(var C=x.length;C--;){var D=x[C];if(D.index===S&&D.fragment.sn===a)return D}return null}},"./src/controller/stream-controller.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return x});var J=N("./src/polyfills/number.ts"),H=N("./src/controller/base-stream-controller.ts"),M=N("./src/is-supported.ts"),z=N("./src/events.ts"),G=N("./src/utils/buffer-helper.ts"),r=N("./src/controller/fragment-tracker.ts"),O=N("./src/types/loader.ts"),v=N("./src/loader/fragment.ts"),m=N("./src/demux/transmuxer-interface.ts"),p=N("./src/types/transmuxer.ts"),h=N("./src/controller/gap-controller.ts"),u=N("./src/errors.ts"),f=N("./src/utils/logger.ts");function o(C,D){for(var L=0;L<D.length;L++){var R=D[L];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(C,R.key,R)}}function l(C,D,L){return D&&o(C.prototype,D),L&&o(C,L),C}function s(C,D){C.prototype=Object.create(D.prototype),C.prototype.constructor=C,a(C,D)}function a(C,D){return a=Object.setPrototypeOf||function(R,A){return R.__proto__=A,R},a(C,D)}var S=100,x=function(C){s(D,C);function D(R,A){var T;return T=C.call(this,R,A,"[stream-controller]")||this,T.audioCodecSwap=!1,T.gapController=null,T.level=-1,T._forceStartLoad=!1,T.altAudio=!1,T.audioOnly=!1,T.fragPlaying=null,T.onvplaying=null,T.onvseeked=null,T.fragLastKbps=0,T.stalled=!1,T.couldBacktrack=!1,T.audioCodecSwitch=!1,T.videoBuffer=null,T._registerListeners(),T}var L=D.prototype;return L._registerListeners=function(){var A=this.hls;A.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),A.on(z.Events.LEVEL_LOADING,this.onLevelLoading,this),A.on(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.on(z.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),A.on(z.Events.ERROR,this.onError,this),A.on(z.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),A.on(z.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),A.on(z.Events.BUFFER_CREATED,this.onBufferCreated,this),A.on(z.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),A.on(z.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),A.on(z.Events.FRAG_BUFFERED,this.onFragBuffered,this)},L._unregisterListeners=function(){var A=this.hls;A.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),A.off(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.off(z.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),A.off(z.Events.ERROR,this.onError,this),A.off(z.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),A.off(z.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),A.off(z.Events.BUFFER_CREATED,this.onBufferCreated,this),A.off(z.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),A.off(z.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),A.off(z.Events.FRAG_BUFFERED,this.onFragBuffered,this)},L.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},L.startLoad=function(A){if(this.levels){var T=this.lastCurrentTime,d=this.hls;if(this.stopLoad(),this.setInterval(S),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var w=d.startLevel;w===-1&&(d.config.testBandwidth?(w=0,this.bitrateTest=!0):w=d.nextAutoLevel),this.level=d.nextLoadLevel=w,this.loadedmetadata=!1}T>0&&A===-1&&(this.log("Override startPosition with lastCurrentTime @"+T.toFixed(3)),A=T),this.state=H.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=A,this.tick()}else this._forceStartLoad=!0,this.state=H.State.STOPPED},L.stopLoad=function(){this._forceStartLoad=!1,C.prototype.stopLoad.call(this)},L.doTick=function(){switch(this.state){case H.State.IDLE:this.doTickIdle();break;case H.State.WAITING_LEVEL:{var A,T=this.levels,d=this.level,w=T==null||((A=T[d])===null||A===void 0)?void 0:A.details;if(w&&(!w.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(w))break;this.state=H.State.IDLE;break}break}case H.State.FRAG_LOADING_WAITING_RETRY:{var y,b=self.performance.now(),j=this.retryDate;(!j||b>=j||(y=this.media)!==null&&y!==void 0&&y.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=H.State.IDLE)}break;default:break}this.onTickEnd()},L.onTickEnd=function(){C.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},L.doTickIdle=function(){var A,T,d=this.hls,w=this.levelLastLoaded,y=this.levels,b=this.media,j=d.config,B=d.nextLoadLevel;if(w===null||!b&&(this.startFragRequested||!j.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!y||!y[B])return;var E=y[B];this.level=d.nextLoadLevel=B;var F=E.details;if(!F||this.state===H.State.WAITING_LEVEL||F.live&&this.levelLastLoaded!==B){this.state=H.State.WAITING_LEVEL;return}var I=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:b,O.PlaylistLevelType.MAIN);if(I===null)return;var g=I.len,W=this.getMaxBufferLength(E.maxBitrate);if(g>=W)return;if(this._streamEnded(I,F)){var $={};this.altAudio&&($.type="video"),this.hls.trigger(z.Events.BUFFER_EOS,$),this.state=H.State.ENDED;return}var le=I.end,de=this.getNextFragment(le,F);if(this.couldBacktrack&&!this.fragPrevious&&de&&de.sn!=="initSegment"){var Ce=de.sn-F.startSN;Ce>1&&(de=F.fragments[Ce-1],this.fragmentTracker.removeFragment(de))}if(de&&this.fragmentTracker.getState(de)===r.FragmentState.OK&&this.nextLoadPosition>le){var be=this.audioOnly&&!this.altAudio?v.ElementaryStreamTypes.AUDIO:v.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(b,be,O.PlaylistLevelType.MAIN),de=this.getNextFragment(this.nextLoadPosition,F)}if(!de)return;de.initSegment&&!de.initSegment.data&&!this.bitrateTest&&(de=de.initSegment),((A=de.decryptdata)===null||A===void 0?void 0:A.keyFormat)==="identity"&&!((T=de.decryptdata)!==null&&T!==void 0&&T.key)?this.loadKey(de,F):this.loadFragment(de,F,le)},L.loadFragment=function(A,T,d){var w,y=this.fragmentTracker.getState(A);if(this.fragCurrent=A,y===r.FragmentState.BACKTRACKED){var b=this.fragmentTracker.getBacktrackData(A);if(b){this._handleFragmentLoadProgress(b),this._handleFragmentLoadComplete(b);return}else y=r.FragmentState.NOT_LOADED}y===r.FragmentState.NOT_LOADED||y===r.FragmentState.PARTIAL?A.sn==="initSegment"?this._loadInitSegment(A):this.bitrateTest?(A.bitrateTest=!0,this.log("Fragment "+A.sn+" of level "+A.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(A)):(this.startFragRequested=!0,C.prototype.loadFragment.call(this,A,T,d)):y===r.FragmentState.APPENDING?this.reduceMaxBufferLength(A.duration)&&this.fragmentTracker.removeFragment(A):((w=this.media)===null||w===void 0?void 0:w.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},L.getAppendedFrag=function(A){var T=this.fragmentTracker.getAppendedFrag(A,O.PlaylistLevelType.MAIN);return T&&"fragment"in T?T.fragment:T},L.getBufferedFrag=function(A){return this.fragmentTracker.getBufferedFrag(A,O.PlaylistLevelType.MAIN)},L.followingBufferedFrag=function(A){return A?this.getBufferedFrag(A.end+.5):null},L.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},L.nextLevelSwitch=function(){var A=this.levels,T=this.media;if(T!=null&&T.readyState){var d,w=this.getAppendedFrag(T.currentTime);if(w&&w.start>1&&this.flushMainBuffer(0,w.start-1),!T.paused&&A){var y=this.hls.nextLoadLevel,b=A[y],j=this.fragLastKbps;j&&this.fragCurrent?d=this.fragCurrent.duration*b.maxBitrate/(1e3*j)+1:d=0}else d=0;var B=this.getBufferedFrag(T.currentTime+d);if(B){var E=this.followingBufferedFrag(B);if(E){this.abortCurrentFrag();var F=E.maxStartPTS?E.maxStartPTS:E.start,I=E.duration,g=Math.max(B.end,F+Math.min(Math.max(I-this.config.maxFragLookUpTolerance,I*.5),I*.75));this.flushMainBuffer(g,Number.POSITIVE_INFINITY)}}}},L.abortCurrentFrag=function(){var A=this.fragCurrent;this.fragCurrent=null,A!=null&&A.loader&&A.loader.abort(),this.state===H.State.KEY_LOADING&&(this.state=H.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},L.flushMainBuffer=function(A,T){C.prototype.flushMainBuffer.call(this,A,T,this.altAudio?"video":null)},L.onMediaAttached=function(A,T){C.prototype.onMediaAttached.call(this,A,T);var d=T.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),d.addEventListener("playing",this.onvplaying),d.addEventListener("seeked",this.onvseeked),this.gapController=new h.default(this.config,d,this.fragmentTracker,this.hls)},L.onMediaDetaching=function(){var A=this.media;A&&(A.removeEventListener("playing",this.onvplaying),A.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),C.prototype.onMediaDetaching.call(this)},L.onMediaPlaying=function(){this.tick()},L.onMediaSeeked=function(){var A=this.media,T=A?A.currentTime:null;Object(J.isFiniteNumber)(T)&&this.log("Media seeked to "+T.toFixed(3)),this.tick()},L.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(z.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},L.onManifestParsed=function(A,T){var d=!1,w=!1,y;T.levels.forEach(function(b){y=b.audioCodec,y&&(y.indexOf("mp4a.40.2")!==-1&&(d=!0),y.indexOf("mp4a.40.5")!==-1&&(w=!0))}),this.audioCodecSwitch=d&&w&&!Object(M.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=T.levels,this.startFragRequested=!1},L.onLevelLoading=function(A,T){var d=this.levels;if(!d||this.state!==H.State.IDLE)return;var w=d[T.level];(!w.details||w.details.live&&this.levelLastLoaded!==T.level||this.waitForCdnTuneIn(w.details))&&(this.state=H.State.WAITING_LEVEL)},L.onLevelLoaded=function(A,T){var d,w=this.levels,y=T.level,b=T.details,j=b.totalduration;if(!w){this.warn("Levels were reset while loading level "+y);return}this.log("Level "+y+" loaded ["+b.startSN+","+b.endSN+"], cc ["+b.startCC+", "+b.endCC+"] duration:"+j);var B=this.fragCurrent;B&&(this.state===H.State.FRAG_LOADING||this.state===H.State.FRAG_LOADING_WAITING_RETRY)&&(B.level!==T.level&&B.loader&&(this.state=H.State.IDLE,B.loader.abort()));var E=w[y],F=0;if(b.live||(d=E.details)!==null&&d!==void 0&&d.live){if(b.fragments[0]||(b.deltaUpdateFailed=!0),b.deltaUpdateFailed)return;F=this.alignPlaylists(b,E.details)}if(E.details=b,this.levelLastLoaded=y,this.hls.trigger(z.Events.LEVEL_UPDATED,{details:b,level:y}),this.state===H.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(b))return;this.state=H.State.IDLE}this.startFragRequested?b.live&&this.synchronizeToLiveEdge(b):this.setStartPosition(b,F),this.tick()},L._handleFragmentLoadProgress=function(A){var T,d=A.frag,w=A.part,y=A.payload,b=this.levels;if(!b){this.warn("Levels were reset while fragment load was in progress. Fragment "+d.sn+" of level "+d.level+" will not be buffered");return}var j=b[d.level],B=j.details;if(!B){this.warn("Dropping fragment "+d.sn+" of level "+d.level+" after level details were reset");return}var E=j.videoCodec,F=B.PTSKnown||!B.live,I=(T=d.initSegment)===null||T===void 0?void 0:T.data,g=this._getAudioCodec(j),W=this.transmuxer=this.transmuxer||new m.default(this.hls,O.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),$=w?w.index:-1,le=$!==-1,de=new p.ChunkMetadata(d.level,d.sn,d.stats.chunkCount,y.byteLength,$,le),Ce=this.initPTS[d.cc];W.push(y,I,g,E,d,w,B.totalduration,F,de,Ce)},L.onAudioTrackSwitching=function(A,T){var d=this.altAudio,w=!!T.url,y=T.id;if(!w){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var b=this.fragCurrent;b!=null&&b.loader&&(this.log("Switching to main audio track, cancel main fragment load"),b.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var j=this.hls;d&&j.trigger(z.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),j.trigger(z.Events.AUDIO_TRACK_SWITCHED,{id:y})}},L.onAudioTrackSwitched=function(A,T){var d=T.id,w=!!this.hls.audioTracks[d].url;if(w){var y=this.videoBuffer;y&&this.mediaBuffer!==y&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=y)}this.altAudio=w,this.tick()},L.onBufferCreated=function(A,T){var d=T.tracks,w,y,b=!1;for(var j in d){var B=d[j];if(B.id==="main"){if(y=j,w=B,j==="video"){var E=d[j];E&&(this.videoBuffer=E.buffer)}}else b=!0}b&&w?(this.log("Alternate track found, use "+y+".buffered to schedule main fragment loading"),this.mediaBuffer=w.buffer):this.mediaBuffer=this.media},L.onFragBuffered=function(A,T){var d=T.frag,w=T.part;if(d&&d.type!==O.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(d)){this.warn("Fragment "+d.sn+(w?" p: "+w.index:"")+" of level "+d.level+" finished buffering, but was aborted. state: "+this.state),this.state===H.State.PARSED&&(this.state=H.State.IDLE);return}var y=w?w.stats:d.stats;this.fragLastKbps=Math.round(8*y.total/(y.buffering.end-y.loading.first)),d.sn!=="initSegment"&&(this.fragPrevious=d),this.fragBufferedComplete(d,w)},L.onError=function(A,T){switch(T.details){case u.ErrorDetails.FRAG_LOAD_ERROR:case u.ErrorDetails.FRAG_LOAD_TIMEOUT:case u.ErrorDetails.KEY_LOAD_ERROR:case u.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(O.PlaylistLevelType.MAIN,T);break;case u.ErrorDetails.LEVEL_LOAD_ERROR:case u.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==H.State.ERROR&&(T.fatal?(this.warn(""+T.details),this.state=H.State.ERROR):!T.levelRetry&&this.state===H.State.WAITING_LEVEL&&(this.state=H.State.IDLE));break;case u.ErrorDetails.BUFFER_FULL_ERROR:if(T.parent==="main"&&(this.state===H.State.PARSING||this.state===H.State.PARSED)){var d=!0,w=this.getFwdBufferInfo(this.media,O.PlaylistLevelType.MAIN);w&&w.len>.5&&(d=!this.reduceMaxBufferLength(w.len)),d&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},L.checkBuffer=function(){var A=this.media,T=this.gapController;if(!A||!T||!A.readyState)return;var d=G.BufferHelper.getBuffered(A);!this.loadedmetadata&&d.length?(this.loadedmetadata=!0,this.seekToStartPos()):T.poll(this.lastCurrentTime),this.lastCurrentTime=A.currentTime},L.onFragLoadEmergencyAborted=function(){this.state=H.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},L.onBufferFlushed=function(A,T){var d=T.type;if(d!==v.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var w=(d===v.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(w,d,O.PlaylistLevelType.MAIN)}},L.onLevelsUpdated=function(A,T){this.levels=T.levels},L.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},L.seekToStartPos=function(){var A=this.media,T=A.currentTime,d=this.startPosition;if(d>=0&&T<d){if(A.seeking){f.logger.log("could not seek to "+d+", already seeking at "+T);return}var w=G.BufferHelper.getBuffered(A),y=w.length?w.start(0):0,b=y-d;b>0&&(b<this.config.maxBufferHole||b<this.config.maxFragLookUpTolerance)&&(f.logger.log("adjusting start position by "+b+" to match buffer start"),d+=b,this.startPosition=d),this.log("seek to target start position "+d+" from current time "+T),A.currentTime=d}},L._getAudioCodec=function(A){var T=this.config.defaultAudioCodec||A.audioCodec;return this.audioCodecSwap&&T&&(this.log("Swapping audio codec"),T.indexOf("mp4a.40.5")!==-1?T="mp4a.40.2":T="mp4a.40.5"),T},L._loadBitrateTestFrag=function(A){var T=this;this._doFragLoad(A).then(function(d){var w=T.hls;if(!d||w.nextLoadLevel||T.fragContextChanged(A))return;T.fragLoadError=0,T.state=H.State.IDLE,T.startFragRequested=!1,T.bitrateTest=!1;var y=A.stats;y.parsing.start=y.parsing.end=y.buffering.start=y.buffering.end=self.performance.now(),w.trigger(z.Events.FRAG_LOADED,d)})},L._handleTransmuxComplete=function(A){var T,d="main",w=this.hls,y=A.remuxResult,b=A.chunkMeta,j=this.getCurrentContext(b);if(!j){this.warn("The loading context changed while buffering fragment "+b.sn+" of level "+b.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(b.level);return}var B=j.frag,E=j.part,F=j.level,I=y.video,g=y.text,W=y.id3,$=y.initSegment,le=this.altAudio?void 0:y.audio;if(this.fragContextChanged(B))return;if(this.state=H.State.PARSING,$){$.tracks&&(this._bufferInitSegment(F,$.tracks,B,b),w.trigger(z.Events.FRAG_PARSING_INIT_SEGMENT,{frag:B,id:d,tracks:$.tracks}));var de=$.initPTS,Ce=$.timescale;Object(J.isFiniteNumber)(de)&&(this.initPTS[B.cc]=de,w.trigger(z.Events.INIT_PTS_FOUND,{frag:B,id:d,initPTS:de,timescale:Ce}))}if(I&&y.independent!==!1){if(F.details){var be=I.startPTS,Ae=I.endPTS,Se=I.startDTS,Re=I.endDTS;if(E)E.elementaryStreams[I.type]={startPTS:be,endPTS:Ae,startDTS:Se,endDTS:Re};else if(I.firstKeyFrame&&I.independent&&(this.couldBacktrack=!0),I.dropped&&I.independent){var ve=this.getLoadPosition()+this.config.maxBufferHole;if(ve<be){this.backtrack(B);return}B.setElementaryStreamInfo(I.type,B.start,Ae,B.start,Re,!0)}B.setElementaryStreamInfo(I.type,be,Ae,Se,Re),this.bufferFragmentData(I,B,E,b)}}else if(y.independent===!1){this.backtrack(B);return}if(le){var X=le.startPTS,_=le.endPTS,k=le.startDTS,U=le.endDTS;E&&(E.elementaryStreams[v.ElementaryStreamTypes.AUDIO]={startPTS:X,endPTS:_,startDTS:k,endDTS:U}),B.setElementaryStreamInfo(v.ElementaryStreamTypes.AUDIO,X,_,k,U),this.bufferFragmentData(le,B,E,b)}if(W!=null&&(T=W.samples)!==null&&T!==void 0&&T.length){var Q={frag:B,id:d,samples:W.samples};w.trigger(z.Events.FRAG_PARSING_METADATA,Q)}if(g){var K={frag:B,id:d,samples:g.samples};w.trigger(z.Events.FRAG_PARSING_USERDATA,K)}},L._bufferInitSegment=function(A,T,d,w){var y=this;if(this.state!==H.State.PARSING)return;this.audioOnly=!!T.audio&&!T.video,this.altAudio&&!this.audioOnly&&delete T.audio;var b=T.audio,j=T.video,B=T.audiovideo;if(b){var E=A.audioCodec,F=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(E&&(E.indexOf("mp4a.40.5")!==-1?E="mp4a.40.2":E="mp4a.40.5"),b.metadata.channelCount!==1&&F.indexOf("firefox")===-1&&(E="mp4a.40.5")),F.indexOf("android")!==-1&&b.container!=="audio/mpeg"&&(E="mp4a.40.2",this.log("Android: force audio codec to "+E)),A.audioCodec&&A.audioCodec!==E&&this.log('Swapping manifest audio codec "'+A.audioCodec+'" for "'+E+'"'),b.levelCodec=E,b.id="main",this.log("Init audio buffer, container:"+b.container+", codecs[selected/level/parsed]=["+(E||"")+"/"+(A.audioCodec||"")+"/"+b.codec+"]")}j&&(j.levelCodec=A.videoCodec,j.id="main",this.log("Init video buffer, container:"+j.container+", codecs[level/parsed]=["+(A.videoCodec||"")+"/"+j.codec+"]")),B&&this.log("Init audiovideo buffer, container:"+B.container+", codecs[level/parsed]=["+(A.attrs.CODECS||"")+"/"+B.codec+"]"),this.hls.trigger(z.Events.BUFFER_CODECS,T),Object.keys(T).forEach(function(I){var g=T[I],W=g.initSegment;W!=null&&W.byteLength&&y.hls.trigger(z.Events.BUFFER_APPENDING,{type:I,data:W,frag:d,part:null,chunkMeta:w,parent:d.type})}),this.tick()},L.backtrack=function(A){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(A);var T=this.fragmentTracker.backtrack(A);this.fragPrevious=null,this.nextLoadPosition=A.start,T?this.resetFragmentLoading(A):this.state=H.State.BACKTRACKING},L.checkFragmentChanged=function(){var A=this.media,T=null;if(A&&A.readyState>1&&A.seeking===!1){var d=A.currentTime;if(G.BufferHelper.isBuffered(A,d)?T=this.getAppendedFrag(d):G.BufferHelper.isBuffered(A,d+.1)&&(T=this.getAppendedFrag(d+.1)),T){var w=this.fragPlaying,y=T.level;(!w||T.sn!==w.sn||w.level!==y||T.urlId!==w.urlId)&&(this.hls.trigger(z.Events.FRAG_CHANGED,{frag:T}),(!w||w.level!==y)&&this.hls.trigger(z.Events.LEVEL_SWITCHED,{level:y}),this.fragPlaying=T)}}},l(D,[{key:"nextLevel",get:function(){var A=this.nextBufferedFrag;return A?A.level:-1}},{key:"currentLevel",get:function(){var A=this.media;if(A){var T=this.getAppendedFrag(A.currentTime);if(T)return T.level}return-1}},{key:"nextBufferedFrag",get:function(){var A=this.media;if(A){var T=this.getAppendedFrag(A.currentTime);return this.followingBufferedFrag(T)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),D}(H.default)},"./src/controller/subtitle-stream-controller.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"SubtitleStreamController",function(){return s});var J=N("./src/events.ts"),H=N("./src/utils/logger.ts"),M=N("./src/utils/buffer-helper.ts"),z=N("./src/controller/fragment-finders.ts"),G=N("./src/utils/discontinuities.ts"),r=N("./src/controller/level-helper.ts"),O=N("./src/controller/fragment-tracker.ts"),v=N("./src/controller/base-stream-controller.ts"),m=N("./src/types/loader.ts"),p=N("./src/types/level.ts");function h(a,S){for(var x=0;x<S.length;x++){var C=S[x];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(a,C.key,C)}}function u(a,S,x){return S&&h(a.prototype,S),x&&h(a,x),a}function f(a,S){a.prototype=Object.create(S.prototype),a.prototype.constructor=a,o(a,S)}function o(a,S){return o=Object.setPrototypeOf||function(C,D){return C.__proto__=D,C},o(a,S)}var l=500,s=function(a){f(S,a);function S(C,D){var L;return L=a.call(this,C,D,"[subtitle-stream-controller]")||this,L.levels=[],L.currentTrackId=-1,L.tracksBuffered=[],L.mainDetails=null,L._registerListeners(),L}var x=S.prototype;return x.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},x._registerListeners=function(){var D=this.hls;D.on(J.Events.MEDIA_ATTACHED,this.onMediaAttached,this),D.on(J.Events.MEDIA_DETACHING,this.onMediaDetaching,this),D.on(J.Events.MANIFEST_LOADING,this.onManifestLoading,this),D.on(J.Events.LEVEL_LOADED,this.onLevelLoaded,this),D.on(J.Events.ERROR,this.onError,this),D.on(J.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),D.on(J.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),D.on(J.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),D.on(J.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),D.on(J.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},x._unregisterListeners=function(){var D=this.hls;D.off(J.Events.MEDIA_ATTACHED,this.onMediaAttached,this),D.off(J.Events.MEDIA_DETACHING,this.onMediaDetaching,this),D.off(J.Events.MANIFEST_LOADING,this.onManifestLoading,this),D.off(J.Events.LEVEL_LOADED,this.onLevelLoaded,this),D.off(J.Events.ERROR,this.onError,this),D.off(J.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),D.off(J.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),D.off(J.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),D.off(J.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),D.off(J.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},x.startLoad=function(){this.stopLoad(),this.state=v.State.IDLE,this.setInterval(l),this.tick()},x.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},x.onLevelLoaded=function(D,L){this.mainDetails=L.details},x.onSubtitleFragProcessed=function(D,L){var R=L.frag,A=L.success;if(this.fragPrevious=R,this.state=v.State.IDLE,!A)return;var T=this.tracksBuffered[this.currentTrackId];if(!T)return;for(var d,w=R.start,y=0;y<T.length;y++)if(w>=T[y].start&&w<=T[y].end){d=T[y];break}var b=R.start+R.duration;d?d.end=b:(d={start:w,end:b},T.push(d)),this.fragmentTracker.fragBuffered(R)},x.onBufferFlushing=function(D,L){var R=L.startOffset,A=L.endOffset;if(R===0&&A!==Number.POSITIVE_INFINITY){var T=this.currentTrackId,d=this.levels;if(!d.length||!d[T]||!d[T].details)return;var w=d[T].details,y=w.targetduration,b=A-y;if(b<=0)return;L.endOffsetSubtitles=Math.max(0,b),this.tracksBuffered.forEach(function(j){for(var B=0;B<j.length;){if(j[B].end<=b){j.shift();continue}else if(j[B].start<b)j[B].start=b;else break;B++}}),this.fragmentTracker.removeFragmentsInRange(R,b,m.PlaylistLevelType.SUBTITLE)}},x.onError=function(D,L){var R,A=L.frag;if(!A||A.type!==m.PlaylistLevelType.SUBTITLE)return;(R=this.fragCurrent)!==null&&R!==void 0&&R.loader&&this.fragCurrent.loader.abort(),this.state=v.State.IDLE},x.onSubtitleTracksUpdated=function(D,L){var R=this,A=L.subtitleTracks;this.tracksBuffered=[],this.levels=A.map(function(T){return new p.Level(T)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(T){R.tracksBuffered[T.id]=[]}),this.mediaBuffer=null},x.onSubtitleTrackSwitch=function(D,L){if(this.currentTrackId=L.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var R=this.levels[this.currentTrackId];R!=null&&R.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,R&&this.setInterval(l)},x.onSubtitleTrackLoaded=function(D,L){var R,A=L.details,T=L.id,d=this.currentTrackId,w=this.levels;if(!w.length)return;var y=w[d];if(T>=w.length||T!==d||!y)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,A.live||(R=y.details)!==null&&R!==void 0&&R.live){var b=this.mainDetails;if(A.deltaUpdateFailed||!b)return;var j=b.fragments[0];if(!y.details)A.hasProgramDateTime&&b.hasProgramDateTime?Object(G.alignMediaPlaylistByPDT)(A,b):j&&Object(r.addSliding)(A,j.start);else{var B=this.alignPlaylists(A,y.details);B===0&&j&&Object(r.addSliding)(A,j.start)}}if(y.details=A,this.levelLastLoaded=T,this.tick(),A.live&&!this.fragCurrent&&this.media&&this.state===v.State.IDLE){var E=Object(z.findFragmentByPTS)(null,A.fragments,this.media.currentTime,0);E||(this.warn("Subtitle playlist not aligned with playback"),y.details=void 0)}},x._handleFragmentLoadComplete=function(D){var L=D.frag,R=D.payload,A=L.decryptdata,T=this.hls;if(this.fragContextChanged(L))return;if(R&&R.byteLength>0&&A&&A.key&&A.iv&&A.method==="AES-128"){var d=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(R),A.key.buffer,A.iv.buffer).then(function(w){var y=performance.now();T.trigger(J.Events.FRAG_DECRYPTED,{frag:L,payload:w,stats:{tstart:d,tdecrypt:y}})})}},x.doTick=function(){if(!this.media){this.state=v.State.IDLE;return}if(this.state===v.State.IDLE){var D,L=this.currentTrackId,R=this.levels;if(!R.length||!R[L]||!R[L].details)return;var A=R[L].details,T=A.targetduration,d=this.config,w=this.media,y=M.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,w.currentTime-T,d.maxBufferHole),b=y.end,j=y.len,B=this.getMaxBufferLength()+T;if(j>B)return;console.assert(A,"Subtitle track details are defined on idle subtitle stream controller tick");var E=A.fragments,F=E.length,I=A.edge,g,W=this.fragPrevious;if(b<I){var $=d.maxFragLookUpTolerance;W&&A.hasProgramDateTime&&(g=Object(z.findFragmentByPDT)(E,W.endProgramDateTime,$)),g||(g=Object(z.findFragmentByPTS)(W,E,b,$),!g&&W&&W.start<E[0].start&&(g=E[0]))}else g=E[F-1];(D=g)!==null&&D!==void 0&&D.encrypted?(H.logger.log("Loading key for "+g.sn),this.state=v.State.KEY_LOADING,this.hls.trigger(J.Events.KEY_LOADING,{frag:g})):g&&this.fragmentTracker.getState(g)===O.FragmentState.NOT_LOADED&&this.loadFragment(g,A,b)}},x.loadFragment=function(D,L,R){this.fragCurrent=D,a.prototype.loadFragment.call(this,D,L,R)},u(S,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),S}(v.default)},"./src/controller/subtitle-track-controller.ts":function(oe,Y,N){"use strict";N.r(Y);var J=N("./src/events.ts"),H=N("./src/utils/texttrack-utils.ts"),M=N("./src/controller/base-playlist-controller.ts"),z=N("./src/types/loader.ts");function G(h,u){for(var f=0;f<u.length;f++){var o=u[f];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(h,o.key,o)}}function r(h,u,f){return u&&G(h.prototype,u),f&&G(h,f),h}function O(h,u){h.prototype=Object.create(u.prototype),h.prototype.constructor=h,v(h,u)}function v(h,u){return v=Object.setPrototypeOf||function(o,l){return o.__proto__=l,o},v(h,u)}var m=function(h){O(u,h);function u(o){var l;return l=h.call(this,o,"[subtitle-track-controller]")||this,l.media=null,l.tracks=[],l.groupId=null,l.tracksInGroup=[],l.trackId=-1,l.selectDefaultTrack=!0,l.queuedDefaultTrack=-1,l.trackChangeListener=function(){return l.onTextTracksChanged()},l.asyncPollTrackChange=function(){return l.pollTrackChange(0)},l.useTextTrackPolling=!1,l.subtitlePollingInterval=-1,l.subtitleDisplay=!0,l.registerListeners(),l}var f=u.prototype;return f.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,h.prototype.destroy.call(this)},f.registerListeners=function(){var l=this.hls;l.on(J.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.on(J.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(J.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(J.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.on(J.Events.LEVEL_LOADING,this.onLevelLoading,this),l.on(J.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.on(J.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),l.on(J.Events.ERROR,this.onError,this)},f.unregisterListeners=function(){var l=this.hls;l.off(J.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.off(J.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(J.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(J.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.off(J.Events.LEVEL_LOADING,this.onLevelLoading,this),l.off(J.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.off(J.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),l.off(J.Events.ERROR,this.onError,this)},f.onMediaAttached=function(l,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)},f.pollTrackChange=function(l){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,l)},f.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 l=p(this.media.textTracks);l.forEach(function(s){Object(H.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},f.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},f.onManifestParsed=function(l,s){this.tracks=s.subtitleTracks},f.onSubtitleTrackLoaded=function(l,s){var a=s.id,S=s.details,x=this.trackId,C=this.tracksInGroup[x];if(!C){this.warn("Invalid subtitle track id "+a);return}var D=C.details;C.details=s.details,this.log("subtitle track "+a+" loaded ["+S.startSN+"-"+S.endSN+"]"),a===this.trackId&&(this.retryCount=0,this.playlistLoaded(a,s,D))},f.onLevelLoading=function(l,s){this.switchLevel(s.level)},f.onLevelSwitching=function(l,s){this.switchLevel(s.level)},f.switchLevel=function(l){var s=this.hls.levels[l];if(!(s!=null&&s.textGroupIds))return;var a=s.textGroupIds[s.urlId];if(this.groupId!==a){var S=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,x=this.tracks.filter(function(L){return!a||L.groupId===a});this.tracksInGroup=x;var C=this.findTrackId(S==null?void 0:S.name)||this.findTrackId();this.groupId=a;var D={subtitleTracks:x};this.log("Updating subtitle tracks, "+x.length+' track(s) found in "'+a+'" group-id'),this.hls.trigger(J.Events.SUBTITLE_TRACKS_UPDATED,D),C!==-1&&this.setSubtitleTrack(C,S)}},f.findTrackId=function(l){for(var s=this.tracksInGroup,a=0;a<s.length;a++){var S=s[a];if((!this.selectDefaultTrack||S.default)&&(!l||l===S.name))return S.id}return-1},f.onError=function(l,s){if(h.prototype.onError.call(this,l,s),s.fatal||!s.context)return;s.context.type===z.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},f.loadPlaylist=function(l){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var a=s.id,S=s.groupId,x=s.url;if(l)try{x=l.addDirectives(x)}catch(C){this.warn("Could not construct new URL with HLS Delivery Directives: "+C)}this.log("Loading subtitle playlist for id "+a),this.hls.trigger(J.Events.SUBTITLE_TRACK_LOADING,{url:x,id:a,groupId:S,deliveryDirectives:l||null})}},f.toggleTrackModes=function(l){var s=this,a=this.media,S=this.subtitleDisplay,x=this.trackId;if(!a)return;var C=p(a.textTracks),D=C.filter(function(A){return A.groupId===s.groupId});if(l===-1)[].slice.call(C).forEach(function(A){A.mode="disabled"});else{var L=D[x];L&&(L.mode="disabled")}var R=D[l];R&&(R.mode=S?"showing":"hidden")},f.setSubtitleTrack=function(l,s){var a,S=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=l;return}if(this.trackId!==l&&this.toggleTrackModes(l),this.trackId===l&&(l===-1||(a=S[l])!==null&&a!==void 0&&a.details)||l<-1||l>=S.length)return;this.clearTimer();var x=S[l];if(this.log("Switching to subtitle track "+l),this.trackId=l,x){var C=x.id,D=x.groupId,L=D===void 0?"":D,R=x.name,A=x.type,T=x.url;this.hls.trigger(J.Events.SUBTITLE_TRACK_SWITCH,{id:C,groupId:L,name:R,type:A,url:T});var d=this.switchParams(x.url,s==null?void 0:s.details);this.loadPlaylist(d)}else this.hls.trigger(J.Events.SUBTITLE_TRACK_SWITCH,{id:l})},f.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var l=-1,s=p(this.media.textTracks),a=0;a<s.length;a++)if(s[a].mode==="hidden")l=a;else if(s[a].mode==="showing"){l=a;break}this.subtitleTrack!==l&&(this.subtitleTrack=l)},r(u,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(l){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(l,s)}}]),u}(M.default);function p(h){for(var u=[],f=0;f<h.length;f++){var o=h[f];o.kind==="subtitles"&&o.label&&u.push(h[f])}return u}Y.default=m},"./src/controller/timeline-controller.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"TimelineController",function(){return p});var J=N("./src/polyfills/number.ts"),H=N("./src/events.ts"),M=N("./src/utils/cea-608-parser.ts"),z=N("./src/utils/output-filter.ts"),G=N("./src/utils/webvtt-parser.ts"),r=N("./src/utils/texttrack-utils.ts"),O=N("./src/utils/imsc1-ttml-parser.ts"),v=N("./src/types/loader.ts"),m=N("./src/utils/logger.ts"),p=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=f(),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 a=new z.default(this,"textTrack1"),S=new z.default(this,"textTrack2"),x=new z.default(this,"textTrack3"),C=new z.default(this,"textTrack4");this.cea608Parser1=new M.default(1,a,S),this.cea608Parser2=new M.default(3,x,C)}s.on(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(H.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(H.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(H.Events.FRAG_LOADING,this.onFragLoading,this),s.on(H.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(H.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(H.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(H.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(H.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var l=o.prototype;return l.destroy=function(){var a=this.hls;a.off(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(H.Events.MANIFEST_LOADED,this.onManifestLoaded,this),a.off(H.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),a.off(H.Events.FRAG_LOADING,this.onFragLoading,this),a.off(H.Events.FRAG_LOADED,this.onFragLoaded,this),a.off(H.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),a.off(H.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),a.off(H.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),a.off(H.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),a.off(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},l.addCues=function(a,S,x,C,D){for(var L=!1,R=D.length;R--;){var A=D[R],T=u(A[0],A[1],S,x);if(T>=0&&(A[0]=Math.min(A[0],S),A[1]=Math.max(A[1],x),L=!0,T/(x-S)>.5))return}if(L||D.push([S,x]),this.config.renderTextTracksNatively){var d=this.captionsTracks[a];this.Cues.newCue(d,S,x,C)}else{var w=this.Cues.newCue(null,S,x,C);this.hls.trigger(H.Events.CUES_PARSED,{type:"captions",cues:w,track:a})}},l.onInitPtsFound=function(a,S){var x=this,C=S.frag,D=S.id,L=S.initPTS,R=S.timescale,A=this.unparsedVttFrags;D==="main"&&(this.initPTS[C.cc]=L,this.timescale[C.cc]=R),A.length&&(this.unparsedVttFrags=[],A.forEach(function(T){x.onFragLoaded(H.Events.FRAG_LOADED,T)}))},l.getExistingTrack=function(a){var S=this.media;if(S)for(var x=0;x<S.textTracks.length;x++){var C=S.textTracks[x];if(C[a])return C}return null},l.createCaptionsTrack=function(a){this.config.renderTextTracksNatively?this.createNativeTrack(a):this.createNonNativeTrack(a)},l.createNativeTrack=function(a){if(this.captionsTracks[a])return;var S=this.captionsProperties,x=this.captionsTracks,C=this.media,D=S[a],L=D.label,R=D.languageCode,A=this.getExistingTrack(a);if(A)x[a]=A,Object(r.clearCurrentCues)(x[a]),Object(r.sendAddTrackEvent)(x[a],C);else{var T=this.createTextTrack("captions",L,R);T&&(T[a]=!0,x[a]=T)}},l.createNonNativeTrack=function(a){if(this.nonNativeCaptionsTracks[a])return;var S=this.captionsProperties[a];if(!S)return;var x=S.label,C={_id:a,label:x,kind:"captions",default:S.media?!!S.media.default:!1,closedCaptions:S.media};this.nonNativeCaptionsTracks[a]=C,this.hls.trigger(H.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[C]})},l.createTextTrack=function(a,S,x){var C=this.media;return C?C.addTextTrack(a,S,x):void 0},l.onMediaAttaching=function(a,S){this.media=S.media,this._cleanTracks()},l.onMediaDetaching=function(){var a=this.captionsTracks;Object.keys(a).forEach(function(S){Object(r.clearCurrentCues)(a[S]),delete a[S]}),this.nonNativeCaptionsTracks={}},l.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=f(),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())},l._cleanTracks=function(){var a=this.media;if(!a)return;var S=a.textTracks;if(S)for(var x=0;x<S.length;x++)Object(r.clearCurrentCues)(S[x])},l.onSubtitleTracksUpdated=function(a,S){var x=this;this.textTracks=[];var C=S.subtitleTracks||[],D=C.some(function(T){return T.textCodec===O.IMSC1_CODEC});if(this.config.enableWebVTT||D&&this.config.enableIMSC1){var L=this.tracks&&C&&this.tracks.length===C.length;if(this.tracks=C||[],this.config.renderTextTracksNatively){var R=this.media?this.media.textTracks:[];this.tracks.forEach(function(T,d){var w;if(d<R.length){for(var y=null,b=0;b<R.length;b++)if(h(R[b],T)){y=R[b];break}y&&(w=y)}w?Object(r.clearCurrentCues)(w):(w=x.createTextTrack("subtitles",T.name,T.lang),w&&(w.mode="disabled")),w&&(w.groupId=T.groupId,x.textTracks.push(w))})}else if(!L&&this.tracks&&this.tracks.length){var A=this.tracks.map(function(T){return{label:T.name,kind:T.type.toLowerCase(),default:T.default,subtitleTrack:T}});this.hls.trigger(H.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:A})}}},l.onManifestLoaded=function(a,S){var x=this;this.config.enableCEA708Captions&&S.captions&&S.captions.forEach(function(C){var D=/(?:CC|SERVICE)([1-4])/.exec(C.instreamId);if(!D)return;var L="textTrack"+D[1],R=x.captionsProperties[L];if(!R)return;R.label=C.name,C.lang&&(R.languageCode=C.lang),R.media=C})},l.onFragLoading=function(a,S){var x=this.cea608Parser1,C=this.cea608Parser2,D=this.lastSn,L=this.lastPartIndex;if(!this.enabled||!(x&&C))return;if(S.frag.type===v.PlaylistLevelType.MAIN){var R,A,T=S.frag.sn,d=(R=S==null||((A=S.part)===null||A===void 0)?void 0:A.index)!=null?R:-1;T===D+1||T===D&&d===L+1||(x.reset(),C.reset()),this.lastSn=T,this.lastPartIndex=d}},l.onFragLoaded=function(a,S){var x=S.frag,C=S.payload,D=this.initPTS,L=this.unparsedVttFrags;if(x.type===v.PlaylistLevelType.SUBTITLE)if(C.byteLength){if(!Object(J.isFiniteNumber)(D[x.cc])){L.push(S),D.length&&this.hls.trigger(H.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:x,error:new Error("Missing initial subtitle PTS")});return}var R=x.decryptdata;if(R==null||R.key==null||R.method!=="AES-128"){var A=this.tracks[x.level],T=this.vttCCs;T[x.cc]||(T[x.cc]={start:x.start,prevCC:this.prevCC,new:!0},this.prevCC=x.cc),A&&A.textCodec===O.IMSC1_CODEC?this._parseIMSC1(x,C):this._parseVTTs(x,C,T)}}else this.hls.trigger(H.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:x,error:new Error("Empty subtitle payload")})},l._parseIMSC1=function(a,S){var x=this,C=this.hls;Object(O.parseIMSC1)(S,this.initPTS[a.cc],this.timescale[a.cc],function(D){x._appendCues(D,a.level),C.trigger(H.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:a})},function(D){m.logger.log("Failed to parse IMSC1: "+D),C.trigger(H.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:a,error:D})})},l._parseVTTs=function(a,S,x){var C=this,D=this.hls;Object(G.parseWebVTT)(S,this.initPTS[a.cc],this.timescale[a.cc],x,a.cc,a.start,function(L){C._appendCues(L,a.level),D.trigger(H.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:a})},function(L){C._fallbackToIMSC1(a,S),m.logger.log("Failed to parse VTT cue: "+L),D.trigger(H.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:a,error:L})})},l._fallbackToIMSC1=function(a,S){var x=this,C=this.tracks[a.level];C.textCodec||Object(O.parseIMSC1)(S,this.initPTS[a.cc],this.timescale[a.cc],function(){C.textCodec=O.IMSC1_CODEC,x._parseIMSC1(a,S)},function(){C.textCodec="wvtt"})},l._appendCues=function(a,S){var x=this.hls;if(this.config.renderTextTracksNatively){var C=this.textTracks[S];if(C.mode==="disabled")return;a.forEach(function(R){return Object(r.addCueToTrack)(C,R)})}else{var D=this.tracks[S],L=D.default?"default":"subtitles"+S;x.trigger(H.Events.CUES_PARSED,{type:"subtitles",cues:a,track:L})}},l.onFragDecrypted=function(a,S){var x=S.frag;if(x.type===v.PlaylistLevelType.SUBTITLE){if(!Object(J.isFiniteNumber)(this.initPTS[x.cc])){this.unparsedVttFrags.push(S);return}this.onFragLoaded(H.Events.FRAG_LOADED,S)}},l.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},l.onFragParsingUserdata=function(a,S){var x=this.cea608Parser1,C=this.cea608Parser2;if(!this.enabled||!(x&&C))return;for(var D=0;D<S.samples.length;D++){var L=S.samples[D].bytes;if(L){var R=this.extractCea608Data(L);x.addData(S.samples[D].pts,R[0]),C.addData(S.samples[D].pts,R[1])}}},l.onBufferFlushing=function(a,S){var x=S.startOffset,C=S.endOffset,D=S.endOffsetSubtitles,L=S.type,R=this.media;if(!R||R.currentTime<C)return;if(!L||L==="video"){var A=this.captionsTracks;Object.keys(A).forEach(function(d){return Object(r.removeCuesInRange)(A[d],x,C)})}if(this.config.renderTextTracksNatively&&(x===0&&D!==void 0)){var T=this.textTracks;Object.keys(T).forEach(function(d){return Object(r.removeCuesInRange)(T[d],x,D)})}},l.extractCea608Data=function(a){for(var S=a[0]&31,x=2,C=[[],[]],D=0;D<S;D++){var L=a[x++],R=127&a[x++],A=127&a[x++],T=(4&L)!==0,d=3&L;if(R===0&&A===0)continue;T&&((d===0||d===1)&&(C[d].push(R),C[d].push(A)))}return C},o}();function h(o,l){return o&&o.label===l.name&&!(o.textTrack1||o.textTrack2)}function u(o,l,s,a){return Math.min(l,a)-Math.max(o,s)}function f(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return J});var J=function(){function H(z,G){this.subtle=void 0,this.aesIV=void 0,this.subtle=z,this.aesIV=G}var M=H.prototype;return M.decrypt=function(G,r){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},r,G)},H}()},"./src/crypt/aes-decryptor.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"removePadding",function(){return H}),N.d(Y,"default",function(){return M});var J=N("./src/utils/typed-array.ts");function H(z){var G=z.byteLength,r=G&&new DataView(z.buffer).getUint8(G-1);return r?Object(J.sliceUint8)(z,0,G-r):z}var M=function(){function z(){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 G=z.prototype;return G.uint8ArrayToUint32Array_=function(O){for(var v=new DataView(O),m=new Uint32Array(4),p=0;p<4;p++)m[p]=v.getUint32(p*4);return m},G.initTable=function(){var O=this.sBox,v=this.invSBox,m=this.subMix,p=m[0],h=m[1],u=m[2],f=m[3],o=this.invSubMix,l=o[0],s=o[1],a=o[2],S=o[3],x=new Uint32Array(256),C=0,D=0,L=0;for(L=0;L<256;L++)L<128?x[L]=L<<1:x[L]=L<<1^283;for(L=0;L<256;L++){var R=D^D<<1^D<<2^D<<3^D<<4;R=R>>>8^R&255^99,O[C]=R,v[R]=C;var A=x[C],T=x[A],d=x[T],w=x[R]*257^R*16843008;p[C]=w<<24|w>>>8,h[C]=w<<16|w>>>16,u[C]=w<<8|w>>>24,f[C]=w,w=d*16843009^T*65537^A*257^C*16843008,l[R]=w<<24|w>>>8,s[R]=w<<16|w>>>16,a[R]=w<<8|w>>>24,S[R]=w,C?(C=A^x[x[x[d^A]]],D^=x[x[D]]):C=D=1}},G.expandKey=function(O){for(var v=this.uint8ArrayToUint32Array_(O),m=!0,p=0;p<v.length&&m;)m=v[p]===this.key[p],p++;if(m)return;this.key=v;var h=this.keySize=v.length;if(h!==4&&h!==6&&h!==8)throw new Error("Invalid aes key size="+h);var u=this.ksRows=(h+6+1)*4,f,o,l=this.keySchedule=new Uint32Array(u),s=this.invKeySchedule=new Uint32Array(u),a=this.sBox,S=this.rcon,x=this.invSubMix,C=x[0],D=x[1],L=x[2],R=x[3],A,T;for(f=0;f<u;f++){if(f<h){A=l[f]=v[f];continue}T=A,f%h===0?(T=T<<8|T>>>24,T=a[T>>>24]<<24|a[T>>>16&255]<<16|a[T>>>8&255]<<8|a[T&255],T^=S[f/h|0]<<24):h>6&&f%h===4&&(T=a[T>>>24]<<24|a[T>>>16&255]<<16|a[T>>>8&255]<<8|a[T&255]),l[f]=A=(l[f-h]^T)>>>0}for(o=0;o<u;o++)f=u-o,o&3?T=l[f]:T=l[f-4],o<4||f<=4?s[o]=T:s[o]=C[a[T>>>24]]^D[a[T>>>16&255]]^L[a[T>>>8&255]]^R[a[T&255]],s[o]=s[o]>>>0},G.networkToHostOrderSwap=function(O){return O<<24|(O&65280)<<8|(O&16711680)>>8|O>>>24},G.decrypt=function(O,v,m){for(var p=this.keySize+6,h=this.invKeySchedule,u=this.invSBox,f=this.invSubMix,o=f[0],l=f[1],s=f[2],a=f[3],S=this.uint8ArrayToUint32Array_(m),x=S[0],C=S[1],D=S[2],L=S[3],R=new Int32Array(O),A=new Int32Array(R.length),T,d,w,y,b,j,B,E,F,I,g,W,$,le,de=this.networkToHostOrderSwap;v<R.length;){for(F=de(R[v]),I=de(R[v+1]),g=de(R[v+2]),W=de(R[v+3]),b=F^h[0],j=W^h[1],B=g^h[2],E=I^h[3],$=4,le=1;le<p;le++)T=o[b>>>24]^l[j>>16&255]^s[B>>8&255]^a[E&255]^h[$],d=o[j>>>24]^l[B>>16&255]^s[E>>8&255]^a[b&255]^h[$+1],w=o[B>>>24]^l[E>>16&255]^s[b>>8&255]^a[j&255]^h[$+2],y=o[E>>>24]^l[b>>16&255]^s[j>>8&255]^a[B&255]^h[$+3],b=T,j=d,B=w,E=y,$=$+4;T=u[b>>>24]<<24^u[j>>16&255]<<16^u[B>>8&255]<<8^u[E&255]^h[$],d=u[j>>>24]<<24^u[B>>16&255]<<16^u[E>>8&255]<<8^u[b&255]^h[$+1],w=u[B>>>24]<<24^u[E>>16&255]<<16^u[b>>8&255]<<8^u[j&255]^h[$+2],y=u[E>>>24]<<24^u[b>>16&255]<<16^u[j>>8&255]<<8^u[B&255]^h[$+3],A[v]=de(T^x),A[v+1]=de(y^C),A[v+2]=de(w^D),A[v+3]=de(d^L),x=F,C=I,D=g,L=W,v=v+4}return A.buffer},z}()},"./src/crypt/decrypter.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return v});var J=N("./src/crypt/aes-crypto.ts"),H=N("./src/crypt/fast-aes-key.ts"),M=N("./src/crypt/aes-decryptor.ts"),z=N("./src/utils/logger.ts"),G=N("./src/utils/mp4-tools.ts"),r=N("./src/utils/typed-array.ts"),O=16,v=function(){function m(h,u,f){var o=f===void 0?{}:f,l=o.removePKCS7Padding,s=l===void 0?!0:l;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=h,this.config=u,this.removePKCS7Padding=s,s)try{var a=self.crypto;a&&(this.subtle=a.subtle||a.webkitSubtle)}catch(S){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var p=m.prototype;return p.destroy=function(){this.observer=null},p.isSync=function(){return this.config.enableSoftwareAES},p.flush=function(){var u=this.currentResult;if(!u){this.reset();return}var f=new Uint8Array(u);return this.reset(),this.removePKCS7Padding?Object(M.removePadding)(f):f},p.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},p.decrypt=function(u,f,o,l){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(u),f,o);var s=this.flush();s&&l(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(u),f,o).then(l)},p.softwareDecrypt=function(u,f,o){var l=this.currentIV,s=this.currentResult,a=this.remainderData;this.logOnce("JS AES decrypt"),a&&(u=Object(G.appendUint8Array)(a,u),this.remainderData=null);var S=this.getValidChunk(u);if(!S.length)return null;l&&(o=l);var x=this.softwareDecrypter;x||(x=this.softwareDecrypter=new M.default),x.expandKey(f);var C=s;return this.currentResult=x.decrypt(S.buffer,0,o),this.currentIV=Object(r.sliceUint8)(S,-16).buffer,C||null},p.webCryptoDecrypt=function(u,f,o){var l=this,s=this.subtle;return(this.key!==f||!this.fastAesKey)&&(this.key=f,this.fastAesKey=new H.default(s,f)),this.fastAesKey.expandKey().then(function(a){if(!s)return Promise.reject(new Error("web crypto not initialized"));var S=new J.default(s,o);return S.decrypt(u.buffer,a)}).catch(function(a){return l.onWebCryptoError(a,u,f,o)})},p.onWebCryptoError=function(u,f,o,l){return z.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",u),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(f,o,l)},p.getValidChunk=function(u){var f=u,o=u.length-u.length%O;return o!==u.length&&(f=Object(r.sliceUint8)(u,0,o),this.remainderData=Object(r.sliceUint8)(u,o)),f},p.logOnce=function(u){if(!this.logEnabled)return;z.logger.log("[decrypter.ts]: "+u),this.logEnabled=!1},m}()},"./src/crypt/fast-aes-key.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return J});var J=function(){function H(z,G){this.subtle=void 0,this.key=void 0,this.subtle=z,this.key=G}var M=H.prototype;return M.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},H}()},"./src/demux/aacdemuxer.ts":function(oe,Y,N){"use strict";N.r(Y);var J=N("./src/demux/base-audio-demuxer.ts"),H=N("./src/demux/adts.ts"),M=N("./src/utils/logger.ts"),z=N("./src/demux/id3.ts");function G(v,m){v.prototype=Object.create(m.prototype),v.prototype.constructor=v,r(v,m)}function r(v,m){return r=Object.setPrototypeOf||function(h,u){return h.__proto__=u,h},r(v,m)}var O=function(v){G(m,v);function m(h,u){var f;return f=v.call(this)||this,f.observer=void 0,f.config=void 0,f.observer=h,f.config=u,f}var p=m.prototype;return p.resetInitSegment=function(u,f,o){v.prototype.resetInitSegment.call(this,u,f,o),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:u,duration:o,inputTimeScale:9e4,dropped:0}},m.probe=function(u){if(!u)return!1;for(var f=z.getID3Data(u,0)||[],o=f.length,l=u.length;o<l;o++)if(H.probe(u,o))return M.logger.log("ADTS sync word found !"),!0;return!1},p.canParse=function(u,f){return H.canParse(u,f)},p.appendFrame=function(u,f,o){H.initTrackConfig(u,this.observer,f,o,u.manifestCodec);var l=H.appendFrame(u,f,o,this.initPTS,this.frameIndex);if(l&&l.missing===0)return l},m}(J.default);O.minProbeByteLength=9,Y.default=O},"./src/demux/adts.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"getAudioConfig",function(){return z}),N.d(Y,"isHeaderPattern",function(){return G}),N.d(Y,"getHeaderLength",function(){return r}),N.d(Y,"getFullFrameLength",function(){return O}),N.d(Y,"canGetFrameLength",function(){return v}),N.d(Y,"isHeader",function(){return m}),N.d(Y,"canParse",function(){return p}),N.d(Y,"probe",function(){return h}),N.d(Y,"initTrackConfig",function(){return u}),N.d(Y,"getFrameDuration",function(){return f}),N.d(Y,"parseFrameHeader",function(){return o}),N.d(Y,"appendFrame",function(){return l});var J=N("./src/utils/logger.ts"),H=N("./src/errors.ts"),M=N("./src/events.ts");function z(s,a,S,x){var C,D,L,R,A=navigator.userAgent.toLowerCase(),T=x,d=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];C=((a[S+2]&192)>>>6)+1;var w=(a[S+2]&60)>>>2;if(w>d.length-1){s.trigger(M.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+w});return}return L=(a[S+2]&1)<<2,L|=(a[S+3]&192)>>>6,J.logger.log("manifest codec:"+x+", ADTS type:"+C+", samplingIndex:"+w),/firefox/i.test(A)?w>=6?(C=5,R=new Array(4),D=w-3):(C=2,R=new Array(2),D=w):A.indexOf("android")!==-1?(C=2,R=new Array(2),D=w):(C=5,R=new Array(4),x&&(x.indexOf("mp4a.40.29")!==-1||x.indexOf("mp4a.40.5")!==-1)||!x&&w>=6?D=w-3:((x&&x.indexOf("mp4a.40.2")!==-1&&(w>=6&&L===1||/vivaldi/i.test(A))||!x&&L===1)&&(C=2,R=new Array(2)),D=w)),R[0]=C<<3,R[0]|=(w&14)>>1,R[1]|=(w&1)<<7,R[1]|=L<<3,C===5&&(R[1]|=(D&14)>>1,R[2]=(D&1)<<7,R[2]|=2<<2,R[3]=0),{config:R,samplerate:d[w],channelCount:L,codec:"mp4a.40."+C,manifestCodec:T}}function G(s,a){return s[a]===255&&(s[a+1]&246)===240}function r(s,a){return s[a+1]&1?7:9}function O(s,a){return(s[a+3]&3)<<11|s[a+4]<<3|(s[a+5]&224)>>>5}function v(s,a){return a+5<s.length}function m(s,a){return a+1<s.length&&G(s,a)}function p(s,a){return v(s,a)&&G(s,a)&&O(s,a)<=s.length-a}function h(s,a){if(m(s,a)){var S=r(s,a);if(a+S>=s.length)return!1;var x=O(s,a);if(x<=S)return!1;var C=a+x;return C===s.length||m(s,C)}return!1}function u(s,a,S,x,C){if(!s.samplerate){var D=z(a,S,x,C);if(!D)return;s.config=D.config,s.samplerate=D.samplerate,s.channelCount=D.channelCount,s.codec=D.codec,s.manifestCodec=D.manifestCodec,J.logger.log("parsed codec:"+s.codec+", rate:"+D.samplerate+", channels:"+D.channelCount)}}function f(s){return 1024*9e4/s}function o(s,a,S,x,C){var D=r(s,a),L=O(s,a);if(L-=D,L>0){var R=S+x*C;return{headerLength:D,frameLength:L,stamp:R}}}function l(s,a,S,x,C){var D=f(s.samplerate),L=o(a,S,x,C,D);if(L){var R=L.frameLength,A=L.headerLength,T=L.stamp,d=A+R,w=Math.max(0,S+d-a.length),y;w?(y=new Uint8Array(d-A),y.set(a.subarray(S+A,a.length),0)):y=a.subarray(S+A,S+d);var b={unit:y,pts:T};return w||s.samples.push(b),{sample:b,length:d,missing:w}}}},"./src/demux/base-audio-demuxer.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"initPTSFn",function(){return O});var J=N("./src/polyfills/number.ts"),H=N("./src/demux/id3.ts"),M=N("./src/demux/dummy-demuxed-track.ts"),z=N("./src/utils/mp4-tools.ts"),G=N("./src/utils/typed-array.ts"),r=function(){function v(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var m=v.prototype;return m.resetInitSegment=function(h,u,f){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},m.resetTimeStamp=function(){},m.resetContiguity=function(){},m.canParse=function(h,u){return!1},m.appendFrame=function(h,u,f){},m.demux=function(h,u){this.cachedData&&(h=Object(z.appendUint8Array)(this.cachedData,h),this.cachedData=null);var f=H.getID3Data(h,0),o=f?f.length:0,l,s,a=this._audioTrack,S=this._id3Track,x=f?H.getTimeStamp(f):void 0,C=h.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=O(x,u)),f&&f.length>0&&S.samples.push({pts:this.initPTS,dts:this.initPTS,data:f}),s=this.initPTS;o<C;){if(this.canParse(h,o)){var D=this.appendFrame(a,h,o);D?(this.frameIndex++,s=D.sample.pts,o+=D.length,l=o):o=C}else H.canParse(h,o)?(f=H.getID3Data(h,o),S.samples.push({pts:s,dts:s,data:f}),o+=f.length,l=o):o++;if(o===C&&l!==C){var L=Object(G.sliceUint8)(h,l);this.cachedData?this.cachedData=Object(z.appendUint8Array)(this.cachedData,L):this.cachedData=L}}return{audioTrack:a,avcTrack:Object(M.dummyTrack)(),id3Track:S,textTrack:Object(M.dummyTrack)()}},m.demuxSampleAes=function(h,u,f){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},m.flush=function(h){var u=this.cachedData;return u&&(this.cachedData=null,this.demux(u,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(M.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(M.dummyTrack)()}},m.destroy=function(){},v}(),O=function(m,p){return Object(J.isFiniteNumber)(m)?m*90:p*9e4};Y.default=r},"./src/demux/chunk-cache.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return J});var J=function(){function M(){this.chunks=[],this.dataLength=0}var z=M.prototype;return z.push=function(r){this.chunks.push(r),this.dataLength+=r.length},z.flush=function(){var r=this.chunks,O=this.dataLength,v;if(r.length)r.length===1?v=r[0]:v=H(r,O);else return new Uint8Array(0);return this.reset(),v},z.reset=function(){this.chunks.length=0,this.dataLength=0},M}();function H(M,z){for(var G=new Uint8Array(z),r=0,O=0;O<M.length;O++){var v=M[O];G.set(v,r),r+=v.length}return G}},"./src/demux/dummy-demuxed-track.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"dummyTrack",function(){return J});function J(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(oe,Y,N){"use strict";N.r(Y);var J=N("./src/utils/logger.ts"),H=function(){function M(G){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=G,this.bytesAvailable=G.byteLength,this.word=0,this.bitsAvailable=0}var z=M.prototype;return z.loadWord=function(){var r=this.data,O=this.bytesAvailable,v=r.byteLength-O,m=new Uint8Array(4),p=Math.min(4,O);if(p===0)throw new Error("no bytes available");m.set(r.subarray(v,v+p)),this.word=new DataView(m.buffer).getUint32(0),this.bitsAvailable=p*8,this.bytesAvailable-=p},z.skipBits=function(r){var O;this.bitsAvailable>r?(this.word<<=r,this.bitsAvailable-=r):(r-=this.bitsAvailable,O=r>>3,r-=O>>3,this.bytesAvailable-=O,this.loadWord(),this.word<<=r,this.bitsAvailable-=r)},z.readBits=function(r){var O=Math.min(this.bitsAvailable,r),v=this.word>>>32-O;return r>32&&J.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=O,this.bitsAvailable>0?this.word<<=O:this.bytesAvailable>0&&this.loadWord(),O=r-O,O>0&&this.bitsAvailable?v<<O|this.readBits(O):v},z.skipLZ=function(){var r;for(r=0;r<this.bitsAvailable;++r)if((this.word&2147483648>>>r)!==0)return this.word<<=r,this.bitsAvailable-=r,r;return this.loadWord(),r+this.skipLZ()},z.skipUEG=function(){this.skipBits(1+this.skipLZ())},z.skipEG=function(){this.skipBits(1+this.skipLZ())},z.readUEG=function(){var r=this.skipLZ();return this.readBits(r+1)-1},z.readEG=function(){var r=this.readUEG();return 1&r?1+r>>>1:-1*(r>>>1)},z.readBoolean=function(){return this.readBits(1)===1},z.readUByte=function(){return this.readBits(8)},z.readUShort=function(){return this.readBits(16)},z.readUInt=function(){return this.readBits(32)},z.skipScalingList=function(r){for(var O=8,v=8,m,p=0;p<r;p++)v!==0&&(m=this.readEG(),v=(O+m+256)%256),O=v===0?O:v},z.readSPS=function(){var r=0,O=0,v=0,m=0,p,h,u,f=this.readUByte.bind(this),o=this.readBits.bind(this),l=this.readUEG.bind(this),s=this.readBoolean.bind(this),a=this.skipBits.bind(this),S=this.skipEG.bind(this),x=this.skipUEG.bind(this),C=this.skipScalingList.bind(this);f();var D=f();if(o(5),a(3),f(),x(),D===100||D===110||D===122||D===244||D===44||D===83||D===86||D===118||D===128){var L=l();if(L===3&&a(1),x(),x(),a(1),s())for(h=L!==3?8:12,u=0;u<h;u++)s()&&(u<6?C(16):C(64))}x();var R=l();if(R===0)l();else if(R===1)for(a(1),S(),S(),p=l(),u=0;u<p;u++)S();x(),a(1);var A=l(),T=l(),d=o(1);d===0&&a(1),a(1),s()&&(r=l(),O=l(),v=l(),m=l());var w=[1,1];if(s()&&s()){var y=f();switch(y){case 1:w=[1,1];break;case 2:w=[12,11];break;case 3:w=[10,11];break;case 4:w=[16,11];break;case 5:w=[40,33];break;case 6:w=[24,11];break;case 7:w=[20,11];break;case 8:w=[32,11];break;case 9:w=[80,33];break;case 10:w=[18,11];break;case 11:w=[15,11];break;case 12:w=[64,33];break;case 13:w=[160,99];break;case 14:w=[4,3];break;case 15:w=[3,2];break;case 16:w=[2,1];break;case 255:{w=[f()<<8|f(),f()<<8|f()];break}}}return{width:Math.ceil((A+1)*16-r*2-O*2),height:(2-d)*(T+1)*16-(d?2:4)*(v+m),pixelRatio:w}},z.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},M}();Y.default=H},"./src/demux/id3.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"isHeader",function(){return J}),N.d(Y,"isFooter",function(){return H}),N.d(Y,"getID3Data",function(){return M}),N.d(Y,"canParse",function(){return G}),N.d(Y,"getTimeStamp",function(){return r}),N.d(Y,"isTimeStampFrame",function(){return O}),N.d(Y,"getID3Frames",function(){return m}),N.d(Y,"decodeFrame",function(){return p}),N.d(Y,"utf8ArrayToStr",function(){return l}),N.d(Y,"testables",function(){return s});var J=function(C,D){return D+10<=C.length&&(C[D]===73&&C[D+1]===68&&C[D+2]===51&&(C[D+3]<255&&C[D+4]<255&&(C[D+6]<128&&C[D+7]<128&&C[D+8]<128&&C[D+9]<128)))},H=function(C,D){return D+10<=C.length&&(C[D]===51&&C[D+1]===68&&C[D+2]===73&&(C[D+3]<255&&C[D+4]<255&&(C[D+6]<128&&C[D+7]<128&&C[D+8]<128&&C[D+9]<128)))},M=function(C,D){for(var L=D,R=0;J(C,D);){R+=10;var A=z(C,D+6);R+=A,H(C,D+10)&&(R+=10),D+=R}return R>0?C.subarray(L,L+R):void 0},z=function(C,D){var L=0;return L=(C[D]&127)<<21,L|=(C[D+1]&127)<<14,L|=(C[D+2]&127)<<7,L|=C[D+3]&127,L},G=function(C,D){return J(C,D)&&z(C,D+6)+10<=C.length-D},r=function(C){for(var D=m(C),L=0;L<D.length;L++){var R=D[L];if(O(R))return o(R)}return},O=function(C){return C&&C.key==="PRIV"&&C.info==="com.apple.streaming.transportStreamTimestamp"},v=function(C){var D=String.fromCharCode(C[0],C[1],C[2],C[3]),L=z(C,4),R=10;return{type:D,size:L,data:C.subarray(R,R+L)}},m=function(C){for(var D=0,L=[];J(C,D);){var R=z(C,D+6);D+=10;for(var A=D+R;D+8<A;){var T=v(C.subarray(D)),d=p(T);d&&L.push(d),D+=T.size+10}H(C,D)&&(D+=10)}return L},p=function(C){return C.type==="PRIV"?h(C):C.type[0]==="W"?f(C):u(C)},h=function(C){if(C.size<2)return;var D=l(C.data,!0),L=new Uint8Array(C.data.subarray(D.length+1));return{key:C.type,info:D,data:L.buffer}},u=function(C){if(C.size<2)return;if(C.type==="TXXX"){var D=1,L=l(C.data.subarray(D),!0);D+=L.length+1;var R=l(C.data.subarray(D));return{key:C.type,info:L,data:R}}var A=l(C.data.subarray(1));return{key:C.type,data:A}},f=function(C){if(C.type==="WXXX"){if(C.size<2)return;var D=1,L=l(C.data.subarray(D),!0);D+=L.length+1;var R=l(C.data.subarray(D));return{key:C.type,info:L,data:R}}var A=l(C.data);return{key:C.type,data:A}},o=function(C){if(C.data.byteLength===8){var D=new Uint8Array(C.data),L=D[3]&1,R=(D[4]<<23)+(D[5]<<15)+(D[6]<<7)+D[7];return R/=45,L&&(R+=4772185884e-2),Math.round(R)}return},l=function(C,D){D===void 0&&(D=!1);var L=S();if(L){var R=L.decode(C);if(D){var A=R.indexOf("\0");return A!==-1?R.substring(0,A):R}return R.replace(/\0/g,"")}for(var T=C.length,d,w,y,b="",j=0;j<T;){if(d=C[j++],d===0&&D)return b;if(d===0||d===3)continue;switch(d>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:b+=String.fromCharCode(d);break;case 12:case 13:w=C[j++],b+=String.fromCharCode((d&31)<<6|w&63);break;case 14:w=C[j++],y=C[j++],b+=String.fromCharCode((d&15)<<12|(w&63)<<6|(y&63)<<0);break;default:}}return b},s={decodeTextFrame:u},a;function S(){return!a&&typeof self.TextDecoder!="undefined"&&(a=new self.TextDecoder("utf-8")),a}},"./src/demux/mp3demuxer.ts":function(oe,Y,N){"use strict";N.r(Y);var J=N("./src/demux/base-audio-demuxer.ts"),H=N("./src/demux/id3.ts"),M=N("./src/utils/logger.ts"),z=N("./src/demux/mpegaudio.ts");function G(v,m){v.prototype=Object.create(m.prototype),v.prototype.constructor=v,r(v,m)}function r(v,m){return r=Object.setPrototypeOf||function(h,u){return h.__proto__=u,h},r(v,m)}var O=function(v){G(m,v);function m(){return v.apply(this,arguments)||this}var p=m.prototype;return p.resetInitSegment=function(u,f,o){v.prototype.resetInitSegment.call(this,u,f,o),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:u,duration:o,inputTimeScale:9e4,dropped:0}},m.probe=function(u){if(!u)return!1;for(var f=H.getID3Data(u,0)||[],o=f.length,l=u.length;o<l;o++)if(z.probe(u,o))return M.logger.log("MPEG Audio sync word found !"),!0;return!1},p.canParse=function(u,f){return z.canParse(u,f)},p.appendFrame=function(u,f,o){return this.initPTS===null?void 0:z.appendFrame(u,f,o,this.initPTS,this.frameIndex)},m}(J.default);O.minProbeByteLength=4,Y.default=O},"./src/demux/mp4demuxer.ts":function(oe,Y,N){"use strict";N.r(Y);var J=N("./src/utils/mp4-tools.ts"),H=N("./src/demux/dummy-demuxed-track.ts"),M=function(){function z(r,O){this.remainderData=null,this.config=void 0,this.config=O}var G=z.prototype;return G.resetTimeStamp=function(){},G.resetInitSegment=function(){},G.resetContiguity=function(){},z.probe=function(O){return Object(J.findBox)({data:O,start:0,end:Math.min(O.length,16384)},["moof"]).length>0},G.demux=function(O){var v=O,m=Object(H.dummyTrack)();if(this.config.progressive){this.remainderData&&(v=Object(J.appendUint8Array)(this.remainderData,O));var p=Object(J.segmentValidRange)(v);this.remainderData=p.remainder,m.samples=p.valid||new Uint8Array}else m.samples=v;return{audioTrack:Object(H.dummyTrack)(),avcTrack:m,id3Track:Object(H.dummyTrack)(),textTrack:Object(H.dummyTrack)()}},G.flush=function(){var O=Object(H.dummyTrack)();return O.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(H.dummyTrack)(),avcTrack:O,id3Track:Object(H.dummyTrack)(),textTrack:Object(H.dummyTrack)()}},G.demuxSampleAes=function(O,v,m){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},G.destroy=function(){},z}();M.minProbeByteLength=1024,Y.default=M},"./src/demux/mpegaudio.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"appendFrame",function(){return r}),N.d(Y,"parseHeader",function(){return O}),N.d(Y,"isHeaderPattern",function(){return v}),N.d(Y,"isHeader",function(){return m}),N.d(Y,"canParse",function(){return p}),N.d(Y,"probe",function(){return h});var J=null,H=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],M=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],z=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],G=[0,1,1,4];function r(u,f,o,l,s){if(o+24>f.length)return;var a=O(f,o);if(a&&o+a.frameLength<=f.length){var S=a.samplesPerFrame*9e4/a.sampleRate,x=l+s*S,C={unit:f.subarray(o,o+a.frameLength),pts:x,dts:x};return u.config=[],u.channelCount=a.channelCount,u.samplerate=a.sampleRate,u.samples.push(C),{sample:C,length:a.frameLength,missing:0}}}function O(u,f){var o=u[f+1]>>3&3,l=u[f+1]>>1&3,s=u[f+2]>>4&15,a=u[f+2]>>2&3;if(o!==1&&s!==0&&s!==15&&a!==3){var S=u[f+2]>>1&1,x=u[f+3]>>6,C=o===3?3-l:l===3?3:4,D=H[C*14+s-1]*1e3,L=o===3?0:o===2?1:2,R=M[L*3+a],A=x===3?1:2,T=z[o][l],d=G[l],w=T*8*d,y=Math.floor(T*D/R+S)*d;if(J===null){var b=navigator.userAgent||"",j=b.match(/Chrome\/(\d+)/i);J=j?parseInt(j[1]):0}var B=!!J&&J<=87;return B&&l===2&&D>=224e3&&x===0&&(u[f+3]=u[f+3]|128),{sampleRate:R,channelCount:A,frameLength:y,samplesPerFrame:w}}}function v(u,f){return u[f]===255&&(u[f+1]&224)===224&&(u[f+1]&6)!==0}function m(u,f){return f+1<u.length&&v(u,f)}function p(u,f){var o=4;return v(u,f)&&o<=u.length-f}function h(u,f){if(f+1<u.length&&v(u,f)){var o=4,l=O(u,f),s=o;l!=null&&l.frameLength&&(s=l.frameLength);var a=f+s;return a===u.length||m(u,a)}return!1}},"./src/demux/sample-aes.ts":function(oe,Y,N){"use strict";N.r(Y);var J=N("./src/crypt/decrypter.ts"),H=N("./src/demux/tsdemuxer.ts"),M=function(){function z(r,O,v){this.keyData=void 0,this.decrypter=void 0,this.keyData=v,this.decrypter=new J.default(r,O,{removePKCS7Padding:!1})}var G=z.prototype;return G.decryptBuffer=function(O,v){this.decrypter.decrypt(O,this.keyData.key.buffer,this.keyData.iv.buffer,v)},G.decryptAacSample=function(O,v,m,p){var h=O[v].unit,u=h.subarray(16,h.length-h.length%16),f=u.buffer.slice(u.byteOffset,u.byteOffset+u.length),o=this;this.decryptBuffer(f,function(l){var s=new Uint8Array(l);h.set(s,16),p||o.decryptAacSamples(O,v+1,m)})},G.decryptAacSamples=function(O,v,m){for(;;v++){if(v>=O.length){m();return}if(O[v].unit.length<32)continue;var p=this.decrypter.isSync();if(this.decryptAacSample(O,v,m,p),!p)return}},G.getAvcEncryptedData=function(O){for(var v=Math.floor((O.length-48)/160)*16+16,m=new Int8Array(v),p=0,h=32;h<=O.length-16;h+=160,p+=16)m.set(O.subarray(h,h+16),p);return m},G.getAvcDecryptedUnit=function(O,v){for(var m=new Uint8Array(v),p=0,h=32;h<=O.length-16;h+=160,p+=16)O.set(m.subarray(p,p+16),h);return O},G.decryptAvcSample=function(O,v,m,p,h,u){var f=Object(H.discardEPB)(h.data),o=this.getAvcEncryptedData(f),l=this;this.decryptBuffer(o.buffer,function(s){h.data=l.getAvcDecryptedUnit(f,s),u||l.decryptAvcSamples(O,v,m+1,p)})},G.decryptAvcSamples=function(O,v,m,p){if(O instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;v++,m=0){if(v>=O.length){p();return}for(var h=O[v].units;!(m>=h.length);m++){var u=h[m];if(u.data.length<=48||u.type!==1&&u.type!==5)continue;var f=this.decrypter.isSync();if(this.decryptAvcSample(O,v,m,p,u,f),!f)return}}},z}();Y.default=M},"./src/demux/transmuxer-interface.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return h});var J=N("./node_modules/webworkify-webpack/index.js"),H=N.n(J),M=N("./src/events.ts"),z=N("./src/demux/transmuxer.ts"),G=N("./src/utils/logger.ts"),r=N("./src/errors.ts"),O=N("./src/utils/mediasource-helper.ts"),v=N("./node_modules/eventemitter3/index.js"),m=N.n(v),p=Object(O.getMediaSource)()||{isTypeSupported:function(){return!1}},h=function(){function u(o,l,s,a){var S=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=l,this.onTransmuxComplete=s,this.onFlush=a;var x=o.config,C=function(T,d){d=d||{},d.frag=S.frag,d.id=S.id,o.trigger(T,d)};this.observer=new v.EventEmitter,this.observer.on(M.Events.FRAG_DECRYPTED,C),this.observer.on(M.Events.ERROR,C);var D={mp4:p.isTypeSupported("video/mp4"),mpeg:p.isTypeSupported("audio/mpeg"),mp3:p.isTypeSupported('audio/mp4; codecs="mp3"')},L=navigator.vendor;if(x.enableWorker&&typeof Worker!="undefined"){G.logger.log("demuxing in webworker");var R;try{R=this.worker=J("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),R.addEventListener("message",this.onwmsg),R.onerror=function(A){o.trigger(M.Events.ERROR,{type:r.ErrorTypes.OTHER_ERROR,details:r.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(A.message+" ("+A.filename+":"+A.lineno+")")})},R.postMessage({cmd:"init",typeSupported:D,vendor:L,id:l,config:JSON.stringify(x)})}catch(A){G.logger.warn("Error in worker:",A),G.logger.error("Error while initializing DemuxerWorker, fallback to inline"),R&&self.URL.revokeObjectURL(R.objectURL),this.transmuxer=new z.default(this.observer,D,x,L,l),this.worker=null}}else this.transmuxer=new z.default(this.observer,D,x,L,l)}var f=u.prototype;return f.destroy=function(){var l=this.worker;if(l)l.removeEventListener("message",this.onwmsg),l.terminate(),this.worker=null;else{var s=this.transmuxer;s&&(s.destroy(),this.transmuxer=null)}var a=this.observer;a&&a.removeAllListeners(),this.observer=null},f.push=function(l,s,a,S,x,C,D,L,R,A){var T=this;R.transmuxing.start=self.performance.now();var d=this.transmuxer,w=this.worker,y=C?C.start:x.start,b=x.decryptdata,j=this.frag,B=!(j&&x.cc===j.cc),E=!(j&&R.level===j.level),F=j?R.sn-j.sn:-1,I=this.part?R.part-this.part.index:1,g=!E&&(F===1||F===0&&I===1),W=self.performance.now();(E||F||x.stats.parsing.start===0)&&(x.stats.parsing.start=W),C&&(I||!g)&&(C.stats.parsing.start=W);var $=new z.TransmuxState(B,g,L,E,y);if(!g||B){G.logger.log("[transmuxer-interface, "+x.type+"]: Starting new transmux session for sn: "+R.sn+" p: "+R.part+" level: "+R.level+" id: "+R.id+`
|
|
discontinuity: `+B+`
|
|
trackSwitch: `+E+`
|
|
contiguous: `+g+`
|
|
accurateTimeOffset: `+L+`
|
|
timeOffset: `+y);var le=new z.TransmuxConfig(a,S,s,D,A);this.configureTransmuxer(le)}if(this.frag=x,this.part=C,w)w.postMessage({cmd:"demux",data:l,decryptdata:b,chunkMeta:R,state:$},l instanceof ArrayBuffer?[l]:[]);else if(d){var de=d.push(l,b,R,$);Object(z.isPromise)(de)?de.then(function(Ce){T.handleTransmuxComplete(Ce)}):this.handleTransmuxComplete(de)}},f.flush=function(l){var s=this;l.transmuxing.start=self.performance.now();var a=this.transmuxer,S=this.worker;if(S)S.postMessage({cmd:"flush",chunkMeta:l});else if(a){var x=a.flush(l);Object(z.isPromise)(x)?x.then(function(C){s.handleFlushResult(C,l)}):this.handleFlushResult(x,l)}},f.handleFlushResult=function(l,s){var a=this;l.forEach(function(S){a.handleTransmuxComplete(S)}),this.onFlush(s)},f.onWorkerMessage=function(l){var s=l.data,a=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,a.trigger(s.event,s.data);break}}},f.configureTransmuxer=function(l){var s=this.worker,a=this.transmuxer;s?s.postMessage({cmd:"configure",config:l}):a&&a.configure(l)},f.handleTransmuxComplete=function(l){l.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(l)},u}()},"./src/demux/transmuxer-worker.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return r});var J=N("./src/demux/transmuxer.ts"),H=N("./src/events.ts"),M=N("./src/utils/logger.ts"),z=N("./node_modules/eventemitter3/index.js"),G=N.n(z);function r(h){var u=new z.EventEmitter,f=function(l,s){h.postMessage({event:l,data:s})};u.on(H.Events.FRAG_DECRYPTED,f),u.on(H.Events.ERROR,f),h.addEventListener("message",function(o){var l=o.data;switch(l.cmd){case"init":{var s=JSON.parse(l.config);h.transmuxer=new J.default(u,l.typeSupported,s,l.vendor,l.id),Object(M.enableLogs)(s.debug),f("init",null);break}case"configure":{h.transmuxer.configure(l.config);break}case"demux":{var a=h.transmuxer.push(l.data,l.decryptdata,l.chunkMeta,l.state);Object(J.isPromise)(a)?a.then(function(C){O(h,C)}):O(h,a);break}case"flush":{var S=l.chunkMeta,x=h.transmuxer.flush(S);Object(J.isPromise)(x)?x.then(function(C){m(h,C,S)}):m(h,x,S);break}default:break}})}function O(h,u){if(p(u.remuxResult))return;var f=[],o=u.remuxResult,l=o.audio,s=o.video;l&&v(f,l),s&&v(f,s),h.postMessage({event:"transmuxComplete",data:u},f)}function v(h,u){u.data1&&h.push(u.data1.buffer),u.data2&&h.push(u.data2.buffer)}function m(h,u,f){u.forEach(function(o){O(h,o)}),h.postMessage({event:"flush",data:f})}function p(h){return!h.audio&&!h.video&&!h.text&&!h.id3&&!h.initSegment}},"./src/demux/transmuxer.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return s}),N.d(Y,"isPromise",function(){return x}),N.d(Y,"TransmuxConfig",function(){return C}),N.d(Y,"TransmuxState",function(){return D});var J=N("./src/events.ts"),H=N("./src/errors.ts"),M=N("./src/crypt/decrypter.ts"),z=N("./src/demux/aacdemuxer.ts"),G=N("./src/demux/mp4demuxer.ts"),r=N("./src/demux/tsdemuxer.ts"),O=N("./src/demux/mp3demuxer.ts"),v=N("./src/remux/mp4-remuxer.ts"),m=N("./src/remux/passthrough-remuxer.ts"),p=N("./src/demux/chunk-cache.ts"),h=N("./src/utils/mp4-tools.ts"),u=N("./src/utils/logger.ts"),f;try{f=self.performance.now.bind(self.performance)}catch(L){u.logger.debug("Unable to use Performance API on this environment"),f=self.Date.now}var o=[{demux:r.default,remux:v.default},{demux:G.default,remux:m.default},{demux:z.default,remux:v.default},{demux:O.default,remux:v.default}],l=1024;o.forEach(function(L){var R=L.demux;l=Math.max(l,R.minProbeByteLength)});var s=function(){function L(A,T,d,w,y){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 p.default,this.observer=A,this.typeSupported=T,this.config=d,this.vendor=w,this.id=y}var R=L.prototype;return R.configure=function(T){this.transmuxConfig=T,this.decrypter&&this.decrypter.reset()},R.push=function(T,d,w,y){var b=this,j=w.transmuxing;j.executeStart=f();var B=new Uint8Array(T),E=this.cache,F=this.config,I=this.currentTransmuxState,g=this.transmuxConfig;y&&(this.currentTransmuxState=y);var W=a(B,d);if(W&&W.method==="AES-128"){var $=this.getDecrypter();if(F.enableSoftwareAES){var le=$.softwareDecrypt(B,W.key.buffer,W.iv.buffer);if(!le)return j.executeEnd=f(),S(w);B=new Uint8Array(le)}else return this.decryptionPromise=$.webCryptoDecrypt(B,W.key.buffer,W.iv.buffer).then(function(xe){var De=b.push(xe,null,w);return b.decryptionPromise=null,De}),this.decryptionPromise}var de=y||I,Ce=de.contiguous,be=de.discontinuity,Ae=de.trackSwitch,Se=de.accurateTimeOffset,Re=de.timeOffset,ve=g.audioCodec,X=g.videoCodec,_=g.defaultInitPts,k=g.duration,U=g.initSegmentData;if((be||Ae)&&this.resetInitSegment(U,ve,X,k),be&&this.resetInitialTimestamp(_),Ce||this.resetContiguity(),this.needsProbing(B,be,Ae)){if(E.dataLength){var Q=E.flush();B=Object(h.appendUint8Array)(Q,B)}this.configureTransmuxer(B,g)}var K=this.transmux(B,W,Re,Se,w),ce=this.currentTransmuxState;return ce.contiguous=!0,ce.discontinuity=!1,ce.trackSwitch=!1,j.executeEnd=f(),K},R.flush=function(T){var d=this,w=T.transmuxing;w.executeStart=f();var y=this.decrypter,b=this.cache,j=this.currentTransmuxState,B=this.decryptionPromise;if(B)return B.then(function(){return d.flush(T)});var E=[],F=j.timeOffset;if(y){var I=y.flush();I&&E.push(this.push(I,null,T))}var g=b.dataLength;b.reset();var W=this.demuxer,$=this.remuxer;if(!W||!$)return g>=l&&this.observer.emit(J.Events.ERROR,J.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),w.executeEnd=f(),[S(T)];var le=W.flush(F);return x(le)?le.then(function(de){return d.flushRemux(E,de,T),E}):(this.flushRemux(E,le,T),E)},R.flushRemux=function(T,d,w){var y=d.audioTrack,b=d.avcTrack,j=d.id3Track,B=d.textTrack,E=this.currentTransmuxState,F=E.accurateTimeOffset,I=E.timeOffset;u.logger.log("[transmuxer.ts]: Flushed fragment "+w.sn+(w.part>-1?" p: "+w.part:"")+" of level "+w.level);var g=this.remuxer.remux(y,b,j,B,I,F,!0,this.id);T.push({remuxResult:g,chunkMeta:w}),w.transmuxing.executeEnd=f()},R.resetInitialTimestamp=function(T){var d=this.demuxer,w=this.remuxer;if(!d||!w)return;d.resetTimeStamp(T),w.resetTimeStamp(T)},R.resetContiguity=function(){var T=this.demuxer,d=this.remuxer;if(!T||!d)return;T.resetContiguity(),d.resetNextTimestamp()},R.resetInitSegment=function(T,d,w,y){var b=this.demuxer,j=this.remuxer;if(!b||!j)return;b.resetInitSegment(d,w,y),j.resetInitSegment(T,d,w)},R.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},R.transmux=function(T,d,w,y,b){var j;return d&&d.method==="SAMPLE-AES"?j=this.transmuxSampleAes(T,d,w,y,b):j=this.transmuxUnencrypted(T,w,y,b),j},R.transmuxUnencrypted=function(T,d,w,y){var b=this.demuxer.demux(T,d,!1,!this.config.progressive),j=b.audioTrack,B=b.avcTrack,E=b.id3Track,F=b.textTrack,I=this.remuxer.remux(j,B,E,F,d,w,!1,this.id);return{remuxResult:I,chunkMeta:y}},R.transmuxSampleAes=function(T,d,w,y,b){var j=this;return this.demuxer.demuxSampleAes(T,d,w).then(function(B){var E=j.remuxer.remux(B.audioTrack,B.avcTrack,B.id3Track,B.textTrack,w,y,!1,j.id);return{remuxResult:E,chunkMeta:b}})},R.configureTransmuxer=function(T,d){for(var w=this.config,y=this.observer,b=this.typeSupported,j=this.vendor,B=d.audioCodec,E=d.defaultInitPts,F=d.duration,I=d.initSegmentData,g=d.videoCodec,W,$=0,le=o.length;$<le;$++)if(o[$].demux.probe(T)){W=o[$];break}W||(u.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),W={demux:G.default,remux:m.default});var de=this.demuxer,Ce=this.remuxer,be=W.remux,Ae=W.demux;(!Ce||!(Ce instanceof be))&&(this.remuxer=new be(y,w,b,j)),(!de||!(de instanceof Ae))&&(this.demuxer=new Ae(y,w,b),this.probe=Ae.probe),this.resetInitSegment(I,B,g,F),this.resetInitialTimestamp(E)},R.needsProbing=function(T,d,w){return!this.demuxer||!this.remuxer||d||w},R.getDecrypter=function(){var T=this.decrypter;return T||(T=this.decrypter=new M.default(this.observer,this.config)),T},L}();function a(L,R){var A=null;return L.byteLength>0&&R!=null&&R.key!=null&&R.iv!==null&&R.method!=null&&(A=R),A}var S=function(R){return{remuxResult:{},chunkMeta:R}};function x(L){return"then"in L&&L.then instanceof Function}var C=function(R,A,T,d,w){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=R,this.videoCodec=A,this.initSegmentData=T,this.duration=d,this.defaultInitPts=w},D=function(R,A,T,d,w){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=R,this.contiguous=A,this.accurateTimeOffset=T,this.trackSwitch=d,this.timeOffset=w}},"./src/demux/tsdemuxer.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"discardEPB",function(){return S});var J=N("./src/demux/adts.ts"),H=N("./src/demux/mpegaudio.ts"),M=N("./src/demux/exp-golomb.ts"),z=N("./src/demux/id3.ts"),G=N("./src/demux/sample-aes.ts"),r=N("./src/events.ts"),O=N("./src/utils/mp4-tools.ts"),v=N("./src/utils/logger.ts"),m=N("./src/errors.ts"),p={video:1,audio:2,id3:3,text:4},h=function(){function x(D,L,R){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=D,this.config=L,this.typeSupported=R}x.probe=function(L){var R=x.syncOffset(L);return R<0?!1:(R&&v.logger.warn("MPEG2-TS detected but first sync word found @ offset "+R+", junk ahead ?"),!0)},x.syncOffset=function(L){for(var R=Math.min(1e3,L.length-3*188),A=0;A<R;){if(L[A]===71&&L[A+188]===71&&L[A+2*188]===71)return A;A++}return-1},x.createTrack=function(L,R){return{container:L==="video"||L==="audio"?"video/mp2t":void 0,type:L,id:p[L],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:L==="audio"?R:void 0}};var C=x.prototype;return C.resetInitSegment=function(L,R,A){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=x.createTrack("video",A),this._audioTrack=x.createTrack("audio",A),this._id3Track=x.createTrack("id3",A),this._txtTrack=x.createTrack("text",A),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=L,this.videoCodec=R,this._duration=A},C.resetTimeStamp=function(){},C.resetContiguity=function(){var L=this._audioTrack,R=this._avcTrack,A=this._id3Track;L&&(L.pesData=null),R&&(R.pesData=null),A&&(A.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},C.demux=function(L,R,A,T){A===void 0&&(A=!1),T===void 0&&(T=!1),A||(this.sampleAes=null);var d,w=this._avcTrack,y=this._audioTrack,b=this._id3Track,j=w.pid,B=w.pesData,E=y.pid,F=b.pid,I=y.pesData,g=b.pesData,W=!1,$=this.pmtParsed,le=this._pmtId,de=L.length;if(this.remainderData&&(L=Object(O.appendUint8Array)(this.remainderData,L),de=L.length,this.remainderData=null),de<188&&!T)return this.remainderData=L,{audioTrack:y,avcTrack:w,id3Track:b,textTrack:this._txtTrack};var Ce=Math.max(0,x.syncOffset(L));de-=(de+Ce)%188,de<L.byteLength&&!T&&(this.remainderData=new Uint8Array(L.buffer,de,L.buffer.byteLength-de));for(var be=Ce;be<de;be+=188)if(L[be]===71){var Ae=!!(L[be+1]&64),Se=((L[be+1]&31)<<8)+L[be+2],Re=(L[be+3]&48)>>4,ve=void 0;if(Re>1){if(ve=be+5+L[be+4],ve===be+188)continue}else ve=be+4;switch(Se){case j:Ae&&(B&&(d=l(B))&&this.parseAVCPES(d,!1),B={data:[],size:0}),B&&(B.data.push(L.subarray(ve,be+188)),B.size+=be+188-ve);break;case E:Ae&&(I&&(d=l(I))&&(y.isAAC?this.parseAACPES(d):this.parseMPEGPES(d)),I={data:[],size:0}),I&&(I.data.push(L.subarray(ve,be+188)),I.size+=be+188-ve);break;case F:Ae&&(g&&(d=l(g))&&this.parseID3PES(d),g={data:[],size:0}),g&&(g.data.push(L.subarray(ve,be+188)),g.size+=be+188-ve);break;case 0:Ae&&(ve+=L[ve]+1),le=this._pmtId=f(L,ve);break;case le:{Ae&&(ve+=L[ve]+1);var X=o(L,ve,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,A);j=X.avc,j>0&&(w.pid=j),E=X.audio,E>0&&(y.pid=E,y.isAAC=X.isAAC),F=X.id3,F>0&&(b.pid=F),W&&!$&&(v.logger.log("reparse from beginning"),W=!1,be=Ce-188),$=this.pmtParsed=!0;break}case 17:case 8191:break;default:W=!0;break}}else this.observer.emit(r.Events.ERROR,r.Events.ERROR,{type:m.ErrorTypes.MEDIA_ERROR,details:m.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});w.pesData=B,y.pesData=I,b.pesData=g;var _={audioTrack:y,avcTrack:w,id3Track:b,textTrack:this._txtTrack};return T&&this.extractRemainingSamples(_),_},C.flush=function(){var L=this.remainderData;this.remainderData=null;var R;return L?R=this.demux(L,-1,!1,!0):R={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(R),this.sampleAes?this.decrypt(R,this.sampleAes):R},C.extractRemainingSamples=function(L){var R=L.audioTrack,A=L.avcTrack,T=L.id3Track,d=A.pesData,w=R.pesData,y=T.pesData,b;d&&(b=l(d))?(this.parseAVCPES(b,!0),A.pesData=null):A.pesData=d,w&&(b=l(w))?(R.isAAC?this.parseAACPES(b):this.parseMPEGPES(b),R.pesData=null):(w!=null&&w.size&&v.logger.log("last AAC PES packet truncated,might overlap between fragments"),R.pesData=w),y&&(b=l(y))?(this.parseID3PES(b),T.pesData=null):T.pesData=y},C.demuxSampleAes=function(L,R,A){var T=this.demux(L,A,!0,!this.config.progressive),d=this.sampleAes=new G.default(this.observer,this.config,R);return this.decrypt(T,d)},C.decrypt=function(L,R){return new Promise(function(A){var T=L.audioTrack,d=L.avcTrack;T.samples&&T.isAAC?R.decryptAacSamples(T.samples,0,function(){d.samples?R.decryptAvcSamples(d.samples,0,0,function(){A(L)}):A(L)}):d.samples&&R.decryptAvcSamples(d.samples,0,0,function(){A(L)})})},C.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},C.parseAVCPES=function(L,R){var A=this,T=this._avcTrack,d=this.parseAVCNALu(L.data),w=!1,y=this.avcSample,b,j=!1;L.data=null,y&&d.length&&!T.audFound&&(s(y,T),y=this.avcSample=u(!1,L.pts,L.dts,"")),d.forEach(function(B){switch(B.type){case 1:{b=!0,y||(y=A.avcSample=u(!0,L.pts,L.dts,"")),w&&(y.debug+="NDR "),y.frame=!0;var E=B.data;if(j&&E.length>4){var F=new M.default(E).readSliceType();(F===2||F===4||F===7||F===9)&&(y.key=!0)}break}case 5:b=!0,y||(y=A.avcSample=u(!0,L.pts,L.dts,"")),w&&(y.debug+="IDR "),y.key=!0,y.frame=!0;break;case 6:{b=!0,w&&y&&(y.debug+="SEI ");var I=new M.default(S(B.data));I.readUByte();for(var g=0,W=0,$=!1,le=0;!$&&I.bytesAvailable>1;){g=0;do le=I.readUByte(),g+=le;while(le===255);W=0;do le=I.readUByte(),W+=le;while(le===255);if(g===4&&I.bytesAvailable!==0){$=!0;var de=I.readUByte();if(de===181){var Ce=I.readUShort();if(Ce===49){var be=I.readUInt();if(be===1195456820){var Ae=I.readUByte();if(Ae===3){for(var Se=I.readUByte(),Re=I.readUByte(),ve=31&Se,X=[Se,Re],_=0;_<ve;_++)X.push(I.readUByte()),X.push(I.readUByte()),X.push(I.readUByte());a(A._txtTrack.samples,{type:3,pts:L.pts,bytes:X})}}}}}else if(g===5&&I.bytesAvailable!==0){if($=!0,W>16){for(var k=[],U=0;U<16;U++)k.push(I.readUByte().toString(16)),(U===3||U===5||U===7||U===9)&&k.push("-");for(var Q=W-16,K=new Uint8Array(Q),ce=0;ce<Q;ce++)K[ce]=I.readUByte();a(A._txtTrack.samples,{pts:L.pts,payloadType:g,uuid:k.join(""),userData:Object(z.utf8ArrayToStr)(K),userDataBytes:K})}}else if(W<I.bytesAvailable)for(var xe=0;xe<W;xe++)I.readUByte()}break}case 7:if(b=!0,j=!0,w&&y&&(y.debug+="SPS "),!T.sps){var De=new M.default(B.data),ue=De.readSPS();T.width=ue.width,T.height=ue.height,T.pixelRatio=ue.pixelRatio,T.sps=[B.data],T.duration=A._duration;for(var ge=B.data.subarray(1,4),we="avc1.",Oe=0;Oe<3;Oe++){var Ne=ge[Oe].toString(16);Ne.length<2&&(Ne="0"+Ne),we+=Ne}T.codec=we}break;case 8:b=!0,w&&y&&(y.debug+="PPS "),T.pps||(T.pps=[B.data]);break;case 9:b=!1,T.audFound=!0,y&&s(y,T),y=A.avcSample=u(!1,L.pts,L.dts,w?"AUD ":"");break;case 12:b=!1;break;default:b=!1,y&&(y.debug+="unknown NAL "+B.type+" ");break}if(y&&b){var Ue=y.units;Ue.push(B)}}),R&&y&&(s(y,T),this.avcSample=null)},C.getLastNalUnit=function(){var L,R=this.avcSample,A;if(!R||R.units.length===0){var T=this._avcTrack.samples;R=T[T.length-1]}if((L=R)!==null&&L!==void 0&&L.units){var d=R.units;A=d[d.length-1]}return A},C.parseAVCNALu=function(L){var R=L.byteLength,A=this._avcTrack,T=A.naluState||0,d=T,w=[],y=0,b,j,B,E=-1,F=0;for(T===-1&&(E=0,F=L[0]&31,T=0,y=1);y<R;){if(b=L[y++],!T){T=b?0:1;continue}if(T===1){T=b?0:2;continue}if(!b)T=3;else if(b===1){if(E>=0){var I={data:L.subarray(E,y-T-1),type:F};w.push(I)}else{var g=this.getLastNalUnit();if(g&&(d&&y<=4-d&&(g.state&&(g.data=g.data.subarray(0,g.data.byteLength-d))),j=y-T-1,j>0)){var W=new Uint8Array(g.data.byteLength+j);W.set(g.data,0),W.set(L.subarray(0,j),g.data.byteLength),g.data=W,g.state=0}}y<R?(B=L[y]&31,E=y,F=B,T=0):T=-1}else T=0}if(E>=0&&T>=0){var $={data:L.subarray(E,R),type:F,state:T};w.push($)}if(w.length===0){var le=this.getLastNalUnit();if(le){var de=new Uint8Array(le.data.byteLength+L.byteLength);de.set(le.data,0),de.set(L,le.data.byteLength),le.data=de}}return A.naluState=T,w},C.parseAACPES=function(L){var R=0,A=this._audioTrack,T=this.aacOverFlow,d=L.data;if(T){this.aacOverFlow=null;var w=T.sample.unit.byteLength,y=Math.min(T.missing,w),b=w-y;T.sample.unit.set(d.subarray(0,y),b),A.samples.push(T.sample),R=T.missing}var j,B;for(j=R,B=d.length;j<B-1&&!J.isHeader(d,j);j++);if(j!==R){var E,F;if(j<B-1?(E="AAC PES did not start with ADTS header,offset:"+j,F=!1):(E="no ADTS header found in AAC PES",F=!0),v.logger.warn("parsing error:"+E),this.observer.emit(r.Events.ERROR,r.Events.ERROR,{type:m.ErrorTypes.MEDIA_ERROR,details:m.ErrorDetails.FRAG_PARSING_ERROR,fatal:F,reason:E}),F)return}J.initTrackConfig(A,this.observer,d,j,this.audioCodec);var I;if(L.pts!==void 0)I=L.pts;else if(T){var g=J.getFrameDuration(A.samplerate);I=T.sample.pts+g}else{v.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var W=0;j<B;)if(J.isHeader(d,j)){if(j+5<B){var $=J.appendFrame(A,d,j,I,W);if($)if($.missing)this.aacOverFlow=$;else{j+=$.length,W++;continue}}break}else j++},C.parseMPEGPES=function(L){var R=L.data,A=R.length,T=0,d=0,w=L.pts;if(w===void 0){v.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;d<A;)if(H.isHeader(R,d)){var y=H.appendFrame(this._audioTrack,R,d,w,T);if(y)d+=y.length,T++;else break}else d++},C.parseID3PES=function(L){if(L.pts===void 0){v.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(L)},x}();h.minProbeByteLength=188;function u(x,C,D,L){return{key:x,frame:!1,pts:C,dts:D,units:[],debug:L,length:0}}function f(x,C){return(x[C+10]&31)<<8|x[C+11]}function o(x,C,D,L){var R={audio:-1,avc:-1,id3:-1,isAAC:!0},A=(x[C+1]&15)<<8|x[C+2],T=C+3+A-4,d=(x[C+10]&15)<<8|x[C+11];for(C+=12+d;C<T;){var w=(x[C+1]&31)<<8|x[C+2];switch(x[C]){case 207:if(!L){v.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:R.audio===-1&&(R.audio=w);break;case 21:R.id3===-1&&(R.id3=w);break;case 219:if(!L){v.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:R.avc===-1&&(R.avc=w);break;case 3:case 4:D?R.audio===-1&&(R.audio=w,R.isAAC=!1):v.logger.log("MPEG audio found, not supported in this browser");break;case 36:v.logger.warn("Unsupported HEVC stream type found");break;default:break}C+=((x[C+3]&15)<<8|x[C+4])+5}return R}function l(x){var C=0,D,L,R,A,T,d=x.data;if(!x||x.size===0)return null;for(;d[0].length<19&&d.length>1;){var w=new Uint8Array(d[0].length+d[1].length);w.set(d[0]),w.set(d[1],d[0].length),d[0]=w,d.splice(1,1)}D=d[0];var y=(D[0]<<16)+(D[1]<<8)+D[2];if(y===1){if(L=(D[4]<<8)+D[5],L&&L>x.size-6)return null;var b=D[7];b&192&&(A=(D[9]&14)*536870912+(D[10]&255)*4194304+(D[11]&254)*16384+(D[12]&255)*128+(D[13]&254)/2,b&64?(T=(D[14]&14)*536870912+(D[15]&255)*4194304+(D[16]&254)*16384+(D[17]&255)*128+(D[18]&254)/2,A-T>60*9e4&&(v.logger.warn(Math.round((A-T)/9e4)+"s delta between PTS and DTS, align them"),A=T)):T=A),R=D[8];var j=R+9;if(x.size<=j)return null;x.size-=j;for(var B=new Uint8Array(x.size),E=0,F=d.length;E<F;E++){D=d[E];var I=D.byteLength;if(j)if(j>I){j-=I;continue}else D=D.subarray(j),I-=j,j=0;B.set(D,C),C+=I}return L&&(L-=R+3),{data:B,pts:A,dts:T,len:L}}return null}function s(x,C){if(x.units.length&&x.frame){if(x.pts===void 0){var D=C.samples,L=D.length;if(L){var R=D[L-1];x.pts=R.pts,x.dts=R.dts}else{C.dropped++;return}}C.samples.push(x)}x.debug.length&&v.logger.log(x.pts+"/"+x.dts+":"+x.debug)}function a(x,C){var D=x.length;if(D>0){if(C.pts>=x[D-1].pts)x.push(C);else for(var L=D-1;L>=0;L--)if(C.pts<x[L].pts){x.splice(L,0,C);break}}else x.push(C)}function S(x){for(var C=x.byteLength,D=[],L=1;L<C-2;)x[L]===0&&x[L+1]===0&&x[L+2]===3?(D.push(L+2),L+=2):L++;if(D.length===0)return x;var R=C-D.length,A=new Uint8Array(R),T=0;for(L=0;L<R;T++,L++)T===D[0]&&(T++,D.shift()),A[L]=x[T];return A}Y.default=h},"./src/errors.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"ErrorTypes",function(){return J}),N.d(Y,"ErrorDetails",function(){return H});var J;(function(M){M.NETWORK_ERROR="networkError",M.MEDIA_ERROR="mediaError",M.KEY_SYSTEM_ERROR="keySystemError",M.MUX_ERROR="muxError",M.OTHER_ERROR="otherError"})(J||(J={}));var H;(function(M){M.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",M.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",M.KEY_SYSTEM_NO_SESSION="keySystemNoSession",M.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",M.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",M.MANIFEST_LOAD_ERROR="manifestLoadError",M.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",M.MANIFEST_PARSING_ERROR="manifestParsingError",M.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",M.LEVEL_EMPTY_ERROR="levelEmptyError",M.LEVEL_LOAD_ERROR="levelLoadError",M.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",M.LEVEL_SWITCH_ERROR="levelSwitchError",M.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",M.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",M.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",M.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",M.FRAG_LOAD_ERROR="fragLoadError",M.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",M.FRAG_DECRYPT_ERROR="fragDecryptError",M.FRAG_PARSING_ERROR="fragParsingError",M.REMUX_ALLOC_ERROR="remuxAllocError",M.KEY_LOAD_ERROR="keyLoadError",M.KEY_LOAD_TIMEOUT="keyLoadTimeOut",M.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",M.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",M.BUFFER_APPEND_ERROR="bufferAppendError",M.BUFFER_APPENDING_ERROR="bufferAppendingError",M.BUFFER_STALLED_ERROR="bufferStalledError",M.BUFFER_FULL_ERROR="bufferFullError",M.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",M.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",M.INTERNAL_EXCEPTION="internalException",M.INTERNAL_ABORTED="aborted",M.UNKNOWN="unknown"})(H||(H={}))},"./src/events.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"Events",function(){return J});var J;(function(H){H.MEDIA_ATTACHING="hlsMediaAttaching",H.MEDIA_ATTACHED="hlsMediaAttached",H.MEDIA_DETACHING="hlsMediaDetaching",H.MEDIA_DETACHED="hlsMediaDetached",H.BUFFER_RESET="hlsBufferReset",H.BUFFER_CODECS="hlsBufferCodecs",H.BUFFER_CREATED="hlsBufferCreated",H.BUFFER_APPENDING="hlsBufferAppending",H.BUFFER_APPENDED="hlsBufferAppended",H.BUFFER_EOS="hlsBufferEos",H.BUFFER_FLUSHING="hlsBufferFlushing",H.BUFFER_FLUSHED="hlsBufferFlushed",H.MANIFEST_LOADING="hlsManifestLoading",H.MANIFEST_LOADED="hlsManifestLoaded",H.MANIFEST_PARSED="hlsManifestParsed",H.LEVEL_SWITCHING="hlsLevelSwitching",H.LEVEL_SWITCHED="hlsLevelSwitched",H.LEVEL_LOADING="hlsLevelLoading",H.LEVEL_LOADED="hlsLevelLoaded",H.LEVEL_UPDATED="hlsLevelUpdated",H.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",H.LEVELS_UPDATED="hlsLevelsUpdated",H.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",H.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",H.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",H.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",H.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",H.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",H.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",H.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",H.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",H.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",H.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",H.CUES_PARSED="hlsCuesParsed",H.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",H.INIT_PTS_FOUND="hlsInitPtsFound",H.FRAG_LOADING="hlsFragLoading",H.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",H.FRAG_LOADED="hlsFragLoaded",H.FRAG_DECRYPTED="hlsFragDecrypted",H.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",H.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",H.FRAG_PARSING_METADATA="hlsFragParsingMetadata",H.FRAG_PARSED="hlsFragParsed",H.FRAG_BUFFERED="hlsFragBuffered",H.FRAG_CHANGED="hlsFragChanged",H.FPS_DROP="hlsFpsDrop",H.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",H.ERROR="hlsError",H.DESTROYING="hlsDestroying",H.KEY_LOADING="hlsKeyLoading",H.KEY_LOADED="hlsKeyLoaded",H.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",H.BACK_BUFFER_REACHED="hlsBackBufferReached"})(J||(J={}))},"./src/hls.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return x});var J=N("./node_modules/url-toolkit/src/url-toolkit.js"),H=N.n(J),M=N("./src/loader/playlist-loader.ts"),z=N("./src/loader/key-loader.ts"),G=N("./src/controller/id3-track-controller.ts"),r=N("./src/controller/latency-controller.ts"),O=N("./src/controller/level-controller.ts"),v=N("./src/controller/fragment-tracker.ts"),m=N("./src/controller/stream-controller.ts"),p=N("./src/is-supported.ts"),h=N("./src/utils/logger.ts"),u=N("./src/config.ts"),f=N("./node_modules/eventemitter3/index.js"),o=N.n(f),l=N("./src/events.ts"),s=N("./src/errors.ts");function a(C,D){for(var L=0;L<D.length;L++){var R=D[L];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(C,R.key,R)}}function S(C,D,L){return D&&a(C.prototype,D),L&&a(C,L),C}var x=function(){C.isSupported=function(){return Object(p.isSupported)()};function C(L){L===void 0&&(L={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new f.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 R=this.config=Object(u.mergeConfig)(C.DefaultConfig,L);this.userConfig=L,Object(h.enableLogs)(R.debug),this._autoLevelCapping=-1,R.progressive&&Object(u.enableStreamingMode)(R);var A=R.abrController,T=R.bufferController,d=R.capLevelController,w=R.fpsController,y=this.abrController=new A(this),b=this.bufferController=new T(this),j=this.capLevelController=new d(this),B=new w(this),E=new M.default(this),F=new z.default(this),I=new G.default(this),g=this.levelController=new O.default(this),W=new v.FragmentTracker(this),$=this.streamController=new m.default(this,W);j.setStreamController($),B.setStreamController($);var le=[g,$];this.networkControllers=le;var de=[E,F,y,b,j,B,I,W];this.audioTrackController=this.createController(R.audioTrackController,null,le),this.createController(R.audioStreamController,W,le),this.subtitleTrackController=this.createController(R.subtitleTrackController,null,le),this.createController(R.subtitleStreamController,W,le),this.createController(R.timelineController,null,de),this.emeController=this.createController(R.emeController,null,de),this.cmcdController=this.createController(R.cmcdController,null,de),this.latencyController=this.createController(r.default,null,de),this.coreComponents=de}var D=C.prototype;return D.createController=function(R,A,T){if(R){var d=A?new R(this,A):new R(this);return T&&T.push(d),d}return null},D.on=function(R,A,T){T===void 0&&(T=this),this._emitter.on(R,A,T)},D.once=function(R,A,T){T===void 0&&(T=this),this._emitter.once(R,A,T)},D.removeAllListeners=function(R){this._emitter.removeAllListeners(R)},D.off=function(R,A,T,d){T===void 0&&(T=this),this._emitter.off(R,A,T,d)},D.listeners=function(R){return this._emitter.listeners(R)},D.emit=function(R,A,T){return this._emitter.emit(R,A,T)},D.trigger=function(R,A){if(this.config.debug)return this.emit(R,R,A);try{return this.emit(R,R,A)}catch(T){h.logger.error("An internal error happened while handling event "+R+'. Error message: "'+T.message+'". Here is a stacktrace:',T),this.trigger(l.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:R,error:T})}return!1},D.listenerCount=function(R){return this._emitter.listenerCount(R)},D.destroy=function(){h.logger.log("destroy"),this.trigger(l.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(R){return R.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(R){return R.destroy()}),this.coreComponents.length=0},D.attachMedia=function(R){h.logger.log("attachMedia"),this._media=R,this.trigger(l.Events.MEDIA_ATTACHING,{media:R})},D.detachMedia=function(){h.logger.log("detachMedia"),this.trigger(l.Events.MEDIA_DETACHING,void 0),this._media=null},D.loadSource=function(R){this.stopLoad();var A=this.media,T=this.url,d=this.url=J.buildAbsoluteURL(self.location.href,R,{alwaysNormalize:!0});h.logger.log("loadSource:"+d),A&&T&&T!==d&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(A)),this.trigger(l.Events.MANIFEST_LOADING,{url:R})},D.startLoad=function(R){R===void 0&&(R=-1),h.logger.log("startLoad("+R+")"),this.networkControllers.forEach(function(A){A.startLoad(R)})},D.stopLoad=function(){h.logger.log("stopLoad"),this.networkControllers.forEach(function(R){R.stopLoad()})},D.swapAudioCodec=function(){h.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},D.recoverMediaError=function(){h.logger.log("recoverMediaError");var R=this._media;this.detachMedia(),R&&this.attachMedia(R)},D.removeLevel=function(R,A){A===void 0&&(A=0),this.levelController.removeLevel(R,A)},S(C,[{key:"levels",get:function(){var R=this.levelController.levels;return R||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(R){h.logger.log("set currentLevel:"+R),this.loadLevel=R,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(R){h.logger.log("set nextLevel:"+R),this.levelController.manualLevel=R,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(R){h.logger.log("set loadLevel:"+R),this.levelController.manualLevel=R}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(R){this.levelController.nextLoadLevel=R}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(R){h.logger.log("set firstLevel:"+R),this.levelController.firstLevel=R}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(R){h.logger.log("set startLevel:"+R),R!==-1&&(R=Math.max(R,this.minAutoLevel)),this.levelController.startLevel=R}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(R){var A=!!R;A!==this.config.capLevelToPlayerSize&&(A?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=A)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(R){this._autoLevelCapping!==R&&(h.logger.log("set autoLevelCapping:"+R),this._autoLevelCapping=R)}},{key:"bandwidthEstimate",get:function(){var R=this.abrController.bwEstimator;return R?R.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var R=this.levels,A=this.config.minAutoBitrate;if(!R)return 0;for(var T=R.length,d=0;d<T;d++)if(R[d].maxBitrate>A)return d;return 0}},{key:"maxAutoLevel",get:function(){var R=this.levels,A=this.autoLevelCapping,T;return A===-1&&R&&R.length?T=R.length-1:T=A,T}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(R){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,R)}},{key:"audioTracks",get:function(){var R=this.audioTrackController;return R?R.audioTracks:[]}},{key:"audioTrack",get:function(){var R=this.audioTrackController;return R?R.audioTrack:-1},set:function(R){var A=this.audioTrackController;A&&(A.audioTrack=R)}},{key:"subtitleTracks",get:function(){var R=this.subtitleTrackController;return R?R.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var R=this.subtitleTrackController;return R?R.subtitleTrack:-1},set:function(R){var A=this.subtitleTrackController;A&&(A.subtitleTrack=R)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var R=this.subtitleTrackController;return R?R.subtitleDisplay:!1},set:function(R){var A=this.subtitleTrackController;A&&(A.subtitleDisplay=R)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(R){this.config.lowLatencyMode=R}},{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 l.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return C.defaultConfig?C.defaultConfig:u.hlsDefaultConfig},set:function(R){C.defaultConfig=R}}]),C}();x.defaultConfig=void 0},"./src/is-supported.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"isSupported",function(){return M}),N.d(Y,"changeTypeSupported",function(){return z});var J=N("./src/utils/mediasource-helper.ts");function H(){return self.SourceBuffer||self.WebKitSourceBuffer}function M(){var G=Object(J.getMediaSource)();if(!G)return!1;var r=H(),O=G&&typeof G.isTypeSupported=="function"&&G.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),v=!r||r.prototype&&typeof r.prototype.appendBuffer=="function"&&typeof r.prototype.remove=="function";return!!O&&!!v}function z(){var G,r=H();return typeof(r==null||((G=r.prototype)===null||G===void 0)?void 0:G.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return h}),N.d(Y,"LoadError",function(){return f});var J=N("./src/polyfills/number.ts"),H=N("./src/errors.ts");function M(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,v(o,l)}function z(o){var l=typeof Map=="function"?new Map:void 0;return z=function(a){if(a===null||!O(a))return a;if(typeof a!="function")throw new TypeError("Super expression must either be null or a function");if(typeof l!="undefined"){if(l.has(a))return l.get(a);l.set(a,S)}function S(){return G(a,arguments,m(this).constructor)}return S.prototype=Object.create(a.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),v(S,a)},z(o)}function G(o,l,s){return r()?G=Reflect.construct:G=function(S,x,C){var D=[null];D.push.apply(D,x);var L=Function.bind.apply(S,D),R=new L;return C&&v(R,C.prototype),R},G.apply(null,arguments)}function r(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(o){return!1}}function O(o){return Function.toString.call(o).indexOf("[native code]")!==-1}function v(o,l){return v=Object.setPrototypeOf||function(a,S){return a.__proto__=S,a},v(o,l)}function m(o){return m=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},m(o)}var p=Math.pow(2,17),h=function(){function o(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var l=o.prototype;return l.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},l.abort=function(){this.loader&&this.loader.abort()},l.load=function(a,S){var x=this,C=a.url;if(!C)return Promise.reject(new f({type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:a,networkDetails:null},"Fragment does not have a "+(C?"part list":"url")));this.abort();var D=this.config,L=D.fLoader,R=D.loader;return new Promise(function(A,T){x.loader&&x.loader.destroy();var d=x.loader=a.loader=L?new L(D):new R(D),w=u(a),y={timeout:D.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:D.fragLoadingMaxRetryTimeout,highWaterMark:p};a.stats=d.stats,d.load(w,y,{onSuccess:function(j,B,E,F){x.resetLoader(a,d),A({frag:a,part:null,payload:j.data,networkDetails:F})},onError:function(j,B,E){x.resetLoader(a,d),T(new f({type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:a,response:j,networkDetails:E}))},onAbort:function(j,B,E){x.resetLoader(a,d),T(new f({type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:a,networkDetails:E}))},onTimeout:function(j,B,E){x.resetLoader(a,d),T(new f({type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:a,networkDetails:E}))},onProgress:function(j,B,E,F){S&&S({frag:a,part:null,payload:E,networkDetails:F})}})})},l.loadPart=function(a,S,x){var C=this;this.abort();var D=this.config,L=D.fLoader,R=D.loader;return new Promise(function(A,T){C.loader&&C.loader.destroy();var d=C.loader=a.loader=L?new L(D):new R(D),w=u(a,S),y={timeout:D.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:D.fragLoadingMaxRetryTimeout,highWaterMark:p};S.stats=d.stats,d.load(w,y,{onSuccess:function(j,B,E,F){C.resetLoader(a,d),C.updateStatsFromPart(a,S);var I={frag:a,part:S,payload:j.data,networkDetails:F};x(I),A(I)},onError:function(j,B,E){C.resetLoader(a,d),T(new f({type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:a,part:S,response:j,networkDetails:E}))},onAbort:function(j,B,E){a.stats.aborted=S.stats.aborted,C.resetLoader(a,d),T(new f({type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:a,part:S,networkDetails:E}))},onTimeout:function(j,B,E){C.resetLoader(a,d),T(new f({type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:a,part:S,networkDetails:E}))}})})},l.updateStatsFromPart=function(a,S){var x=a.stats,C=S.stats,D=C.total;if(x.loaded+=C.loaded,D){var L=Math.round(a.duration/S.duration),R=Math.min(Math.round(x.loaded/D),L),A=L-R,T=A*Math.round(x.loaded/R);x.total=x.loaded+T}else x.total=Math.max(x.loaded,x.total);var d=x.loading,w=C.loading;d.start?d.first+=w.first-w.start:(d.start=w.start,d.first=w.first),d.end=w.end},l.resetLoader=function(a,S){a.loader=null,this.loader===S&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),S.destroy()},o}();function u(o,l){l===void 0&&(l=null);var s=l||o,a={frag:o,part:l,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},S=s.byteRangeStartOffset,x=s.byteRangeEndOffset;return Object(J.isFiniteNumber)(S)&&Object(J.isFiniteNumber)(x)&&(a.rangeStart=S,a.rangeEnd=x),a}var f=function(o){M(l,o);function l(s){for(var a,S=arguments.length,x=new Array(S>1?S-1:0),C=1;C<S;C++)x[C-1]=arguments[C];return a=o.call.apply(o,[this].concat(x))||this,a.data=void 0,a.data=s,a}return l}(z(Error))},"./src/loader/fragment.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"ElementaryStreamTypes",function(){return h}),N.d(Y,"BaseSegment",function(){return u}),N.d(Y,"Fragment",function(){return f}),N.d(Y,"Part",function(){return o});var J=N("./src/polyfills/number.ts"),H=N("./node_modules/url-toolkit/src/url-toolkit.js"),M=N.n(H),z=N("./src/utils/logger.ts"),G=N("./src/loader/level-key.ts"),r=N("./src/loader/load-stats.ts");function O(l,s){l.prototype=Object.create(s.prototype),l.prototype.constructor=l,v(l,s)}function v(l,s){return v=Object.setPrototypeOf||function(S,x){return S.__proto__=x,S},v(l,s)}function m(l,s){for(var a=0;a<s.length;a++){var S=s[a];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(l,S.key,S)}}function p(l,s,a){return s&&m(l.prototype,s),a&&m(l,a),l}var h;(function(l){l.AUDIO="audio",l.VIDEO="video",l.AUDIOVIDEO="audiovideo"})(h||(h={}));var u=function(){function l(a){var S;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(S={},S[h.AUDIO]=null,S[h.VIDEO]=null,S[h.AUDIOVIDEO]=null,S),this.baseurl=a}var s=l.prototype;return s.setByteRange=function(S,x){var C=S.split("@",2),D=[];C.length===1?D[0]=x?x.byteRangeEndOffset:0:D[0]=parseInt(C[1]),D[1]=parseInt(C[0])+D[0],this._byteRange=D},p(l,[{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(H.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(S){this._url=S}}]),l}(),f=function(l){O(s,l);function s(S,x){var C;return C=l.call(this,x)||this,C._decryptdata=null,C.rawProgramDateTime=null,C.programDateTime=null,C.tagList=[],C.duration=0,C.sn=0,C.levelkey=void 0,C.type=void 0,C.loader=null,C.level=-1,C.cc=0,C.startPTS=void 0,C.endPTS=void 0,C.appendedPTS=void 0,C.startDTS=void 0,C.endDTS=void 0,C.start=0,C.deltaPTS=void 0,C.maxStartPTS=void 0,C.minEndPTS=void 0,C.stats=new r.LoadStats,C.urlId=0,C.data=void 0,C.bitrateTest=!1,C.title=null,C.initSegment=null,C.type=S,C}var a=s.prototype;return a.createInitializationVector=function(x){for(var C=new Uint8Array(16),D=12;D<16;D++)C[D]=x>>8*(15-D)&255;return C},a.setDecryptDataFromLevelKey=function(x,C){var D=x;return(x==null?void 0:x.method)==="AES-128"&&x.uri&&!x.iv&&(D=G.LevelKey.fromURI(x.uri),D.method=x.method,D.iv=this.createInitializationVector(C),D.keyFormat="identity"),D},a.setElementaryStreamInfo=function(x,C,D,L,R,A){A===void 0&&(A=!1);var T=this.elementaryStreams,d=T[x];if(!d){T[x]={startPTS:C,endPTS:D,startDTS:L,endDTS:R,partial:A};return}d.startPTS=Math.min(d.startPTS,C),d.endPTS=Math.max(d.endPTS,D),d.startDTS=Math.min(d.startDTS,L),d.endDTS=Math.max(d.endDTS,R)},a.clearElementaryStreamInfo=function(){var x=this.elementaryStreams;x[h.AUDIO]=null,x[h.VIDEO]=null,x[h.AUDIOVIDEO]=null},p(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var x=this.sn;typeof x!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&z.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),x=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,x)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(J.isFiniteNumber)(this.programDateTime))return null;var x=Object(J.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+x*1e3}},{key:"encrypted",get:function(){var x;return!!((x=this.decryptdata)!==null&&x!==void 0&&x.keyFormat&&this.decryptdata.uri)}}]),s}(u),o=function(l){O(s,l);function s(a,S,x,C,D){var L;L=l.call(this,x)||this,L.fragOffset=0,L.duration=0,L.gap=!1,L.independent=!1,L.relurl=void 0,L.fragment=void 0,L.index=void 0,L.stats=new r.LoadStats,L.duration=a.decimalFloatingPoint("DURATION"),L.gap=a.bool("GAP"),L.independent=a.bool("INDEPENDENT"),L.relurl=a.enumeratedString("URI"),L.fragment=S,L.index=C;var R=a.enumeratedString("BYTERANGE");return R&&L.setByteRange(R,D),D&&(L.fragOffset=D.fragOffset+D.duration),L}return p(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 S=this.elementaryStreams;return!!(S.audio||S.video||S.audiovideo)}}]),s}(u)},"./src/loader/key-loader.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return z});var J=N("./src/events.ts"),H=N("./src/errors.ts"),M=N("./src/utils/logger.ts"),z=function(){function G(O){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=O,this._registerListeners()}var r=G.prototype;return r._registerListeners=function(){this.hls.on(J.Events.KEY_LOADING,this.onKeyLoading,this)},r._unregisterListeners=function(){this.hls.off(J.Events.KEY_LOADING,this.onKeyLoading)},r.destroy=function(){this._unregisterListeners();for(var v in this.loaders){var m=this.loaders[v];m&&m.destroy()}this.loaders={}},r.onKeyLoading=function(v,m){var p=m.frag,h=p.type,u=this.loaders[h];if(!p.decryptdata){M.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var f=p.decryptdata.uri;if(f!==this.decrypturl||this.decryptkey===null){var o=this.hls.config;if(u&&(M.logger.warn("abort previous key loader for type:"+h),u.abort()),!f){M.logger.warn("key uri is falsy");return}var l=o.loader,s=p.loader=this.loaders[h]=new l(o);this.decrypturl=f,this.decryptkey=null;var a={url:f,frag:p,responseType:"arraybuffer"},S={timeout:o.fragLoadingTimeOut,maxRetry:0,retryDelay:o.fragLoadingRetryDelay,maxRetryDelay:o.fragLoadingMaxRetryTimeout,highWaterMark:0},x={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(a,S,x)}else this.decryptkey&&(p.decryptdata.key=this.decryptkey,this.hls.trigger(J.Events.KEY_LOADED,{frag:p}))},r.loadsuccess=function(v,m,p){var h=p.frag;if(!h.decryptdata){M.logger.error("after key load, decryptdata unset");return}this.decryptkey=h.decryptdata.key=new Uint8Array(v.data),h.loader=null,delete this.loaders[h.type],this.hls.trigger(J.Events.KEY_LOADED,{frag:h})},r.loaderror=function(v,m){var p=m.frag,h=p.loader;h&&h.abort(),delete this.loaders[p.type],this.hls.trigger(J.Events.ERROR,{type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:p,response:v})},r.loadtimeout=function(v,m){var p=m.frag,h=p.loader;h&&h.abort(),delete this.loaders[p.type],this.hls.trigger(J.Events.ERROR,{type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:p})},G}()},"./src/loader/level-details.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"LevelDetails",function(){return G});var J=N("./src/polyfills/number.ts");function H(r,O){for(var v=0;v<O.length;v++){var m=O[v];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(r,m.key,m)}}function M(r,O,v){return O&&H(r.prototype,O),v&&H(r,v),r}var z=10,G=function(){function r(v){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=v}var O=r.prototype;return O.reloaded=function(m){if(!m){this.advanced=!0,this.updated=!0;return}var p=this.lastPartSn-m.lastPartSn,h=this.lastPartIndex-m.lastPartIndex;this.updated=this.endSN!==m.endSN||!!h||!!p,this.advanced=this.endSN>m.endSN||p>0||p===0&&h>0,this.updated||this.advanced?this.misses=Math.floor(m.misses*.6):this.misses=m.misses+1,this.availabilityDelay=m.availabilityDelay},M(r,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(J.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||z}},{key:"drift",get:function(){var m=this.driftEndTime-this.driftStartTime;if(m>0){var p=this.driftEnd-this.driftStart;return p*1e3/m}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var m;return(m=this.partList)!==null&&m!==void 0&&m.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var m;return(m=this.fragments)!==null&&m!==void 0&&m.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 m;return(m=this.partList)!==null&&m!==void 0&&m.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var m;return(m=this.partList)!==null&&m!==void 0&&m.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),r}()},"./src/loader/level-key.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"LevelKey",function(){return G});var J=N("./node_modules/url-toolkit/src/url-toolkit.js"),H=N.n(J);function M(r,O){for(var v=0;v<O.length;v++){var m=O[v];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(r,m.key,m)}}function z(r,O,v){return O&&M(r.prototype,O),v&&M(r,v),r}var G=function(){r.fromURL=function(v,m){return new r(v,m)},r.fromURI=function(v){return new r(v)};function r(O,v){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,v?this._uri=Object(J.buildAbsoluteURL)(O,v,{alwaysNormalize:!0}):this._uri=O}return z(r,[{key:"uri",get:function(){return this._uri}}]),r}()},"./src/loader/load-stats.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"LoadStats",function(){return J});var J=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(oe,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return s});var J=N("./src/polyfills/number.ts"),H=N("./node_modules/url-toolkit/src/url-toolkit.js"),M=N.n(H),z=N("./src/loader/fragment.ts"),G=N("./src/loader/level-details.ts"),r=N("./src/loader/level-key.ts"),O=N("./src/utils/attr-list.ts"),v=N("./src/utils/logger.ts"),m=N("./src/utils/codecs.ts"),p=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,h=/#EXT-X-MEDIA:(.*)/g,u=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),f=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 l(D){var L,R;return o.test((L=(R=H.parseURL(D))===null||R===void 0?void 0:R.path)!=null?L:"")}var s=function(){function D(){}return D.findGroup=function(R,A){for(var T=0;T<R.length;T++){var d=R[T];if(d.id===A)return d}},D.convertAVC1ToAVCOTI=function(R){var A=R.split(".");if(A.length>2){var T=A.shift()+".";return T+=parseInt(A.shift()).toString(16),T+=("000"+parseInt(A.shift()).toString(16)).substr(-4),T}return R},D.resolve=function(R,A){return H.buildAbsoluteURL(A,R,{alwaysNormalize:!0})},D.parseMasterPlaylist=function(R,A){var T=[],d={},w=!1;p.lastIndex=0;for(var y;(y=p.exec(R))!=null;)if(y[1]){var b=new O.AttrList(y[1]),j={attrs:b,bitrate:b.decimalInteger("AVERAGE-BANDWIDTH")||b.decimalInteger("BANDWIDTH"),name:b.NAME,url:D.resolve(y[2],A)},B=b.decimalResolution("RESOLUTION");B&&(j.width=B.width,j.height=B.height),a((b.CODECS||"").split(/[ ,]+/).filter(function(F){return F}),j),j.videoCodec&&j.videoCodec.indexOf("avc1")!==-1&&(j.videoCodec=D.convertAVC1ToAVCOTI(j.videoCodec)),T.push(j)}else if(y[3]){var E=new O.AttrList(y[3]);E["DATA-ID"]&&(w=!0,d[E["DATA-ID"]]=E)}return{levels:T,sessionData:w?d:null}},D.parseMasterPlaylistMedia=function(R,A,T,d){d===void 0&&(d=[]);var w,y=[],b=0;for(h.lastIndex=0;(w=h.exec(R))!==null;){var j=new O.AttrList(w[1]);if(j.TYPE===T){var B={attrs:j,bitrate:0,id:b++,groupId:j["GROUP-ID"],instreamId:j["INSTREAM-ID"],name:j.NAME||j.LANGUAGE||"",type:T,default:j.bool("DEFAULT"),autoselect:j.bool("AUTOSELECT"),forced:j.bool("FORCED"),lang:j.LANGUAGE,url:j.URI?D.resolve(j.URI,A):""};if(d.length){var E=D.findGroup(d,B.groupId)||d[0];S(B,E,"audioCodec"),S(B,E,"textCodec")}y.push(B)}}return y},D.parseLevelPlaylist=function(R,A,T,d,w){var y=new G.LevelDetails(A),b=y.fragments,j=null,B=0,E=0,F=0,I=0,g=null,W=new z.Fragment(d,A),$,le,de,Ce=-1,be=!1;for(u.lastIndex=0,y.m3u8=R;($=u.exec(R))!==null;){be&&(be=!1,W=new z.Fragment(d,A),W.start=F,W.sn=B,W.cc=I,W.level=T,j&&(W.initSegment=j,W.rawProgramDateTime=j.rawProgramDateTime));var Ae=$[1];if(Ae){W.duration=parseFloat(Ae);var Se=(" "+$[2]).slice(1);W.title=Se||null,W.tagList.push(Se?["INF",Ae,Se]:["INF",Ae])}else if($[3])Object(J.isFiniteNumber)(W.duration)&&(W.start=F,de&&(W.levelkey=de),W.sn=B,W.level=T,W.cc=I,W.urlId=w,b.push(W),W.relurl=(" "+$[3]).slice(1),C(W,g),g=W,F+=W.duration,B++,E=0,be=!0);else if($[4]){var Re=(" "+$[4]).slice(1);g?W.setByteRange(Re,g):W.setByteRange(Re)}else if($[5])W.rawProgramDateTime=(" "+$[5]).slice(1),W.tagList.push(["PROGRAM-DATE-TIME",W.rawProgramDateTime]),Ce===-1&&(Ce=b.length);else{if($=$[0].match(f),!$){v.logger.warn("No matches on slow regex match for level playlist!");continue}for(le=1;le<$.length&&!(typeof $[le]!="undefined");le++);var ve=(" "+$[le]).slice(1),X=(" "+$[le+1]).slice(1),_=$[le+2]?(" "+$[le+2]).slice(1):"";switch(ve){case"PLAYLIST-TYPE":y.type=X.toUpperCase();break;case"MEDIA-SEQUENCE":B=y.startSN=parseInt(X);break;case"SKIP":{var k=new O.AttrList(X),U=k.decimalInteger("SKIPPED-SEGMENTS");if(Object(J.isFiniteNumber)(U)){y.skippedSegments=U;for(var Q=U;Q--;)b.unshift(null);B+=U}var K=k.enumeratedString("RECENTLY-REMOVED-DATERANGES");K&&(y.recentlyRemovedDateranges=K.split(" "));break}case"TARGETDURATION":y.targetduration=parseFloat(X);break;case"VERSION":y.version=parseInt(X);break;case"EXTM3U":break;case"ENDLIST":y.live=!1;break;case"#":(X||_)&&W.tagList.push(_?[X,_]:[X]);break;case"DIS":I++;case"GAP":W.tagList.push([ve]);break;case"BITRATE":W.tagList.push([ve,X]);break;case"DISCONTINUITY-SEQ":I=parseInt(X);break;case"KEY":{var ce,xe=new O.AttrList(X),De=xe.enumeratedString("METHOD"),ue=xe.URI,ge=xe.hexadecimalInteger("IV"),we=xe.enumeratedString("KEYFORMATVERSIONS"),Oe=xe.enumeratedString("KEYID"),Ne=(ce=xe.enumeratedString("KEYFORMAT"))!=null?ce:"identity",Ue=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ue.indexOf(Ne)>-1){v.logger.warn("Keyformat "+Ne+" is not supported from the manifest");continue}else if(Ne!=="identity")continue;De&&(de=r.LevelKey.fromURL(A,ue),ue&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(De)>=0&&(de.method=De,de.keyFormat=Ne,Oe&&(de.keyID=Oe),we&&(de.keyFormatVersions=we),de.iv=ge));break}case"START":{var Ge=new O.AttrList(X),We=Ge.decimalFloatingPoint("TIME-OFFSET");Object(J.isFiniteNumber)(We)&&(y.startTimeOffset=We);break}case"MAP":{var Xe=new O.AttrList(X);W.relurl=Xe.URI,Xe.BYTERANGE&&W.setByteRange(Xe.BYTERANGE),W.level=T,W.sn="initSegment",de&&(W.levelkey=de),W.initSegment=null,j=W,be=!0;break}case"SERVER-CONTROL":{var He=new O.AttrList(X);y.canBlockReload=He.bool("CAN-BLOCK-RELOAD"),y.canSkipUntil=He.optionalFloat("CAN-SKIP-UNTIL",0),y.canSkipDateRanges=y.canSkipUntil>0&&He.bool("CAN-SKIP-DATERANGES"),y.partHoldBack=He.optionalFloat("PART-HOLD-BACK",0),y.holdBack=He.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Ye=new O.AttrList(X);y.partTarget=Ye.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Me=y.partList;Me||(Me=y.partList=[]);var it=E>0?Me[Me.length-1]:void 0,qe=E++,he=new z.Part(new O.AttrList(X),W,A,qe,it);Me.push(he),W.duration+=he.duration;break}case"PRELOAD-HINT":{var ee=new O.AttrList(X);y.preloadHint=ee;break}case"RENDITION-REPORT":{var re=new O.AttrList(X);y.renditionReports=y.renditionReports||[],y.renditionReports.push(re);break}default:v.logger.warn("line parsed but not handled: "+$);break}}}g&&!g.relurl?(b.pop(),F-=g.duration,y.partList&&(y.fragmentHint=g)):y.partList&&(C(W,g),W.cc=I,y.fragmentHint=W);var ae=b.length,fe=b[0],ie=b[ae-1];if(F+=y.skippedSegments*y.targetduration,F>0&&ae&&ie){y.averagetargetduration=F/ae;var se=ie.sn;y.endSN=se!=="initSegment"?se:0,fe&&(y.startCC=fe.cc,fe.initSegment||y.fragments.every(function(pe){return pe.relurl&&l(pe.relurl)})&&(v.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),W=new z.Fragment(d,A),W.relurl=ie.relurl,W.level=T,W.sn="initSegment",fe.initSegment=W,y.needSidxRanges=!0))}else y.endSN=0,y.startCC=0;return y.fragmentHint&&(F+=y.fragmentHint.duration),y.totalduration=F,y.endCC=I,Ce>0&&x(b,Ce),y},D}();function a(D,L){["video","audio","text"].forEach(function(R){var A=D.filter(function(d){return Object(m.isCodecType)(d,R)});if(A.length){var T=A.filter(function(d){return d.lastIndexOf("avc1",0)===0||d.lastIndexOf("mp4a",0)===0});L[R+"Codec"]=T.length>0?T[0]:A[0],D=D.filter(function(d){return A.indexOf(d)===-1})}}),L.unknownCodecs=D}function S(D,L,R){var A=L[R];A&&(D[R]=A)}function x(D,L){for(var R=D[L],A=L;A--;){var T=D[A];if(!T)return;T.programDateTime=R.programDateTime-T.duration*1e3,R=T}}function C(D,L){D.rawProgramDateTime?D.programDateTime=Date.parse(D.rawProgramDateTime):L!=null&&L.programDateTime&&(D.programDateTime=L.endProgramDateTime),Object(J.isFiniteNumber)(D.programDateTime)||(D.programDateTime=null,D.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(oe,Y,N){"use strict";N.r(Y);var J=N("./src/polyfills/number.ts"),H=N("./src/events.ts"),M=N("./src/errors.ts"),z=N("./src/utils/logger.ts"),G=N("./src/utils/mp4-tools.ts"),r=N("./src/loader/m3u8-parser.ts"),O=N("./src/types/loader.ts"),v=N("./src/utils/attr-list.ts");function m(u){var f=u.type;switch(f){case O.PlaylistContextType.AUDIO_TRACK:return O.PlaylistLevelType.AUDIO;case O.PlaylistContextType.SUBTITLE_TRACK:return O.PlaylistLevelType.SUBTITLE;default:return O.PlaylistLevelType.MAIN}}function p(u,f){var o=u.url;return(o===void 0||o.indexOf("data:")===0)&&(o=f.url),o}var h=function(){function u(o){this.hls=void 0,this.loaders=Object.create(null),this.hls=o,this.registerListeners()}var f=u.prototype;return f.registerListeners=function(){var l=this.hls;l.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),l.on(H.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),l.on(H.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},f.unregisterListeners=function(){var l=this.hls;l.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(H.Events.LEVEL_LOADING,this.onLevelLoading,this),l.off(H.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),l.off(H.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},f.createInternalLoader=function(l){var s=this.hls.config,a=s.pLoader,S=s.loader,x=a||S,C=new x(s);return l.loader=C,this.loaders[l.type]=C,C},f.getInternalLoader=function(l){return this.loaders[l.type]},f.resetInternalLoader=function(l){this.loaders[l]&&delete this.loaders[l]},f.destroyInternalLoaders=function(){for(var l in this.loaders){var s=this.loaders[l];s&&s.destroy(),this.resetInternalLoader(l)}},f.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},f.onManifestLoading=function(l,s){var a=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:O.PlaylistContextType.MANIFEST,url:a,deliveryDirectives:null})},f.onLevelLoading=function(l,s){var a=s.id,S=s.level,x=s.url,C=s.deliveryDirectives;this.load({id:a,groupId:null,level:S,responseType:"text",type:O.PlaylistContextType.LEVEL,url:x,deliveryDirectives:C})},f.onAudioTrackLoading=function(l,s){var a=s.id,S=s.groupId,x=s.url,C=s.deliveryDirectives;this.load({id:a,groupId:S,level:null,responseType:"text",type:O.PlaylistContextType.AUDIO_TRACK,url:x,deliveryDirectives:C})},f.onSubtitleTrackLoading=function(l,s){var a=s.id,S=s.groupId,x=s.url,C=s.deliveryDirectives;this.load({id:a,groupId:S,level:null,responseType:"text",type:O.PlaylistContextType.SUBTITLE_TRACK,url:x,deliveryDirectives:C})},f.load=function(l){var s,a=this.hls.config,S=this.getInternalLoader(l);if(S){var x=S.context;if(x&&x.url===l.url){z.logger.trace("[playlist-loader]: playlist request ongoing");return}z.logger.log("[playlist-loader]: aborting previous loader for type: "+l.type),S.abort()}var C,D,L,R;switch(l.type){case O.PlaylistContextType.MANIFEST:C=a.manifestLoadingMaxRetry,D=a.manifestLoadingTimeOut,L=a.manifestLoadingRetryDelay,R=a.manifestLoadingMaxRetryTimeout;break;case O.PlaylistContextType.LEVEL:case O.PlaylistContextType.AUDIO_TRACK:case O.PlaylistContextType.SUBTITLE_TRACK:C=0,D=a.levelLoadingTimeOut;break;default:C=a.levelLoadingMaxRetry,D=a.levelLoadingTimeOut,L=a.levelLoadingRetryDelay,R=a.levelLoadingMaxRetryTimeout;break}if(S=this.createInternalLoader(l),(s=l.deliveryDirectives)!==null&&s!==void 0&&s.part){var A;if(l.type===O.PlaylistContextType.LEVEL&&l.level!==null?A=this.hls.levels[l.level].details:l.type===O.PlaylistContextType.AUDIO_TRACK&&l.id!==null?A=this.hls.audioTracks[l.id].details:l.type===O.PlaylistContextType.SUBTITLE_TRACK&&l.id!==null&&(A=this.hls.subtitleTracks[l.id].details),A){var T=A.partTarget,d=A.targetduration;T&&d&&(D=Math.min(Math.max(T*3,d*.8)*1e3,D))}}var w={timeout:D,maxRetry:C,retryDelay:L,maxRetryDelay:R,highWaterMark:0},y={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};S.load(l,w,y)},f.loadsuccess=function(l,s,a,S){if(S===void 0&&(S=null),a.isSidxRequest){this.handleSidxRequest(l,a),this.handlePlaylistLoaded(l,s,a,S);return}this.resetInternalLoader(a.type);var x=l.data;if(x.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(l,a,"no EXTM3U delimiter",S);return}s.parsing.start=performance.now(),x.indexOf("#EXTINF:")>0||x.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(l,s,a,S):this.handleMasterPlaylist(l,s,a,S)},f.loaderror=function(l,s,a){a===void 0&&(a=null),this.handleNetworkError(s,a,!1,l)},f.loadtimeout=function(l,s,a){a===void 0&&(a=null),this.handleNetworkError(s,a,!0)},f.handleMasterPlaylist=function(l,s,a,S){var x=this.hls,C=l.data,D=p(l,a),L=r.default.parseMasterPlaylist(C,D),R=L.levels,A=L.sessionData;if(!R.length){this.handleManifestParsingError(l,a,"no level found in manifest",S);return}var T=R.map(function(B){return{id:B.attrs.AUDIO,audioCodec:B.audioCodec}}),d=R.map(function(B){return{id:B.attrs.SUBTITLES,textCodec:B.textCodec}}),w=r.default.parseMasterPlaylistMedia(C,D,"AUDIO",T),y=r.default.parseMasterPlaylistMedia(C,D,"SUBTITLES",d),b=r.default.parseMasterPlaylistMedia(C,D,"CLOSED-CAPTIONS");if(w.length){var j=w.some(function(B){return!B.url});!j&&R[0].audioCodec&&!R[0].attrs.AUDIO&&(z.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),w.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new v.AttrList({}),bitrate:0,url:""}))}x.trigger(H.Events.MANIFEST_LOADED,{levels:R,audioTracks:w,subtitles:y,captions:b,url:D,stats:s,networkDetails:S,sessionData:A})},f.handleTrackOrLevelPlaylist=function(l,s,a,S){var x=this.hls,C=a.id,D=a.level,L=a.type,R=p(l,a),A=Object(J.isFiniteNumber)(C)?C:0,T=Object(J.isFiniteNumber)(D)?D:A,d=m(a),w=r.default.parseLevelPlaylist(l.data,R,T,d,A);if(!w.fragments.length){x.trigger(H.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:R,reason:"no fragments found in level",level:typeof a.level=="number"?a.level:void 0});return}if(L===O.PlaylistContextType.MANIFEST){var y={attrs:new v.AttrList({}),bitrate:0,details:w,name:"",url:R};x.trigger(H.Events.MANIFEST_LOADED,{levels:[y],audioTracks:[],url:R,stats:s,networkDetails:S,sessionData:null})}if(s.parsing.end=performance.now(),w.needSidxRanges){var b,j=(b=w.fragments[0].initSegment)===null||b===void 0?void 0:b.url;this.load({url:j,isSidxRequest:!0,type:L,level:D,levelDetails:w,id:C,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}a.levelDetails=w,this.handlePlaylistLoaded(l,s,a,S)},f.handleSidxRequest=function(l,s){var a=Object(G.parseSegmentIndex)(new Uint8Array(l.data));if(!a)return;var S=a.references,x=s.levelDetails;S.forEach(function(C,D){var L=C.info,R=x.fragments[D];R.byteRange.length===0&&R.setByteRange(String(1+L.end-L.start)+"@"+String(L.start)),R.initSegment&&R.initSegment.setByteRange(String(a.moovEndOffset)+"@0")})},f.handleManifestParsingError=function(l,s,a,S){this.hls.trigger(H.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===O.PlaylistContextType.MANIFEST,url:l.url,reason:a,response:l,context:s,networkDetails:S})},f.handleNetworkError=function(l,s,a,S){a===void 0&&(a=!1),z.logger.warn("[playlist-loader]: A network "+(a?"timeout":"error")+" occurred while loading "+l.type+" level: "+l.level+" id: "+l.id+' group-id: "'+l.groupId+'"');var x=M.ErrorDetails.UNKNOWN,C=!1,D=this.getInternalLoader(l);switch(l.type){case O.PlaylistContextType.MANIFEST:x=a?M.ErrorDetails.MANIFEST_LOAD_TIMEOUT:M.ErrorDetails.MANIFEST_LOAD_ERROR,C=!0;break;case O.PlaylistContextType.LEVEL:x=a?M.ErrorDetails.LEVEL_LOAD_TIMEOUT:M.ErrorDetails.LEVEL_LOAD_ERROR,C=!1;break;case O.PlaylistContextType.AUDIO_TRACK:x=a?M.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:M.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,C=!1;break;case O.PlaylistContextType.SUBTITLE_TRACK:x=a?M.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:M.ErrorDetails.SUBTITLE_LOAD_ERROR,C=!1;break}D&&this.resetInternalLoader(l.type);var L={type:M.ErrorTypes.NETWORK_ERROR,details:x,fatal:C,url:l.url,loader:D,context:l,networkDetails:s};S&&(L.response=S),this.hls.trigger(H.Events.ERROR,L)},f.handlePlaylistLoaded=function(l,s,a,S){var x=a.type,C=a.level,D=a.id,L=a.groupId,R=a.loader,A=a.levelDetails,T=a.deliveryDirectives;if(!(A!=null&&A.targetduration)){this.handleManifestParsingError(l,a,"invalid target duration",S);return}if(!R)return;A.live&&(R.getCacheAge&&(A.ageHeader=R.getCacheAge()||0),(!R.getCacheAge||isNaN(A.ageHeader))&&(A.ageHeader=0));switch(x){case O.PlaylistContextType.MANIFEST:case O.PlaylistContextType.LEVEL:this.hls.trigger(H.Events.LEVEL_LOADED,{details:A,level:C||0,id:D||0,stats:s,networkDetails:S,deliveryDirectives:T});break;case O.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(H.Events.AUDIO_TRACK_LOADED,{details:A,id:D||0,groupId:L||"",stats:s,networkDetails:S,deliveryDirectives:T});break;case O.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(H.Events.SUBTITLE_TRACK_LOADED,{details:A,id:D||0,groupId:L||"",stats:s,networkDetails:S,deliveryDirectives:T});break}},u}();Y.default=h},"./src/polyfills/number.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"isFiniteNumber",function(){return J}),N.d(Y,"MAX_SAFE_INTEGER",function(){return H});var J=Number.isFinite||function(M){return typeof M=="number"&&isFinite(M)},H=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(oe,Y,N){"use strict";N.r(Y);var J=function(){function H(){}return H.getSilentFrame=function(z,G){switch(z){case"mp4a.40.2":if(G===1)return new Uint8Array([0,200,0,128,35,128]);if(G===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(G===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(G===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(G===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(G===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(G===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(G===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(G===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},H}();Y.default=J},"./src/remux/mp4-generator.ts":function(oe,Y,N){"use strict";N.r(Y);var J=Math.pow(2,32)-1,H=function(){function M(){}return M.init=function(){M.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var G;for(G in M.types)M.types.hasOwnProperty(G)&&(M.types[G]=[G.charCodeAt(0),G.charCodeAt(1),G.charCodeAt(2),G.charCodeAt(3)]);var r=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]),O=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);M.HDLR_TYPES={video:r,audio:O};var v=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),m=new Uint8Array([0,0,0,0,0,0,0,0]);M.STTS=M.STSC=M.STCO=m,M.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),M.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),M.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),M.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var p=new Uint8Array([105,115,111,109]),h=new Uint8Array([97,118,99,49]),u=new Uint8Array([0,0,0,1]);M.FTYP=M.box(M.types.ftyp,p,u,p,h),M.DINF=M.box(M.types.dinf,M.box(M.types.dref,v))},M.box=function(G){for(var r=8,O=arguments.length,v=new Array(O>1?O-1:0),m=1;m<O;m++)v[m-1]=arguments[m];for(var p=v.length,h=p;p--;)r+=v[p].byteLength;var u=new Uint8Array(r);for(u[0]=r>>24&255,u[1]=r>>16&255,u[2]=r>>8&255,u[3]=r&255,u.set(G,4),p=0,r=8;p<h;p++)u.set(v[p],r),r+=v[p].byteLength;return u},M.hdlr=function(G){return M.box(M.types.hdlr,M.HDLR_TYPES[G])},M.mdat=function(G){return M.box(M.types.mdat,G)},M.mdhd=function(G,r){r*=G;var O=Math.floor(r/(J+1)),v=Math.floor(r%(J+1));return M.box(M.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,G>>24&255,G>>16&255,G>>8&255,G&255,O>>24,O>>16&255,O>>8&255,O&255,v>>24,v>>16&255,v>>8&255,v&255,85,196,0,0]))},M.mdia=function(G){return M.box(M.types.mdia,M.mdhd(G.timescale,G.duration),M.hdlr(G.type),M.minf(G))},M.mfhd=function(G){return M.box(M.types.mfhd,new Uint8Array([0,0,0,0,G>>24,G>>16&255,G>>8&255,G&255]))},M.minf=function(G){return G.type==="audio"?M.box(M.types.minf,M.box(M.types.smhd,M.SMHD),M.DINF,M.stbl(G)):M.box(M.types.minf,M.box(M.types.vmhd,M.VMHD),M.DINF,M.stbl(G))},M.moof=function(G,r,O){return M.box(M.types.moof,M.mfhd(G),M.traf(O,r))},M.moov=function(G){for(var r=G.length,O=[];r--;)O[r]=M.trak(G[r]);return M.box.apply(null,[M.types.moov,M.mvhd(G[0].timescale,G[0].duration)].concat(O).concat(M.mvex(G)))},M.mvex=function(G){for(var r=G.length,O=[];r--;)O[r]=M.trex(G[r]);return M.box.apply(null,[M.types.mvex].concat(O))},M.mvhd=function(G,r){r*=G;var O=Math.floor(r/(J+1)),v=Math.floor(r%(J+1)),m=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,G>>24&255,G>>16&255,G>>8&255,G&255,O>>24,O>>16&255,O>>8&255,O&255,v>>24,v>>16&255,v>>8&255,v&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return M.box(M.types.mvhd,m)},M.sdtp=function(G){var r=G.samples||[],O=new Uint8Array(4+r.length),v,m;for(v=0;v<r.length;v++)m=r[v].flags,O[v+4]=m.dependsOn<<4|m.isDependedOn<<2|m.hasRedundancy;return M.box(M.types.sdtp,O)},M.stbl=function(G){return M.box(M.types.stbl,M.stsd(G),M.box(M.types.stts,M.STTS),M.box(M.types.stsc,M.STSC),M.box(M.types.stsz,M.STSZ),M.box(M.types.stco,M.STCO))},M.avc1=function(G){var r=[],O=[],v,m,p;for(v=0;v<G.sps.length;v++)m=G.sps[v],p=m.byteLength,r.push(p>>>8&255),r.push(p&255),r=r.concat(Array.prototype.slice.call(m));for(v=0;v<G.pps.length;v++)m=G.pps[v],p=m.byteLength,O.push(p>>>8&255),O.push(p&255),O=O.concat(Array.prototype.slice.call(m));var h=M.box(M.types.avcC,new Uint8Array([1,r[3],r[4],r[5],252|3,224|G.sps.length].concat(r).concat([G.pps.length]).concat(O))),u=G.width,f=G.height,o=G.pixelRatio[0],l=G.pixelRatio[1];return M.box(M.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,u>>8&255,u&255,f>>8&255,f&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]),h,M.box(M.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),M.box(M.types.pasp,new Uint8Array([o>>24,o>>16&255,o>>8&255,o&255,l>>24,l>>16&255,l>>8&255,l&255])))},M.esds=function(G){var r=G.config.length;return new Uint8Array([0,0,0,0,3,23+r,0,1,0,4,15+r,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([r]).concat(G.config).concat([6,1,2]))},M.mp4a=function(G){var r=G.samplerate;return M.box(M.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,G.channelCount,0,16,0,0,0,0,r>>8&255,r&255,0,0]),M.box(M.types.esds,M.esds(G)))},M.mp3=function(G){var r=G.samplerate;return M.box(M.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,G.channelCount,0,16,0,0,0,0,r>>8&255,r&255,0,0]))},M.stsd=function(G){return G.type==="audio"?!G.isAAC&&G.codec==="mp3"?M.box(M.types.stsd,M.STSD,M.mp3(G)):M.box(M.types.stsd,M.STSD,M.mp4a(G)):M.box(M.types.stsd,M.STSD,M.avc1(G))},M.tkhd=function(G){var r=G.id,O=G.duration*G.timescale,v=G.width,m=G.height,p=Math.floor(O/(J+1)),h=Math.floor(O%(J+1));return M.box(M.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,r>>24&255,r>>16&255,r>>8&255,r&255,0,0,0,0,p>>24,p>>16&255,p>>8&255,p&255,h>>24,h>>16&255,h>>8&255,h&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,v>>8&255,v&255,0,0,m>>8&255,m&255,0,0]))},M.traf=function(G,r){var O=M.sdtp(G),v=G.id,m=Math.floor(r/(J+1)),p=Math.floor(r%(J+1));return M.box(M.types.traf,M.box(M.types.tfhd,new Uint8Array([0,0,0,0,v>>24,v>>16&255,v>>8&255,v&255])),M.box(M.types.tfdt,new Uint8Array([1,0,0,0,m>>24,m>>16&255,m>>8&255,m&255,p>>24,p>>16&255,p>>8&255,p&255])),M.trun(G,O.length+16+20+8+16+8+8),O)},M.trak=function(G){return G.duration=G.duration||4294967295,M.box(M.types.trak,M.tkhd(G),M.mdia(G))},M.trex=function(G){var r=G.id;return M.box(M.types.trex,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},M.trun=function(G,r){var O=G.samples||[],v=O.length,m=12+16*v,p=new Uint8Array(m),h,u,f,o,l,s;for(r+=8+m,p.set([0,0,15,1,v>>>24&255,v>>>16&255,v>>>8&255,v&255,r>>>24&255,r>>>16&255,r>>>8&255,r&255],0),h=0;h<v;h++)u=O[h],f=u.duration,o=u.size,l=u.flags,s=u.cts,p.set([f>>>24&255,f>>>16&255,f>>>8&255,f&255,o>>>24&255,o>>>16&255,o>>>8&255,o&255,l.isLeading<<2|l.dependsOn,l.isDependedOn<<6|l.hasRedundancy<<4|l.paddingValue<<1|l.isNonSync,l.degradPrio&240<<8,l.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*h);return M.box(M.types.trun,p)},M.initSegment=function(G){M.types||M.init();var r=M.moov(G),O=new Uint8Array(M.FTYP.byteLength+r.byteLength);return O.set(M.FTYP),O.set(r,M.FTYP.byteLength),O},M}();H.types=void 0,H.HDLR_TYPES=void 0,H.STTS=void 0,H.STSC=void 0,H.STCO=void 0,H.STSZ=void 0,H.VMHD=void 0,H.SMHD=void 0,H.STSD=void 0,H.FTYP=void 0,H.DINF=void 0,Y.default=H},"./src/remux/mp4-remuxer.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return s}),N.d(Y,"normalizePts",function(){return a});var J=N("./src/polyfills/number.ts"),H=N("./src/remux/aac-helper.ts"),M=N("./src/remux/mp4-generator.ts"),z=N("./src/events.ts"),G=N("./src/errors.ts"),r=N("./src/utils/logger.ts"),O=N("./src/types/loader.ts"),v=N("./src/utils/timescale-conversion.ts");function m(){return m=Object.assign||function(D){for(var L=1;L<arguments.length;L++){var R=arguments[L];for(var A in R)Object.prototype.hasOwnProperty.call(R,A)&&(D[A]=R[A])}return D},m.apply(this,arguments)}var p=10*1e3,h=1024,u=1152,f=null,o=null,l=!1,s=function(){function D(R,A,T,d){if(d===void 0&&(d=""),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=R,this.config=A,this.typeSupported=T,this.ISGenerated=!1,f===null){var w=navigator.userAgent||"",y=w.match(/Chrome\/(\d+)/i);f=y?parseInt(y[1]):0}if(o===null){var b=navigator.userAgent.match(/Safari\/(\d+)/i);o=b?parseInt(b[1]):0}l=!!f&&f<75||!!o&&o<600}var L=D.prototype;return L.destroy=function(){},L.resetTimeStamp=function(A){r.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=A},L.resetNextTimestamp=function(){r.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},L.resetInitSegment=function(){r.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},L.getVideoStartPts=function(A){var T=!1,d=A.reduce(function(w,y){var b=y.pts-w;return b<-4294967296?(T=!0,a(w,y.pts)):b>0?w:y.pts},A[0].pts);return T&&r.logger.debug("PTS rollover detected"),d},L.remux=function(A,T,d,w,y,b,j,B){var E,F,I,g,W,$,le=y,de=y,Ce=A.pid>-1,be=T.pid>-1,Ae=T.samples.length,Se=A.samples.length>0,Re=Ae>1,ve=(!Ce||Se)&&(!be||Re)||this.ISGenerated||j;if(ve){this.ISGenerated||(I=this.generateIS(A,T,y));var X=this.isVideoContiguous,_=-1;if(Re&&(_=S(T.samples),!X&&this.config.forceKeyFrameOnDiscontinuity))if($=!0,_>0){r.logger.warn("[mp4-remuxer]: Dropped "+_+" out of "+Ae+" video samples due to a missing keyframe");var k=this.getVideoStartPts(T.samples);T.samples=T.samples.slice(_),T.dropped+=_,de+=(T.samples[0].pts-k)/(T.timescale||9e4)}else _===-1&&(r.logger.warn("[mp4-remuxer]: No keyframe found out of "+Ae+" video samples"),$=!1);if(this.ISGenerated){if(Se&&Re){var U=this.getVideoStartPts(T.samples),Q=a(A.samples[0].pts,U)-U,K=Q/T.inputTimeScale;le+=Math.max(0,K),de+=Math.max(0,-K)}if(Se){if(A.samplerate||(r.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),I=this.generateIS(A,T,y)),F=this.remuxAudio(A,le,this.isAudioContiguous,b,be||Re||B===O.PlaylistLevelType.AUDIO?de:void 0),Re){var ce=F?F.endPTS-F.startPTS:0;T.inputTimeScale||(r.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),I=this.generateIS(A,T,y)),E=this.remuxVideo(T,de,X,ce)}}else Re&&(E=this.remuxVideo(T,de,X,0));E&&(E.firstKeyFrame=_,E.independent=_!==-1)}}return this.ISGenerated&&(d.samples.length&&(W=this.remuxID3(d,y)),w.samples.length&&(g=this.remuxText(w,y))),{audio:F,video:E,initSegment:I,independent:$,text:g,id3:W}},L.generateIS=function(A,T,d){var w=A.samples,y=T.samples,b=this.typeSupported,j={},B=!Object(J.isFiniteNumber)(this._initPTS),E="audio/mp4",F,I,g;if(B&&(F=I=Infinity),A.config&&w.length&&(A.timescale=A.samplerate,A.isAAC||(b.mpeg?(E="audio/mpeg",A.codec=""):b.mp3&&(A.codec="mp3")),j.audio={id:"audio",container:E,codec:A.codec,initSegment:!A.isAAC&&b.mpeg?new Uint8Array(0):M.default.initSegment([A]),metadata:{channelCount:A.channelCount}},B&&(g=A.inputTimeScale,F=I=w[0].pts-Math.round(g*d))),T.sps&&T.pps&&y.length&&(T.timescale=T.inputTimeScale,j.video={id:"main",container:"video/mp4",codec:T.codec,initSegment:M.default.initSegment([T]),metadata:{width:T.width,height:T.height}},B)){g=T.inputTimeScale;var W=this.getVideoStartPts(y),$=Math.round(g*d);I=Math.min(I,a(y[0].dts,W)-$),F=Math.min(F,W-$)}if(Object.keys(j).length)return this.ISGenerated=!0,B&&(this._initPTS=F,this._initDTS=I),{tracks:j,initPTS:F,timescale:g}},L.remuxVideo=function(A,T,d,w){var y=A.inputTimeScale,b=A.samples,j=[],B=b.length,E=this._initPTS,F=this.nextAvcDts,I=8,g,W,$,le=Number.POSITIVE_INFINITY,de=Number.NEGATIVE_INFINITY,Ce=0,be=!1;if(!d||F===null){var Ae=T*y,Se=b[0].pts-a(b[0].dts,b[0].pts);F=Ae-Se}for(var Re=0;Re<B;Re++){var ve=b[Re];if(ve.pts=a(ve.pts-E,F),ve.dts=a(ve.dts-E,F),ve.dts>ve.pts){var X=9e4*.2;Ce=Math.max(Math.min(Ce,ve.pts-ve.dts),-1*X)}ve.dts<b[Re>0?Re-1:Re].dts&&(be=!0)}be&&b.sort(function(yt,ot){var at=yt.dts-ot.dts,Lt=yt.pts-ot.pts;return at||Lt}),W=b[0].dts,$=b[b.length-1].dts;var _=Math.round(($-W)/(B-1));if(Ce<0){if(Ce<_*-2){r.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(v.toMsFromMpegTsClock)(-_,!0)+" ms");for(var k=Ce,U=0;U<B;U++)b[U].dts=k=Math.max(k,b[U].pts-_),b[U].pts=Math.max(k,b[U].pts)}else{r.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(v.toMsFromMpegTsClock)(Ce,!0)+" ms to overcome this issue");for(var Q=0;Q<B;Q++)b[Q].dts=b[Q].dts+Ce}W=b[0].dts}if(d){var K=W-F,ce=K>_,xe=K<-1;if(ce||xe){ce?r.logger.warn("AVC: "+Object(v.toMsFromMpegTsClock)(K,!0)+" ms ("+K+"dts) hole between fragments detected, filling it"):r.logger.warn("AVC: "+Object(v.toMsFromMpegTsClock)(-K,!0)+" ms ("+K+"dts) overlapping between fragments detected"),W=F;var De=b[0].pts-K;b[0].dts=W,b[0].pts=De,r.logger.log("Video: First PTS/DTS adjusted: "+Object(v.toMsFromMpegTsClock)(De,!0)+"/"+Object(v.toMsFromMpegTsClock)(W,!0)+", delta: "+Object(v.toMsFromMpegTsClock)(K,!0)+" ms")}}l&&(W=Math.max(0,W));for(var ue=0,ge=0,we=0;we<B;we++){for(var Oe=b[we],Ne=Oe.units,Ue=Ne.length,Ge=0,We=0;We<Ue;We++)Ge+=Ne[We].data.length;ge+=Ge,ue+=Ue,Oe.length=Ge,Oe.dts=Math.max(Oe.dts,W),Oe.pts=Math.max(Oe.pts,Oe.dts,0),le=Math.min(Oe.pts,le),de=Math.max(Oe.pts,de)}$=b[B-1].dts;var Xe=ge+4*ue+8,He;try{He=new Uint8Array(Xe)}catch(yt){this.observer.emit(z.Events.ERROR,z.Events.ERROR,{type:G.ErrorTypes.MUX_ERROR,details:G.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Xe,reason:"fail allocating video mdat "+Xe});return}var Ye=new DataView(He.buffer);Ye.setUint32(0,Xe),He.set(M.default.types.mdat,4);for(var Me=0;Me<B;Me++){for(var it=b[Me],qe=it.units,he=0,ee=0,re=qe.length;ee<re;ee++){var ae=qe[ee],fe=ae.data,ie=ae.data.byteLength;Ye.setUint32(I,ie),I+=4,He.set(fe,I),I+=ie,he+=4+ie}if(Me<B-1)g=b[Me+1].dts-it.dts;else{var se=this.config,pe=it.dts-b[Me>0?Me-1:Me].dts;if(se.stretchShortVideoTrack&&this.nextAudioPts!==null){var me=Math.floor(se.maxBufferHole*y),Ee=(w?le+w*y:this.nextAudioPts)-it.pts;Ee>me?(g=Ee-pe,g<0&&(g=pe),r.logger.log("[mp4-remuxer]: It is approximately "+Ee/90+" ms to the next segment; using duration "+g/90+" ms for the last video frame.")):g=pe}else g=pe}var Le=Math.round(it.pts-it.dts);j.push(new x(it.key,g,he,Le))}if(j.length&&f&&f<70){var Pe=j[0].flags;Pe.dependsOn=2,Pe.isNonSync=0}console.assert(g!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=F=$+g,this.isVideoContiguous=!0;var Ke=M.default.moof(A.sequenceNumber++,W,m({},A,{samples:j})),et="video",rt={data1:Ke,data2:He,startPTS:le/y,endPTS:(de+g)/y,startDTS:W/y,endDTS:F/y,type:et,hasAudio:!1,hasVideo:!0,nb:j.length,dropped:A.dropped};return A.samples=[],A.dropped=0,console.assert(He.length,"MDAT length must not be zero"),rt},L.remuxAudio=function(A,T,d,w,y){var b=A.inputTimeScale,j=A.samplerate?A.samplerate:b,B=b/j,E=A.isAAC?h:u,F=E*B,I=this._initPTS,g=!A.isAAC&&this.typeSupported.mpeg,W=[],$=A.samples,le=g?0:8,de=this.nextAudioPts||-1,Ce=T*b;if(this.isAudioContiguous=d=d||$.length&&de>0&&(w&&Math.abs(Ce-de)<9e3||Math.abs(a($[0].pts-I,Ce)-de)<20*F),$.forEach(function(fe){fe.pts=a(fe.pts-I,Ce)}),!d||de<0){if($=$.filter(function(fe){return fe.pts>=0}),!$.length)return;y===0?de=0:w?de=Math.max(0,Ce):de=$[0].pts}if(A.isAAC)for(var be=y!==void 0,Ae=this.config.maxAudioFramesDrift,Se=0,Re=de;Se<$.length;Se++){var ve=$[Se],X=ve.pts,_=X-Re,k=Math.abs(1e3*_/b);if(_<=-Ae*F&&be)Se===0&&(r.logger.warn("Audio frame @ "+(X/b).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*_/b)+" ms."),this.nextAudioPts=de=Re=X);else if(_>=Ae*F&&k<p&&be){var U=Math.round(_/F);Re=X-U*F,Re<0&&(U--,Re+=F),Se===0&&(this.nextAudioPts=de=Re),r.logger.warn("[mp4-remuxer]: Injecting "+U+" audio frame @ "+(Re/b).toFixed(3)+"s due to "+Math.round(1e3*_/b)+" ms gap.");for(var Q=0;Q<U;Q++){var K=Math.max(Re,0),ce=H.default.getSilentFrame(A.manifestCodec||A.codec,A.channelCount);ce||(r.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ce=ve.unit.subarray()),$.splice(Se,0,{unit:ce,pts:K}),Re+=F,Se++}}ve.pts=Re,Re+=F}for(var xe=null,De=null,ue,ge=0,we=$.length;we--;)ge+=$[we].unit.byteLength;for(var Oe=0,Ne=$.length;Oe<Ne;Oe++){var Ue=$[Oe],Ge=Ue.unit,We=Ue.pts;if(De!==null){var Xe=W[Oe-1];Xe.duration=Math.round((We-De)/B)}else if(d&&A.isAAC&&(We=de),xe=We,ge>0){ge+=le;try{ue=new Uint8Array(ge)}catch(fe){this.observer.emit(z.Events.ERROR,z.Events.ERROR,{type:G.ErrorTypes.MUX_ERROR,details:G.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ge,reason:"fail allocating audio mdat "+ge});return}if(!g){var He=new DataView(ue.buffer);He.setUint32(0,ge),ue.set(M.default.types.mdat,4)}}else return;ue.set(Ge,le);var Ye=Ge.byteLength;le+=Ye,W.push(new x(!0,E,Ye,0)),De=We}var Me=W.length;if(!Me)return;var it=W[W.length-1];this.nextAudioPts=de=De+B*it.duration;var qe=g?new Uint8Array(0):M.default.moof(A.sequenceNumber++,xe/B,m({},A,{samples:W}));A.samples=[];var he=xe/b,ee=de/b,re="audio",ae={data1:qe,data2:ue,startPTS:he,endPTS:ee,startDTS:he,endDTS:ee,type:re,hasAudio:!0,hasVideo:!1,nb:Me};return this.isAudioContiguous=!0,console.assert(ue.length,"MDAT length must not be zero"),ae},L.remuxEmptyAudio=function(A,T,d,w){var y=A.inputTimeScale,b=A.samplerate?A.samplerate:y,j=y/b,B=this.nextAudioPts,E=(B!==null?B:w.startDTS*y)+this._initDTS,F=w.endDTS*y+this._initDTS,I=j*h,g=Math.ceil((F-E)/I),W=H.default.getSilentFrame(A.manifestCodec||A.codec,A.channelCount);if(r.logger.warn("[mp4-remuxer]: remux empty Audio"),!W){r.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var $=[],le=0;le<g;le++){var de=E+le*I;$.push({unit:W,pts:de,dts:de})}return A.samples=$,this.remuxAudio(A,T,d,!1)},L.remuxID3=function(A,T){var d=A.samples.length;if(!d)return;for(var w=A.inputTimeScale,y=this._initPTS,b=this._initDTS,j=0;j<d;j++){var B=A.samples[j];B.pts=a(B.pts-y,T*w)/w,B.dts=a(B.dts-b,T*w)/w}var E=A.samples;return A.samples=[],{samples:E}},L.remuxText=function(A,T){var d=A.samples.length;if(!d)return;for(var w=A.inputTimeScale,y=this._initPTS,b=0;b<d;b++){var j=A.samples[b];j.pts=a(j.pts-y,T*w)/w}A.samples.sort(function(E,F){return E.pts-F.pts});var B=A.samples;return A.samples=[],{samples:B}},D}();function a(D,L){var R;if(L===null)return D;for(L<D?R=-8589934592:R=8589934592;Math.abs(D-L)>4294967296;)D+=R;return D}function S(D){for(var L=0;L<D.length;L++)if(D[L].key)return L;return-1}var x=function(L,R,A,T){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=R,this.size=A,this.cts=T,this.flags=new C(L)},C=function(L){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=L?2:1,this.isNonSync=L?0:1}},"./src/remux/passthrough-remuxer.ts":function(oe,Y,N){"use strict";N.r(Y);var J=N("./src/polyfills/number.ts"),H=N("./src/utils/mp4-tools.ts"),M=N("./src/loader/fragment.ts"),z=N("./src/utils/logger.ts"),G=function(){function v(){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 m=v.prototype;return m.destroy=function(){},m.resetTimeStamp=function(h){this.initPTS=h,this.lastEndDTS=null},m.resetNextTimestamp=function(){this.lastEndDTS=null},m.resetInitSegment=function(h,u,f){this.audioCodec=u,this.videoCodec=f,this.generateInitSegment(h),this.emitInitSegment=!0},m.generateInitSegment=function(h){var u=this.audioCodec,f=this.videoCodec;if(!h||!h.byteLength){this.initTracks=void 0,this.initData=void 0;return}var o=this.initData=Object(H.parseInitSegment)(h);u||(u=O(o.audio,M.ElementaryStreamTypes.AUDIO)),f||(f=O(o.video,M.ElementaryStreamTypes.VIDEO));var l={};o.audio&&o.video?l.audiovideo={container:"video/mp4",codec:u+","+f,initSegment:h,id:"main"}:o.audio?l.audio={container:"audio/mp4",codec:u,initSegment:h,id:"audio"}:o.video?l.video={container:"video/mp4",codec:f,initSegment:h,id:"main"}:z.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=l},m.remux=function(h,u,f,o,l){var s=this.initPTS,a=this.lastEndDTS,S={audio:void 0,video:void 0,text:o,id3:f,initSegment:void 0};Object(J.isFiniteNumber)(a)||(a=this.lastEndDTS=l||0);var x=u.samples;if(!x||!x.length)return S;var C={initPTS:void 0,timescale:1},D=this.initData;if((!D||!D.length)&&(this.generateInitSegment(x),D=this.initData),!D||!D.length)return z.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),S;this.emitInitSegment&&(C.tracks=this.initTracks,this.emitInitSegment=!1),Object(J.isFiniteNumber)(s)||(this.initPTS=C.initPTS=s=r(D,x,a));var L=Object(H.getDuration)(x,D),R=a,A=L+R;Object(H.offsetStartDTS)(D,x,s),L>0?this.lastEndDTS=A:(z.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var T=!!D.audio,d=!!D.video,w="";T&&(w+="audio"),d&&(w+="video");var y={data1:x,startPTS:R,startDTS:R,endPTS:A,endDTS:A,type:w,hasAudio:T,hasVideo:d,nb:1,dropped:0};return S.audio=y.type==="audio"?y:void 0,S.video=y.type!=="audio"?y:void 0,S.text=o,S.id3=f,S.initSegment=C,S},v}(),r=function(m,p,h){return Object(H.getStartDTS)(m,p)-h};function O(v,m){var p=v==null?void 0:v.codec;return p&&p.length>4?p:p==="hvc1"?"hvc1.1.c.L120.90":p==="av01"?"av01.0.04M.08":p==="avc1"||m===M.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}Y.default=G},"./src/task-loop.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return J});var J=function(){function H(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var M=H.prototype;return M.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},M.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},M.onHandlerDestroyed=function(){},M.hasInterval=function(){return!!this._tickInterval},M.hasNextTick=function(){return!!this._tickTimer},M.setInterval=function(G){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,G),!0)},M.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},M.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},M.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},M.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},M.doTick=function(){},H}()},"./src/types/cmcd.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"CMCDVersion",function(){return J}),N.d(Y,"CMCDObjectType",function(){return H}),N.d(Y,"CMCDStreamingFormat",function(){return M}),N.d(Y,"CMCDStreamType",function(){return z});var J=1,H;(function(G){G.MANIFEST="m",G.AUDIO="a",G.VIDEO="v",G.MUXED="av",G.INIT="i",G.CAPTION="c",G.TIMED_TEXT="tt",G.KEY="k",G.OTHER="o"})(H||(H={}));var M;(function(G){G.DASH="d",G.HLS="h",G.SMOOTH="s",G.OTHER="o"})(M||(M={}));var z;(function(G){G.VOD="v",G.LIVE="l"})(z||(z={}))},"./src/types/level.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"HlsSkip",function(){return M}),N.d(Y,"getSkipValue",function(){return z}),N.d(Y,"HlsUrlParameters",function(){return G}),N.d(Y,"Level",function(){return r});function J(O,v){for(var m=0;m<v.length;m++){var p=v[m];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(O,p.key,p)}}function H(O,v,m){return v&&J(O.prototype,v),m&&J(O,m),O}var M;(function(O){O.No="",O.Yes="YES",O.v2="v2"})(M||(M={}));function z(O,v){var m=O.canSkipUntil,p=O.canSkipDateRanges,h=O.endSN,u=v!==void 0?v-h:0;return m&&u<m?p?M.v2:M.Yes:M.No}var G=function(){function O(m,p,h){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=m,this.part=p,this.skip=h}var v=O.prototype;return v.addDirectives=function(p){var h=new self.URL(p);return this.msn!==void 0&&h.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&h.searchParams.set("_HLS_part",this.part.toString()),this.skip&&h.searchParams.set("_HLS_skip",this.skip),h.toString()},O}(),r=function(){function O(v){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=[v.url],this.attrs=v.attrs,this.bitrate=v.bitrate,v.details&&(this.details=v.details),this.id=v.id||0,this.name=v.name,this.width=v.width||0,this.height=v.height||0,this.audioCodec=v.audioCodec,this.videoCodec=v.videoCodec,this.unknownCodecs=v.unknownCodecs,this.codecSet=[v.videoCodec,v.audioCodec].filter(function(m){return m}).join(",").replace(/\.[^.,]+/g,"")}return H(O,[{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(m){var p=m%this.url.length;this._urlId!==p&&(this.details=void 0,this._urlId=p)}}]),O}()},"./src/types/loader.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"PlaylistContextType",function(){return J}),N.d(Y,"PlaylistLevelType",function(){return H});var J;(function(M){M.MANIFEST="manifest",M.LEVEL="level",M.AUDIO_TRACK="audioTrack",M.SUBTITLE_TRACK="subtitleTrack"})(J||(J={}));var H;(function(M){M.MAIN="main",M.AUDIO="audio",M.SUBTITLE="subtitle"})(H||(H={}))},"./src/types/transmuxer.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"ChunkMetadata",function(){return J});var J=function(z,G,r,O,v,m){O===void 0&&(O=0),v===void 0&&(v=-1),m===void 0&&(m=!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=H(),this.buffering={audio:H(),video:H(),audiovideo:H()},this.level=z,this.sn=G,this.id=r,this.size=O,this.part=v,this.partial=m};function H(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"AttrList",function(){return M});var J=/^(\d+)x(\d+)$/,H=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,M=function(){function z(r){typeof r=="string"&&(r=z.parseAttrList(r));for(var O in r)r.hasOwnProperty(O)&&(this[O]=r[O])}var G=z.prototype;return G.decimalInteger=function(O){var v=parseInt(this[O],10);return v>Number.MAX_SAFE_INTEGER?Infinity:v},G.hexadecimalInteger=function(O){if(this[O]){var v=(this[O]||"0x").slice(2);v=(v.length&1?"0":"")+v;for(var m=new Uint8Array(v.length/2),p=0;p<v.length/2;p++)m[p]=parseInt(v.slice(p*2,p*2+2),16);return m}else return null},G.hexadecimalIntegerAsNumber=function(O){var v=parseInt(this[O],16);return v>Number.MAX_SAFE_INTEGER?Infinity:v},G.decimalFloatingPoint=function(O){return parseFloat(this[O])},G.optionalFloat=function(O,v){var m=this[O];return m?parseFloat(m):v},G.enumeratedString=function(O){return this[O]},G.bool=function(O){return this[O]==="YES"},G.decimalResolution=function(O){var v=J.exec(this[O]);return v===null?void 0:{width:parseInt(v[1],10),height:parseInt(v[2],10)}},z.parseAttrList=function(O){var v,m={},p='"';for(H.lastIndex=0;(v=H.exec(O))!==null;){var h=v[2];h.indexOf(p)===0&&h.lastIndexOf(p)===h.length-1&&(h=h.slice(1,-1)),m[v[1]]=h}return m},z}()},"./src/utils/binary-search.ts":function(oe,Y,N){"use strict";N.r(Y);var J={search:function(M,z){for(var G=0,r=M.length-1,O=null,v=null;G<=r;){O=(G+r)/2|0,v=M[O];var m=z(v);if(m>0)G=O+1;else if(m<0)r=O-1;else return v}return null}};Y.default=J},"./src/utils/buffer-helper.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"BufferHelper",function(){return M});var J=N("./src/utils/logger.ts"),H={length:0,start:function(){return 0},end:function(){return 0}},M=function(){function z(){}return z.isBuffered=function(r,O){try{if(r){for(var v=z.getBuffered(r),m=0;m<v.length;m++)if(O>=v.start(m)&&O<=v.end(m))return!0}}catch(p){}return!1},z.bufferInfo=function(r,O,v){try{if(r){var m=z.getBuffered(r),p=[],h;for(h=0;h<m.length;h++)p.push({start:m.start(h),end:m.end(h)});return this.bufferedInfo(p,O,v)}}catch(u){}return{len:0,start:O,end:O,nextStart:void 0}},z.bufferedInfo=function(r,O,v){O=Math.max(0,O),r.sort(function(C,D){var L=C.start-D.start;return L||D.end-C.end});var m=[];if(v)for(var p=0;p<r.length;p++){var h=m.length;if(h){var u=m[h-1].end;r[p].start-u<v?r[p].end>u&&(m[h-1].end=r[p].end):m.push(r[p])}else m.push(r[p])}else m=r;for(var f=0,o,l=O,s=O,a=0;a<m.length;a++){var S=m[a].start,x=m[a].end;if(O+v>=S&&O<x)l=S,s=x,f=s-O;else if(O+v<S){o=S;break}}return{len:f,start:l||0,end:s||0,nextStart:o}},z.getBuffered=function(r){try{return r.buffered}catch(O){return J.logger.log("failed to get media.buffered",O),H}},z}()},"./src/utils/cea-608-parser.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"Row",function(){return s}),N.d(Y,"CaptionScreen",function(){return a});var J=N("./src/utils/logger.ts"),H={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},M=function(A){var T=A;return H.hasOwnProperty(A)&&(T=H[A]),String.fromCharCode(T)},z=15,G=100,r={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},O={17:2,18:4,21:6,22:8,23:10,19:13,20:15},v={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},m={25:2,26:4,29:6,30:8,31:10,27:13,28:15},p=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],h;(function(R){R[R.ERROR=0]="ERROR",R[R.TEXT=1]="TEXT",R[R.WARNING=2]="WARNING",R[R.INFO=2]="INFO",R[R.DEBUG=3]="DEBUG",R[R.DATA=3]="DATA"})(h||(h={}));var u=function(){function R(){this.time=null,this.verboseLevel=h.ERROR}var A=R.prototype;return A.log=function(d,w){this.verboseLevel>=d&&J.logger.log(this.time+" ["+d+"] "+w)},R}(),f=function(A){for(var T=[],d=0;d<A.length;d++)T.push(A[d].toString(16));return T},o=function(){function R(T,d,w,y,b){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=T||"white",this.underline=d||!1,this.italics=w||!1,this.background=y||"black",this.flash=b||!1}var A=R.prototype;return A.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},A.setStyles=function(d){for(var w=["foreground","underline","italics","background","flash"],y=0;y<w.length;y++){var b=w[y];d.hasOwnProperty(b)&&(this[b]=d[b])}},A.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},A.equals=function(d){return this.foreground===d.foreground&&this.underline===d.underline&&this.italics===d.italics&&this.background===d.background&&this.flash===d.flash},A.copy=function(d){this.foreground=d.foreground,this.underline=d.underline,this.italics=d.italics,this.background=d.background,this.flash=d.flash},A.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},R}(),l=function(){function R(T,d,w,y,b,j){this.uchar=void 0,this.penState=void 0,this.uchar=T||" ",this.penState=new o(d,w,y,b,j)}var A=R.prototype;return A.reset=function(){this.uchar=" ",this.penState.reset()},A.setChar=function(d,w){this.uchar=d,this.penState.copy(w)},A.setPenState=function(d){this.penState.copy(d)},A.equals=function(d){return this.uchar===d.uchar&&this.penState.equals(d.penState)},A.copy=function(d){this.uchar=d.uchar,this.penState.copy(d.penState)},A.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},R}(),s=function(){function R(T){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var d=0;d<G;d++)this.chars.push(new l);this.logger=T,this.pos=0,this.currPenState=new o}var A=R.prototype;return A.equals=function(d){for(var w=!0,y=0;y<G;y++)if(!this.chars[y].equals(d.chars[y])){w=!1;break}return w},A.copy=function(d){for(var w=0;w<G;w++)this.chars[w].copy(d.chars[w])},A.isEmpty=function(){for(var d=!0,w=0;w<G;w++)if(!this.chars[w].isEmpty()){d=!1;break}return d},A.setCursor=function(d){this.pos!==d&&(this.pos=d),this.pos<0?(this.logger.log(h.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>G&&(this.logger.log(h.DEBUG,"Too large cursor position "+this.pos),this.pos=G)},A.moveCursor=function(d){var w=this.pos+d;if(d>1)for(var y=this.pos+1;y<w+1;y++)this.chars[y].setPenState(this.currPenState);this.setCursor(w)},A.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},A.insertChar=function(d){d>=144&&this.backSpace();var w=M(d);if(this.pos>=G){this.logger.log(h.ERROR,"Cannot insert "+d.toString(16)+" ("+w+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(w,this.currPenState),this.moveCursor(1)},A.clearFromPos=function(d){var w;for(w=d;w<G;w++)this.chars[w].reset()},A.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},A.clearToEndOfRow=function(){this.clearFromPos(this.pos)},A.getTextString=function(){for(var d=[],w=!0,y=0;y<G;y++){var b=this.chars[y].uchar;b!==" "&&(w=!1),d.push(b)}return w?"":d.join("")},A.setPenStyles=function(d){this.currPenState.setStyles(d);var w=this.chars[this.pos];w.setPenState(this.currPenState)},R}(),a=function(){function R(T){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var d=0;d<z;d++)this.rows.push(new s(T));this.logger=T,this.currRow=z-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var A=R.prototype;return A.reset=function(){for(var d=0;d<z;d++)this.rows[d].clear();this.currRow=z-1},A.equals=function(d){for(var w=!0,y=0;y<z;y++)if(!this.rows[y].equals(d.rows[y])){w=!1;break}return w},A.copy=function(d){for(var w=0;w<z;w++)this.rows[w].copy(d.rows[w])},A.isEmpty=function(){for(var d=!0,w=0;w<z;w++)if(!this.rows[w].isEmpty()){d=!1;break}return d},A.backSpace=function(){var d=this.rows[this.currRow];d.backSpace()},A.clearToEndOfRow=function(){var d=this.rows[this.currRow];d.clearToEndOfRow()},A.insertChar=function(d){var w=this.rows[this.currRow];w.insertChar(d)},A.setPen=function(d){var w=this.rows[this.currRow];w.setPenStyles(d)},A.moveCursor=function(d){var w=this.rows[this.currRow];w.moveCursor(d)},A.setCursor=function(d){this.logger.log(h.INFO,"setCursor: "+d);var w=this.rows[this.currRow];w.setCursor(d)},A.setPAC=function(d){this.logger.log(h.INFO,"pacData = "+JSON.stringify(d));var w=d.row-1;if(this.nrRollUpRows&&w<this.nrRollUpRows-1&&(w=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==w){for(var y=0;y<z;y++)this.rows[y].clear();var b=this.currRow+1-this.nrRollUpRows,j=this.lastOutputScreen;if(j){var B=j.rows[b].cueStartTime,E=this.logger.time;if(B&&E!==null&&B<E)for(var F=0;F<this.nrRollUpRows;F++)this.rows[w-this.nrRollUpRows+F+1].copy(j.rows[b+F])}}this.currRow=w;var I=this.rows[this.currRow];if(d.indent!==null){var g=d.indent,W=Math.max(g-1,0);I.setCursor(d.indent),d.color=I.chars[W].penState.foreground}var $={foreground:d.color,underline:d.underline,italics:d.italics,background:"black",flash:!1};this.setPen($)},A.setBkgData=function(d){this.logger.log(h.INFO,"bkgData = "+JSON.stringify(d)),this.backSpace(),this.setPen(d),this.insertChar(32)},A.setRollUpRows=function(d){this.nrRollUpRows=d},A.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(h.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(h.TEXT,this.getDisplayText());var d=this.currRow+1-this.nrRollUpRows,w=this.rows.splice(d,1)[0];w.clear(),this.rows.splice(this.currRow,0,w),this.logger.log(h.INFO,"Rolling up")},A.getDisplayText=function(d){d=d||!1;for(var w=[],y="",b=-1,j=0;j<z;j++){var B=this.rows[j].getTextString();B&&(b=j+1,d?w.push("Row "+b+": '"+B+"'"):w.push(B.trim()))}return w.length>0&&(d?y="["+w.join(" | ")+"]":y=w.join(`
|
|
`)),y},A.getTextAndFormat=function(){return this.rows},R}(),S=function(){function R(T,d,w){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=T,this.outputFilter=d,this.mode=null,this.verbose=0,this.displayedMemory=new a(w),this.nonDisplayedMemory=new a(w),this.lastOutputScreen=new a(w),this.currRollUpRow=this.displayedMemory.rows[z-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=w}var A=R.prototype;return A.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[z-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},A.getHandler=function(){return this.outputFilter},A.setHandler=function(d){this.outputFilter=d},A.setPAC=function(d){this.writeScreen.setPAC(d)},A.setBkgData=function(d){this.writeScreen.setBkgData(d)},A.setMode=function(d){if(d===this.mode)return;this.mode=d,this.logger.log(h.INFO,"MODE="+d),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=d},A.insertChars=function(d){for(var w=0;w<d.length;w++)this.writeScreen.insertChar(d[w]);var y=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(h.INFO,y+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(h.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},A.ccRCL=function(){this.logger.log(h.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},A.ccBS=function(){if(this.logger.log(h.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},A.ccAOF=function(){},A.ccAON=function(){},A.ccDER=function(){this.logger.log(h.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},A.ccRU=function(d){this.logger.log(h.INFO,"RU("+d+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(d)},A.ccFON=function(){this.logger.log(h.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},A.ccRDC=function(){this.logger.log(h.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},A.ccTR=function(){this.logger.log(h.INFO,"TR"),this.setMode("MODE_TEXT")},A.ccRTD=function(){this.logger.log(h.INFO,"RTD"),this.setMode("MODE_TEXT")},A.ccEDM=function(){this.logger.log(h.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},A.ccCR=function(){this.logger.log(h.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},A.ccENM=function(){this.logger.log(h.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},A.ccEOC=function(){if(this.logger.log(h.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var d=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=d,this.writeScreen=this.nonDisplayedMemory,this.logger.log(h.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},A.ccTO=function(d){this.logger.log(h.INFO,"TO("+d+") - Tab Offset"),this.writeScreen.moveCursor(d)},A.ccMIDROW=function(d){var w={flash:!1};if(w.underline=d%2===1,w.italics=d>=46,w.italics)w.foreground="white";else{var y=Math.floor(d/2)-16,b=["white","green","blue","cyan","red","yellow","magenta"];w.foreground=b[y]}this.logger.log(h.INFO,"MIDROW: "+JSON.stringify(w)),this.writeScreen.setPen(w)},A.outputDataUpdate=function(d){d===void 0&&(d=!1);var w=this.logger.time;if(w===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=w:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,w,this.lastOutputScreen),d&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:w),this.lastOutputScreen.copy(this.displayedMemory))},A.cueSplitAtTime=function(d){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,d,this.displayedMemory),this.cueStartTime=d))},R}(),x=function(){function R(T,d,w){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var y=new u;this.channels=[null,new S(T,d,y),new S(T+1,w,y)],this.cmdHistory=L(),this.logger=y}var A=R.prototype;return A.getHandler=function(d){return this.channels[d].getHandler()},A.setHandler=function(d,w){this.channels[d].setHandler(w)},A.addData=function(d,w){var y,b,j,B=!1;this.logger.time=d;for(var E=0;E<w.length;E+=2){if(b=w[E]&127,j=w[E+1]&127,b===0&&j===0)continue;if(this.logger.log(h.DATA,"["+f([w[E],w[E+1]])+"] -> ("+f([b,j])+")"),y=this.parseCmd(b,j),y||(y=this.parseMidrow(b,j)),y||(y=this.parsePAC(b,j)),y||(y=this.parseBackgroundAttributes(b,j)),!y&&(B=this.parseChars(b,j),B)){var F=this.currentChannel;if(F&&F>0){var I=this.channels[F];I.insertChars(B)}else this.logger.log(h.WARNING,"No channel found yet. TEXT-MODE?")}!y&&!B&&this.logger.log(h.WARNING,"Couldn't parse cleaned data "+f([b,j])+" orig: "+f([w[E],w[E+1]]))}},A.parseCmd=function(d,w){var y=this.cmdHistory,b=(d===20||d===28||d===21||d===29)&&w>=32&&w<=47,j=(d===23||d===31)&&w>=33&&w<=35;if(!(b||j))return!1;if(D(d,w,y))return C(null,null,y),this.logger.log(h.DEBUG,"Repeated command ("+f([d,w])+") is dropped"),!0;var B=d===20||d===21||d===23?1:2,E=this.channels[B];return d===20||d===21||d===28||d===29?w===32?E.ccRCL():w===33?E.ccBS():w===34?E.ccAOF():w===35?E.ccAON():w===36?E.ccDER():w===37?E.ccRU(2):w===38?E.ccRU(3):w===39?E.ccRU(4):w===40?E.ccFON():w===41?E.ccRDC():w===42?E.ccTR():w===43?E.ccRTD():w===44?E.ccEDM():w===45?E.ccCR():w===46?E.ccENM():w===47&&E.ccEOC():E.ccTO(w-32),C(d,w,y),this.currentChannel=B,!0},A.parseMidrow=function(d,w){var y=0;if((d===17||d===25)&&w>=32&&w<=47){if(d===17?y=1:y=2,y!==this.currentChannel)return this.logger.log(h.ERROR,"Mismatch channel in midrow parsing"),!1;var b=this.channels[y];return b?(b.ccMIDROW(w),this.logger.log(h.DEBUG,"MIDROW ("+f([d,w])+")"),!0):!1}return!1},A.parsePAC=function(d,w){var y,b=this.cmdHistory,j=(d>=17&&d<=23||d>=25&&d<=31)&&w>=64&&w<=127,B=(d===16||d===24)&&w>=64&&w<=95;if(!(j||B))return!1;if(D(d,w,b))return C(null,null,b),!0;var E=d<=23?1:2;w>=64&&w<=95?y=E===1?r[d]:v[d]:y=E===1?O[d]:m[d];var F=this.channels[E];return F?(F.setPAC(this.interpretPAC(y,w)),C(d,w,b),this.currentChannel=E,!0):!1},A.interpretPAC=function(d,w){var y,b={color:null,italics:!1,indent:null,underline:!1,row:d};return w>95?y=w-96:y=w-64,b.underline=(y&1)===1,y<=13?b.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(y/2)]:y<=15?(b.italics=!0,b.color="white"):b.indent=Math.floor((y-16)/2)*4,b},A.parseChars=function(d,w){var y,b=null,j=null;if(d>=25?(y=2,j=d-8):(y=1,j=d),j>=17&&j<=19){var B;j===17?B=w+80:j===18?B=w+112:B=w+144,this.logger.log(h.INFO,"Special char '"+M(B)+"' in channel "+y),b=[B]}else d>=32&&d<=127&&(b=w===0?[d]:[d,w]);if(b){var E=f(b);this.logger.log(h.DEBUG,"Char codes = "+E.join(",")),C(d,w,this.cmdHistory)}return b},A.parseBackgroundAttributes=function(d,w){var y=(d===16||d===24)&&w>=32&&w<=47,b=(d===23||d===31)&&w>=45&&w<=47;if(!(y||b))return!1;var j,B={};d===16||d===24?(j=Math.floor((w-32)/2),B.background=p[j],w%2===1&&(B.background=B.background+"_semi")):w===45?B.background="transparent":(B.foreground="black",w===47&&(B.underline=!0));var E=d<=23?1:2,F=this.channels[E];return F.setBkgData(B),C(d,w,this.cmdHistory),!0},A.reset=function(){for(var d=0;d<Object.keys(this.channels).length;d++){var w=this.channels[d];w&&w.reset()}this.cmdHistory=L()},A.cueSplitAtTime=function(d){for(var w=0;w<this.channels.length;w++){var y=this.channels[w];y&&y.cueSplitAtTime(d)}},R}();function C(R,A,T){T.a=R,T.b=A}function D(R,A,T){return T.a===R&&T.b===A}function L(){return{a:null,b:null}}Y.default=x},"./src/utils/codecs.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"isCodecType",function(){return H}),N.d(Y,"isCodecSupportedInMp4",function(){return M});var J={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 H(z,G){var r=J[G];return!!r&&r[z.slice(0,4)]===!0}function M(z,G){return MediaSource.isTypeSupported((G||"video")+'/mp4;codecs="'+z+'"')}},"./src/utils/cues.ts":function(oe,Y,N){"use strict";N.r(Y);var J=N("./src/utils/vttparser.ts"),H=N("./src/utils/webvtt-parser.ts"),M=N("./src/utils/texttrack-utils.ts"),z=/\s/,G={newCue:function(O,v,m,p){for(var h=[],u,f,o,l,s,a=self.VTTCue||self.TextTrackCue,S=0;S<p.rows.length;S++)if(u=p.rows[S],o=!0,l=0,s="",!u.isEmpty()){for(var x=0;x<u.chars.length;x++)z.test(u.chars[x].uchar)&&o?l++:(s+=u.chars[x].uchar,o=!1);u.cueStartTime=v,v===m&&(m+=1e-4),l>=16?l--:l++;var C=Object(J.fixLineBreaks)(s.trim()),D=Object(H.generateCueId)(v,m,C);(!O||!O.cues||!O.cues.getCueById(D))&&(f=new a(v,m,C),f.id=D,f.line=S+1,f.align="left",f.position=10+Math.min(80,Math.floor(l*8/32)*10),h.push(f))}return O&&h.length&&(h.sort(function(L,R){return L.line==="auto"||R.line==="auto"?0:L.line>8&&R.line>8?R.line-L.line:L.line-R.line}),h.forEach(function(L){return Object(M.addCueToTrack)(O,L)})),h}};Y.default=G},"./src/utils/discontinuities.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"findFirstFragWithCC",function(){return z}),N.d(Y,"shouldAlignOnDiscontinuities",function(){return G}),N.d(Y,"findDiscontinuousReferenceFrag",function(){return r}),N.d(Y,"adjustSlidingStart",function(){return v}),N.d(Y,"alignStream",function(){return m}),N.d(Y,"alignPDT",function(){return h}),N.d(Y,"alignFragmentByPDTDelta",function(){return u}),N.d(Y,"alignMediaPlaylistByPDT",function(){return f});var J=N("./src/polyfills/number.ts"),H=N("./src/utils/logger.ts"),M=N("./src/controller/level-helper.ts");function z(o,l){for(var s=null,a=0,S=o.length;a<S;a++){var x=o[a];if(x&&x.cc===l){s=x;break}}return s}function G(o,l,s){return!!(l.details&&(s.endCC>s.startCC||o&&o.cc<s.startCC))}function r(o,l){var s=o.fragments,a=l.fragments;if(!a.length||!s.length){H.logger.log("No fragments to align");return}var S=z(s,a[0].cc);if(!S||S&&!S.startPTS){H.logger.log("No frag in previous level to align on");return}return S}function O(o,l){if(o){var s=o.start+l;o.start=o.startPTS=s,o.endPTS=s+o.duration}}function v(o,l){for(var s=l.fragments,a=0,S=s.length;a<S;a++)O(s[a],o);l.fragmentHint&&O(l.fragmentHint,o),l.alignedSliding=!0}function m(o,l,s){if(!l)return;p(o,s,l),!s.alignedSliding&&l.details&&h(s,l.details),!s.alignedSliding&&l.details&&!s.skippedSegments&&Object(M.adjustSliding)(l.details,s)}function p(o,l,s){if(G(o,s,l)){var a=r(s.details,l);a&&Object(J.isFiniteNumber)(a.start)&&(H.logger.log("Adjusting PTS using last level due to CC increase within current level "+l.url),v(a.start,l))}}function h(o,l){if(!l.fragments.length||!o.hasProgramDateTime||!l.hasProgramDateTime)return;var s=l.fragments[0].programDateTime,a=o.fragments[0].programDateTime,S=(a-s)/1e3+l.fragments[0].start;S&&Object(J.isFiniteNumber)(S)&&(H.logger.log("Adjusting PTS using programDateTime delta "+(a-s)+"ms, sliding:"+S.toFixed(3)+" "+o.url+" "),v(S,o))}function u(o,l){var s=o.programDateTime;if(!s)return;var a=(s-l)/1e3;o.start=o.startPTS=a,o.endPTS=a+o.duration}function f(o,l){if(!l.fragments.length||!o.hasProgramDateTime||!l.hasProgramDateTime)return;var s=l.fragments[0].programDateTime,a=l.fragments[0].start,S=s-a*1e3;o.fragments.forEach(function(x){u(x,S)}),o.fragmentHint&&u(o.fragmentHint,S),o.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(oe,Y,N){"use strict";N.r(Y);var J=N("./src/utils/ewma.ts"),H=function(){function M(G,r,O){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=O,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new J.default(G),this.fast_=new J.default(r)}var z=M.prototype;return z.update=function(r,O){var v=this.slow_,m=this.fast_;this.slow_.halfLife!==r&&(this.slow_=new J.default(r,v.getEstimate(),v.getTotalWeight())),this.fast_.halfLife!==O&&(this.fast_=new J.default(O,m.getEstimate(),m.getTotalWeight()))},z.sample=function(r,O){r=Math.max(r,this.minDelayMs_);var v=8*O,m=r/1e3,p=v/m;this.fast_.sample(m,p),this.slow_.sample(m,p)},z.canEstimate=function(){var r=this.fast_;return r&&r.getTotalWeight()>=this.minWeight_},z.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},z.destroy=function(){},M}();Y.default=H},"./src/utils/ewma.ts":function(oe,Y,N){"use strict";N.r(Y);var J=function(){function H(z,G,r){G===void 0&&(G=0),r===void 0&&(r=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=z,this.alpha_=z?Math.exp(Math.log(.5)/z):0,this.estimate_=G,this.totalWeight_=r}var M=H.prototype;return M.sample=function(G,r){var O=Math.pow(this.alpha_,G);this.estimate_=r*(1-O)+O*this.estimate_,this.totalWeight_+=G},M.getTotalWeight=function(){return this.totalWeight_},M.getEstimate=function(){if(this.alpha_){var G=1-Math.pow(this.alpha_,this.totalWeight_);if(G)return this.estimate_/G}return this.estimate_},H}();Y.default=J},"./src/utils/fetch-loader.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"fetchSupported",function(){return u});var J=N("./src/polyfills/number.ts"),H=N("./src/loader/load-stats.ts"),M=N("./src/demux/chunk-cache.ts");function z(a,S){a.prototype=Object.create(S.prototype),a.prototype.constructor=a,m(a,S)}function G(a){var S=typeof Map=="function"?new Map:void 0;return G=function(C){if(C===null||!v(C))return C;if(typeof C!="function")throw new TypeError("Super expression must either be null or a function");if(typeof S!="undefined"){if(S.has(C))return S.get(C);S.set(C,D)}function D(){return r(C,arguments,p(this).constructor)}return D.prototype=Object.create(C.prototype,{constructor:{value:D,enumerable:!1,writable:!0,configurable:!0}}),m(D,C)},G(a)}function r(a,S,x){return O()?r=Reflect.construct:r=function(D,L,R){var A=[null];A.push.apply(A,L);var T=Function.bind.apply(D,A),d=new T;return R&&m(d,R.prototype),d},r.apply(null,arguments)}function O(){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(a){return!1}}function v(a){return Function.toString.call(a).indexOf("[native code]")!==-1}function m(a,S){return m=Object.setPrototypeOf||function(C,D){return C.__proto__=D,C},m(a,S)}function p(a){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(x){return x.__proto__||Object.getPrototypeOf(x)},p(a)}function h(){return h=Object.assign||function(a){for(var S=1;S<arguments.length;S++){var x=arguments[S];for(var C in x)Object.prototype.hasOwnProperty.call(x,C)&&(a[C]=x[C])}return a},h.apply(this,arguments)}function u(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(a){}return!1}var f=function(){function a(x){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=x.fetchSetup||l,this.controller=new self.AbortController,this.stats=new H.LoadStats}var S=a.prototype;return S.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},S.abortInternal=function(){var C=this.response;(!C||!C.ok)&&(this.stats.aborted=!0,this.controller.abort())},S.abort=function(){var C;this.abortInternal(),(C=this.callbacks)!==null&&C!==void 0&&C.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},S.load=function(C,D,L){var R=this,A=this.stats;if(A.loading.start)throw new Error("Loader can only be used once.");A.loading.start=self.performance.now();var T=o(C,this.controller.signal),d=L.onProgress,w=C.responseType==="arraybuffer",y=w?"byteLength":"length";this.context=C,this.config=D,this.callbacks=L,this.request=this.fetchSetup(C,T),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){R.abortInternal(),L.onTimeout(A,C,R.response)},D.timeout),self.fetch(this.request).then(function(b){if(R.response=R.loader=b,!b.ok){var j=b.status,B=b.statusText;throw new s(B||"fetch, bad network response",j,b)}return A.loading.first=Math.max(self.performance.now(),A.loading.start),A.total=parseInt(b.headers.get("Content-Length")||"0"),d&&Object(J.isFiniteNumber)(D.highWaterMark)?R.loadProgressively(b,A,C,D.highWaterMark,d):w?b.arrayBuffer():b.text()}).then(function(b){var j=R.response;self.clearTimeout(R.requestTimeout),A.loading.end=Math.max(self.performance.now(),A.loading.first),A.loaded=A.total=b[y];var B={url:j.url,data:b};d&&!Object(J.isFiniteNumber)(D.highWaterMark)&&d(A,C,b,j),L.onSuccess(B,A,C,j)}).catch(function(b){if(self.clearTimeout(R.requestTimeout),A.aborted)return;var j=b.code||0;L.onError({code:j,text:b.message},C,b.details)})},S.getCacheAge=function(){var C=null;if(this.response){var D=this.response.headers.get("age");C=D?parseFloat(D):null}return C},S.loadProgressively=function(C,D,L,R,A){R===void 0&&(R=0);var T=new M.default,d=C.body.getReader(),w=function y(){return d.read().then(function(b){if(b.done)return T.dataLength&&A(D,L,T.flush(),C),Promise.resolve(new ArrayBuffer(0));var j=b.value,B=j.length;return D.loaded+=B,B<R||T.dataLength?(T.push(j),T.dataLength>=R&&A(D,L,T.flush(),C)):A(D,L,j,C),y()}).catch(function(){return Promise.reject()})};return w()},a}();function o(a,S){var x={method:"GET",mode:"cors",credentials:"same-origin",signal:S,headers:new self.Headers(h({},a.headers))};return a.rangeEnd&&x.headers.set("Range","bytes="+a.rangeStart+"-"+String(a.rangeEnd-1)),x}function l(a,S){return new self.Request(a.url,S)}var s=function(a){z(S,a);function S(x,C,D){var L;return L=a.call(this,x)||this,L.code=void 0,L.details=void 0,L.code=C,L.details=D,L}return S}(G(Error));Y.default=f},"./src/utils/imsc1-ttml-parser.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"IMSC1_CODEC",function(){return v}),N.d(Y,"parseIMSC1",function(){return u});var J=N("./src/utils/mp4-tools.ts"),H=N("./src/utils/vttparser.ts"),M=N("./src/utils/vttcue.ts"),z=N("./src/demux/id3.ts"),G=N("./src/utils/timescale-conversion.ts"),r=N("./src/utils/webvtt-parser.ts");function O(){return O=Object.assign||function(R){for(var A=1;A<arguments.length;A++){var T=arguments[A];for(var d in T)Object.prototype.hasOwnProperty.call(T,d)&&(R[d]=T[d])}return R},O.apply(this,arguments)}var v="stpp.ttml.im1t",m=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,p=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,h={left:"start",center:"center",right:"end",start:"start",end:"end"};function u(R,A,T,d,w){var y=Object(J.findBox)(new Uint8Array(R),["mdat"]);if(y.length===0){w(new Error("Could not parse IMSC1 mdat"));return}var b=y[0],j=Object(z.utf8ArrayToStr)(new Uint8Array(R,b.start,b.end-b.start)),B=Object(G.toTimescaleFromScale)(A,1,T);try{d(f(j,B))}catch(E){w(E)}}function f(R,A){var T=new DOMParser,d=T.parseFromString(R,"text/xml"),w=d.getElementsByTagName("tt")[0];if(!w)throw new Error("Invalid ttml");var y={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},b=Object.keys(y).reduce(function(I,g){return I[g]=w.getAttribute("ttp:"+g)||y[g],I},{}),j=w.getAttribute("xml:space")!=="preserve",B=l(o(w,"styling","style")),E=l(o(w,"layout","region")),F=o(w,"body","[begin]");return[].map.call(F,function(I){var g=s(I,j);if(!g||!I.hasAttribute("begin"))return null;var W=C(I.getAttribute("begin"),b),$=C(I.getAttribute("dur"),b),le=C(I.getAttribute("end"),b);if(W===null)throw x(I);if(le===null){if($===null)throw x(I);le=W+$}var de=new M.default(W-A,le-A,g);de.id=Object(r.generateCueId)(de.startTime,de.endTime,de.text);var Ce=E[I.getAttribute("region")],be=B[I.getAttribute("style")];de.position=10,de.size=80;var Ae=a(Ce,be),Se=Ae.textAlign;if(Se){var Re=h[Se];Re&&(de.lineAlign=Re),de.align=Se}return O(de,Ae),de}).filter(function(I){return I!==null})}function o(R,A,T){var d=R.getElementsByTagName(A)[0];return d?[].slice.call(d.querySelectorAll(T)):[]}function l(R){return R.reduce(function(A,T){var d=T.getAttribute("xml:id");return d&&(A[d]=T),A},{})}function s(R,A){return[].slice.call(R.childNodes).reduce(function(T,d,w){var y;return d.nodeName==="br"&&w?T+`
|
|
`:(y=d.childNodes)!==null&&y!==void 0&&y.length?s(d,A):A?T+d.textContent.trim().replace(/\s+/g," "):T+d.textContent},"")}function a(R,A){var T="http://www.w3.org/ns/ttml#styling",d=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return d.reduce(function(w,y){var b=S(A,T,y)||S(R,T,y);return b&&(w[y]=b),w},{})}function S(R,A,T){return R.hasAttributeNS(A,T)?R.getAttributeNS(A,T):null}function x(R){return new Error("Could not parse ttml timestamp "+R)}function C(R,A){if(!R)return null;var T=Object(H.parseTimeStamp)(R);return T===null&&(m.test(R)?T=D(R,A):p.test(R)&&(T=L(R,A))),T}function D(R,A){var T=m.exec(R),d=(T[4]|0)+(T[5]|0)/A.subFrameRate;return(T[1]|0)*3600+(T[2]|0)*60+(T[3]|0)+d/A.frameRate}function L(R,A){var T=p.exec(R),d=Number(T[1]),w=T[2];switch(w){case"h":return d*3600;case"m":return d*60;case"ms":return d*1e3;case"f":return d/A.frameRate;case"t":return d/A.tickRate}return d}},"./src/utils/logger.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"enableLogs",function(){return r}),N.d(Y,"logger",function(){return O});var J=function(){},H={trace:J,debug:J,log:J,warn:J,info:J,error:J},M=H;function z(v){var m=self.console[v];return m?m.bind(self.console,"["+v+"] >"):J}function G(v){for(var m=arguments.length,p=new Array(m>1?m-1:0),h=1;h<m;h++)p[h-1]=arguments[h];p.forEach(function(u){M[u]=v[u]?v[u].bind(v):z(u)})}function r(v){if(self.console&&v===!0||typeof v=="object"){G(v,"debug","log","info","warn","error");try{M.log()}catch(m){M=H}}else M=H}var O=M},"./src/utils/mediakeys-helper.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"KeySystems",function(){return J}),N.d(Y,"requestMediaKeySystemAccess",function(){return H});var J;(function(M){M.WIDEVINE="com.widevine.alpha",M.PLAYREADY="com.microsoft.playready"})(J||(J={}));var H=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"getMediaSource",function(){return J});function J(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"bin2str",function(){return G}),N.d(Y,"readUint16",function(){return r}),N.d(Y,"readUint32",function(){return O}),N.d(Y,"writeUint32",function(){return v}),N.d(Y,"findBox",function(){return m}),N.d(Y,"parseSegmentIndex",function(){return p}),N.d(Y,"parseInitSegment",function(){return h}),N.d(Y,"getStartDTS",function(){return u}),N.d(Y,"getDuration",function(){return f}),N.d(Y,"computeRawDurationFromSamples",function(){return o}),N.d(Y,"offsetStartDTS",function(){return l}),N.d(Y,"segmentValidRange",function(){return s}),N.d(Y,"appendUint8Array",function(){return a});var J=N("./src/utils/typed-array.ts"),H=N("./src/loader/fragment.ts"),M=Math.pow(2,32)-1,z=[].push;function G(S){return String.fromCharCode.apply(null,S)}function r(S,x){"data"in S&&(x+=S.start,S=S.data);var C=S[x]<<8|S[x+1];return C<0?65536+C:C}function O(S,x){"data"in S&&(x+=S.start,S=S.data);var C=S[x]<<24|S[x+1]<<16|S[x+2]<<8|S[x+3];return C<0?4294967296+C:C}function v(S,x,C){"data"in S&&(x+=S.start,S=S.data),S[x]=C>>24,S[x+1]=C>>16&255,S[x+2]=C>>8&255,S[x+3]=C&255}function m(S,x){var C=[];if(!x.length)return C;var D,L,R;"data"in S?(D=S.data,L=S.start,R=S.end):(D=S,L=0,R=D.byteLength);for(var A=L;A<R;){var T=O(D,A),d=G(D.subarray(A+4,A+8)),w=T>1?A+T:R;if(d===x[0])if(x.length===1)C.push({data:D,start:A+8,end:w});else{var y=m({data:D,start:A+8,end:w},x.slice(1));y.length&&z.apply(C,y)}A=w}return C}function p(S){var x=m(S,["moov"]),C=x[0],D=C?C.end:null,L=m(S,["sidx"]);if(!L||!L[0])return null;var R=[],A=L[0],T=A.data[0],d=T===0?8:16,w=O(A,d);d+=4;var y=0,b=0;T===0?d+=8:d+=16,d+=2;var j=A.end+b,B=r(A,d);d+=2;for(var E=0;E<B;E++){var F=d,I=O(A,F);F+=4;var g=I&2147483647,W=(I&2147483648)>>>31;if(W===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var $=O(A,F);F+=4,R.push({referenceSize:g,subsegmentDuration:$,info:{duration:$/w,start:j,end:j+g-1}}),j+=g,F+=4,d=F}return{earliestPresentationTime:y,timescale:w,version:T,referencesCount:B,references:R,moovEndOffset:D}}function h(S){for(var x=[],C=m(S,["moov","trak"]),D=0;D<C.length;D++){var L=C[D],R=m(L,["tkhd"])[0];if(R){var A=R.data[R.start],T=A===0?12:20,d=O(R,T),w=m(L,["mdia","mdhd"])[0];if(w){A=w.data[w.start],T=A===0?12:20;var y=O(w,T),b=m(L,["mdia","hdlr"])[0];if(b){var j=G(b.data.subarray(b.start+8,b.start+12)),B={soun:H.ElementaryStreamTypes.AUDIO,vide:H.ElementaryStreamTypes.VIDEO}[j];if(B){var E=m(L,["mdia","minf","stbl","stsd"])[0],F=void 0;E&&(F=G(E.data.subarray(E.start+12,E.start+16))),x[d]={timescale:y,type:B},x[B]={timescale:y,id:d,codec:F}}}}}}var I=m(S,["moov","mvex","trex"]);return I.forEach(function(g){var W=O(g,4),$=x[W];$&&($.default={duration:O(g,12),flags:O(g,20)})}),x}function u(S,x){return m(x,["moof","traf"]).reduce(function(C,D){var L=m(D,["tfdt"])[0],R=L.data[L.start],A=m(D,["tfhd"]).reduce(function(T,d){var w=O(d,4),y=S[w];if(y){var b=O(L,4);R===1&&(b*=Math.pow(2,32),b+=O(L,8));var j=y.timescale||9e4,B=b/j;if(isFinite(B)&&(T===null||B<T))return B}return T},null);return A!==null&&isFinite(A)&&(C===null||A<C)?A:C},null)||0}function f(S,x){for(var C=0,D=0,L=0,R=m(S,["moof","traf"]),A=0;A<R.length;A++){var T=R[A],d=m(T,["tfhd"])[0],w=O(d,4),y=x[w];if(!y)continue;var b=y.default,j=O(d,0)|(b==null?void 0:b.flags),B=b==null?void 0:b.duration;j&8&&(j&2?B=O(d,12):B=O(d,8));for(var E=y.timescale||9e4,F=m(T,["trun"]),I=0;I<F.length;I++){if(B){var g=O(F[I],4);C=B*g}else C=o(F[I]);y.type===H.ElementaryStreamTypes.VIDEO?D+=C/E:y.type===H.ElementaryStreamTypes.AUDIO&&(L+=C/E)}}if(D===0&&L===0){var W=p(S);if(W!=null&&W.references)return W.references.reduce(function($,le){return $+le.info.duration||0},0)}return D||L}function o(S){var x=O(S,0),C=8;x&1&&(C+=4),x&4&&(C+=4);for(var D=0,L=O(S,4),R=0;R<L;R++){if(x&256){var A=O(S,C);D+=A,C+=4}x&512&&(C+=4),x&1024&&(C+=4),x&2048&&(C+=4)}return D}function l(S,x,C){m(x,["moof","traf"]).forEach(function(D){m(D,["tfhd"]).forEach(function(L){var R=O(L,4),A=S[R];if(!A)return;var T=A.timescale||9e4;m(D,["tfdt"]).forEach(function(d){var w=d.data[d.start],y=O(d,4);if(w===0)v(d,4,y-C*T);else{y*=Math.pow(2,32),y+=O(d,8),y-=C*T,y=Math.max(y,0);var b=Math.floor(y/(M+1)),j=Math.floor(y%(M+1));v(d,4,b),v(d,8,j)}})})})}function s(S){var x={valid:null,remainder:null},C=m(S,["moof"]);if(C){if(C.length<2)return x.remainder=S,x}else return x;var D=C[C.length-1];return x.valid=Object(J.sliceUint8)(S,0,D.start-8),x.remainder=Object(J.sliceUint8)(S,D.start-8),x}function a(S,x){var C=new Uint8Array(S.length+x.length);return C.set(S),C.set(x,S.length),C}},"./src/utils/output-filter.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return J});var J=function(){function H(z,G){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=z,this.trackName=G}var M=H.prototype;return M.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},M.newCue=function(G,r,O){(this.startTime===null||this.startTime>G)&&(this.startTime=G),this.endTime=r,this.screen=O,this.timelineController.createCaptionsTrack(this.trackName)},M.reset=function(){this.cueRanges=[]},H}()},"./src/utils/texttrack-utils.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"sendAddTrackEvent",function(){return H}),N.d(Y,"addCueToTrack",function(){return M}),N.d(Y,"clearCurrentCues",function(){return z}),N.d(Y,"removeCuesInRange",function(){return G}),N.d(Y,"getCuesInRange",function(){return O});var J=N("./src/utils/logger.ts");function H(v,m){var p;try{p=new Event("addtrack")}catch(h){p=document.createEvent("Event"),p.initEvent("addtrack",!1,!1)}p.track=v,m.dispatchEvent(p)}function M(v,m){var p=v.mode;if(p==="disabled"&&(v.mode="hidden"),v.cues&&!v.cues.getCueById(m.id))try{if(v.addCue(m),!v.cues.getCueById(m.id))throw new Error("addCue is failed for: "+m)}catch(u){J.logger.debug("[texttrack-utils]: "+u);var h=new self.TextTrackCue(m.startTime,m.endTime,m.text);h.id=m.id,v.addCue(h)}p==="disabled"&&(v.mode=p)}function z(v){var m=v.mode;if(m==="disabled"&&(v.mode="hidden"),v.cues)for(var p=v.cues.length;p--;)v.removeCue(v.cues[p]);m==="disabled"&&(v.mode=m)}function G(v,m,p){var h=v.mode;if(h==="disabled"&&(v.mode="hidden"),v.cues&&v.cues.length>0)for(var u=O(v.cues,m,p),f=0;f<u.length;f++)v.removeCue(u[f]);h==="disabled"&&(v.mode=h)}function r(v,m){if(m<v[0].startTime)return 0;var p=v.length-1;if(m>v[p].endTime)return-1;for(var h=0,u=p;h<=u;){var f=Math.floor((u+h)/2);if(m<v[f].startTime)u=f-1;else if(m>v[f].startTime&&h<p)h=f+1;else return f}return v[h].startTime-m<m-v[u].startTime?h:u}function O(v,m,p){var h=[],u=r(v,m);if(u>-1)for(var f=u,o=v.length;f<o;f++){var l=v[f];if(l.startTime>=m&&l.endTime<=p)h.push(l);else if(l.startTime>p)return h}return h}},"./src/utils/time-ranges.ts":function(oe,Y,N){"use strict";N.r(Y);var J={toString:function(M){for(var z="",G=M.length,r=0;r<G;r++)z+="["+M.start(r).toFixed(3)+","+M.end(r).toFixed(3)+"]";return z}};Y.default=J},"./src/utils/timescale-conversion.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"toTimescaleFromBase",function(){return H}),N.d(Y,"toTimescaleFromScale",function(){return M}),N.d(Y,"toMsFromMpegTsClock",function(){return z}),N.d(Y,"toMpegTsClockFromTimescale",function(){return G});var J=9e4;function H(r,O,v,m){v===void 0&&(v=1),m===void 0&&(m=!1);var p=r*O*v;return m?Math.round(p):p}function M(r,O,v,m){return v===void 0&&(v=1),m===void 0&&(m=!1),H(r,O,1/v,m)}function z(r,O){return O===void 0&&(O=!1),H(r,1e3,1/J,O)}function G(r,O){return O===void 0&&(O=1),H(r,J,1/O)}},"./src/utils/typed-array.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"sliceUint8",function(){return J});function J(H,M,z){return Uint8Array.prototype.slice?H.slice(M,z):new Uint8Array(Array.prototype.slice.call(H,M,z))}},"./src/utils/vttcue.ts":function(oe,Y,N){"use strict";N.r(Y),Y.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var J=["","lr","rl"],H=["start","middle","end","left","right"];function M(v,m){if(typeof m!="string")return!1;if(!Array.isArray(v))return!1;var p=m.toLowerCase();return~v.indexOf(p)?p:!1}function z(v){return M(J,v)}function G(v){return M(H,v)}function r(v){for(var m=arguments.length,p=new Array(m>1?m-1:0),h=1;h<m;h++)p[h-1]=arguments[h];for(var u=1;u<arguments.length;u++){var f=arguments[u];for(var o in f)v[o]=f[o]}return v}function O(v,m,p){var h=this,u={enumerable:!0};h.hasBeenReset=!1;var f="",o=!1,l=v,s=m,a=p,S=null,x="",C=!0,D="auto",L="start",R=50,A="middle",T=50,d="middle";Object.defineProperty(h,"id",r({},u,{get:function(){return f},set:function(y){f=""+y}})),Object.defineProperty(h,"pauseOnExit",r({},u,{get:function(){return o},set:function(y){o=!!y}})),Object.defineProperty(h,"startTime",r({},u,{get:function(){return l},set:function(y){if(typeof y!="number")throw new TypeError("Start time must be set to a number.");l=y,this.hasBeenReset=!0}})),Object.defineProperty(h,"endTime",r({},u,{get:function(){return s},set:function(y){if(typeof y!="number")throw new TypeError("End time must be set to a number.");s=y,this.hasBeenReset=!0}})),Object.defineProperty(h,"text",r({},u,{get:function(){return a},set:function(y){a=""+y,this.hasBeenReset=!0}})),Object.defineProperty(h,"region",r({},u,{get:function(){return S},set:function(y){S=y,this.hasBeenReset=!0}})),Object.defineProperty(h,"vertical",r({},u,{get:function(){return x},set:function(y){var b=z(y);if(b===!1)throw new SyntaxError("An invalid or illegal string was specified.");x=b,this.hasBeenReset=!0}})),Object.defineProperty(h,"snapToLines",r({},u,{get:function(){return C},set:function(y){C=!!y,this.hasBeenReset=!0}})),Object.defineProperty(h,"line",r({},u,{get:function(){return D},set:function(y){if(typeof y!="number"&&y!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");D=y,this.hasBeenReset=!0}})),Object.defineProperty(h,"lineAlign",r({},u,{get:function(){return L},set:function(y){var b=G(y);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");L=b,this.hasBeenReset=!0}})),Object.defineProperty(h,"position",r({},u,{get:function(){return R},set:function(y){if(y<0||y>100)throw new Error("Position must be between 0 and 100.");R=y,this.hasBeenReset=!0}})),Object.defineProperty(h,"positionAlign",r({},u,{get:function(){return A},set:function(y){var b=G(y);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");A=b,this.hasBeenReset=!0}})),Object.defineProperty(h,"size",r({},u,{get:function(){return T},set:function(y){if(y<0||y>100)throw new Error("Size must be between 0 and 100.");T=y,this.hasBeenReset=!0}})),Object.defineProperty(h,"align",r({},u,{get:function(){return d},set:function(y){var b=G(y);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");d=b,this.hasBeenReset=!0}})),h.displayState=void 0}return O.prototype.getCueAsHTML=function(){var v=self.WebVTT;return v.convertCueToDOMTree(self,this.text)},O}()},"./src/utils/vttparser.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"parseTimeStamp",function(){return M}),N.d(Y,"fixLineBreaks",function(){return m}),N.d(Y,"VTTParser",function(){return p});var J=N("./src/utils/vttcue.ts"),H=function(){function h(){}var u=h.prototype;return u.decode=function(o,l){if(!o)return"";if(typeof o!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(o))},h}();function M(h){function u(o,l,s,a){return(o|0)*3600+(l|0)*60+(s|0)+parseFloat(a||0)}var f=h.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return f?parseFloat(f[2])>59?u(f[2],f[3],0,f[4]):u(f[1],f[2],f[3],f[4]):null}var z=function(){function h(){this.values=Object.create(null)}var u=h.prototype;return u.set=function(o,l){!this.get(o)&&l!==""&&(this.values[o]=l)},u.get=function(o,l,s){return s?this.has(o)?this.values[o]:l[s]:this.has(o)?this.values[o]:l},u.has=function(o){return o in this.values},u.alt=function(o,l,s){for(var a=0;a<s.length;++a)if(l===s[a]){this.set(o,l);break}},u.integer=function(o,l){/^-?\d+$/.test(l)&&this.set(o,parseInt(l,10))},u.percent=function(o,l){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(l)){var s=parseFloat(l);if(s>=0&&s<=100)return this.set(o,s),!0}return!1},h}();function G(h,u,f,o){var l=o?h.split(o):[h];for(var s in l){if(typeof l[s]!="string")continue;var a=l[s].split(f);if(a.length!==2)continue;var S=a[0],x=a[1];u(S,x)}}var r=new J.default(0,0,""),O=r.align==="middle"?"middle":"center";function v(h,u,f){var o=h;function l(){var S=M(h);if(S===null)throw new Error("Malformed timestamp: "+o);return h=h.replace(/^[^\sa-zA-Z-]+/,""),S}function s(S,x){var C=new z;G(S,function(R,A){var T;switch(R){case"region":for(var d=f.length-1;d>=0;d--)if(f[d].id===A){C.set(R,f[d].region);break}break;case"vertical":C.alt(R,A,["rl","lr"]);break;case"line":T=A.split(","),C.integer(R,T[0]),C.percent(R,T[0])&&C.set("snapToLines",!1),C.alt(R,T[0],["auto"]),T.length===2&&C.alt("lineAlign",T[1],["start",O,"end"]);break;case"position":T=A.split(","),C.percent(R,T[0]),T.length===2&&C.alt("positionAlign",T[1],["start",O,"end","line-left","line-right","auto"]);break;case"size":C.percent(R,A);break;case"align":C.alt(R,A,["start",O,"end","left","right"]);break}},/:/,/\s/),x.region=C.get("region",null),x.vertical=C.get("vertical","");var D=C.get("line","auto");D==="auto"&&r.line===-1&&(D=-1),x.line=D,x.lineAlign=C.get("lineAlign","start"),x.snapToLines=C.get("snapToLines",!0),x.size=C.get("size",100),x.align=C.get("align",O);var L=C.get("position","auto");L==="auto"&&r.position===50&&(L=x.align==="start"||x.align==="left"?0:x.align==="end"||x.align==="right"?100:50),x.position=L}function a(){h=h.replace(/^\s+/,"")}if(a(),u.startTime=l(),a(),h.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+o);h=h.substr(3),a(),u.endTime=l(),a(),s(h,u)}function m(h){return h.replace(/<br(?: \/)?>/gi,`
|
|
`)}var p=function(){function h(){this.state="INITIAL",this.buffer="",this.decoder=new H,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var u=h.prototype;return u.parse=function(o){var l=this;o&&(l.buffer+=l.decoder.decode(o,{stream:!0}));function s(){var L=l.buffer,R=0;for(L=m(L);R<L.length&&L[R]!=="\r"&&L[R]!==`
|
|
`;)++R;var A=L.substr(0,R);return L[R]==="\r"&&++R,L[R]===`
|
|
`&&++R,l.buffer=L.substr(R),A}function a(L){G(L,function(R,A){},/:/)}try{var S="";if(l.state==="INITIAL"){if(!/\r\n|\n/.test(l.buffer))return this;S=s();var x=S.match(/^()?WEBVTT([ \t].*)?$/);if(!x||!x[0])throw new Error("Malformed WebVTT signature.");l.state="HEADER"}for(var C=!1;l.buffer;){if(!/\r\n|\n/.test(l.buffer))return this;C?C=!1:S=s();switch(l.state){case"HEADER":/:/.test(S)?a(S):S||(l.state="ID");continue;case"NOTE":S||(l.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(S)){l.state="NOTE";break}if(!S)continue;if(l.cue=new J.default(0,0,""),l.state="CUE",S.indexOf("-->")===-1){l.cue.id=S;continue}case"CUE":if(!l.cue){l.state="BADCUE";continue}try{v(S,l.cue,l.regionList)}catch(L){l.cue=null,l.state="BADCUE";continue}l.state="CUETEXT";continue;case"CUETEXT":{var D=S.indexOf("-->")!==-1;if(!S||D&&(C=!0)){l.oncue&&l.cue&&l.oncue(l.cue),l.cue=null,l.state="ID";continue}if(l.cue===null)continue;l.cue.text&&(l.cue.text+=`
|
|
`),l.cue.text+=S}continue;case"BADCUE":S||(l.state="ID")}}}catch(L){l.state==="CUETEXT"&&l.cue&&l.oncue&&l.oncue(l.cue),l.cue=null,l.state=l.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},u.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(l){o.onparsingerror&&o.onparsingerror(l)}return o.onflush&&o.onflush(),this},h}()},"./src/utils/webvtt-parser.ts":function(oe,Y,N){"use strict";N.r(Y),N.d(Y,"generateCueId",function(){return p}),N.d(Y,"parseWebVTT",function(){return u});var J=N("./src/polyfills/number.ts"),H=N("./src/utils/vttparser.ts"),M=N("./src/demux/id3.ts"),z=N("./src/utils/timescale-conversion.ts"),G=N("./src/remux/mp4-remuxer.ts"),r=/\r\n|\n\r|\n|\r/g,O=function(o,l,s){return s===void 0&&(s=0),o.substr(s,l.length)===l},v=function(o){var l=parseInt(o.substr(-3)),s=parseInt(o.substr(-6,2)),a=parseInt(o.substr(-9,2)),S=o.length>9?parseInt(o.substr(0,o.indexOf(":"))):0;if(!Object(J.isFiniteNumber)(l)||!Object(J.isFiniteNumber)(s)||!Object(J.isFiniteNumber)(a)||!Object(J.isFiniteNumber)(S))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+o);return l+=1e3*s,l+=60*1e3*a,l+=60*60*1e3*S,l},m=function(o){for(var l=5381,s=o.length;s;)l=l*33^o.charCodeAt(--s);return(l>>>0).toString()};function p(f,o,l){return m(f.toString())+m(o.toString())+m(l)}var h=function(o,l,s){var a=o[l],S=o[a.prevCC];if(!S||!S.new&&a.new){o.ccOffset=o.presentationOffset=a.start,a.new=!1;return}for(;(x=S)!==null&&x!==void 0&&x.new;){var x;o.ccOffset+=a.start-S.start,a.new=!1,a=S,S=o[a.prevCC]}o.presentationOffset=s};function u(f,o,l,s,a,S,x,C){var D=new H.VTTParser,L=Object(M.utf8ArrayToStr)(new Uint8Array(f)).trim().replace(r,`
|
|
`).split(`
|
|
`),R=[],A=Object(z.toMpegTsClockFromTimescale)(o,l),T="00:00.000",d=0,w=0,y,b=!0,j=!1;D.oncue=function(B){var E=s[a],F=s.ccOffset,I=(d-A)/9e4;if(E!=null&&E.new&&(w!==void 0?F=s.ccOffset=E.start:h(s,a,I)),I&&(F=I-s.presentationOffset),j){var g=B.endTime-B.startTime,W=Object(G.normalizePts)((B.startTime+F-w)*9e4,S*9e4)/9e4;B.startTime=W,B.endTime=W+g}var $=B.text.trim();B.text=decodeURIComponent(encodeURIComponent($)),B.id||(B.id=p(B.startTime,B.endTime,$)),B.endTime>0&&R.push(B)},D.onparsingerror=function(B){y=B},D.onflush=function(){if(y){C(y);return}x(R)},L.forEach(function(B){if(b)if(O(B,"X-TIMESTAMP-MAP=")){b=!1,j=!0,B.substr(16).split(",").forEach(function(E){O(E,"LOCAL:")?T=E.substr(6):O(E,"MPEGTS:")&&(d=parseInt(E.substr(7)))});try{w=v(T)/1e3}catch(E){j=!1,y=E}return}else B===""&&(b=!1);D.parse(B+`
|
|
`)}),D.flush()}},"./src/utils/xhr-loader.ts":function(oe,Y,N){"use strict";N.r(Y);var J=N("./src/utils/logger.ts"),H=N("./src/loader/load-stats.ts"),M=/^age:\s*[\d.]+\s*$/m,z=function(){function G(O){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=O?O.xhrSetup:null,this.stats=new H.LoadStats,this.retryDelay=0}var r=G.prototype;return r.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},r.abortInternal=function(){var v=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),v&&(v.onreadystatechange=null,v.onprogress=null,v.readyState!==4&&(this.stats.aborted=!0,v.abort()))},r.abort=function(){var v;this.abortInternal(),(v=this.callbacks)!==null&&v!==void 0&&v.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},r.load=function(v,m,p){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=v,this.config=m,this.callbacks=p,this.retryDelay=m.retryDelay,this.loadInternal()},r.loadInternal=function(){var v=this.config,m=this.context;if(!v)return;var p=this.loader=new self.XMLHttpRequest,h=this.stats;h.loading.first=0,h.loaded=0;var u=this.xhrSetup;try{if(u)try{u(p,m.url)}catch(l){p.open("GET",m.url,!0),u(p,m.url)}p.readyState||p.open("GET",m.url,!0);var f=this.context.headers;if(f)for(var o in f)p.setRequestHeader(o,f[o])}catch(l){this.callbacks.onError({code:p.status,text:l.message},m,p);return}m.rangeEnd&&p.setRequestHeader("Range","bytes="+m.rangeStart+"-"+(m.rangeEnd-1)),p.onreadystatechange=this.readystatechange.bind(this),p.onprogress=this.loadprogress.bind(this),p.responseType=m.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),v.timeout),p.send()},r.readystatechange=function(){var v=this.context,m=this.loader,p=this.stats;if(!v||!m)return;var h=m.readyState,u=this.config;if(p.aborted)return;if(h>=2)if(self.clearTimeout(this.requestTimeout),p.loading.first===0&&(p.loading.first=Math.max(self.performance.now(),p.loading.start)),h===4){m.onreadystatechange=null,m.onprogress=null;var f=m.status;if(f>=200&&f<300){p.loading.end=Math.max(self.performance.now(),p.loading.first);var o,l;if(v.responseType==="arraybuffer"?(o=m.response,l=o.byteLength):(o=m.responseText,l=o.length),p.loaded=p.total=l,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(p,v,o,m),!this.callbacks)return;var a={url:m.responseURL,data:o};this.callbacks.onSuccess(a,p,v,m)}else p.retry>=u.maxRetry||f>=400&&f<499?(J.logger.error(f+" while loading "+v.url),this.callbacks.onError({code:f,text:m.statusText},v,m)):(J.logger.warn(f+" while loading "+v.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,u.maxRetryDelay),p.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),u.timeout)},r.loadtimeout=function(){J.logger.warn("timeout while loading "+this.context.url);var v=this.callbacks;v&&(this.abortInternal(),v.onTimeout(this.stats,this.context,this.loader))},r.loadprogress=function(v){var m=this.stats;m.loaded=v.loaded,v.lengthComputable&&(m.total=v.total)},r.getCacheAge=function(){var v=null;if(this.loader&&M.test(this.loader.getAllResponseHeaders())){var m=this.loader.getResponseHeader("age");v=m?parseFloat(m):null}return v},G}();Y.default=z}}).default})},vHTk:function(Qe,Te,q){Qe.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);
|