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.
NewEduCoderBuild/p__Classrooms__Lists__Group...

372 lines
950 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[81,5,6,7],{"+NIl":function(bt,Qe,ie){(function(le){le(ie("VrN/"))})(function(le){"use strict";le.defineMode("stex",function(Q,D){"use strict";function Z(_,C){_.cmdState.push(C)}function B(_){return _.cmdState.length>0?_.cmdState[_.cmdState.length-1]:null}function P(_){var C=_.cmdState.pop();C&&C.closeBracket()}function G(_){for(var C=_.cmdState,S=C.length-1;S>=0;S--){var d=C[S];if(d.name=="DEFAULT")continue;return d}return{styleIdentifier:function(){return null}}}function j(_,C,S){return function(){this.name=_,this.bracketNo=0,this.style=C,this.styles=S,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var I={};I.importmodule=j("importmodule","tag",["string","builtin"]),I.documentclass=j("documentclass","tag",["","atom"]),I.usepackage=j("usepackage","tag",["atom"]),I.begin=j("begin","tag",["atom"]),I.end=j("end","tag",["atom"]),I.label=j("label","tag",["atom"]),I.ref=j("ref","tag",["atom"]),I.eqref=j("eqref","tag",["atom"]),I.cite=j("cite","tag",["atom"]),I.bibitem=j("bibitem","tag",["atom"]),I.Bibitem=j("Bibitem","tag",["atom"]),I.RBibitem=j("RBibitem","tag",["atom"]),I.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function k(_,C){_.f=C}function y(_,C){var S;if(_.match(/^\\[a-zA-Z@]+/)){var d=_.current().slice(1);return S=I.hasOwnProperty(d)?I[d]:I.DEFAULT,S=new S,Z(C,S),k(C,O),S.style}if(_.match(/^\\[$&%#{}_]/))return"tag";if(_.match(/^\\[,;!\/\\]/))return"tag";if(_.match("\\["))return k(C,function(l,h){return A(l,h,"\\]")}),"keyword";if(_.match("\\("))return k(C,function(l,h){return A(l,h,"\\)")}),"keyword";if(_.match("$$"))return k(C,function(l,h){return A(l,h,"$$")}),"keyword";if(_.match("$"))return k(C,function(l,h){return A(l,h,"$")}),"keyword";var o=_.next();if(o=="%")return _.skipToEnd(),"comment";if(o=="}"||o=="]"){if(S=B(C),S)S.closeBracket(o),k(C,O);else return"error";return"bracket"}else return o=="{"||o=="["?(S=I.DEFAULT,S=new S,Z(C,S),"bracket"):/\d/.test(o)?(_.eatWhile(/[\w.%]/),"atom"):(_.eatWhile(/[\w\-_]/),S=G(C),S.name=="begin"&&(S.argument=_.current()),S.styleIdentifier())}function A(_,C,S){if(_.eatSpace())return null;if(S&&_.match(S))return k(C,y),"keyword";if(_.match(/^\\[a-zA-Z@]+/))return"tag";if(_.match(/^[a-zA-Z]+/))return"variable-2";if(_.match(/^\\[$&%#{}_]/))return"tag";if(_.match(/^\\[,;!\/]/))return"tag";if(_.match(/^[\^_&]/))return"tag";if(_.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(_.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var d=_.next();return d=="{"||d=="}"||d=="["||d=="]"||d=="("||d==")"?"bracket":d=="%"?(_.skipToEnd(),"comment"):"error"}function O(_,C){var S=_.peek(),d;return S=="{"||S=="["?(d=B(C),d.openBracket(S),_.eat(S),k(C,y),"bracket"):/[ \t\r]/.test(S)?(_.eat(S),null):(k(C,y),P(C),y(_,C))}return{startState:function(){var _=D.inMathMode?function(C,S){return A(C,S)}:y;return{cmdState:[],f:_}},copyState:function(_){return{cmdState:_.cmdState.slice(),f:_.f}},token:function(_,C){return C.f(_,C)},blankLine:function(_){_.f=y,_.cmdState.length=0},lineComment:"%"}}),le.defineMIME("text/x-stex","stex"),le.defineMIME("text/x-latex","stex")})},"19Vz":function(bt,Qe,ie){(function(le){le(ie("VrN/"))})(function(le){le.defineOption("placeholder","",function(j,I,k){var y=k&&k!=le.Init;if(I&&!y)j.on("blur",B),j.on("change",P),j.on("swapDoc",P),le.on(j.getInputField(),"compositionupdate",j.state.placeholderCompose=function(){Z(j)}),P(j);else if(!I&&y){j.off("blur",B),j.off("change",P),j.off("swapDoc",P),le.off(j.getInputField(),"compositionupdate",j.state.placeholderCompose),Q(j);var A=j.getWrapperElement();A.className=A.className.replace(" CodeMirror-empty","")}I&&!j.hasFocus()&&B(j)});function Q(j){j.state.placeholder&&(j.state.placeholder.parentNode.removeChild(j.state.placeholder),j.state.placeholder=null)}function D(j){Q(j);var I=j.state.placeholder=document.createElement("pre");I.style.cssText="height: 0; overflow: visible",I.style.direction=j.getOption("direction"),I.className="CodeMirror-placeholder CodeMirror-line-like";var k=j.getOption("placeholder");typeof k=="string"&&(k=document.createTextNode(k)),I.appendChild(k),j.display.lineSpace.insertBefore(I,j.display.lineSpace.firstChild)}function Z(j){setTimeout(function(){var I=!1,k=j.getInputField();k.nodeName=="TEXTAREA"?I=!k.value:j.lineCount()==1&&(I=!/[^\u200b]/.test(k.querySelector(".CodeMirror-line").textContent)),I?D(j):Q(j)},20)}function B(j){G(j)&&D(j)}function P(j){var I=j.getWrapperElement(),k=G(j);I.className=I.className.replace(" CodeMirror-empty","")+(k?" CodeMirror-empty":""),k?D(j):Q(j)}function G(j){return j.lineCount()===1&&j.getLine(0)===""}})},"1eCo":function(bt,Qe,ie){(function(le){le(ie("VrN/"))})(function(le){"use strict";var Q={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},D={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};le.defineMode("xml",function(Z,B){var P=Z.indentUnit,G={},j=B.htmlMode?Q:D;for(var I in j)G[I]=j[I];for(var I in B)G[I]=B[I];var k,y;function A(a,x){function b(U){return x.tokenize=U,U(a,x)}var E=a.next();if(E=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?b(C("atom","]]>")):null:a.match("--")?b(C("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),b(S(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),x.tokenize=C("meta","?>"),"meta"):(k=a.eat("/")?"closeTag":"openTag",x.tokenize=O,"tag bracket");if(E=="&"){var N;return a.eat("#")?a.eat("x")?N=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):N=a.eatWhile(/[\d]/)&&a.eat(";"):N=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),N?"atom":"error"}else return a.eatWhile(/[^&<]/),null}A.isInText=!0;function O(a,x){var b=a.next();if(b==">"||b=="/"&&a.eat(">"))return x.tokenize=A,k=b==">"?"endTag":"selfcloseTag","tag bracket";if(b=="=")return k="equals",null;if(b=="<"){x.tokenize=A,x.state=h,x.tagName=x.tagStart=null;var E=x.tokenize(a,x);return E?E+" tag error":"tag error"}else return/[\'\"]/.test(b)?(x.tokenize=_(b),x.stringStartCol=a.column(),x.tokenize(a,x)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function _(a){var x=function(b,E){for(;!b.eol();)if(b.next()==a){E.tokenize=O;break}return"string"};return x.isInAttribute=!0,x}function C(a,x){return function(b,E){for(;!b.eol();){if(b.match(x)){E.tokenize=A;break}b.next()}return a}}function S(a){return function(x,b){for(var E;(E=x.next())!=null;){if(E=="<")return b.tokenize=S(a+1),b.tokenize(x,b);if(E==">")if(a==1){b.tokenize=A;break}else return b.tokenize=S(a-1),b.tokenize(x,b)}return"meta"}}function d(a,x,b){this.prev=a.context,this.tagName=x,this.indent=a.indented,this.startOfLine=b,(G.doNotIndent.hasOwnProperty(x)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function l(a,x){for(var b;;){if(!a.context)return;if(b=a.context.tagName,!G.contextGrabbers.hasOwnProperty(b)||!G.contextGrabbers[b].hasOwnProperty(x))return;o(a)}}function h(a,x,b){return a=="openTag"?(b.tagStart=x.column(),w):a=="closeTag"?p:h}function w(a,x,b){return a=="word"?(b.tagName=x.current(),y="tag",g):G.allowMissingTagName&&a=="endTag"?(y="tag bracket",g(a,x,b)):(y="error",w)}function p(a,x,b){if(a=="word"){var E=x.current();return b.context&&b.context.tagName!=E&&G.implicitlyClosed.hasOwnProperty(b.context.tagName)&&o(b),b.context&&b.context.tagName==E||G.matchClosing===!1?(y="tag",f):(y="tag error",L)}else return G.allowMissingTagName&&a=="endTag"?(y="tag bracket",f(a,x,b)):(y="error",L)}function f(a,x,b){return a!="endTag"?(y="error",f):(o(b),h)}function L(a,x,b){return y="error",f(a,x,b)}function g(a,x,b){if(a=="word")return y="attribute",m;if(a=="endTag"||a=="selfcloseTag"){var E=b.tagName,N=b.tagStart;return b.tagName=b.tagStart=null,a=="selfcloseTag"||G.autoSelfClosers.hasOwnProperty(E)?l(b,E):(l(b,E),b.context=new d(b,E,N==b.indented)),h}return y="error",g}function m(a,x,b){return a=="equals"?c:(G.allowMissing||(y="error"),g(a,x,b))}function c(a,x,b){return a=="string"?u:a=="word"&&G.allowUnquoted?(y="string",g):(y="error",g(a,x,b))}function u(a,x,b){return a=="string"?u:g(a,x,b)}return{startState:function(a){var x={tokenize:A,state:h,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(x.baseIndent=a),x},token:function(a,x){if(!x.tagName&&a.sol()&&(x.indented=a.indentation()),a.eatSpace())return null;k=null;var b=x.tokenize(a,x);return(b||k)&&b!="comment"&&(y=null,x.state=x.state(k||b,a,x),y&&(b=y=="error"?b+" error":y)),b},indent:function(a,x,b){var E=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+P;if(E&&E.noIndent)return le.Pass;if(a.tokenize!=O&&a.tokenize!=A)return b?b.match(/^(\s*)/)[0].length:0;if(a.tagName)return G.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+P*(G.multilineTagIndentFactor||1);if(G.alignCDATA&&/<!\[CDATA\[/.test(x))return 0;var N=x&&/^<(\/)?([\w_:\.-]*)/.exec(x);if(N&&N[1])for(;E;)if(E.tagName==N[2]){E=E.prev;break}else if(G.implicitlyClosed.hasOwnProperty(E.tagName))E=E.prev;else break;else if(N)for(;E;){var U=G.contextGrabbers[E.tagName];if(U&&U.hasOwnProperty(N[2]))E=E.prev;else break}for(;E&&E.prev&&!E.startOfLine;)E=E.prev;return E?E.indent+P:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:G.htmlMode?"html":"xml",helperType:G.htmlMode?"html":"xml",skipAttribute:function(a){a.state==c&&(a.state=g)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var x=[],b=a.context;b;b=b.prev)b.tagName&&x.push(b.tagName);return x.reverse()}}}),le.defineMIME("text/xml","xml"),le.defineMIME("application/xml","xml"),le.mimeModes.hasOwnProperty("text/html")||le.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"500L":function(bt,Qe,ie){"use strict";ie.d(Qe,"a",function(){return p});var le=ie("+L6B"),Q=ie("2/Rp"),D=ie("2qtc"),Z=ie("kLXV"),B=ie("9og8"),P=ie("k1fw"),G=ie("miYZ"),j=ie("tsqr"),I=ie("oBTY"),k=ie("tJVT"),y=ie("DZo9"),A=ie("8z0m"),O=ie("WmNS"),_=ie.n(O),C=ie("q1tI"),S=ie.n(C),d=ie("m3rI"),o=ie("wzkS"),l=ie("y5JW"),h=ie("LtfV"),w=A.a.Dragger;function p(f){var L=[];return f&&f.length>0&&(L=f.map(function(g){return{uid:g.id,id:g.id,name:g.title+l.c+g.filesize,url:g.url,filesize:g.filesize,status:"done",response:{id:g.id}}})),L}Qe.b=function(f){var L=f.value,g=f.onChange,m=f.action,c=f.className,u=f.maxSize,a=u===void 0?150:u,x=f.title,b=x===void 0?"\u4E0A\u4F20\u9644\u4EF6":x,E=f.showRemoveModal,N=E===void 0?!1:E,U=f.accept,K=U===void 0?"":U,V=f.additionalText,R=f.isDragger,M=f.number,$=M===void 0?1e3:M,ee=f.aloneClear,oe=ee===void 0?!1:ee,fe=f.restrict,ke=fe===void 0?!0:fe,Ee=Object(C.useState)(!1),Te=Object(k.a)(Ee,2),we=Te[0],Ce=Te[1],me=Object(C.useState)(L||[]),ue=Object(k.a)(me,2),te=ue[0],de=ue[1];Object(C.useEffect)(function(){L&&(de(Object(I.a)(L)),$===(L==null?void 0:L.length)&&Ce(!0))},[L]);var ae=function(){setTimeout(function(){te.pop(),de(Object(I.a)(te))},500)},_e={multiple:!0,disabled:we,accept:K,withCredentials:!0,fileList:te,beforeUpload:function(Oe,Pe){var Ie=Oe.size/1024/1024;return te.concat(Pe).length>$?(te.pop(),de(Object(I.a)(te)),j.b.error("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20".concat($,"\u4E2A\u6587\u4EF6")),oe?Promise.reject():(ae(),!1)):Ie<a?!0:(j.b.error("\u8BE5\u6587\u4EF6\u65E0\u6CD5\u4E0A\u4F20\u3002\u8D85\u8FC7\u6587\u4EF6\u5927\u5C0F\u9650\u5236(".concat(a,"MB).")),oe?Promise.reject():(ae(),!1))},action:m||"".concat(d.a.API_SERVER,"/api/attachments.json"),onChange:function(Oe){var Pe=Object(I.a)(Oe.fileList);Pe.length>=$?Ce(!0):Ce(!1),de(Object(I.a)(Pe)),Pe=Pe.map(function(Ie){var je;if(Ie!=null&&(je=Ie.response)!==null&&je!==void 0&&je.id){var Be;Ie.url="/api/attachments/".concat(Ie==null||((Be=Ie.response)===null||Be===void 0)?void 0:Be.id)}return Ie.name.indexOf(l.c)===-1&&(Ie.name="".concat(Ie.name).concat(l.c).concat(Object(l.a)(Ie.size))),Object(P.a)({},Ie)}),console.log("info:",Oe),g(Pe)},onRemove:function(){var ye=Object(B.a)(_.a.mark(function Pe(Ie){var je;return _.a.wrap(function(Ne){for(;;)switch(Ne.prev=Ne.next){case 0:if(je=function(){var et=Object(B.a)(_.a.mark(function Ze(){var $e,Xe;return _.a.wrap(function(qe){for(;;)switch(qe.prev=qe.next){case 0:if($e=Ie.response?Ie.response.id:Ie.id,!$e){qe.next=8;break}return qe.next=4,Object(o.d)(Ie.response?Ie.response.id:Ie.uid);case 4:return Xe=qe.sent,qe.abrupt("return",Xe);case 8:return qe.abrupt("return",!0);case 9:case"end":return qe.stop()}},Ze)}));return function(){return et.apply(this,arguments)}}(),!N){Ne.next=5;break}return Ne.abrupt("return",new Promise(function(et,Ze){Z.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:S.a.createElement("div",{className:"tc font16"},"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),onOk:function(){var $e=Object(B.a)(_.a.mark(function st(){var qe;return _.a.wrap(function(Me){for(;;)switch(Me.prev=Me.next){case 0:return Me.next=2,je();case 2:qe=Me.sent,j.b.success("\u5220\u9664\u6210\u529F"),et(!0);case 5:case"end":return Me.stop()}},st)}));function Xe(){return $e.apply(this,arguments)}return Xe}(),onCancel:function(){return et(!1)}})}));case 5:return Ne.next=7,je();case 7:return Ne.abrupt("return",Ne.sent);case 8:case"end":return Ne.stop()}},Pe)}));function Oe(Pe){return ye.apply(this,arguments)}return Oe}()};function Re(ye){ye.preventDefault(),ye.stopPropagation()}return S.a.createElement("div",{className:"multi-upload ".concat(c||"")},R&&S.a.createElement(w,_e,S.a.createElement("p",{className:"ant-upload-drag-icon"},S.a.createElement(h.a,null)),S.a.createElement("p",{className:"ant-upload-text"},"\u70B9\u51FB\u4E0A\u4F20\u56FE\u6807\uFF0C\u9009\u62E9\u8981\u4E0A\u4F20\u7684\u6587\u4EF6\u6216\u5C06\u6587\u4EF6\u62D6\u62FD\u5230\u6B64",S.a.createElement("br",null),S.a.createElement("span",{style:{display:ke?"block":"none"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927\u9650\u5236\u4E3A",a,"MB) ")),V),!R&&S.a.createElement(A.a,_e,S.a.createElement(Q.a,{disabled:we},b),S.a.createElement("span",{onClick:Re,style:{marginLeft:10,color:"#FA6400",display:ke?"block":"none"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",a,"MB) ")))}},"55Ip":function(bt,Qe,ie){"use strict";ie.d(Qe,"a",function(){return l}),ie.d(Qe,"b",function(){return g});var le=ie("Ty5D"),Q=ie("dI71"),D=ie("q1tI"),Z=ie.n(D),B=ie("YS25"),P=ie("17x9"),G=ie.n(P),j=ie("wx14"),I=ie("zLVn"),k=ie("9R94"),y=function(c){Object(Q.a)(u,c);function u(){for(var x,b=arguments.length,E=new Array(b),N=0;N<b;N++)E[N]=arguments[N];return x=c.call.apply(c,[this].concat(E))||this,x.history=Object(B.a)(x.props),x}var a=u.prototype;return a.render=function(){return Z.a.createElement(le.c,{history:this.history,children:this.props.children})},u}(Z.a.Component),A=function(c){Object(Q.a)(u,c);function u(){for(var x,b=arguments.length,E=new Array(b),N=0;N<b;N++)E[N]=arguments[N];return x=c.call.apply(c,[this].concat(E))||this,x.history=Object(B.b)(x.props),x}var a=u.prototype;return a.render=function(){return Z.a.createElement(le.c,{history:this.history,children:this.props.children})},u}(Z.a.Component),O=function(u,a){return typeof u=="function"?u(a):u},_=function(u,a){return typeof u=="string"?Object(B.c)(u,null,null,a):u},C=function(u){return u},S=Z.a.forwardRef;typeof S=="undefined"&&(S=C);function d(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var o=S(function(c,u){var a=c.innerRef,x=c.navigate,b=c.onClick,E=Object(I.a)(c,["innerRef","navigate","onClick"]),N=E.target,U=Object(j.a)({},E,{onClick:function(V){try{b&&b(V)}catch(R){throw V.preventDefault(),R}!V.defaultPrevented&&V.button===0&&(!N||N==="_self")&&!d(V)&&(V.preventDefault(),x())}});return C!==S?U.ref=u||a:U.ref=a,Z.a.createElement("a",U)}),l=S(function(c,u){var a=c.component,x=a===void 0?o:a,b=c.replace,E=c.to,N=c.innerRef,U=Object(I.a)(c,["component","replace","to","innerRef"]);return Z.a.createElement(le.e.Consumer,null,function(K){K||Object(k.a)(!1);var V=K.history,R=_(O(E,K.location),K.location),M=R?V.createHref(R):"",$=Object(j.a)({},U,{href:M,navigate:function(){var oe=O(E,K.location),fe=b?V.replace:V.push;fe(oe)}});return C!==S?$.ref=u||N:$.innerRef=N,Z.a.createElement(x,$)})});if(!1)var h,w;var p=function(u){return u},f=Z.a.forwardRef;typeof f=="undefined"&&(f=p);function L(){for(var c=arguments.length,u=new Array(c),a=0;a<c;a++)u[a]=arguments[a];return u.filter(function(x){return x}).join(" ")}var g=f(function(c,u){var a=c["aria-current"],x=a===void 0?"page":a,b=c.activeClassName,E=b===void 0?"active":b,N=c.activeStyle,U=c.className,K=c.exact,V=c.isActive,R=c.location,M=c.sensitive,$=c.strict,ee=c.style,oe=c.to,fe=c.innerRef,ke=Object(I.a)(c,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return Z.a.createElement(le.e.Consumer,null,function(Ee){Ee||Object(k.a)(!1);var Te=R||Ee.location,we=_(O(oe,Te),Te),Ce=we.pathname,me=Ce&&Ce.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),ue=me?Object(le.f)(Te.pathname,{path:me,exact:K,sensitive:M,strict:$}):null,te=!!(V?V(ue,Te):ue),de=te?L(U,E):U,ae=te?Object(j.a)({},ee,{},N):ee,_e=Object(j.a)({"aria-current":te&&x||null,className:de,style:ae,to:we},ke);return p!==f?_e.ref=u||fe:_e.innerRef=fe,Z.a.createElement(l,_e)})});if(!1)var m},"7Cbv":function(bt,Qe,ie){"use strict";var le=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),Q=new Uint8Array(16);function D(){if(!le)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return le(Q)}var Z=/^(?:[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 B(O){return typeof O=="string"&&Z.test(O)}for(var P=B,G=[],j=0;j<256;++j)G.push((j+256).toString(16).substr(1));function I(O){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,C=(G[O[_+0]]+G[O[_+1]]+G[O[_+2]]+G[O[_+3]]+"-"+G[O[_+4]]+G[O[_+5]]+"-"+G[O[_+6]]+G[O[_+7]]+"-"+G[O[_+8]]+G[O[_+9]]+"-"+G[O[_+10]]+G[O[_+11]]+G[O[_+12]]+G[O[_+13]]+G[O[_+14]]+G[O[_+15]]).toLowerCase();if(!P(C))throw TypeError("Stringified UUID is invalid");return C}var k=I;function y(O,_,C){O=O||{};var S=O.random||(O.rng||D)();if(S[6]=S[6]&15|64,S[8]=S[8]&63|128,_){C=C||0;for(var d=0;d<16;++d)_[C+d]=S[d];return _}return k(S)}var A=Qe.a=y},"7ahc":function(bt,Qe,ie){"use strict";ie.d(Qe,"a",function(){return w});var le=ie("k1fw"),Q=ie("0Owb"),D=ie("+L6B"),Z=ie("2/Rp"),B=ie("y8nQ"),P=ie("Vl3Y"),G=ie("tJVT"),j=ie("OaEy"),I=ie("2fM7"),k=ie("q1tI"),y=ie.n(k),A=ie("VrN/"),O=ie.n(A),_=ie("p77/"),C=ie.n(_),S=ie("c5Ni"),d=ie.n(S),o=I.a.Option,l={labelCol:{span:4},wrapperCol:{span:20}},h={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"]};Qe.b=function(p){var f=p.callback,L=p.onCancel,g=Object(k.useState)("python"),m=Object(G.a)(g,2),c=m[0],u=m[1];function a(b){u(h[b][1])}function x(b){f(b)}return y.a.createElement(P.a,Object(Q.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:x}),y.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},y.a.createElement(I.a,{onChange:a},Object.keys(h).map(function(b){return y.a.createElement(o,{key:b,value:b},h[b][0])}))),y.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},y.a.createElement(w,{mode:c})),y.a.createElement("div",{className:"flex-container flex-end"},y.a.createElement(Z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),y.a.createElement(Z.a,{type:"ghost",onClick:L},"\u53D6\u6D88")))};function w(p){var f=p.value,L=p.onChange,g=p.mode,m=p.options,c=m===void 0?{}:m,u=Object(k.useRef)(),a=Object(k.useState)(),x=Object(G.a)(a,2),b=x[0],E=x[1];return Object(k.useEffect)(function(){if(b){function N(U){var K=U.getValue();L&&L(K)}return b.on("change",N),function(){b.off("change",N)}}},[b,L]),Object(k.useEffect)(function(){b&&b.setOption("mode",g)},[b,g]),Object(k.useEffect)(function(){b&&((f!==b.getValue()||f==="")&&setTimeout(function(){b.setValue(f||" ")},300))},[b,f]),Object(k.useEffect)(function(){if(u.current&&!b){var N=O.a.fromTextArea(u.current,Object(le.a)({mode:g,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));E(N)}},[u.current,b]),y.a.createElement("div",{className:"my-codemirror-container"},y.a.createElement("textarea",{ref:u}))}},"8EBN":function(bt,Qe,ie){(function(le){le(ie("VrN/"))})(function(le){"use strict";le.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 Q=0;Q<le.modeInfo.length;Q++){var D=le.modeInfo[Q];D.mimes&&(D.mime=D.mimes[0])}le.findModeByMIME=function(Z){Z=Z.toLowerCase();for(var B=0;B<le.modeInfo.length;B++){var P=le.modeInfo[B];if(P.mime==Z)return P;if(P.mimes){for(var G=0;G<P.mimes.length;G++)if(P.mimes[G]==Z)return P}}if(/\+xml$/.test(Z))return le.findModeByMIME("application/xml");if(/\+json$/.test(Z))return le.findModeByMIME("application/json")},le.findModeByExtension=function(Z){Z=Z.toLowerCase();for(var B=0;B<le.modeInfo.length;B++){var P=le.modeInfo[B];if(P.ext){for(var G=0;G<P.ext.length;G++)if(P.ext[G]==Z)return P}}},le.findModeByFileName=function(Z){for(var B=0;B<le.modeInfo.length;B++){var P=le.modeInfo[B];if(P.file&&P.file.test(Z))return P}var G=Z.lastIndexOf("."),j=G>-1&&Z.substring(G+1,Z.length);if(j)return le.findModeByExtension(j)},le.findModeByName=function(Z){Z=Z.toLowerCase();for(var B=0;B<le.modeInfo.length;B++){var P=le.modeInfo[B];if(P.name.toLowerCase()==Z)return P;if(P.alias){for(var G=0;G<P.alias.length;G++)if(P.alias[G].toLowerCase()==Z)return P}}}})},"8hTe":function(bt,Qe,ie){bt.exports={button:"button___1wy9m"}},"9Bee":function(bt,Qe,ie){"use strict";var le=ie("DYRE"),Q=ie("zeV3"),D=ie("+L6B"),Z=ie("2/Rp"),B=ie("k1fw"),P=ie("9og8"),G=ie("tJVT"),j=ie("WmNS"),I=ie.n(j),k=ie("q1tI"),y=ie.n(k),A=ie("vg9a"),O=ie("DlQD"),_=ie.n(O),C=ie("rUJ1");function S(z,s){var v=z.match(/^(\s+)(?:```)/);if(v===null)return s;var W=v[1];return s.split(`
`).map(function(X){var H=X.match(/^\s+/);if(H===null)return X;var ve=Object(G.a)(H,1),He=ve[0];return He.length>=W.length?X.slice(W.length):X}).join(`
`)}var d=[],o=["<ul>"],l=new _.a.Renderer,h=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function w(){d.length=0,o=["<ul>"]}var p={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function f(z,s,v,W){if(s>=z.length||z[s].level<=v)return s;var X=z[s];W.push("<li><a href='#"+X.anchor+"'>"+X.text+"</a>"),s++;var H=[];return s=f(z,s,X.level,H),H.length>0&&(W.push("<ul>"),H.forEach(function(ve){W.push(ve)}),W.push("</ul>")),W.push("</li>"),s=f(z,s,v,W),s}function L(){return f(d,0,0,o),o.push("</ul>"),o.join("")}var g={heading:function(s){var v=h.exec(s);if(v)return{type:"heading",raw:v[0],depth:v[1].length,text:v[2]}},fences:function(s){var v=this.rules.block.fences.exec(s);if(v){var W=v[0],X=S(W,v[3]||""),H=v[2]?v[2].trim():v[2];if(["latex","katex","math"].indexOf(H)>=0){var ve=u(),He=X;X=ve,a[ve]={type:"block",expression:He}}return{type:"code",raw:W,lang:H,text:X}}}},m=/(?:\${2})([^\n`]+?)(?:\${2})/gi,c=0,u=function(){return"__special_katext_id_".concat(c++,"__")},a={};function x(){return a}function b(){c=0,a={}}function E(z){return z=z.replace(m,function(s,v){var W=u();return a[W]={type:"inline",expression:v},W}),z}var N=l.listitem;l.listitem=function(z){return N(E(z))};var U=l.paragraph;l.paragraph=function(z){return U(E(z))};var K=l.tablecell;l.tablecell=function(z,s){return K(E(z),s)},l.code=function(z,s,v){var W=(s||"").match(/\S*/)[0];return W?["latex","katex","math"].indexOf(W)>=0?"<p class='editormd-tex'>".concat(z,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(s,'">').concat(v?z:Object(C.escape)(z,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(v?z:Object(C.escape)(z,!0))+"</code></pre>"},l.heading=function(z,s,v){var W=this.options.headerPrefix+v.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return d.push({anchor:W,level:s,text:z}),"<h"+s+' id="'+W+'">'+z+"</h"+s+">"},_.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),_.a.use({tokenizer:g,renderer:l});var V=_.a,R=ie("SJMd"),M=ie("ulZh"),$=ie.n(M),ee=ie("m3rI"),oe=ie("Oy/b"),fe=ie("p5ED"),ke=ie("ErOA");/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var Ee=function(z,s){return(Ee=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,W){v.__proto__=W}||function(v,W){for(var X in W)Object.prototype.hasOwnProperty.call(W,X)&&(v[X]=W[X])})(z,s)};function Te(z,s){function v(){this.constructor=z}Ee(z,s),z.prototype=s===null?Object.create(s):(v.prototype=s.prototype,new v)}function we(z,s,v,W){return new(v||(v=Promise))(function(X,H){function ve(ut){try{Je(W.next(ut))}catch(Ge){H(Ge)}}function He(ut){try{Je(W.throw(ut))}catch(Ge){H(Ge)}}function Je(ut){var Ge;ut.done?X(ut.value):(Ge=ut.value,Ge instanceof v?Ge:new v(function(Et){Et(Ge)})).then(ve,He)}Je((W=W.apply(z,s||[])).next())})}function Ce(z,s){var v,W,X,H,ve={label:0,sent:function(){if(1&X[0])throw X[1];return X[1]},trys:[],ops:[]};return H={next:He(0),throw:He(1),return:He(2)},typeof Symbol=="function"&&(H[Symbol.iterator]=function(){return this}),H;function He(Je){return function(ut){return function(Ge){if(v)throw new TypeError("Generator is already executing.");for(;ve;)try{if(v=1,W&&(X=2&Ge[0]?W.return:Ge[0]?W.throw||((X=W.return)&&X.call(W),0):W.next)&&!(X=X.call(W,Ge[1])).done)return X;switch(W=0,X&&(Ge=[2&Ge[0],X.value]),Ge[0]){case 0:case 1:X=Ge;break;case 4:return ve.label++,{value:Ge[1],done:!1};case 5:ve.label++,W=Ge[1],Ge=[0];continue;case 7:Ge=ve.ops.pop(),ve.trys.pop();continue;default:if(!(X=ve.trys,(X=X.length>0&&X[X.length-1])||Ge[0]!==6&&Ge[0]!==2)){ve=0;continue}if(Ge[0]===3&&(!X||Ge[1]>X[0]&&Ge[1]<X[3])){ve.label=Ge[1];break}if(Ge[0]===6&&ve.label<X[1]){ve.label=X[1],X=Ge;break}if(X&&ve.label<X[2]){ve.label=X[2],ve.ops.push(Ge);break}X[2]&&ve.ops.pop(),ve.trys.pop();continue}Ge=s.call(z,ve)}catch(Et){Ge=[6,Et],W=0}finally{v=X=0}if(5&Ge[0])throw Ge[1];return{value:Ge[0]?Ge[1]:void 0,done:!0}}([Je,ut])}}}function me(){for(var z=0,s=0,v=arguments.length;s<v;s++)z+=arguments[s].length;var W=Array(z),X=0;for(s=0;s<v;s++)for(var H=arguments[s],ve=0,He=H.length;ve<He;ve++,X++)W[X]=H[ve];return W}var ue=function(){function z(){}return z.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},z.setAttributes=function(s,v){for(var W=0,X=v;W<X.length;W++){var H=X[W],ve=H[0],He=H[1];s.setAttribute(ve,He)}},z.createRect=function(s,v,W){var X=document.createElementNS("http://www.w3.org/2000/svg","rect");return X.setAttribute("width",s.toString()),X.setAttribute("height",v.toString()),W&&z.setAttributes(X,W),X},z.createLine=function(s,v,W,X,H){var ve=document.createElementNS("http://www.w3.org/2000/svg","line");return ve.setAttribute("x1",s.toString()),ve.setAttribute("y1",v.toString()),ve.setAttribute("x2",W.toString()),ve.setAttribute("y2",X.toString()),H&&z.setAttributes(ve,H),ve},z.createPolygon=function(s,v){var W=document.createElementNS("http://www.w3.org/2000/svg","polygon");return W.setAttribute("points",s),v&&z.setAttributes(W,v),W},z.createCircle=function(s,v){var W=document.createElementNS("http://www.w3.org/2000/svg","circle");return W.setAttribute("cx",(s/2).toString()),W.setAttribute("cy",(s/2).toString()),W.setAttribute("r",s.toString()),v&&z.setAttributes(W,v),W},z.createEllipse=function(s,v,W){var X=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return X.setAttribute("cx",(s/2).toString()),X.setAttribute("cy",(v/2).toString()),X.setAttribute("rx",(s/2).toString()),X.setAttribute("ry",(v/2).toString()),W&&z.setAttributes(X,W),X},z.createGroup=function(s){var v=document.createElementNS("http://www.w3.org/2000/svg","g");return s&&z.setAttributes(v,s),v},z.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},z.createMarker=function(s,v,W,X,H,ve,He){var Je=document.createElementNS("http://www.w3.org/2000/svg","marker");return z.setAttributes(Je,[["id",s],["orient",v],["markerWidth",W.toString()],["markerHeight",X.toString()],["refX",H.toString()],["refY",ve.toString()]]),Je.appendChild(He),Je},z.createText=function(s){var v=document.createElementNS("http://www.w3.org/2000/svg","text");return v.setAttribute("x","0"),v.setAttribute("y","0"),s&&z.setAttributes(v,s),v},z.createTSpan=function(s,v){var W=document.createElementNS("http://www.w3.org/2000/svg","tspan");return W.textContent=s,v&&z.setAttributes(W,v),W},z.createImage=function(s){var v=document.createElementNS("http://www.w3.org/2000/svg","image");return s&&z.setAttributes(v,s),v},z.createPoint=function(s,v){var W=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return W.x=s,W.y=v,W},z.createPath=function(s,v){var W=document.createElementNS("http://www.w3.org/2000/svg","path");return W.setAttribute("d",s),v&&z.setAttributes(W,v),W},z}(),te=function(){function z(){}return z.addKey=function(s){z.key=s},Object.defineProperty(z,"isLicensed",{get:function(){return!!z.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(z.key)},enumerable:!1,configurable:!0}),z}(),de=function(){function z(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return z.prototype.rasterize=function(s,v,W){var X=this;return new Promise(function(H){var ve=W!==void 0?W:document.createElement("canvas");s===null&&(X.markersOnly=!0,X.naturalSize=!1);var He=document.createElementNS("http://www.w3.org/2000/svg","svg");He.setAttribute("xmlns","http://www.w3.org/2000/svg"),He.setAttribute("width",v.width.baseVal.valueAsString),He.setAttribute("height",v.height.baseVal.valueAsString),He.setAttribute("viewBox","0 0 "+v.viewBox.baseVal.width.toString()+" "+v.viewBox.baseVal.height.toString()),He.innerHTML=v.innerHTML,X.naturalSize===!0?(He.width.baseVal.value=s.naturalWidth,He.height.baseVal.value=s.naturalHeight):X.width!==void 0&&X.height!==void 0&&(He.width.baseVal.value=X.width,He.height.baseVal.value=X.height),ve.width=He.width.baseVal.value,ve.height=He.height.baseVal.value;var Je=He.outerHTML,ut=ve.getContext("2d");X.markersOnly!==!0&&ut.drawImage(s,0,0,ve.width,ve.height);var Ge=window.URL,Et=new Image(ve.width,ve.height);Et.setAttribute("crossOrigin","anonymous");var Dt=new Blob([Je],{type:"image/svg+xml"}),Vt=Ge.createObjectURL(Dt);Et.onload=function(){ut.drawImage(Et,0,0),Ge.revokeObjectURL(Vt);var Ir=ve.toDataURL(X.imageType,X.imageQuality);H(Ir)},Et.src=Vt})},z}(),ae=function(){},_e=function(){function z(s){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+s+"_"}return Object.defineProperty(z.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(z.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(z.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),z.prototype.addClass=function(s){return this.styleSheet===void 0&&this.addStyleSheet(),s.name=""+this.classNamePrefix+s.localName,this.classes.push(s),this.styleSheet.sheet.insertRule("."+s.name+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length),s},z.prototype.addRule=function(s){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(s),this.styleSheet.sheet.insertRule(s.selector+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length)},z.prototype.addStyleSheet=function(){var s;this.styleSheet=document.createElement("style"),((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).appendChild(this.styleSheet),this.addRule(new Re("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Re("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new Re("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new ye("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new ye("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},z.prototype.removeStyleSheet=function(){var s;this.styleSheet&&(((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},z}(),Re=function(z,s){this.selector=z,this.style=s},ye=function(z,s){this.localName=z,this.style=s},Oe=function(){function z(s,v,W,X,H){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=s,this.displayMode=v,this.markerItems=W,this.uiStyleSettings=X,this.styles=H,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return z.prototype.show=function(s){var v=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var W=document.createElement("div");W.className=this.toolbarBlockStyleClass.name,W.style.whiteSpace="nowrap",this.uiContainer.appendChild(W),this.addActionButton(W,'<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(W,'<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(W,'<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(W,'<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(W,'<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(W,'<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(W,'<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(W,'<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(H){var ve=document.createElement("div");ve.className=""+v.toolbarButtonStyleClass.name,ve.setAttribute("data-type-name",H.typeName),ve.innerHTML=H.icon,ve.addEventListener("click",function(){v.markerToolbarButtonClicked(ve,H)}),v.buttons.push(ve),v.markerButtons.push(ve)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var X=document.createElement("div");X.className=this.toolbarBlockStyleClass.name,X.style.whiteSpace="nowrap",X.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(X),this.addActionButton(X,'<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"render"),this.addActionButton(X,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},z.prototype.addButtonClickListener=function(s){this.buttonClickListeners.push(s)},z.prototype.removeButtonClickListener=function(s){this.buttonClickListeners.indexOf(s)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(s),1)},z.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},z.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var s=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var v=0;v<this.markerButtons.length;v++)v<s||v===s&&this.markerButtons.length-1===s?this.markerButtonBlock.appendChild(this.markerButtons[v]):(v===s&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[v]))}},z.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")},z.prototype.resetButtonStyles=function(){var s=this;this.buttons.forEach(function(v){v.className=v.className.replace(s.uiStyleSettings.toolbarButtonStyleColorsClassName?s.uiStyleSettings.toolbarButtonStyleColorsClassName:s.toolbarButtonStyleColorsClass.name,"").trim(),v.className=v.className.replace(s.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?s.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:s.toolbarActiveButtonStyleColorsClass.name,"").trim(),v.className+=" "+(s.uiStyleSettings.toolbarButtonStyleColorsClassName?s.uiStyleSettings.toolbarButtonStyleColorsClassName:s.toolbarButtonStyleColorsClass.name)})},z.prototype.addActionButton=function(s,v,W){var X=this,H=document.createElement("div");switch(H.className=""+this.toolbarButtonStyleClass.name,H.innerHTML=v,H.setAttribute("data-action",W),H.addEventListener("click",function(){X.actionToolbarButtonClicked(H,W)}),W){case"select":H.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":H.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":H.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":H.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":H.style.fill=this.uiStyleSettings.closeButtonColor}s.appendChild(H),this.buttons.push(H)},z.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new ye("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 ye("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new ye("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new ye("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 ye("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var s=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new ye("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*s)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*s)+`px;
padding: `+s+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new ye("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new ye("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Re("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new Re("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},z.prototype.markerToolbarButtonClicked=function(s,v){this.setActiveButton(s),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(W){return W("marker",v)}),this.markerButtonOverflowBlock.style.display="none"},z.prototype.actionToolbarButtonClicked=function(s,v){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(W){return W("action",v)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},z.prototype.setActiveButton=function(s){this.resetButtonStyles(),s.className=s.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),s.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},z.prototype.setActiveMarkerButton=function(s){var v=this.markerButtons.find(function(W){return W.getAttribute("data-type-name")===s});v&&this.setActiveButton(v)},z.prototype.setCurrentMarker=function(s){var v=this;this.currentMarker=s,this.buttons.filter(function(W){return/delete|notes/.test(W.getAttribute("data-action"))}).forEach(function(W){v.currentMarker===void 0?(W.style.fillOpacity="0.4",W.style.pointerEvents="none"):(W.style.fillOpacity="1",W.style.pointerEvents="all")})},z}(),Pe=function(){function z(s,v,W,X){this.panels=[],this.panelButtons=[],this.markerjsContainer=s,this.displayMode=v,this.uiStyleSettings=W,this.styles=X,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return z.prototype.addStyles=function(){var s;this.toolboxStyleClass=this.styles.addClass(new ye("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 ye("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var v=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new ye("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new ye("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new ye("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 ye("toolbox-panel-row_colors",`
background-color: `+((s=this.uiStyleSettings.toolboxBackgroundColor)!==null&&s!==void 0?s:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new ye("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*v)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*v)+`px;
padding: `+v+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new ye("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new ye("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new Re("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Re("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},z.prototype.show=function(s){var v;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolboxStyleClass.name+" "+((v=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&v!==void 0?v:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},z.prototype.setPanelButtons=function(s){var v,W,X=this;this.panels=s,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((v=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&v!==void 0?v:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((W=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&W!==void 0?W:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(H){var ve;H.uiStyleSettings=X.uiStyleSettings;var He=document.createElement("div");He.className=X.toolboxButtonStyleClass.name+" "+((ve=X.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ve!==void 0?ve:X.toolboxButtonStyleColorsClass.name),He.innerHTML=H.icon,He.title=H.title,He.addEventListener("click",function(){X.panelButtonClick(H)}),X.panelButtons.push(He),X.buttonRow.appendChild(He)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},z.prototype.panelButtonClick=function(s){var v=this,W=-1;if(s!==this.activePanel){W=this.panels.indexOf(s),this.panelRow.innerHTML="";var X=s.getUi();X.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(X),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=s}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){v.displayMode==="inline"?v.panelRow.style.display="none":v.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(H,ve){var He,Je;H.className=v.toolboxButtonStyleClass.name+" "+(ve===W?""+((He=v.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&He!==void 0?He:v.toolboxActiveButtonStyleColorsClass.name):""+((Je=v.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Je!==void 0?Je:v.toolboxButtonStyleColorsClass.name))})},z}(),Ie=function(z,s){this.title=z,this.icon=s},je=function(z){function s(v,W,X,H){var ve=z.call(this,v,H||'<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 ve.colors=[],ve.addTransparent=!1,ve.colorBoxes=[],ve.colors=W,ve.currentColor=X,ve.setCurrentColor=ve.setCurrentColor.bind(ve),ve.getColorBox=ve.getColorBox.bind(ve),ve}return Te(s,z),s.prototype.getUi=function(){var v=this,W=document.createElement("div");return W.style.overflow="hidden",W.style.whiteSpace="nowrap",this.colors.forEach(function(X){var H=v.getColorBox(X);W.appendChild(H),v.colorBoxes.push(H)}),W},s.prototype.getColorBox=function(v){var W=this,X=this.uiStyleSettings.toolbarHeight/4,H=this.uiStyleSettings.toolbarHeight-X,ve=document.createElement("div");ve.style.display="inline-block",ve.style.boxSizing="content-box",ve.style.width=H-2+"px",ve.style.height=H-2+"px",ve.style.padding="1px",ve.style.marginRight="2px",ve.style.marginBottom="2px",ve.style.borderWidth="2px",ve.style.borderStyle="solid",ve.style.borderRadius=(H+2)/2+"px",ve.style.borderColor=v===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ve.addEventListener("click",function(){W.setCurrentColor(v,ve)});var He=document.createElement("div");return He.style.display="inline-block",He.style.width=H-2+"px",He.style.height=H-2+"px",He.style.backgroundColor=v,He.style.borderRadius=H/2+"px",v==="transparent"&&(He.style.fill=this.uiStyleSettings.toolboxAccentColor,He.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>`),ve.appendChild(He),ve},s.prototype.setCurrentColor=function(v,W){var X=this;this.currentColor=v,this.colorBoxes.forEach(function(H){H.style.borderColor=H===W?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(v)},s}(Ie),Be=function(){function z(s,v,W){this._state="new",this._isSelected=!1,this._container=s,this._overlayContainer=v,this.globalSettings=W,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(z.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),z.prototype.ownsTarget=function(s){return!1},Object.defineProperty(z.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),z.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},z.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},z.prototype.pointerDown=function(s,v){},z.prototype.dblClick=function(s,v){},z.prototype.manipulate=function(s){},z.prototype.pointerUp=function(s){this.stateChanged()},z.prototype.dispose=function(){},z.prototype.addMarkerVisualToContainer=function(s){this.container.childNodes.length>0?this.container.insertBefore(s,this.container.childNodes[0]):this.container.appendChild(s)},z.prototype.getState=function(){return{typeName:z.typeName,state:this.state,notes:this.notes}},z.prototype.restoreState=function(s){this._state=s.state,this.notes=s.notes},z.prototype.scale=function(s,v){},z.prototype.colorChanged=function(s){this.onColorChanged&&this.onColorChanged(s),this.stateChanged()},z.prototype.fillColorChanged=function(s){this.onFillColorChanged&&this.onFillColorChanged(s),this.stateChanged()},z.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var s=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),s.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(s)&&this.onStateChanged(this)}},z.typeName="MarkerBase",z}(),Ne=function(){function z(){this.findGripByVisual=this.findGripByVisual.bind(this)}return z.prototype.findGripByVisual=function(s){return this.topLeft.ownsTarget(s)?this.topLeft:this.topCenter.ownsTarget(s)?this.topCenter:this.topRight.ownsTarget(s)?this.topRight:this.centerLeft.ownsTarget(s)?this.centerLeft:this.centerRight.ownsTarget(s)?this.centerRight:this.bottomLeft.ownsTarget(s)?this.bottomLeft:this.bottomCenter.ownsTarget(s)?this.bottomCenter:this.bottomRight.ownsTarget(s)?this.bottomRight:void 0},z}(),et=function(){function z(){this.GRIP_SIZE=10,this.visual=ue.createGroup(),this.visual.appendChild(ue.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(ue.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return z.prototype.ownsTarget=function(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},z}(),Ze=function(){function z(){}return z.toITransformMatrix=function(s){return{a:s.a,b:s.b,c:s.c,d:s.d,e:s.e,f:s.f}},z.toSVGMatrix=function(s,v){return s.a=v.a,s.b=v.b,s.c=v.c,s.d=v.d,s.e=v.e,s.f=v.f,s},z}(),$e=function(z){function s(v,W,X){var H=z.call(this,v,W,X)||this;return H.left=0,H.top=0,H.width=0,H.height=0,H.defaultSize={x:50,y:20},H.offsetX=0,H.offsetY=0,H.rotationAngle=0,H.CB_DISTANCE=10,H._suppressMarkerCreateEvent=!1,H.container.transform.baseVal.appendItem(ue.createTransform()),H.setupControlBox(),H}return Te(s,z),Object.defineProperty(s.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"visual",{get:function(){return this._visual},set:function(v){this._visual=v;var W=ue.createTransform();this._visual.transform.baseVal.appendItem(W)},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(v){return!!z.prototype.ownsTarget.call(this,v)||!!(this.controlGrips.findGripByVisual(v)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(v))},s.prototype.pointerDown=function(v,W){z.prototype.pointerDown.call(this,v,W),this.state==="new"&&(this.left=v.x,this.top=v.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var X=this.unrotatePoint(v);if(this.manipulationStartX=X.x,this.manipulationStartY=X.y,this.offsetX=X.x-this.left,this.offsetY=X.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(W),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(W)){this.activeGrip=this.rotatorGrip;var H=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=H.x-this.width/2,this.top=H.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ve=this.container.transform.baseVal.getItem(0);ve.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ve,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},s.prototype.pointerUp=function(v){var W=this.state;z.prototype.pointerUp.call(this,v),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(v),this._state="select",W==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},s.prototype.moveVisual=function(v){this.visual.style.transform="translate("+v.x+"px, "+v.y+"px)"},s.prototype.manipulate=function(v){var W=this.unrotatePoint(v);this.state==="creating"?this.resize(v):this.state==="move"?(this.left=this.manipulationStartLeft+(W.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(W.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(W):this.state==="rotate"&&this.rotate(v)},s.prototype.resize=function(v){var W=this.manipulationStartLeft,X=this.manipulationStartWidth,H=this.manipulationStartTop,ve=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:W=this.manipulationStartLeft+v.x-this.manipulationStartX,X=this.manipulationStartWidth+this.manipulationStartLeft-W;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:X=this.manipulationStartWidth+v.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:H=this.manipulationStartTop+v.y-this.manipulationStartY,ve=this.manipulationStartHeight+this.manipulationStartTop-H;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ve=this.manipulationStartHeight+v.y-this.manipulationStartY}X>=0?(this.left=W,this.width=X):(this.left=W+X,this.width=-X),ve>=0?(this.top=H,this.height=ve):(this.top=H+ve,this.height=-ve),this.setSize()},s.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},s.prototype.rotate=function(v){if(Math.abs(v.x-this.centerX)>.1){var W=Math.sign(v.x-this.centerX);this.rotationAngle=180*Math.atan((v.y-this.centerY)/(v.x-this.centerX))/Math.PI+90*W,this.applyRotation()}},s.prototype.applyRotation=function(){var v=this.container.transform.baseVal.getItem(0);v.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(v,0)},s.prototype.rotatePoint=function(v){if(this.rotationAngle===0)return v;var W=this.container.getCTM(),X=ue.createPoint(v.x,v.y);return{x:(X=X.matrixTransform(W)).x,y:X.y}},s.prototype.unrotatePoint=function(v){if(this.rotationAngle===0)return v;var W=this.container.getCTM();W=W.inverse();var X=ue.createPoint(v.x,v.y);return{x:(X=X.matrixTransform(W)).x,y:X.y}},s.prototype.select=function(){z.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){z.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=ue.createGroup();var v=ue.createTransform();v.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(v),this.container.appendChild(this.controlBox),this.controlRect=ue.createRect(this.width+this.CB_DISTANCE,this.height+this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"],["fill","transparent"],["pointer-events","none"]]),this.controlBox.appendChild(this.controlRect),this.globalSettings.disableRotation!==!0&&(this.rotatorGripLine=ue.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new Ne,this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){var v=this.controlBox.transform.baseVal.getItem(0);v.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(v,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()},s.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()},s.prototype.createGrip=function(){var v=new et;return v.visual.transform.baseVal.appendItem(ue.createTransform()),this.controlBox.appendChild(v.visual),v},s.prototype.positionGrips=function(){var v=this.controlGrips.topLeft.GRIP_SIZE,W=-v/2,X=W,H=(this.width+this.CB_DISTANCE)/2-v/2,ve=(this.height+this.CB_DISTANCE)/2-v/2,He=this.height+this.CB_DISTANCE-v/2,Je=this.width+this.CB_DISTANCE-v/2;this.positionGrip(this.controlGrips.topLeft.visual,W,X),this.positionGrip(this.controlGrips.topCenter.visual,H,X),this.positionGrip(this.controlGrips.topRight.visual,Je,X),this.positionGrip(this.controlGrips.centerLeft.visual,W,ve),this.positionGrip(this.controlGrips.centerRight.visual,Je,ve),this.positionGrip(this.controlGrips.bottomLeft.visual,W,He),this.positionGrip(this.controlGrips.bottomCenter.visual,H,He),this.positionGrip(this.controlGrips.bottomRight.visual,Je,He),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,H,X-3*this.CB_DISTANCE)},s.prototype.positionGrip=function(v,W,X){var H=v.transform.baseVal.getItem(0);H.setTranslate(W,X),v.transform.baseVal.replaceItem(H,0)},s.prototype.hideControlBox=function(){this.controlBox.style.display="none"},s.prototype.showControlBox=function(){this.controlBox.style.display=""},s.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:Ze.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:Ze.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},z.prototype.getState.call(this))},s.prototype.restoreState=function(v){z.prototype.restoreState.call(this,v);var W=v;this.left=W.left,this.top=W.top,this.width=W.width,this.height=W.height,this.rotationAngle=W.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(Ze.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,W.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(Ze.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,W.containerTransformMatrix))},s.prototype.scale=function(v,W){z.prototype.scale.call(this,v,W);var X=this.rotatePoint({x:this.left,y:this.top}),H=this.unrotatePoint({x:X.x*v,y:X.y*W});this.left=H.x,this.top=H.y,this.width=this.width*v,this.height=this.height*W,this.adjustControlBox()},s}(Be),Xe=function(z){function s(v,W,X){var H=z.call(this,v,W,X)||this;return H.fillColor="transparent",H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.opacity=1,H.setStrokeColor=H.setStrokeColor.bind(H),H.setFillColor=H.setFillColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.createVisual=H.createVisual.bind(H),H}return Te(s,z),s.prototype.ownsTarget=function(v){return!(!z.prototype.ownsTarget.call(this,v)&&v!==this.visual)},s.prototype.createVisual=function(){this.visual=ue.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(v,W){z.prototype.pointerDown.call(this,v,W),this.state==="new"&&(this.createVisual(),this.moveVisual(v),this._state="creating")},s.prototype.manipulate=function(v){z.prototype.manipulate.call(this,v)},s.prototype.resize=function(v){z.prototype.resize.call(this,v),this.setSize()},s.prototype.setSize=function(){z.prototype.setSize.call(this),ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(v){z.prototype.pointerUp.call(this,v),this.setSize()},s.prototype.setStrokeColor=function(v){this.strokeColor=v,this.visual&&ue.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(v),this.stateChanged()},s.prototype.setFillColor=function(v){this.fillColor=v,this.visual&&ue.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},s.prototype.setStrokeWidth=function(v){this.strokeWidth=v,this.visual&&ue.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(v){this.strokeDasharray=v,this.visual&&ue.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},z.prototype.getState.call(this))},s.prototype.restoreState=function(v){var W=v;this.fillColor=W.fillColor,this.strokeColor=W.strokeColor,this.strokeWidth=W.strokeWidth,this.strokeDasharray=W.strokeDasharray,this.opacity=W.opacity,this.createVisual(),z.prototype.restoreState.call(this,v),this.setSize()},s.prototype.scale=function(v,W){z.prototype.scale.call(this,v,W),this.setSize()},s.title="Rectangle marker",s}($e),st=function(z){function s(v,W,X,H){var ve=z.call(this,v,H||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return ve.widths=[],ve.widthBoxes=[],ve.widths=W,ve.currentWidth=X,ve.setCurrentWidth=ve.setCurrentWidth.bind(ve),ve}return Te(s,z),s.prototype.getUi=function(){var v=this,W=document.createElement("div");return W.style.display="flex",W.style.overflow="hidden",W.style.flexGrow="2",this.widths.forEach(function(X){var H=document.createElement("div");H.style.display="flex",H.style.flexGrow="2",H.style.alignItems="center",H.style.justifyContent="space-between",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.borderColor=X===v.currentWidth?v.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){v.setCurrentWidth(X,H)}),W.appendChild(H);var ve=document.createElement("div");ve.innerText=X.toString(),ve.style.marginRight="5px",H.appendChild(ve);var He=document.createElement("div");He.style.minHeight="20px",He.style.flexGrow="2",He.style.display="flex",He.style.alignItems="center";var Je=document.createElement("hr");Je.style.minWidth="20px",Je.style.border="0px",Je.style.borderTop=X+"px solid "+v.uiStyleSettings.toolboxColor,Je.style.flexGrow="2",He.appendChild(Je),H.appendChild(He),v.widthBoxes.push(H)}),W},s.prototype.setCurrentWidth=function(v,W){var X=this;this.currentWidth=v,this.widthBoxes.forEach(function(H){H.style.borderColor=H===W?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},s}(Ie),qe=function(z){function s(v,W,X,H){var ve=z.call(this,v,H||'<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 ve.styles=[],ve.styleBoxes=[],ve.styles=W,ve.currentStyle=X,ve.setCurrentStyle=ve.setCurrentStyle.bind(ve),ve}return Te(s,z),s.prototype.getUi=function(){var v=this,W=document.createElement("div");return W.style.display="flex",W.style.overflow="hidden",W.style.flexGrow="2",this.styles.forEach(function(X){var H=document.createElement("div");H.style.display="flex",H.style.alignItems="center",H.style.justifyContent="space-between",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.overflow="hidden",H.style.maxWidth=100/v.styles.length-5+"%",H.style.borderColor=X===v.currentStyle?v.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){v.setCurrentStyle(X,H)}),W.appendChild(H);var ve=document.createElement("div");ve.style.minHeight="20px",ve.style.flexGrow="2",ve.style.overflow="hidden";var He=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+v.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(X!==""?'stroke-dasharray="'+X+'"':"")+` />
</svg>`;ve.innerHTML=He,H.appendChild(ve),v.styleBoxes.push(H)}),W},s.prototype.setCurrentStyle=function(v,W){var X=this;this.currentStyle=v,this.styleBoxes.forEach(function(H){H.style.borderColor=H===W?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},s}(Ie),nt=function(z){function s(v,W,X){var H=z.call(this,v,W,X)||this;return H.strokeColor=X.defaultColor,H.strokeWidth=X.defaultStrokeWidth,H.strokeDasharray=X.defaultStrokeDasharray,H.strokePanel=new je("Line color",X.defaultColorSet,X.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.strokeWidthPanel=new st("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new qe("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H}return Te(s,z),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var v=z.prototype.getState.call(this);return v.typeName=s.typeName,v},s.typeName="FrameMarker",s.title="Frame marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',s}(Xe),Me=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},ct=function(z){function s(v,W,X){var H=z.call(this,v,W,X)||this;return H.x1=0,H.y1=0,H.x2=0,H.y2=0,H.defaultLength=50,H.manipulationStartX=0,H.manipulationStartY=0,H.manipulationStartX1=0,H.manipulationStartY1=0,H.manipulationStartX2=0,H.manipulationStartY2=0,H.setupControlBox(),H}return Te(s,z),s.prototype.ownsTarget=function(v){return!!z.prototype.ownsTarget.call(this,v)||!(!this.grip1.ownsTarget(v)&&!this.grip2.ownsTarget(v))},s.prototype.pointerDown=function(v,W){z.prototype.pointerDown.call(this,v,W),this.manipulationStartX=v.x,this.manipulationStartY=v.y,this.state==="new"&&(this.x1=v.x,this.y1=v.y,this.x2=v.x,this.y2=v.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(W)?this.activeGrip=this.grip1:this.grip2.ownsTarget(W)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},s.prototype.pointerUp=function(v){var W=this.state;z.prototype.pointerUp.call(this,v),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(v),this._state="select",W==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},s.prototype.adjustVisual=function(){},s.prototype.manipulate=function(v){this.state==="creating"?this.resize(v):this.state==="move"?(this.x1=this.manipulationStartX1+v.x-this.manipulationStartX,this.y1=this.manipulationStartY1+v.y-this.manipulationStartY,this.x2=this.manipulationStartX2+v.x-this.manipulationStartX,this.y2=this.manipulationStartY2+v.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(v)},s.prototype.resize=function(v){switch(this.activeGrip){case this.grip1:this.x1=v.x,this.y1=v.y;break;case this.grip2:case void 0:this.x2=v.x,this.y2=v.y}this.adjustVisual(),this.adjustControlBox()},s.prototype.select=function(){z.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){z.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=ue.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){this.positionGrips()},s.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},s.prototype.createGrip=function(){var v=new et;return v.visual.transform.baseVal.appendItem(ue.createTransform()),this.controlBox.appendChild(v.visual),v},s.prototype.positionGrips=function(){var v=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-v/2,this.y1-v/2),this.positionGrip(this.grip2.visual,this.x2-v/2,this.y2-v/2)},s.prototype.positionGrip=function(v,W,X){var H=v.transform.baseVal.getItem(0);H.setTranslate(W,X),v.transform.baseVal.replaceItem(H,0)},s.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},z.prototype.getState.call(this))},s.prototype.restoreState=function(v){z.prototype.restoreState.call(this,v);var W=v;this.x1=W.x1,this.y1=W.y1,this.x2=W.x2,this.y2=W.y2},s.prototype.scale=function(v,W){z.prototype.scale.call(this,v,W),this.x1=this.x1*v,this.y1=this.y1*W,this.x2=this.x2*v,this.y2=this.y2*W,this.adjustVisual(),this.adjustControlBox()},s}(Be),at=function(z){function s(v,W,X){var H=z.call(this,v,W,X)||this;return H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.setStrokeColor=H.setStrokeColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.strokeColor=X.defaultColor,H.strokeWidth=X.defaultStrokeWidth,H.strokeDasharray=X.defaultStrokeDasharray,H.strokePanel=new je("Line color",X.defaultColorSet,X.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.strokeWidthPanel=new st("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new qe("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H}return Te(s,z),s.prototype.ownsTarget=function(v){return!(!z.prototype.ownsTarget.call(this,v)&&v!==this.visual&&v!==this.selectorLine&&v!==this.visibleLine)},s.prototype.createVisual=function(){this.visual=ue.createGroup(),this.selectorLine=ue.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=ue.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(v,W){z.prototype.pointerDown.call(this,v,W),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},s.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),ue.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),ue.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),ue.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setStrokeColor=function(v){this.strokeColor=v,this.adjustVisual(),this.colorChanged(v)},s.prototype.setStrokeWidth=function(v){this.strokeWidth=v,this.adjustVisual()},s.prototype.setStrokeDasharray=function(v){this.strokeDasharray=v,this.adjustVisual(),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var v=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},z.prototype.getState.call(this));return v.typeName=s.typeName,v},s.prototype.restoreState=function(v){z.prototype.restoreState.call(this,v);var W=v;this.strokeColor=W.strokeColor,this.strokeWidth=W.strokeWidth,this.strokeDasharray=W.strokeDasharray,this.createVisual(),this.adjustVisual()},s.typeName="LineMarker",s.title="Line marker",s.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',s}(ct),Ue=function(z){function s(v,W,X,H){var ve=z.call(this,v,H||'<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 ve.fonts=[],ve.fontBoxes=[],ve.fonts=W,ve.currentFont=X,ve.setCurrentFont=ve.setCurrentFont.bind(ve),ve}return Te(s,z),s.prototype.getUi=function(){var v=this,W=document.createElement("div");return W.style.overflow="hidden",W.style.flexGrow="2",this.fonts.forEach(function(X){var H=document.createElement("div");H.style.display="inline-block",H.style.alignItems="center",H.style.justifyContent="space-between",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.overflow="hidden",H.style.maxWidth=100/v.fonts.length-5+"%",H.style.borderColor=X===v.currentFont?v.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){v.setCurrentFont(X,H)}),W.appendChild(H);var ve=document.createElement("div");ve.style.display="flex",ve.style.minHeight="20px",ve.style.flexGrow="2",ve.style.fontFamily=X,ve.style.overflow="hidden";var He=document.createElement("div");He.style.whiteSpace="nowrap",He.style.overflow="hidden",He.style.textOverflow="ellipsis",He.innerHTML="The quick brown fox jumps over the lazy dog",ve.appendChild(He),H.appendChild(ve),v.fontBoxes.push(H)}),W},s.prototype.setCurrentFont=function(v,W){var X=this;this.currentFont=v,this.fontBoxes.forEach(function(H){H.style.borderColor=H===W?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},s}(Ie),Ke=function(z){function s(v,W,X){var H=z.call(this,v,W,X)||this;return H.color="transparent",H.padding=5,H.DEFAULT_TEXT="your text here",H.text=H.DEFAULT_TEXT,H.isMoved=!1,H.color=X.defaultColor,H.fontFamily=X.defaultFontFamily,H.defaultSize={x:100,y:30},H.setColor=H.setColor.bind(H),H.setFont=H.setFont.bind(H),H.renderText=H.renderText.bind(H),H.sizeText=H.sizeText.bind(H),H.textEditDivClicked=H.textEditDivClicked.bind(H),H.showTextEditor=H.showTextEditor.bind(H),H.setSize=H.setSize.bind(H),H.positionTextEditor=H.positionTextEditor.bind(H),H.colorPanel=new je("Color",X.defaultColorSet,X.defaultColor),H.colorPanel.onColorChanged=H.setColor,H.fontFamilyPanel=new Ue("Font",X.defaultFontFamilies,X.defaultFontFamily),H.fontFamilyPanel.onFontChanged=H.setFont,H}return Te(s,z),s.prototype.ownsTarget=function(v){if(z.prototype.ownsTarget.call(this,v)||v===this.visual||v===this.textElement||v===this.bgRectangle)return!0;var W=!1;return this.textElement.childNodes.forEach(function(X){X===v&&(W=!0)}),W},s.prototype.createVisual=function(){this.visual=ue.createGroup(),this.bgRectangle=ue.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=ue.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(ue.createTransform()),this.textElement.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},s.prototype.pointerDown=function(v,W){z.prototype.pointerDown.call(this,v,W),this.isMoved=!1,this.pointerDownPoint=v,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(v),this._state="creating")},s.prototype.renderText=function(){var v=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(W){v.textElement.appendChild(ue.createTSpan(W.trim()===""?" ":W.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},s.prototype.getTextScale=function(){var v=this.textElement.getBBox(),W=1;if(v.width>0&&v.height>0){var X=(1*this.width-this.width*this.padding*2/100)/v.width,H=(1*this.height-this.height*this.padding*2/100)/v.height;W=Math.min(X,H)}return W},s.prototype.getTextPosition=function(v){var W=this.textElement.getBBox(),X=0,H=0;return W.width>0&&W.height>0&&(X=(this.width-W.width*v)/2,H=this.height/2-W.height*v/2),{x:X,y:H}},s.prototype.sizeText=function(){var v=this.textElement.getBBox(),W=this.getTextScale(),X=this.getTextPosition(W);X.y-=v.y*W,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+X.x+"px, "+X.y+"px) scale("+W+", "+W+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(X.x,X.y),this.textElement.transform.baseVal.getItem(1).setScale(W,W))},s.prototype.manipulate=function(v){z.prototype.manipulate.call(this,v),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(v.x-this.pointerDownPoint.x)>5||Math.abs(v.y-this.pointerDownPoint.y)>5)},s.prototype.resize=function(v){z.prototype.resize.call(this,v),this.isMoved=!0,this.setSize(),this.sizeText()},s.prototype.setSize=function(){z.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),ue.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},s.prototype.pointerUp=function(v){var W=this.state;W==="creating"&&(this._suppressMarkerCreateEvent=!0),z.prototype.pointerUp.call(this,v),this.setSize(),(W==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},s.prototype.showTextEditor=function(){var v=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(W){W.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var W=Number.parseFloat(v.textEditor.style.fontSize);v.textEditor.clientWidth>=Number.parseInt(v.textEditor.style.maxWidth)&&W>.9;)W-=.1,v.textEditor.style.fontSize=Math.max(W,.9)+"em"}),this.textEditor.addEventListener("keyup",function(W){W.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(W){if(W.clipboardData){var X=W.clipboardData.getData("text"),H=window.getSelection();if(!H.rangeCount)return!1;H.deleteFromDocument(),H.getRangeAt(0).insertNode(document.createTextNode(X)),W.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){v.textEditDivClicked(v.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},s.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var v=this.getTextScale(),W=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),X=this.textElement.getBBox(),H={x:X.width*v,y:X.height*v};W.x-=H.x/2,W.y-=H.y/2,this.textEditor.style.top=W.y+"px",this.textEditor.style.left=W.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-W.x+"px",this.textEditor.style.fontSize=Math.max(16*v,12)+"px",this.textElement.style.display="none"}},s.prototype.textEditDivClicked=function(v){this.text=v.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},s.prototype.select=function(){z.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},s.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),z.prototype.deselect.call(this)},s.prototype.dblClick=function(v,W){z.prototype.dblClick.call(this,v,W),this.showTextEditor()},s.prototype.setColor=function(v){this.textElement&&ue.setAttributes(this.textElement,[["fill",v]]),this.color=v,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(v)},s.prototype.setFont=function(v){this.textElement&&ue.setAttributes(this.textElement,[["font-family",v]]),this.fontFamily=v,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},s.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},s.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var v=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},z.prototype.getState.call(this));return v.typeName=s.typeName,v},s.prototype.restoreState=function(v){var W=v;this.color=W.color,this.fontFamily=W.fontFamily,this.padding=W.padding,this.text=W.text,this.createVisual(),z.prototype.restoreState.call(this,v),this.setSize()},s.prototype.scale=function(v,W){z.prototype.scale.call(this,v,W),this.setSize(),this.sizeText(),this.positionTextEditor()},s.typeName="TextMarker",s.title="Text marker",s.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}($e),xe=function(z){function s(v,W,X){var H=z.call(this,v,W,X)||this;return H.color="transparent",H.lineWidth=3,H.drawing=!1,H.pixelRatio=1,H.color=X.defaultColor,H.lineWidth=X.defaultStrokeWidth,H.pixelRatio=X.freehandPixelRatio,H.setColor=H.setColor.bind(H),H.addCanvas=H.addCanvas.bind(H),H.finishCreation=H.finishCreation.bind(H),H.setLineWidth=H.setLineWidth.bind(H),H.colorPanel=new je("Color",X.defaultColorSet,X.defaultColor),H.colorPanel.onColorChanged=H.setColor,H.lineWidthPanel=new st("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),H.lineWidthPanel.onWidthChanged=H.setLineWidth,H}return Te(s,z),s.prototype.ownsTarget=function(v){return!(!z.prototype.ownsTarget.call(this,v)&&v!==this.visual&&v!==this.drawingImage)},s.prototype.createVisual=function(){this.visual=ue.createGroup(),this.drawingImage=ue.createImage(),this.visual.appendChild(this.drawingImage);var v=ue.createTransform();this.visual.transform.baseVal.appendItem(v),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(v,W){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(v.x,v.y),this.drawing=!0):z.prototype.pointerDown.call(this,v,W)},s.prototype.manipulate=function(v){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(v.x,v.y),this.canvasContext.stroke()):z.prototype.manipulate.call(this,v)},s.prototype.resize=function(v){z.prototype.resize.call(this,v),ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),ue.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(v){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):z.prototype.pointerUp.call(this,v)},s.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)},s.prototype.select=function(){this.state==="creating"&&this.finishCreation(),z.prototype.select.call(this)},s.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),z.prototype.deselect.call(this)},s.prototype.finishCreation=function(){for(var v=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),W=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],X=W[0],H=W[1],ve=W[2],He=W[3],Je=!1,ut=0;ut<this.canvasElement.height;ut++)for(var Ge=0;Ge<this.canvasElement.width;Ge++)v.data[ut*this.canvasElement.width*4+4*Ge+3]>0&&(Je=!0,ut<H&&(H=ut),Ge<X&&(X=Ge),ut>He&&(He=ut),Ge>ve&&(ve=Ge));if(Je){this.left=X/this.pixelRatio,this.top=H/this.pixelRatio,this.width=(ve-X)/this.pixelRatio,this.height=(He-H)/this.pixelRatio;var Et=document.createElement("canvas");Et.width=ve-X,Et.height=He-H,Et.getContext("2d").putImageData(this.canvasContext.getImageData(X,H,ve-X,He-H),0,0),this.drawingImgUrl=Et.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},s.prototype.setDrawingImage=function(){ue.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),ue.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},s.prototype.setColor=function(v){this.color=v,this.colorChanged(v)},s.prototype.setLineWidth=function(v){this.lineWidth=v},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var v=Object.assign({drawingImgUrl:this.drawingImgUrl},z.prototype.getState.call(this));return v.typeName=s.typeName,v},s.prototype.restoreState=function(v){this.createVisual(),z.prototype.restoreState.call(this,v),this.drawingImgUrl=v.drawingImgUrl,this.setDrawingImage()},s.prototype.scale=function(v,W){z.prototype.scale.call(this,v,W),this.setDrawingImage()},s.typeName="FreehandMarker",s.title="Freehand marker",s.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}($e),ge=function(z){function s(v,W,X){var H=z.call(this,v,X||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return H.typeBoxes=[],H.currentType=W,H.setCurrentType=H.setCurrentType.bind(H),H}return Te(s,z),s.prototype.getUi=function(){var v=this,W=document.createElement("div");W.style.display="flex",W.style.overflow="hidden",W.style.flexGrow="2";for(var X=function(He){var Je="both";switch(He){case 0:Je="both";break;case 1:Je="start";break;case 2:Je="end";break;case 3:Je="none"}var ut=document.createElement("div");if(ut.style.display="flex",ut.style.flexGrow="2",ut.style.alignItems="center",ut.style.justifyContent="space-between",ut.style.padding="5px",ut.style.borderWidth="2px",ut.style.borderStyle="solid",ut.style.borderColor=Je===H.currentType?H.uiStyleSettings.toolboxAccentColor:"transparent",ut.addEventListener("click",function(){v.setCurrentType(Je,ut)}),W.appendChild(ut),Je==="both"||Je==="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="`+(H.uiStyleSettings!==void 0?H.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Ge.style.marginLeft="5px",ut.appendChild(Ge)}var Et=document.createElement("div");Et.style.display="flex",Et.style.alignItems="center",Et.style.minHeight="20px",Et.style.flexGrow="2";var Dt=document.createElement("hr");if(Dt.style.minWidth="20px",Dt.style.border="0px",Dt.style.borderTop="3px solid "+(H.uiStyleSettings!==void 0?H.uiStyleSettings.toolboxColor:"#eeeeee"),Dt.style.flexGrow="2",Et.appendChild(Dt),ut.appendChild(Et),Je==="both"||Je==="end"){var Vt=document.createElement("div");Vt.style.display="flex",Vt.style.alignItems="center",Vt.style.minHeight="20px",Vt.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="`+(H.uiStyleSettings!==void 0?H.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Vt.style.marginRight="5px",ut.appendChild(Vt)}H.typeBoxes.push(ut)},H=this,ve=0;ve<4;ve++)X(ve);return W},s.prototype.setCurrentType=function(v,W){var X=this;this.currentType=v,this.typeBoxes.forEach(function(H){H.style.borderColor=H===W?X.uiStyleSettings!==void 0?X.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},s}(Ie),be=function(z){function s(v,W,X){var H=z.call(this,v,W,X)||this;return H.arrowType="end",H.arrowBaseHeight=10,H.arrowBaseWidth=10,H.getArrowPoints=H.getArrowPoints.bind(H),H.setArrowType=H.setArrowType.bind(H),H.arrowTypePanel=new ge("Arrow type","end"),H.arrowTypePanel.onArrowTypeChanged=H.setArrowType,H}return Te(s,z),s.prototype.ownsTarget=function(v){return!(!z.prototype.ownsTarget.call(this,v)&&v!==this.arrow1&&v!==this.arrow2)},s.prototype.getArrowPoints=function(v,W){var X=this.arrowBaseWidth+2*this.strokeWidth,H=this.arrowBaseHeight+2*this.strokeWidth;return v-X/2+","+(W+H/2)+" "+v+","+(W-H/2)+" "+(v+X/2)+","+(W+H/2)},s.prototype.createTips=function(){this.arrow1=ue.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=ue.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.arrow2)},s.prototype.pointerDown=function(v,W){z.prototype.pointerDown.call(this,v,W),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(z.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",ue.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),ue.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var v=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),W=this.arrow1.transform.baseVal.getItem(0);W.setRotate(v,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(W,0);var X=this.arrow2.transform.baseVal.getItem(0);X.setRotate(v+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(X,0)}},s.prototype.setArrowType=function(v){this.arrowType=v,this.adjustVisual(),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var v=Object.assign({arrowType:this.arrowType},z.prototype.getState.call(this));return v.typeName=s.typeName,v},s.prototype.restoreState=function(v){z.prototype.restoreState.call(this,v);var W=v;this.arrowType=W.arrowType,this.createTips(),this.adjustVisual()},s.typeName="ArrowMarker",s.title="Arrow marker",s.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',s}(at),re=function(z){function s(v,W,X){var H=z.call(this,v,W,X)||this;return H.fillColor=X.defaultFillColor,H.strokeWidth=0,H.fillPanel=new je("Color",X.defaultColorSet,X.defaultFillColor),H.fillPanel.onColorChanged=H.setFillColor,H}return Te(s,z),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var v=z.prototype.getState.call(this);return v.typeName=s.typeName,v},s.typeName="CoverMarker",s.title="Cover marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',s}(Xe),ne=function(z){function s(v,W,X,H){var ve=z.call(this,v,H||'<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 ve.opacities=[],ve.opacityBoxes=[],ve.opacities=W,ve.currentOpacity=X,ve.setCurrentOpacity=ve.setCurrentOpacity.bind(ve),ve}return Te(s,z),s.prototype.getUi=function(){var v=this,W=document.createElement("div");return W.style.display="flex",W.style.overflow="hidden",W.style.flexGrow="2",W.style.justifyContent="space-between",this.opacities.forEach(function(X){var H=document.createElement("div");H.style.display="flex",H.style.alignItems="center",H.style.justifyContent="center",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.borderColor=X===v.currentOpacity?v.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){v.setCurrentOpacity(X,H)}),W.appendChild(H);var ve=document.createElement("div");ve.innerText=100*X+"%",H.appendChild(ve),v.opacityBoxes.push(H)}),W},s.prototype.setCurrentOpacity=function(v,W){var X=this;this.currentOpacity=v,this.opacityBoxes.forEach(function(H){H.style.borderColor=H===W?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},s}(Ie),se=function(z){function s(v,W,X){var H=z.call(this,v,W,X)||this;return H.setOpacity=H.setOpacity.bind(H),H.fillColor=X.defaultHighlightColor,H.strokeWidth=0,H.opacity=X.defaultHighlightOpacity,H.fillPanel=new je("Color",X.defaultColorSet,H.fillColor),H.fillPanel.onColorChanged=H.setFillColor,H.opacityPanel=new ne("Opacity",X.defaultOpacitySteps,H.opacity),H.opacityPanel.onOpacityChanged=H.setOpacity,H}return Te(s,z),s.prototype.setOpacity=function(v){this.opacity=v,this.visual&&ue.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var v=z.prototype.getState.call(this);return v.typeName=s.typeName,v},s.typeName="HighlightMarker",s.title="Highlight marker",s.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>',s}(re),he='<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>',Le=function(z){function s(v,W,X){var H=z.call(this,v,W,X)||this;return H.bgColor="transparent",H.tipPosition={x:0,y:0},H.tipBase1Position={x:0,y:0},H.tipBase2Position={x:0,y:0},H.tipMoving=!1,H.color=X.defaultStrokeColor,H.bgColor=X.defaultFillColor,H.fontFamily=X.defaultFontFamily,H.defaultSize={x:100,y:30},H.setBgColor=H.setBgColor.bind(H),H.getTipPoints=H.getTipPoints.bind(H),H.positionTip=H.positionTip.bind(H),H.setTipPoints=H.setTipPoints.bind(H),H.colorPanel=new je("Text color",X.defaultColorSet,H.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>'),H.colorPanel.onColorChanged=H.setColor,H.bgColorPanel=new je("Fill color",X.defaultColorSet,H.bgColor,he),H.bgColorPanel.onColorChanged=H.setBgColor,H.fontFamilyPanel=new Ue("Font",X.defaultFontFamilies,X.defaultFontFamily),H.fontFamilyPanel.onFontChanged=H.setFont,H.tipGrip=new et,H.tipGrip.visual.transform.baseVal.appendItem(ue.createTransform()),H.controlBox.appendChild(H.tipGrip.visual),H}return Te(s,z),s.prototype.ownsTarget=function(v){return z.prototype.ownsTarget.call(this,v)||this.tipGrip.ownsTarget(v)||this.tip===v},s.prototype.createTip=function(){ue.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=ue.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},s.prototype.pointerDown=function(v,W){this.state==="new"&&z.prototype.pointerDown.call(this,v,W),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(W)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):z.prototype.pointerDown.call(this,v,W)},s.prototype.pointerUp=function(v){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,z.prototype.pointerUp.call(this,v);else{var W=this.state==="creating";z.prototype.pointerUp.call(this,v),this.setTipPoints(W),this.positionTip()}},s.prototype.manipulate=function(v){if(this.tipMoving){var W=this.unrotatePoint(v);this.tipPosition={x:W.x-this.manipulationStartLeft,y:W.y-this.manipulationStartTop},this.positionTip()}else z.prototype.manipulate.call(this,v)},s.prototype.setBgColor=function(v){this.bgRectangle&&this.tip&&(ue.setAttributes(this.bgRectangle,[["fill",v]]),ue.setAttributes(this.tip,[["fill",v]])),this.bgColor=v,this.fillColorChanged(v)},s.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},s.prototype.setTipPoints=function(v){v===void 0&&(v=!1);var W=Math.min(this.height/2,15),X=this.height/5;v&&(this.tipPosition={x:W+X/2,y:this.height+20});var H=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?H<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(X=this.width/5,W=Math.min(this.width/2,15),this.tipBase1Position={x:W,y:0},this.tipBase2Position={x:W+X,y:0}):(this.tipBase1Position={x:0,y:W},this.tipBase2Position={x:0,y:W+X}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?H<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(X=this.width/5,W=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-W-X,y:0},this.tipBase2Position={x:this.width-W,y:0}):(this.tipBase1Position={x:this.width,y:W},this.tipBase2Position={x:this.width,y:W+X}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?H<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(X=this.width/5,W=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-W-X,y:this.height},this.tipBase2Position={x:this.width-W,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-W-X},this.tipBase2Position={x:this.width,y:this.height-W}):H<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(X=this.width/5,W=Math.min(this.width/2,15),this.tipBase1Position={x:W,y:this.height},this.tipBase2Position={x:W+X,y:this.height}):(this.tipBase1Position={x:0,y:this.height-W},this.tipBase2Position={x:0,y:this.height-W-X})},s.prototype.resize=function(v){z.prototype.resize.call(this,v),this.positionTip()},s.prototype.positionTip=function(){ue.setAttributes(this.tip,[["points",this.getTipPoints()]]);var v=this.tipGrip.visual.transform.baseVal.getItem(0);v.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(v,0)},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),s.prototype.select=function(){this.positionTip(),z.prototype.select.call(this)},s.prototype.getState=function(){var v=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},z.prototype.getState.call(this));return v.typeName=s.typeName,v},s.prototype.restoreState=function(v){var W=v;this.bgColor=W.bgColor,this.tipPosition=W.tipPosition,z.prototype.restoreState.call(this,v),this.createTip(),this.setTipPoints()},s.prototype.scale=function(v,W){z.prototype.scale.call(this,v,W),this.tipPosition={x:this.tipPosition.x*v,y:this.tipPosition.y*W},this.positionTip()},s.typeName="CalloutMarker",s.title="Callout marker",s.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>',s}(Ke),Se=function(z){function s(v,W,X){var H=z.call(this,v,W,X)||this;return H.fillColor="transparent",H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.opacity=1,H.strokeColor=X.defaultColor,H.strokeWidth=X.defaultStrokeWidth,H.strokeDasharray=X.defaultStrokeDasharray,H.fillColor=X.defaultFillColor,H.setStrokeColor=H.setStrokeColor.bind(H),H.setFillColor=H.setFillColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.setOpacity=H.setOpacity.bind(H),H.createVisual=H.createVisual.bind(H),H.strokePanel=new je("Line color",me(X.defaultColorSet,["transparent"]),X.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.fillPanel=new je("Fill color",me(X.defaultColorSet,["transparent"]),H.fillColor,he),H.fillPanel.onColorChanged=H.setFillColor,H.strokeWidthPanel=new st("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new qe("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H.opacityPanel=new ne("Opacity",X.defaultOpacitySteps,H.opacity),H.opacityPanel.onOpacityChanged=H.setOpacity,H}return Te(s,z),s.prototype.ownsTarget=function(v){return!(!z.prototype.ownsTarget.call(this,v)&&v!==this.visual)},s.prototype.createVisual=function(){this.visual=ue.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(v,W){z.prototype.pointerDown.call(this,v,W),this.state==="new"&&(this.createVisual(),this.moveVisual(v),this._state="creating")},s.prototype.manipulate=function(v){z.prototype.manipulate.call(this,v)},s.prototype.resize=function(v){z.prototype.resize.call(this,v),this.setSize()},s.prototype.setSize=function(){z.prototype.setSize.call(this),ue.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},s.prototype.pointerUp=function(v){z.prototype.pointerUp.call(this,v),this.setSize()},s.prototype.setStrokeColor=function(v){this.strokeColor=v,this.visual&&ue.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(v),this.stateChanged()},s.prototype.setFillColor=function(v){this.fillColor=v,this.visual&&ue.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(v),this.stateChanged()},s.prototype.setStrokeWidth=function(v){this.strokeWidth=v,this.visual&&ue.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(v){this.strokeDasharray=v,this.visual&&ue.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.setOpacity=function(v){this.opacity=v,this.visual&&ue.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var v=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},z.prototype.getState.call(this));return v.typeName=s.typeName,v},s.prototype.restoreState=function(v){var W=v;this.fillColor=W.fillColor,this.strokeColor=W.strokeColor,this.strokeWidth=W.strokeWidth,this.strokeDasharray=W.strokeDasharray,this.opacity=W.opacity,this.createVisual(),z.prototype.restoreState.call(this,v),this.setSize()},s.prototype.scale=function(v,W){z.prototype.scale.call(this,v,W),this.setSize()},s.typeName="EllipseMarker",s.title="Ellipse marker",s.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}($e),We=function(z){function s(v,W,X){return z.call(this,v,W,X)||this}return Te(s,z),Object.defineProperty(s.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(v){return!(!z.prototype.ownsTarget.call(this,v)&&v!==this.tip1&&v!==this.tip2)},s.prototype.createTips=function(){this.tip1=ue.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.tip1),this.tip2=ue.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.tip2)},s.prototype.pointerDown=function(v,W){z.prototype.pointerDown.call(this,v,W),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(z.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(ue.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),ue.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var v=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),W=this.tip1.transform.baseVal.getItem(0);W.setRotate(v,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(W,0);var X=this.tip2.transform.baseVal.getItem(0);X.setRotate(v+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(X,0)}},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var v=z.prototype.getState.call(this);return v.typeName=s.typeName,v},s.prototype.restoreState=function(v){z.prototype.restoreState.call(this,v),this.createTips(),this.adjustVisual()},s.typeName="MeasurementMarker",s.title="Measurement marker",s.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>',s}(at),it=function(z){function s(v,W,X){var H=z.call(this,v,W,X)||this;return H.strokePanel.colors=X.defaultColorSet,H.fillColor="transparent",H}return Te(s,z),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var v=z.prototype.getState.call(this);return v.typeName=s.typeName,v},s.typeName="EllipseFrameMarker",s.title="Ellipse frame marker",s.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>',s}(Se),ft=function(){function z(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(z.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),z.prototype.addUndoStep=function(s){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(s)||(this.undoStack.push(s),JSON.stringify(this.lastRedoStep)!==JSON.stringify(s)&&this.redoStack.splice(0,this.redoStack.length))},z.prototype.replaceLastUndoStep=function(s){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=s)},z.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},z.prototype.undo=function(){if(this.undoStack.length>1){var s=this.undoStack.pop();return s!==void 0&&this.redoStack.push(s),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},z.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},z}(),lt=function(z){function s(v,W,X){var H=z.call(this,v,W,X)||this;return H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.curveX=0,H.curveY=0,H.manipulationStartCurveX=0,H.manipulationStartCurveY=0,H.setStrokeColor=H.setStrokeColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.positionGrips=H.positionGrips.bind(H),H.addControlGrips=H.addControlGrips.bind(H),H.adjustVisual=H.adjustVisual.bind(H),H.setupControlBox=H.setupControlBox.bind(H),H.resize=H.resize.bind(H),H.strokeColor=X.defaultColor,H.strokeWidth=X.defaultStrokeWidth,H.strokeDasharray=X.defaultStrokeDasharray,H.strokePanel=new je("Line color",X.defaultColorSet,X.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.strokeWidthPanel=new st("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new qe("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H}return Te(s,z),s.prototype.ownsTarget=function(v){return!(!z.prototype.ownsTarget.call(this,v)&&v!==this.visual&&v!==this.selectorCurve&&v!==this.visibleCurve&&!this.curveGrip.ownsTarget(v))},s.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},s.prototype.createVisual=function(){this.visual=ue.createGroup(),this.selectorCurve=ue.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=ue.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(v,W){z.prototype.pointerDown.call(this,v,W),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=v.x,this.curveY=v.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(W)&&(this.activeGrip=this.curveGrip,this._state="resize")},s.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),ue.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),ue.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),ue.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setupControlBox=function(){z.prototype.setupControlBox.call(this),this.curveControlLine1=ue.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=ue.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},s.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,z.prototype.addControlGrips.call(this)},s.prototype.positionGrips=function(){z.prototype.positionGrips.call(this);var v=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-v/2,this.curveY-v/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()))},s.prototype.manipulate=function(v){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+v.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+v.y-this.manipulationStartY),z.prototype.manipulate.call(this,v)},s.prototype.resize=function(v){this.activeGrip===this.curveGrip&&(this.curveX=v.x,this.curveY=v.y),z.prototype.resize.call(this,v),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},s.prototype.setStrokeColor=function(v){this.strokeColor=v,this.adjustVisual(),this.colorChanged(v)},s.prototype.setStrokeWidth=function(v){this.strokeWidth=v,this.adjustVisual()},s.prototype.setStrokeDasharray=function(v){this.strokeDasharray=v,this.adjustVisual()},s.prototype.scale=function(v,W){this.curveX=this.curveX*v,this.curveY=this.curveY*W,z.prototype.scale.call(this,v,W)},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var v=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},z.prototype.getState.call(this));return v.typeName=s.typeName,v},s.prototype.restoreState=function(v){z.prototype.restoreState.call(this,v);var W=v;this.strokeColor=W.strokeColor,this.strokeWidth=W.strokeWidth,this.strokeDasharray=W.strokeDasharray,this.curveX=W.curveX,this.curveY=W.curveY,this.createVisual(),this.adjustVisual()},s.typeName="CurveMarker",s.title="Curve marker",s.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>',s}(ct),wt=function(){function z(s,v){v===void 0&&(v=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=s,this.cancelable=v}return Object.defineProperty(z.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),z.prototype.preventDefault=function(){this._defaultPrevented=!0},z}(),St=function(z){function s(v,W,X){var H=z.call(this,v,!1)||this;return H.dataUrl=W,H.state=X,H}return Te(s,z),s}(wt),dt=function(z){function s(v,W,X){X===void 0&&(X=!1);var H=z.call(this,v,X)||this;return H.marker=W,H}return Te(s,z),s}(wt),zt=function(){function z(){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 z.prototype.addEventListener=function(s,v){this[s].push(v)},z.prototype.removeEventListener=function(s,v){var W=this[s].indexOf(v);W>-1&&this[s].splice(W,1)},z}(),It=function(){function z(s){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Me,this._isOpen=!1,this.undoRedoManager=new ft,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 zt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=z.instanceCounter++,this.styles=new _e(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=s,this.targetRoot=document.body,this.width=s.clientWidth,this.height=s.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(z.prototype,"ALL_MARKER_TYPES",{get:function(){return[nt,xe,be,Ke,it,Se,se,Le,We,re,at,lt]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[nt,xe,be,Ke,Se,se,Le]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"BASIC_MARKER_TYPES",{get:function(){return[nt,xe,be,Ke,se]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(s){var v=this;this._availableMarkerTypes.splice(0),s.forEach(function(W){if(typeof W=="string"){var X=v.ALL_MARKER_TYPES.find(function(H){return H.typeName===W});X!==void 0&&v._availableMarkerTypes.push(X)}else v._availableMarkerTypes.push(W)})},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(s){this._zoomLevel=s,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(z.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),z.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),te.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},z.prototype.show=function(){var s=this;this.styles.styleSheetRoot===void 0&&ae.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=ae.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(v){return v(new wt(s))})},z.prototype.render=function(){return we(this,void 0,void 0,function(){var s;return Ce(this,function(v){switch(v.label){case 0:return this.setCurrentMarker(),(s=new de).naturalSize=this.renderAtNaturalSize,s.imageType=this.renderImageType,s.imageQuality=this.renderImageQuality,s.markersOnly=this.renderMarkersOnly,s.width=this.renderWidth,s.height=this.renderHeight,[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return v.sent(),[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,v.sent()]}})})},z.prototype.close=function(s){var v=this;if(s===void 0&&(s=!1),this.isOpen){var W=!1;s||this.eventListeners.beforeclose.forEach(function(X){var H=new wt(v,!0);X(H),H.defaultPrevented&&(W=!0)}),W||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(X){return X(new wt(v))}),this.detachEvents(),this._isOpen=!1)}},z.prototype.addMarkersToToolbar=function(){for(var s,v=[],W=0;W<arguments.length;W++)v[W]=arguments[W];(s=this._availableMarkerTypes).push.apply(s,v)},z.prototype.addRenderEventListener=function(s){this.addEventListener("render",function(v){s(v.dataUrl,v.state)})},z.prototype.removeRenderEventListener=function(s){},z.prototype.addCloseEventListener=function(s){this.addEventListener("close",function(){s()})},z.prototype.removeCloseEventListener=function(s){},z.prototype.setupResizeObserver=function(){var s=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){s.resize(s.target.clientWidth,s.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return s.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},z.prototype.onPopupTargetResize=function(){var s=1*this.target.clientWidth/this.target.clientHeight,v=this.editorCanvas.clientWidth/s>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*s:this.editorCanvas.clientWidth,W=v<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/s;this.resize(v,W)},z.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},z.prototype.resize=function(s,v){this._isResizing=!0;var W=s/this.imageWidth,X=v/this.imageHeight;this.imageWidth=Math.round(s),this.imageHeight=Math.round(v),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(W,X),this._isResizing=!1},z.prototype.scaleMarkers=function(s,v){var W,X=this;this._currentMarker&&this._currentMarker instanceof Ke?this._currentMarker.scale(s,v):(W=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(H){H!==X._currentMarker&&H.scale(s,v)}),W!==void 0&&this.setCurrentMarker(W)},z.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"},z.prototype.setTopLeft=function(){var s=this.editingTarget.getBoundingClientRect(),v=this.editorCanvas.getBoundingClientRect();this.left=s.left-v.left,this.top=s.top-v.top},z.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)},z.prototype.addDefs=function(){for(var s,v=[],W=0;W<arguments.length;W++)v[W]=arguments[W];this.defs=ue.createDefs(),this.addDefsToImage(),(s=this.defs).append.apply(s,v)},z.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},z.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)},z.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},z.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},z.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)},z.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},z.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)},z.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 s=document.createElement("a");s.href="https://markerjs.com/",s.target="_blank",s.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>',s.title="Powered by marker.js",s.style.display="grid",s.style.alignItems="center",s.style.justifyItems="center",s.style.padding="3px",s.style.width="20px",s.style.height="20px",this.logoUI.appendChild(s),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},z.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")},z.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"},z.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},z.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 s=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=s+"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 Oe(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 Pe(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},z.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},z.prototype.removeMarker=function(s){this.markerImage.removeChild(s.container),this.markers.indexOf(s)>-1&&this.markers.splice(this.markers.indexOf(s),1),s.dispose()},z.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())},z.prototype.toolbarButtonClicked=function(s,v){if(s==="marker"&&v!==void 0)this.createNewMarker(v);else if(s==="action")switch(v){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()}},z.prototype.deleteSelectedMarker=function(){var s=this;if(this._currentMarker!==void 0){var v=!1;if(this.eventListeners.markerbeforedelete.forEach(function(X){var H=new dt(s,s._currentMarker,!0);X(H),H.defaultPrevented&&(v=!0)}),!v){var W=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(X){return X(new dt(s,W))})}}},z.prototype.clear=function(){var s=this,v=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ve){var He=new dt(s,void 0,!0);ve(He),He.defaultPrevented&&(v=!0)}),!v)){this.setCurrentMarker();for(var W=function(ve){var He=X.markers[ve];X.setCurrentMarker(X.markers[ve]),X._currentMarker.dispose(),X.markerImage.removeChild(X._currentMarker.container),X.markers.splice(X.markers.indexOf(X._currentMarker),1),X.eventListeners.markerdelete.forEach(function(Je){return Je(new dt(s,He))})},X=this,H=this.markers.length-1;H>=0;H--)W(H);this.addUndoStep()}},Object.defineProperty(z.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),z.prototype.showNotesEditor=function(){var s;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=(s=this._currentMarker.notes)!==null&&s!==void 0?s:"",this.overlayContainer.appendChild(this.notesArea))},z.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)},z.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},z.prototype.addUndoStep=function(){var s=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var v=this.getState(),W=this.undoRedoManager.getLastUndoStep();if(!W||W.width===v.width&&W.height===v.height){var X=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(v),X<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(H){return H(new wt(s))})}else this.undoRedoManager.replaceLastUndoStep(v),this.eventListeners.statechange.forEach(function(H){return H(new wt(s))})}},z.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},z.prototype.undoStep=function(){var s=this,v=this.undoRedoManager.undo();v!==void 0&&(this.restoreState(v),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(W){return W(new wt(s))}))},z.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},z.prototype.redoStep=function(){var s=this,v=this.undoRedoManager.redo();v!==void 0&&(this.restoreState(v),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(W){return W(new wt(s))}))},z.prototype.stepZoom=function(){var s=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=s<this.zoomSteps.length-1?this.zoomSteps[s+1]:this.zoomSteps[0]},z.prototype.panTo=function(s){this.contentDiv.scrollBy({left:this.prevPanPoint.x-s.x,top:this.prevPanPoint.y-s.y}),this.prevPanPoint=s},z.prototype.startRenderAndClose=function(){return we(this,void 0,void 0,function(){var s,v,W=this;return Ce(this,function(X){switch(X.label){case 0:return[4,this.render()];case 1:return s=X.sent(),v=this.getState(),this.eventListeners.render.forEach(function(H){return H(new St(W,s,v))}),this.close(!0),[2]}})})},z.prototype.getState=function(s){s===!0&&this.setCurrentMarker();var v={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(W){return v.markers.push(W.getState())}),v},z.prototype.restoreState=function(s){var v=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);s.markers.forEach(function(W){var X=v._availableMarkerTypes.find(function(ve){return ve.typeName===W.typeName});if(X!==void 0){var H=v.addNewMarker(X);H.restoreState(W),v.markers.push(H)}}),s.width&&s.height&&(s.width!==this.imageWidth||s.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/s.width,this.imageHeight/s.height),this.eventListeners.restorestate.forEach(function(W){return W(new wt(v))})},z.prototype.addNewMarker=function(s){var v=ue.createGroup();return this.markerImage.appendChild(v),new s(v,this.overlayContainer,this.settings)},z.prototype.createNewMarker=function(s){var v,W=this;(v=typeof s=="string"?this._availableMarkerTypes.find(function(X){return X.typeName===s}):s)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(v),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(v.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(X){return X(new dt(W,W._currentMarker))}))},z.prototype.markerCreated=function(s){var v=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(s),this.setCurrentMarker(s),s instanceof xe&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(xe):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(W){return W(new dt(v,v._currentMarker))})},z.prototype.colorChanged=function(s){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=s,this.settings.defaultStrokeColor=s)},z.prototype.fillColorChanged=function(s){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=s)},z.prototype.markerStateChanged=function(s){var v=this;this.eventListeners.markerchange.forEach(function(W){return W(new dt(v,s))})},z.prototype.setCurrentMarker=function(s){var v=this;this._currentMarker!==s&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(W){return W(new dt(v,v._currentMarker))})),this._currentMarker=s,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(W){return W(new dt(v,v._currentMarker))}))},z.prototype.onPointerDown=function(s){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||s.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var v=this.markers.find(function(W){return W.ownsTarget(s.target)});v!==void 0?(this.setCurrentMarker(v),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(s.clientX,s.clientY),s.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:s.clientX,y:s.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(s.clientX,s.clientY))},z.prototype.onDblClick=function(s){if(this._isFocused||this.focus(),this.mode==="select"){var v=this.markers.find(function(W){return W.ownsTarget(s.target)});v!==void 0&&v!==this._currentMarker&&this.setCurrentMarker(v),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(s.clientX,s.clientY),s.target):this.setCurrentMarker()}},z.prototype.onPointerMove=function(s){this.touchPoints!==1&&s.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||s.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(s.clientX,s.clientY)):this.zoomLevel>1&&this.panTo({x:s.clientX,y:s.clientY}))},z.prototype.onPointerUp=function(s){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(s.clientX,s.clientY)),this.isDragging=!1,this.addUndoStep()},z.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},z.prototype.onKeyUp=function(s){this._currentMarker===void 0||this.notesArea!==void 0||s.key!=="Delete"&&s.key!=="Backspace"||this.deleteSelectedMarker()},z.prototype.clientToLocalCoordinates=function(s,v){var W=this.markerImage.getBoundingClientRect();return{x:(s-W.left)/this.zoomLevel,y:(v-W.top)/this.zoomLevel}},z.prototype.onWindowResize=function(){this.positionUI()},z.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var s=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=s+"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()},z.prototype.addLicenseKey=function(s){te.addKey(s)},z.prototype.addEventListener=function(s,v){this.eventListeners.addEventListener(s,v)},z.prototype.removeEventListener=function(s,v){this.eventListeners.removeEventListener(s,v)},z.prototype.renderState=function(s){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(s),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(z.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),z.prototype.focus=function(){var s=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(v){return v(new wt(s))}))},z.prototype.blur=function(){var s=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(v){return v(new wt(s))}))},z.instanceCounter=0,z}();/* **********************************
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 Kt=function(z,s){return(Kt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,W){v.__proto__=W}||function(v,W){for(var X in W)Object.prototype.hasOwnProperty.call(W,X)&&(v[X]=W[X])})(z,s)};function Wt(z,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function v(){this.constructor=z}Kt(z,s),z.prototype=s===null?Object.create(s):(v.prototype=s.prototype,new v)}function _t(z,s,v,W){return new(v||(v=Promise))(function(X,H){function ve(ut){try{Je(W.next(ut))}catch(Ge){H(Ge)}}function He(ut){try{Je(W.throw(ut))}catch(Ge){H(Ge)}}function Je(ut){var Ge;ut.done?X(ut.value):(Ge=ut.value,Ge instanceof v?Ge:new v(function(Et){Et(Ge)})).then(ve,He)}Je((W=W.apply(z,s||[])).next())})}function Wr(z,s){var v,W,X,H,ve={label:0,sent:function(){if(1&X[0])throw X[1];return X[1]},trys:[],ops:[]};return H={next:He(0),throw:He(1),return:He(2)},typeof Symbol=="function"&&(H[Symbol.iterator]=function(){return this}),H;function He(Je){return function(ut){return function(Ge){if(v)throw new TypeError("Generator is already executing.");for(;ve;)try{if(v=1,W&&(X=2&Ge[0]?W.return:Ge[0]?W.throw||((X=W.return)&&X.call(W),0):W.next)&&!(X=X.call(W,Ge[1])).done)return X;switch(W=0,X&&(Ge=[2&Ge[0],X.value]),Ge[0]){case 0:case 1:X=Ge;break;case 4:return ve.label++,{value:Ge[1],done:!1};case 5:ve.label++,W=Ge[1],Ge=[0];continue;case 7:Ge=ve.ops.pop(),ve.trys.pop();continue;default:if(!(X=ve.trys,(X=X.length>0&&X[X.length-1])||Ge[0]!==6&&Ge[0]!==2)){ve=0;continue}if(Ge[0]===3&&(!X||Ge[1]>X[0]&&Ge[1]<X[3])){ve.label=Ge[1];break}if(Ge[0]===6&&ve.label<X[1]){ve.label=X[1],X=Ge;break}if(X&&ve.label<X[2]){ve.label=X[2],ve.ops.push(Ge);break}X[2]&&ve.ops.pop(),ve.trys.pop();continue}Ge=s.call(z,ve)}catch(Et){Ge=[6,Et],W=0}finally{v=X=0}if(5&Ge[0])throw Ge[1];return{value:Ge[0]?Ge[1]:void 0,done:!0}}([Je,ut])}}}var ai=function(){function z(){}return z.addKey=function(s){z.key=s},Object.defineProperty(z,"isLicensed",{get:function(){return!!z.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(z.key)},enumerable:!1,configurable:!0}),z}(),vt=function(){function z(){}return z.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},z.setAttributes=function(s,v){for(var W=0,X=v;W<X.length;W++){var H=X[W],ve=H[0],He=H[1];s.setAttribute(ve,He)}},z.createRect=function(s,v,W){var X=document.createElementNS("http://www.w3.org/2000/svg","rect");return X.setAttribute("width",s.toString()),X.setAttribute("height",v.toString()),W&&z.setAttributes(X,W),X},z.createLine=function(s,v,W,X,H){var ve=document.createElementNS("http://www.w3.org/2000/svg","line");return ve.setAttribute("x1",s.toString()),ve.setAttribute("y1",v.toString()),ve.setAttribute("x2",W.toString()),ve.setAttribute("y2",X.toString()),H&&z.setAttributes(ve,H),ve},z.createPolygon=function(s,v){var W=document.createElementNS("http://www.w3.org/2000/svg","polygon");return W.setAttribute("points",s),v&&z.setAttributes(W,v),W},z.createCircle=function(s,v){var W=document.createElementNS("http://www.w3.org/2000/svg","circle");return W.setAttribute("cx",(s/2).toString()),W.setAttribute("cy",(s/2).toString()),W.setAttribute("r",s.toString()),v&&z.setAttributes(W,v),W},z.createEllipse=function(s,v,W){var X=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return X.setAttribute("cx",(s/2).toString()),X.setAttribute("cy",(v/2).toString()),X.setAttribute("rx",(s/2).toString()),X.setAttribute("ry",(v/2).toString()),W&&z.setAttributes(X,W),X},z.createGroup=function(s){var v=document.createElementNS("http://www.w3.org/2000/svg","g");return s&&z.setAttributes(v,s),v},z.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},z.createMarker=function(s,v,W,X,H,ve,He){var Je=document.createElementNS("http://www.w3.org/2000/svg","marker");return z.setAttributes(Je,[["id",s],["orient",v],["markerWidth",W.toString()],["markerHeight",X.toString()],["refX",H.toString()],["refY",ve.toString()]]),Je.appendChild(He),Je},z.createText=function(s){var v=document.createElementNS("http://www.w3.org/2000/svg","text");return v.setAttribute("x","0"),v.setAttribute("y","0"),s&&z.setAttributes(v,s),v},z.createTSpan=function(s,v){var W=document.createElementNS("http://www.w3.org/2000/svg","tspan");return W.textContent=s,v&&z.setAttributes(W,v),W},z.createImage=function(s){var v=document.createElementNS("http://www.w3.org/2000/svg","image");return s&&z.setAttributes(v,s),v},z.createPoint=function(s,v){var W=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return W.x=s,W.y=v,W},z.createPath=function(s,v){var W=document.createElementNS("http://www.w3.org/2000/svg","path");return W.setAttribute("d",s),v&&z.setAttributes(W,v),W},z.createElement=function(s,v){var W=document.createElementNS("http://www.w3.org/2000/svg",s);return v&&z.setAttributes(W,v),W},z.getHollowRectanglePath=function(s,v,W,X,H,ve,He,Je){return"M"+s+","+v+"V"+(v+X)+"H"+(s+W)+"V"+v+"H"+H+"V"+ve+"H"+(H+He)+"V"+(ve+Je)+"H"+H+"V"+v+"Z"},z}(),Vr=function(){function z(s){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+s+"_"}return Object.defineProperty(z.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(z.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(z.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),z.prototype.addClass=function(s){return this.styleSheet===void 0&&this.addStyleSheet(),s.name=""+this.classNamePrefix+s.localName,this.classes.push(s),this.styleSheet.sheet.insertRule("."+s.name+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length),s},z.prototype.addRule=function(s){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(s),this.styleSheet.sheet.insertRule(s.selector+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length)},z.prototype.addStyleSheet=function(){var s;this.styleSheet=document.createElement("style"),((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).appendChild(this.styleSheet),this.addRule(new nr("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new nr("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new nr("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new cr("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new cr("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},z.prototype.removeStyleSheet=function(){var s;this.styleSheet&&(((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},z}(),nr=function(z,s){this.selector=z,this.style=s},cr=function(z,s){this.localName=z,this.style=s},Hr=function(){function z(){this.blocks=[],this.display=""}return z.prototype.addButtonBlock=function(s){s.className=this.blockClassName,s.buttonClassName=this.buttonClassName,s.buttonColorsClassName=this.buttonColorsClassName,s.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(s)},z.prototype.addElementBlock=function(s){s.className===void 0&&(s.className=this.blockClassName),this.blocks.push(s)},z.prototype.getUI=function(){var s=document.createElement("div");return s.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,s.style.display=this.display,this.blocks.forEach(function(v){return s.appendChild(v.getUI())}),s},z}(),oi=function(){function z(){}return z.prototype.getUI=function(){var s=document.createElement("div");if(s.className=this.className,this.minWidth!==void 0&&(s.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":s.style.justifyContent="flex-start";break;case"center":s.style.justifyContent="center";break;case"end":s.style.justifyContent="flex-end"}return s.style.whiteSpace="nowrap",s},z}(),si=function(z){function s(){var v=z!==null&&z.apply(this,arguments)||this;return v.buttons=[],v}return Wt(s,z),s.prototype.addButton=function(v){v.className=this.buttonClassName,v.colorsClassName=this.buttonColorsClassName,v.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(v)},s.prototype.getUI=function(){var v=z.prototype.getUI.call(this);return this.buttons.forEach(function(W){return v.appendChild(W.getUI())}),v},s}(oi),Pt=function(){function z(s,v){this._isActive=!1,this._isHidden=!1,this._icon=s,this.title=v,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(z.prototype,"icon",{get:function(){return this._icon},set:function(s){this._icon=s,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isActive",{get:function(){return this._isActive},set:function(s){this._isActive=s,this.adjustClassName()},enumerable:!1,configurable:!0}),z.prototype.getUI=function(){var s=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 s.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},z.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,"")))},z.prototype.hide=function(){this._isHidden=!0},z}(),pt=function(z){function s(){var v=z!==null&&z.apply(this,arguments)||this;return v.elements=[],v}return Wt(s,z),s.prototype.addElement=function(v){this.elements.push(v)},s.prototype.getUI=function(){var v=z.prototype.getUI.call(this);return this.elements.forEach(function(W){return v.appendChild(W)}),v},s}(oi),Pr=function(){function z(s,v){this.horizontal=s,this.vertical=v}return Object.defineProperty(z.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),z.prototype.getVerticalLength=function(s){return s/this.ratio},z.prototype.getHorizontalLength=function(s){return s*this.ratio},z}(),li=function(){function z(){}return z.getIcon=function(s,v){if(s>0&&v>0){var W=new Pr(s,v),X=W.ratio>=1?20:W.getHorizontalLength(20),H=W.ratio<1?20:W.getVerticalLength(20),ve=document.createElementNS("http://www.w3.org/2000/svg","svg");ve.setAttribute("xmlns","http://www.w3.org/2000/svg"),ve.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ve);var He=vt.createDefs();ve.appendChild(He);var Je=vt.createElement("clipPath",[["id","text-bg-clip"]]);He.appendChild(Je);var ut=vt.createPath(vt.getHollowRectanglePath((24-X)/2,(24-H)/2,X,H,(24-X)/2+2,(24-H)/2+2,X-4,H-4));ve.appendChild(ut);var Ge=vt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ge.appendChild(vt.createTSpan(s+":"+v)),ve.appendChild(Ge);var Et=Ge.getBBox();vt.setAttributes(Ge,[["x",((24-Et.width)/2).toString()],["y",((24-Et.height)/2-Et.y).toString()]]);var Dt=vt.createPath(vt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Et.width))/2,(24-Math.ceil(Et.height))/2,Math.ceil(Et.width),Math.ceil(Et.height)));return Je.appendChild(Dt),vt.setAttributes(ut,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ve),ve.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>'},z}(),xr=function(z){function s(v,W,X){var H=z.call(this,v,W)||this;return H.isDropdownOpen=!1,H.onClick=H.dropdownButtonClicked,H.dropdownButtons=X,H}return Wt(s,z),s.prototype.setupDropdown=function(){var v=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(W){W.className=v.className,W.colorsClassName=v.colorsClassName,v.dropdownBlock.appendChild(W.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},s.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},s.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},s.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},s.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},s.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},s}(Pt),Lt=function(){function z(s,v){this.GRIP_SIZE=10,this.color=s,this.fillColor=v,this.visual=vt.createGroup(),this.visual.appendChild(vt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(vt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return z.prototype.ownsTarget=function(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},z.prototype.setCenter=function(s,v){this.visual.childNodes.forEach(function(W){return vt.setAttributes(W,[["cx",s.toString()],["cy",v.toString()]])})},z}(),Mr=function(){function z(s,v,W,X){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=s,this.canvasHeight=v,this.margin=W,this.container=X,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(z.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(s){this._aspectRatio=s,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(s){this._isGridVisible=s,this.gridContainer&&vt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(s){this._zoomFactor=s,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),z.prototype.open=function(){var s=this;this.cropShadeElement=vt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=vt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var v=0;v<this.numberOfGridLines;v++)this.horizontalGridLines.push(vt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(vt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(W){return s.gridContainer.appendChild(W)}),this.verticalGridLines.forEach(function(W){return s.gridContainer.appendChild(W)}),this.cropRectElement=vt.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Lt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Lt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Lt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Lt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},z.prototype.setCropRectangle=function(s){this.cropRect=s;var v=Object.assign({},this.cropRect);this.zoomFactor!==1&&(v.width=this.cropRect.width*this.zoomFactor,v.height=this.cropRect.height*this.zoomFactor,v.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-v.width/2,v.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-v.height/2),vt.setAttributes(this.cropRectElement,[["x",v.x.toString()],["y",v.y.toString()],["width",v.width.toString()],["height",v.height.toString()]]);var W=v.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(H,ve){var He=v.y+W*(ve+1);vt.setAttributes(H,[["x1",""+v.x],["y1",""+He],["x2",""+(v.x+v.width)],["y2",""+He]])});var X=v.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(H,ve){var He=v.x+X*(ve+1);vt.setAttributes(H,[["x1",""+He],["y1",""+v.y],["x2",""+He],["y2",""+(v.y+v.height)]])}),vt.setAttributes(this.cropShadeElement,[["d",vt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,v.x,v.y,v.width,v.height)]]),this.topLeftGrip.setCenter(v.x,v.y),this.topRightGrip.setCenter(v.x+v.width,v.y),this.bottomLeftGrip.setCenter(v.x,v.y+v.height),this.bottomRightGrip.setCenter(v.x+v.width,v.y+v.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},z.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)},z.prototype.clientToLocalCoordinates=function(s,v){var W=this.container.getBoundingClientRect();return{x:s-W.left+this.margin,y:v-W.top+this.margin}},z.prototype.onPointerDown=function(s){this.container.setPointerCapture(s.pointerId),this.previousPoint=this.clientToLocalCoordinates(s.clientX,s.clientY),this.cropRectElement===s.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(s.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(s.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(s.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(s.target)&&(this.activeGrip=this.bottomRightGrip)},z.prototype.onPointerMove=function(s){if(this.isMoving)this.move(this.clientToLocalCoordinates(s.clientX,s.clientY));else if(this.activeGrip){var v=this.clientToLocalCoordinates(s.clientX,s.clientY);this.resize(v)}s.preventDefault()},z.prototype.onPointerUp=function(s){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(s.pointerId)},z.prototype.move=function(s){var v=s.x-this.previousPoint.x,W=s.y-this.previousPoint.y;this.zoomFactor!==1&&(v=-v/this.zoomFactor,W=-W/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+v),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+W),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=s},z.prototype.resize=function(s){var v=Object.assign({},this.cropRect),W=s.x-this.previousPoint.x,X=s.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:v.x+W<this.margin&&(W=this.margin-v.x),v.x+=W,v.width=this.cropRect.x+this.cropRect.width-v.x;break;case this.bottomRightGrip:case this.topRightGrip:v.width+W>this.canvasWidth*this.zoomFactor&&(W=this.canvasWidth*this.zoomFactor-v.width),v.width+=W}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(v.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(W),v.height=this.aspectRatio.getVerticalLength(v.width)):(v.y+=X,v.height=this.cropRect.y+this.cropRect.height-v.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?v.height=this.aspectRatio.getVerticalLength(v.width):v.height+=X}v.width<10&&(v.x=this.cropRect.x,v.width=10),v.height<10&&(v.y=this.cropRect.y,v.height=10),this.previousPoint=s,v.x>=this.margin&&v.y>=this.margin&&v.x-this.margin+v.width<=this.canvasWidth&&v.y-this.margin+v.height<=this.canvasHeight&&(this.cropRect=v,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},z.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var s=this.cropRect.x+this.cropRect.width/2,v=this.cropRect.y+this.cropRect.height/2,W=this.aspectRatio.getHorizontalLength(this.cropRect.height),X=this.aspectRatio.getVerticalLength(this.cropRect.width);W/this.canvasWidth<X/this.canvasHeight?this.cropRect.width=W:this.cropRect.height=X,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=s-this.cropRect.width/2,this.cropRect.y=v-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)}},z.prototype.getRescaledRect=function(s,v,W,X,H,ve){var He=W/s,Je=X/v;return{x:(H.x-ve)*He+ve,y:(H.y-ve)*Je+ve,width:H.width*He,height:H.height*Je}},z.prototype.scaleCanvas=function(s,v){var W=this.getRescaledRect(this.canvasWidth,this.canvasHeight,s,v,this.cropRect,this.margin);this.canvasWidth=s,this.canvasHeight=v,this.onCropChange&&this.onCropChange(W),this.setCropRectangle(W)},z}(),Xr=function(){function z(s){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=s,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(z.prototype,"angle",{get:function(){return this._angle},set:function(s){this._angle=s,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),z.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},z.prototype.onPointerDown=function(s){this.controlContainer.setPointerCapture(s.pointerId),this.isDragging=!0,this.previousPoint={x:s.clientX,y:s.clientY}},z.prototype.onPointerMove=function(s){this.isDragging&&(this.onAngleChange&&this.onAngleChange((s.clientX-this.previousPoint.x)/5),this.previousPoint.x=s.clientX)},z.prototype.onPointerUp=function(s){this.isDragging&&this.onAngleChange&&this.onAngleChange((s.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(s.pointerId)},z.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var s=this.angleLabelText.getBBox();vt.setAttributes(this.angleLabelElement,[["x",((this.width-s.width)/2).toString()],["y",(this.height/2).toString()]])}},z.prototype.positionScaleShape=function(){if(this.scaleShape){var s=this.scaleShape.transform.baseVal.getItem(0);s.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(s,0)}},z.prototype.getVisual=function(){var s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("width",this.width+"px"),s.setAttribute("height",this.height+"px"),s.setAttribute("viewBox","0 0 "+this.width+" "+this.height),s.style.flexShrink="0",document.body.appendChild(s);for(var v="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,W=1;W<=this.width/5+10;W++){var X=W%5==0?this.height/3:this.height/6;v+="h4v"+-X+"h1v"+X}v+="v1H0Z",this.scaleShape=vt.createPath(v);var H=vt.createTransform();this.scaleShape.transform.baseVal.appendItem(H),s.appendChild(this.scaleShape),this.angleLabelElement=vt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=vt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ve=vt.createTSpan("");return ve.innerHTML="&deg;",this.angleLabelElement.appendChild(ve),s.appendChild(this.angleLabelElement),document.body.removeChild(s),s},z}(),ui=function(){function z(){this.naturalSize=!1,this.imageType="image/png"}return z.prototype.rasterize=function(s,v,W,X,H,ve,He){var Je=this;return new Promise(function(ut){var Ge=document.createElement("canvas");Ge.width=s.width.baseVal.value-2*X,Ge.height=s.height.baseVal.value-2*X;var Et=1,Dt=1;Je.naturalSize===!0?(Et=v.naturalWidth/(s.width.baseVal.value-2*X)/ve,Dt=v.naturalHeight/(s.height.baseVal.value-2*X)/He,Ge.width=v.naturalWidth/ve,Ge.height=v.naturalHeight/He):Je.width!==void 0&&Je.height!==void 0&&(Et=Je.width/W.width,Dt=Je.height/W.height,Ge.width*=Et,Ge.height*=Dt);var Vt=Ge.getContext("2d");Vt.translate(Ge.width/2,Ge.height/2),Vt.rotate(H*Math.PI/180),Vt.scale(ve,He),Vt.translate(-Ge.width/2,-Ge.height/2),Vt.drawImage(v,0,0,Ge.width,Ge.height);var Ir=document.createElement("canvas");Ir.width=W.width*Et,Ir.height=W.height*Dt,Ir.getContext("2d").putImageData(Vt.getImageData((W.x-X)*Et,(W.y-X)*Dt,W.width*Et,W.height*Dt),0,0),ut(Ir.toDataURL(Je.imageType,Je.imageQuality))})},z}(),Ve=function(){function z(s){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=z.instanceCounter++,this.styles=new Vr(this.instanceNo),this.target=s,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(z.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(s){this._zoomToCropEnabled=s,s?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(s){this._isGridVisible=s,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"gridLines",{get:function(){return this._gridLines},set:function(s){this._gridLines=s,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(s){this._rotationAngle=s,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"aspectRatio",{get:function(){var s;return(s=this._aspectRatio)!==null&&s!==void 0?s:this.aspectRatios[0]},set:function(s){this._aspectRatio=s},enumerable:!1,configurable:!0}),z.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},z.prototype.show=function(){this.showUI(),this.open()},z.prototype.close=function(s){s===void 0&&(s=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),s||this.closeEventListeners.forEach(function(v){return v()}),this._isOpen=!1)},z.prototype.addRenderEventListener=function(s){this.renderEventListeners.push(s)},z.prototype.removeRenderEventListener=function(s){this.renderEventListeners.indexOf(s)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(s),1)},z.prototype.addCloseEventListener=function(s){this.closeEventListeners.push(s)},z.prototype.removeCloseEventListener=function(s){this.closeEventListeners.indexOf(s)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(s),1)},z.prototype.setupResizeObserver=function(){var s=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){s.resize(s.target.clientWidth,s.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))},z.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var s=1*this.target.clientWidth/this.target.clientHeight,v=this.contentDiv.clientWidth/s>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*s:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,W=v+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/s;this.resize(v,W)}},z.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},z.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",vt.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},z.prototype.resize=function(s,v){this.imageWidth=Math.round(s),this.imageHeight=Math.round(v),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()},z.prototype.setEditingTarget=function(){var s=document.createElement("canvas");s.width=this.target.naturalWidth,s.height=this.target.naturalHeight,s.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var v=s.toDataURL();vt.setAttributes(this.editingTarget,[["href",v]]),this.setEditingTargetSize()},z.prototype.setTopLeft=function(){var s=this.target.getBoundingClientRect(),v=this.editorCanvas.getBoundingClientRect();this.left=s.left-v.left-this.CANVAS_MARGIN,this.top=s.top-v.top-this.CANVAS_MARGIN},z.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=vt.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=vt.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=vt.createGroup(),this.editingTargetRotationScaleContainer=vt.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var s=vt.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(s);var v=vt.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(v),this.editingTargetContainer=vt.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)},z.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},z.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=vt.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Mr(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()},z.prototype.zoomToCrop=function(){if(this.cropRect){var s=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,v=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=s+"px "+v+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-s+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-v+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},z.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)},z.prototype.cropRectChanged=function(s){this.cropRect=s,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},z.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},z.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"},z.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},z.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 s=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,v=this.target.offsetTop>s+this.CANVAS_MARGIN?this.target.offsetTop-(s+this.CANVAS_MARGIN):0;this.coverDiv.style.top=v+"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},z.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},z.prototype.addTopToolbar=function(){var s=this;this.topToolbar=new Hr,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 v=new si;v.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(v);var W=[];this.aspectRatios.forEach(function(Dt){var Vt=new Pt(li.getIcon(Dt.horizontal,Dt.vertical),Dt.horizontal===0&&Dt.vertical===0?"FREE":Dt.horizontal+":"+Dt.vertical);Vt.onClick=function(){return s.ratioButtonClicked(Dt)},W.push(Vt)}),this.aspectRatioButton=new xr(li.getIcon(0,0),"Aspect ratio",W),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,v.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var X=new Pt('<svg viewBox="0 0 24 24"><path d="M10 4v4h4V4h-4m6 0v4h4V4h-4m0 6v4h4v-4h-4m0 6v4h4v-4h-4m-2 4v-4h-4v4h4m-6 0v-4H4v4h4m0-6v-4H4v4h4m0-6V4H4v4h4m2 6h4v-4h-4v4M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4c-1.08 0-2-.9-2-2V4a2 2 0 012-2z"/></svg>',"Toggle grid");X.isActive=this.isGridVisible,X.onClick=function(){s.isGridVisible=!s.isGridVisible,X.isActive=s.isGridVisible},v.addButton(X);var H=new Pt('<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(H.isActive=this.zoomToCropEnabled,H.onClick=function(){s.zoomToCropEnabled=!s.zoomToCropEnabled,H.isActive=s.zoomToCropEnabled},v.addButton(H),!ai.isLicensed){var ve=new pt;this.topToolbar.addElementBlock(ve);var He=document.createElement("div");He.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var Je=document.createElement("a");Je.style.color="currentColor",Je.href="https://markerjs.com/products/cropro",Je.target="_blank",Je.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>',He.appendChild(Je),ve.addElement(He)}var ut=new si;ut.minWidth=3*this.toolbarHeight+"px",ut.contentAlign="end",this.topToolbar.addButtonBlock(ut);var Ge=new Pt('<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");Ge.onClick=this.startRenderAndClose,ut.addButton(Ge),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ge.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Et=new Pt('<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");Et.onClick=this.close,ut.addButton(Et),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Et.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},z.prototype.addBottomToolbar=function(){var s=this;this.bottomToolbar=new Hr,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 v=new si;v.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(v);var W=new Pt('<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");W.onClick=this.rotateLeftButtonClicked,v.addButton(W);var X=new Pt('<svg viewBox="0 0 24 24"><path d="M16.89 15.5l1.42 1.39c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.5M13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03m6.93-6.9a7.906 7.906 0 00-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47m-2.36-5.45L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45z"/></svg>',"Rotate right");X.onClick=this.rotateRightButtonClicked,v.addButton(X);var H=new pt;H.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(H),this.straightener=new Xr("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(ut){s.rotateBy(ut),s.straightener.angle=s.rotationAngle},H.addElement(this.straightener.getUI());var ve=new si;ve.minWidth=2*this.toolbarHeight+"px",ve.contentAlign="end",this.bottomToolbar.addButtonBlock(ve);var He=new Pt('<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");He.onClick=this.flipHorizontallyButtonClicked,ve.addButton(He);var Je=new Pt('<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");Je.onClick=this.flipVerticallyButtonClicked,ve.addButton(Je)},z.prototype.ratioButtonClicked=function(s){this.aspectRatio=s,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},z.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=li.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},z.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Pr(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},z.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},z.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},z.prototype.restoreState=function(s){if(s){var v=this.cropLayer.getRescaledRect(s.width,s.height,this.imageWidth,this.imageHeight,s.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(v),this.cropRectChanged(v),this.flippedHorizontally=s.flippedHorizontally,this.flippedVertically=s.flippedVertically,this.applyFlip(),this.rotationAngle=s.rotationAngle,this.applyRotation()}},z.prototype.clientToLocalCoordinates=function(s,v){var W=this.cropImage.getBoundingClientRect();return{x:s-W.left,y:v-W.top}},z.prototype.onWindowResize=function(){this.positionUI()},z.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var s=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=s+"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()},z.prototype.rotateLeftButtonClicked=function(){var s=this.rotationAngle-90;this.rotationAngle%90!=0&&(s+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(s)},z.prototype.rotateRightButtonClicked=function(){var s=this.rotationAngle+90;this.rotationAngle%90!=0&&(s-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(s)},z.prototype.rotateTo=function(s){s=(s=s>180?s-360:s)<=-180?s+360:s,this.rotationAngle=s,this.applyRotation()},z.prototype.rotateBy=function(s){this.rotateTo((this.rotationAngle+s)%360)},z.prototype.applyRotation=function(){var s=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var v=this.editingTargetRotationContainer.transform.baseVal.getItem(0);v.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(v,0);var W=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/W.width,this.imageHeight/W.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=s},z.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},z.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},z.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},z.prototype.startRenderAndClose=function(){return _t(this,void 0,void 0,function(){var s,v;return Wr(this,function(W){switch(W.label){case 0:return[4,this.render()];case 1:return s=W.sent(),v=this.getState(),this.renderEventListeners.forEach(function(X){return X(s,v)}),this.close(!0),[2]}})})},z.prototype.render=function(){return _t(this,void 0,void 0,function(){var s;return Wr(this,function(v){switch(v.label){case 0:return(s=new ui).naturalSize=this.renderAtNaturalSize,s.imageType=this.renderImageType,s.imageQuality=this.renderImageQuality,s.width=this.renderWidth,s.height=this.renderHeight,this.unzoomFromCrop(),vt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,s.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 v.sent(),[4,s.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,v.sent()]}})})},z.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new cr("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 cr("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new cr("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var s=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new cr("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*s)+`px;
height: `+(this.toolbarHeight-2*s)+`px;
padding: `+s+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new cr("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new cr("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new nr("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new nr("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new cr("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 cr("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new cr("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 cr("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*s)+`px;
padding: `+s+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new cr("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},z.instanceCounter=0,z}(),Ct=ie("8hTe"),hi=ie.n(Ct),_i=/<pre[^>]*>/g;function di(z){var s=document.createElement("div");return s.innerHTML=z,s.childNodes.length===0?"":s.childNodes[0].nodeValue}var Li=Qe.a=function(z){var s=z.value,v=s===void 0?"":s,W=z.edit,X=W===void 0?!1:W,H=z.className,ve=z.showTextOnly,He=z.showLines,Je=z.replaces,ut=z.zoomImg,Ge=z.hasMask,Et=z.style,Dt=Et===void 0?{}:Et,Vt=z.stylesPrev,Ir=Vt===void 0?{}:Vt,Nr=String(v),ar=Object(k.useRef)(),Gr=Object(k.useRef)(),Hi=Object(k.useState)(""),Er=Object(G.a)(Hi,2),Br=Er[0],kr=Er[1],gi=Object(k.useState)("office"),Yr=Object(G.a)(gi,2),ci=Yr[0],ei=Yr[1],dn=function(){var Nt=new Ve(Gr.current);Nt.displayMode="popup",Nt.addRenderEventListener(function(){var fr=Object(P.a)(I.a.mark(function Mt(er){var Ft;return I.a.wrap(function(Qt){for(;;)switch(Qt.prev=Qt.next){case 0:return ar.current.style.display="none",Qt.next=3,Object(ke.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:er}});case 3:Ft=Qt.sent,Ft!=null&&Ft.id&&Je(Gr.current.getAttribute("src").replace(ee.a.API_SERVER,""),"/api/attachments/".concat(Ft==null?void 0:Ft.id,"?type=").concat(Ft.content_type));case 5:case"end":return Qt.stop()}},Mt)}));return function(Mt){return fr.apply(this,arguments)}}()),Nt.show()},Gi=function(){var Nt=new It(Gr.current);Nt.settings.displayMode="popup",Nt.addEventListener("render",function(){var fr=Object(P.a)(I.a.mark(function Mt(er){var Ft;return I.a.wrap(function(Qt){for(;;)switch(Qt.prev=Qt.next){case 0:if(ar.current.style.display="none",!Gr.current){Qt.next=6;break}return Qt.next=4,Object(ke.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:er.dataUrl}});case 4:Ft=Qt.sent,Ft!=null&&Ft.id&&Je(Gr.current.getAttribute("src").replace(ee.a.API_SERVER,""),"/api/attachments/".concat(Ft==null?void 0:Ft.id,"?type=").concat(Ft.content_type));case 6:case"end":return Qt.stop()}},Mt)}));return function(Mt){return fr.apply(this,arguments)}}()),Nt.show(),window.markerArea=Nt},$r=Object(k.useMemo)(function(){try{var Zt=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Nt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,fr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Nr=Nr.replace(Zt,"("+ee.a.API_SERVER+"/api/attachments/").replace(Nt,'"'+ee.a.API_SERVER+"/api/attachments/").replace(fr,'"'+ee.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,`
`),Nr=Nr.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
`)}catch(ti){}var Mt=V(Nr),er=x();if(Nr.match(/\[TOC\]/)&&(Mt=Mt.replace("<p>[TOC]</p>",L()),w()),Mt=Mt.replace(/(__special_katext_id_\d+__)/g,function(ti,Qt){var Sr=er[Qt],zi=Sr.type,Ki=Sr.expression;return Object(oe.renderToString)(di(Ki)||"",{displayMode:zi==="block",throwOnError:!1,output:"html"})}),Mt=Mt.replace(/▁/g,"\u2581\u2581\u2581"),b(),ve){var Ft=document.createElement("div");return Ft.innerHTML=Mt,Ft.innerText}return setTimeout(function(){return Di()},500),Mt},[Nr]),Ur=Object(k.useRef)();p.WebkitLineClamp=He,He&&(Dt=Object(B.a)(Object(B.a)({},Dt),p));function ki(Zt){var Nt=Zt.target;if(Nt.tagName.toUpperCase()==="IMG"){if(ut){var fr=Nt.getAttribute("src");kr(fr),ei("image")}}else if(Nt.tagName.toUpperCase()==="A"){var Mt=Nt.getAttribute("href");if(Mt.indexOf("office")>-1)Zt.preventDefault(),kr(Mt),ei("office");else if(Mt.indexOf("application/pdf")>-1)Zt.preventDefault(),kr(Mt),ei("pdf");else if(Mt.indexOf("type=text")>-1)Zt.preventDefault(),kr(Mt),ei("html");else if(Mt.startsWith("#")){Zt.preventDefault();var er=document.getElementById(Mt.replace("#",""));er&&er.scrollIntoView(!0)}}}var Di=function(){var Nt,fr=(Nt=Ur.current)===null||Nt===void 0?void 0:Nt.querySelectorAll("video");fr==null||fr.forEach(function(Mt){if(Mt.oncontextmenu=function(){return!1},Mt.src.indexOf(".m3u8")>-1&&!Mt.canPlayType("application/vnd.apple.mpegurl")){if($.a.isSupported()){var er=new $.a;er.loadSource(Mt.src),er.attachMedia(Mt)}}})};Object(k.useEffect)(function(){if(Ur.current&&$r&&($r.match(_i)&&window.PR.prettyPrint()),Ur.current)return Ur.current.addEventListener("click",ki),function(){Ur.current.removeEventListener("click",ki),b(),w()}},[$r,Ur.current,ki]);var cn=function(Nt){if(!X)return;Nt.target.nodeName==="IMG"?(ar.current.style.display="flex",ar.current.style.width=Nt.target.clientWidth+"px",ar.current.style.height=Nt.target.clientHeight+"px",ar.current.style.top=Nt.target.offsetTop+"px",ar.current.style.left=Nt.target.offsetLeft+"px",Gr.current.src=Nt.target.getAttribute("src")):ar.current.style.display="none"};return y.a.createElement("div",{style:{position:"relative"}},y.a.createElement("div",{ref:Ur,style:Object(B.a)({},Dt),className:"".concat(H||""," markdown-body ").concat(hi.a.mdBody),onMouseOver:cn,dangerouslySetInnerHTML:{__html:$r}}),y.a.createElement("div",{ref:ar,className:hi.a.button},y.a.createElement(Q.a,null,y.a.createElement(Z.a,{onClick:function(){return dn()}},"\u88C1\u526A"),y.a.createElement(Z.a,{onClick:function(){return Gi()}},"\u7F16\u8F91"))),y.a.createElement("img",{ref:Gr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),y.a.createElement(fe.a,{close:!0,data:Br,hasMask:Ge,type:Br!=null&&Br.length?ci:"",style:Object(B.a)({},Ir),onClose:function(){return kr("")}}))}},"9VGf":function(bt,Qe,ie){"use strict";ie.d(Qe,"a",function(){return D});var le=ie("q1tI"),Q=ie.n(le);function D(Z,B){var P=Object(le.useRef)();Object(le.useEffect)(function(){P.current=Z}),Object(le.useEffect)(function(){function G(){P.current()}if(B!==null){var j=setInterval(G,B);return function(){return clearInterval(j)}}},[B])}},BU3w:function(bt,Qe,ie){"use strict";ie.d(Qe,"a",function(){return P});var le=ie("MNnm"),Q="rc-util-key";function D(G){if(G.attachTo)return G.attachTo;var j=document.querySelector("head");return j||document.body}function Z(G){var j,I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(le.a)())return null;var k=document.createElement("style");if((j=I.csp)===null||j===void 0?void 0:j.nonce){var y;k.nonce=(y=I.csp)===null||y===void 0?void 0:y.nonce}k.innerHTML=G;var A=D(I),O=A.firstChild;return I.prepend&&A.prepend?A.prepend(k):I.prepend&&O?A.insertBefore(k,O):A.appendChild(k),k}var B=new Map;function P(G,j){var I=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},k=D(I);if(!B.has(k)){var y=Z("",I),A=y.parentNode;B.set(k,A),A.removeChild(y)}var O=Array.from(B.get(k).children).find(function(o){return o.tagName==="STYLE"&&o[Q]===j});if(O){var _,C;if(((_=I.csp)===null||_===void 0?void 0:_.nonce)&&O.nonce!==((C=I.csp)===null||C===void 0?void 0:C.nonce)){var S;O.nonce=(S=I.csp)===null||S===void 0?void 0:S.nonce}return O.innerHTML!==G&&(O.innerHTML=G),O}var d=Z(G,I);return d[Q]=j,d}},Bd2K:function(bt,Qe,ie){(function(le){le(ie("VrN/"),ie("osHv"))})(function(le){le.defineOption("autoCloseTags",!1,function(I,k,y){if(y!=le.Init&&y&&I.removeKeyMap("autoCloseTags"),!k)return;var A={name:"autoCloseTags"};(typeof k!="object"||k.whenClosing!==!1)&&(A["'/'"]=function(O){return P(O)}),(typeof k!="object"||k.whenOpening!==!1)&&(A["'>'"]=function(O){return Z(O)}),I.addKeyMap(A)});var Q=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],D=["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 Z(I){if(I.getOption("disableInput"))return le.Pass;for(var k=I.listSelections(),y=[],A=I.getOption("autoCloseTags"),O=0;O<k.length;O++){if(!k[O].empty())return le.Pass;var _=k[O].head,C=I.getTokenAt(_),S=le.innerMode(I.getMode(),C.state),d=S.state,o=S.mode.xmlCurrentTag&&S.mode.xmlCurrentTag(d),l=o&&o.name;if(!l)return le.Pass;var h=S.mode.configuration=="html",w=typeof A=="object"&&A.dontCloseTags||h&&Q,p=typeof A=="object"&&A.indentTags||h&&D;C.end>_.ch&&(l=l.slice(0,l.length-C.end+_.ch));var f=l.toLowerCase();if(!l||C.type=="string"&&(C.end!=_.ch||!/[\"\']/.test(C.string.charAt(C.string.length-1))||C.string.length==1)||C.type=="tag"&&o.close||C.string.indexOf("/")==_.ch-C.start-1||w&&G(w,f)>-1||j(I,S.mode.xmlCurrentContext&&S.mode.xmlCurrentContext(d)||[],l,_,!0))return le.Pass;var L=typeof A=="object"&&A.emptyTags;if(L&&G(L,l)>-1){y[O]={text:"/>",newPos:le.Pos(_.line,_.ch+2)};continue}var g=p&&G(p,f)>-1;y[O]={indent:g,text:">"+(g?`
`:"")+"</"+l+">",newPos:g?le.Pos(_.line+1,0):le.Pos(_.line,_.ch+1)}}for(var m=typeof A=="object"&&A.dontIndentOnAutoClose,O=k.length-1;O>=0;O--){var c=y[O];I.replaceRange(c.text,k[O].head,k[O].anchor,"+insert");var u=I.listSelections().slice(0);u[O]={head:c.newPos,anchor:c.newPos},I.setSelections(u),!m&&c.indent&&(I.indentLine(c.newPos.line,null,!0),I.indentLine(c.newPos.line+1,null,!0))}}function B(I,k){for(var y=I.listSelections(),A=[],O=k?"/":"</",_=I.getOption("autoCloseTags"),C=typeof _=="object"&&_.dontIndentOnSlash,S=0;S<y.length;S++){if(!y[S].empty())return le.Pass;var d=y[S].head,o=I.getTokenAt(d),l=le.innerMode(I.getMode(),o.state),h=l.state;if(k&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=d.ch-1))return le.Pass;var w,p=l.mode.name!="xml"&&I.getMode().name=="htmlmixed";if(p&&l.mode.name=="javascript")w=O+"script";else if(p&&l.mode.name=="css")w=O+"style";else{var f=l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(h);if(!f||f.length&&j(I,f,f[f.length-1],d))return le.Pass;w=O+f[f.length-1]}I.getLine(d.line).charAt(o.end)!=">"&&(w+=">"),A[S]=w}if(I.replaceSelections(A),y=I.listSelections(),!C)for(var S=0;S<y.length;S++)(S==y.length-1||y[S].head.line<y[S+1].head.line)&&I.indentLine(y[S].head.line)}function P(I){return I.getOption("disableInput")?le.Pass:B(I,!0)}le.commands.closeTag=function(I){return B(I)};function G(I,k){if(I.indexOf)return I.indexOf(k);for(var y=0,A=I.length;y<A;++y)if(I[y]==k)return y;return-1}function j(I,k,y,A,O){if(!le.scanForClosingTag)return!1;var _=Math.min(I.lastLine()+1,A.line+500),C=le.scanForClosingTag(I,A,null,_);if(!C||C.tag!=y)return!1;for(var S=O?1:0,d=k.length-1;d>=0&&k[d]==y;d--)++S;A=C.to;for(var d=1;d<S;d++){var o=le.scanForClosingTag(I,A,null,_);if(!o||o.tag!=y)return!1;A=o.to}return!0}})},BjJ7:function(bt,Qe,ie){"use strict";ie.d(Qe,"d",function(){return Q}),ie.d(Qe,"c",function(){return D}),ie.d(Qe,"e",function(){return Z}),ie.d(Qe,"b",function(){return B}),ie.d(Qe,"a",function(){return G});var le=ie("m3rI");function Q(j){var I=!0;if(j.length>0){for(var k=0;k<j.length;k++)if(j[k].compile_success==0||!j[k].compile_success){I=!1;break}}else I=!1;return I}function D(j){for(var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",k=[],y=0;y<j.length;y++){var A=j[y],O=I?"".concat(I,"/").concat(A.name):"".concat(A.name);k.push({title:A.name,isLeaf:!(A.type==="tree"),key:O})}return k}function Z(j,I,k){for(var y=0;y<j.length;y++){var A=j[y];if(A.key===I){A.children=k;break}A.children&&Z(A.children,I,k)}return j}function B(j,I,k){var y;return function(){var A=this,O=arguments,_=function(){y=null,k||j.apply(A,O)},C=k&&!y;clearTimeout(y),y=setTimeout(_,I),C&&j.apply(A,O)}}var P=!0,G=le.a.API_SERVER},"C+DQ":function(bt,Qe,ie){},DlQD:function(bt,Qe,ie){(function(le,Q){bt.exports=Q()})(this,function(){"use strict";function le(xe,ge){for(var be=0;be<ge.length;be++){var re=ge[be];re.enumerable=re.enumerable||!1,re.configurable=!0,"value"in re&&(re.writable=!0),Object.defineProperty(xe,re.key,re)}}function Q(xe,ge,be){return ge&&le(xe.prototype,ge),be&&le(xe,be),xe}function D(xe,ge){if(!xe)return;if(typeof xe=="string")return Z(xe,ge);var be=Object.prototype.toString.call(xe).slice(8,-1);if(be==="Object"&&xe.constructor&&(be=xe.constructor.name),be==="Map"||be==="Set")return Array.from(xe);if(be==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(be))return Z(xe,ge)}function Z(xe,ge){(ge==null||ge>xe.length)&&(ge=xe.length);for(var be=0,re=new Array(ge);be<ge;be++)re[be]=xe[be];return re}function B(xe,ge){var be;if(typeof Symbol=="undefined"||xe[Symbol.iterator]==null){if(Array.isArray(xe)||(be=D(xe))||ge&&xe&&typeof xe.length=="number"){be&&(xe=be);var re=0;return function(){return re>=xe.length?{done:!0}:{done:!1,value:xe[re++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return be=xe[Symbol.iterator](),be.next.bind(be)}function P(xe,ge){return ge={exports:{}},xe(ge,ge.exports),ge.exports}var G=P(function(xe){function ge(){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 be(re){xe.exports.defaults=re}xe.exports={defaults:ge(),getDefaults:ge,changeDefaults:be}}),j=G.defaults,I=G.getDefaults,k=G.changeDefaults,y=/[&<>"']/,A=/[&<>"']/g,O=/[<>"']|&(?!#?\w+;)/,_=/[<>"']|&(?!#?\w+;)/g,C={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},S=function(ge){return C[ge]};function d(xe,ge){if(ge){if(y.test(xe))return xe.replace(A,S)}else if(O.test(xe))return xe.replace(_,S);return xe}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(xe){return xe.replace(o,function(ge,be){return be=be.toLowerCase(),be==="colon"?":":be.charAt(0)==="#"?be.charAt(1)==="x"?String.fromCharCode(parseInt(be.substring(2),16)):String.fromCharCode(+be.substring(1)):""})}var h=/(^|[^\[])\^/g;function w(xe,ge){xe=xe.source||xe,ge=ge||"";var be={replace:function(ne,se){return se=se.source||se,se=se.replace(h,"$1"),xe=xe.replace(ne,se),be},getRegex:function(){return new RegExp(xe,ge)}};return be}var p=/[^\w:]/g,f=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function L(xe,ge,be){if(xe){var re;try{re=decodeURIComponent(l(be)).replace(p,"").toLowerCase()}catch(ne){return null}if(re.indexOf("javascript:")===0||re.indexOf("vbscript:")===0||re.indexOf("data:")===0)return null}ge&&!f.test(be)&&(be=a(ge,be));try{be=encodeURI(be).replace(/%25/g,"%")}catch(ne){return null}return be}var g={},m=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(xe,ge){g[" "+xe]||(m.test(xe)?g[" "+xe]=xe+"/":g[" "+xe]=N(xe,"/",!0)),xe=g[" "+xe];var be=xe.indexOf(":")===-1;return ge.substring(0,2)==="//"?be?ge:xe.replace(c,"$1")+ge:ge.charAt(0)==="/"?be?ge:xe.replace(u,"$1")+ge:xe+ge}var x={exec:function(){}};function b(xe){for(var ge=1,be,re;ge<arguments.length;ge++){be=arguments[ge];for(re in be)Object.prototype.hasOwnProperty.call(be,re)&&(xe[re]=be[re])}return xe}function E(xe,ge){var be=xe.replace(/\|/g,function(se,he,Le){for(var Se=!1,We=he;--We>=0&&Le[We]==="\\";)Se=!Se;return Se?"|":" |"}),re=be.split(/ \|/),ne=0;if(re.length>ge)re.splice(ge);else for(;re.length<ge;)re.push("");for(;ne<re.length;ne++)re[ne]=re[ne].trim().replace(/\\\|/g,"|");return re}function N(xe,ge,be){var re=xe.length;if(re===0)return"";for(var ne=0;ne<re;){var se=xe.charAt(re-ne-1);if(se===ge&&!be)ne++;else if(se!==ge&&be)ne++;else break}return xe.substr(0,re-ne)}function U(xe,ge){if(xe.indexOf(ge[1])===-1)return-1;for(var be=xe.length,re=0,ne=0;ne<be;ne++)if(xe[ne]==="\\")ne++;else if(xe[ne]===ge[0])re++;else if(xe[ne]===ge[1]&&(re--,re<0))return ne;return-1}function K(xe){xe&&xe.sanitize&&!xe.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 V={escape:d,unescape:l,edit:w,cleanUrl:L,resolveUrl:a,noopTest:x,merge:b,splitCells:E,rtrim:N,findClosingBracket:U,checkSanitizeDeprecation:K},R=G.defaults,M=V.rtrim,$=V.splitCells,ee=V.escape,oe=V.findClosingBracket;function fe(xe,ge,be){var re=ge.href,ne=ge.title?ee(ge.title):null,se=xe[1].replace(/\\([\[\]])/g,"$1");return xe[0].charAt(0)!=="!"?{type:"link",raw:be,href:re,title:ne,text:se}:{type:"image",raw:be,href:re,title:ne,text:ee(se)}}function ke(xe,ge){var be=xe.match(/^(\s+)(?:```)/);if(be===null)return ge;var re=be[1];return ge.split(`
`).map(function(ne){var se=ne.match(/^\s+/);if(se===null)return ne;var he=se[0];return he.length>=re.length?ne.slice(re.length):ne}).join(`
`)}var Ee=function(){function xe(be){this.options=be||R}var ge=xe.prototype;return ge.space=function(re){var ne=this.rules.block.newline.exec(re);if(ne)return ne[0].length>1?{type:"space",raw:ne[0]}:{raw:`
`}},ge.code=function(re,ne){var se=this.rules.block.code.exec(re);if(se){var he=ne[ne.length-1];if(he&&he.type==="paragraph")return{raw:se[0],text:se[0].trimRight()};var Le=se[0].replace(/^ {4}/gm,"");return{type:"code",raw:se[0],codeBlockStyle:"indented",text:this.options.pedantic?Le:M(Le,`
`)}}},ge.fences=function(re){var ne=this.rules.block.fences.exec(re);if(ne){var se=ne[0],he=ke(se,ne[3]||"");return{type:"code",raw:se,lang:ne[2]?ne[2].trim():ne[2],text:he}}},ge.heading=function(re){var ne=this.rules.block.heading.exec(re);if(ne)return{type:"heading",raw:ne[0],depth:ne[1].length,text:ne[2]}},ge.nptable=function(re){var ne=this.rules.block.nptable.exec(re);if(ne){var se={type:"table",header:$(ne[1].replace(/^ *| *\| *$/g,"")),align:ne[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ne[3]?ne[3].replace(/\n$/,"").split(`
`):[],raw:ne[0]};if(se.header.length===se.align.length){var he=se.align.length,Le;for(Le=0;Le<he;Le++)/^ *-+: *$/.test(se.align[Le])?se.align[Le]="right":/^ *:-+: *$/.test(se.align[Le])?se.align[Le]="center":/^ *:-+ *$/.test(se.align[Le])?se.align[Le]="left":se.align[Le]=null;for(he=se.cells.length,Le=0;Le<he;Le++)se.cells[Le]=$(se.cells[Le],se.header.length);return se}}},ge.hr=function(re){var ne=this.rules.block.hr.exec(re);if(ne)return{type:"hr",raw:ne[0]}},ge.blockquote=function(re){var ne=this.rules.block.blockquote.exec(re);if(ne){var se=ne[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ne[0],text:se}}},ge.list=function(re){var ne=this.rules.block.list.exec(re);if(ne){for(var se=ne[0],he=ne[2],Le=he.length>1,Se=he[he.length-1]===")",We={type:"list",raw:se,ordered:Le,start:Le?+he.slice(0,-1):"",loose:!1,items:[]},it=ne[0].match(this.rules.block.item),ft=!1,lt,wt,St,dt,zt,It,Kt,Wt=it.length,_t=0;_t<Wt;_t++)lt=it[_t],se=lt,wt=lt.length,lt=lt.replace(/^ *([*+-]|\d+[.)]) */,""),~lt.indexOf(`
`)&&(wt-=lt.length,lt=this.options.pedantic?lt.replace(/^ {1,4}/gm,""):lt.replace(new RegExp("^ {1,"+wt+"}","gm"),"")),_t!==Wt-1&&(St=this.rules.block.bullet.exec(it[_t+1])[0],(Le?St.length===1||!Se&&St[St.length-1]===")":St.length>1||this.options.smartLists&&St!==he)&&(dt=it.slice(_t+1).join(`
`),We.raw=We.raw.substring(0,We.raw.length-dt.length),_t=Wt-1)),zt=ft||/\n\n(?!\s*$)/.test(lt),_t!==Wt-1&&(ft=lt.charAt(lt.length-1)===`
`,zt||(zt=ft)),zt&&(We.loose=!0),It=/^\[[ xX]\] /.test(lt),Kt=void 0,It&&(Kt=lt[1]!==" ",lt=lt.replace(/^\[[ xX]\] +/,"")),We.items.push({type:"list_item",raw:se,task:It,checked:Kt,loose:zt,text:lt});return We}},ge.html=function(re){var ne=this.rules.block.html.exec(re);if(ne)return{type:this.options.sanitize?"paragraph":"html",raw:ne[0],pre:!this.options.sanitizer&&(ne[1]==="pre"||ne[1]==="script"||ne[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ne[0]):ee(ne[0]):ne[0]}},ge.def=function(re){var ne=this.rules.block.def.exec(re);if(ne){ne[3]&&(ne[3]=ne[3].substring(1,ne[3].length-1));var se=ne[1].toLowerCase().replace(/\s+/g," ");return{tag:se,raw:ne[0],href:ne[2],title:ne[3]}}},ge.table=function(re){var ne=this.rules.block.table.exec(re);if(ne){var se={type:"table",header:$(ne[1].replace(/^ *| *\| *$/g,"")),align:ne[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ne[3]?ne[3].replace(/\n$/,"").split(`
`):[]};if(se.header.length===se.align.length){se.raw=ne[0];var he=se.align.length,Le;for(Le=0;Le<he;Le++)/^ *-+: *$/.test(se.align[Le])?se.align[Le]="right":/^ *:-+: *$/.test(se.align[Le])?se.align[Le]="center":/^ *:-+ *$/.test(se.align[Le])?se.align[Le]="left":se.align[Le]=null;for(he=se.cells.length,Le=0;Le<he;Le++)se.cells[Le]=$(se.cells[Le].replace(/^ *\| *| *\| *$/g,""),se.header.length);return se}}},ge.lheading=function(re){var ne=this.rules.block.lheading.exec(re);if(ne)return{type:"heading",raw:ne[0],depth:ne[2].charAt(0)==="="?1:2,text:ne[1]}},ge.paragraph=function(re){var ne=this.rules.block.paragraph.exec(re);if(ne)return{type:"paragraph",raw:ne[0],text:ne[1].charAt(ne[1].length-1)===`
`?ne[1].slice(0,-1):ne[1]}},ge.text=function(re,ne){var se=this.rules.block.text.exec(re);if(se){var he=ne[ne.length-1];return he&&he.type==="text"?{raw:se[0],text:se[0]}:{type:"text",raw:se[0],text:se[0]}}},ge.escape=function(re){var ne=this.rules.inline.escape.exec(re);if(ne)return{type:"escape",raw:ne[0],text:ee(ne[1])}},ge.tag=function(re,ne,se){var he=this.rules.inline.tag.exec(re);if(he)return!ne&&/^<a /i.test(he[0])?ne=!0:ne&&/^<\/a>/i.test(he[0])&&(ne=!1),!se&&/^<(pre|code|kbd|script)(\s|>)/i.test(he[0])?se=!0:se&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(he[0])&&(se=!1),{type:this.options.sanitize?"text":"html",raw:he[0],inLink:ne,inRawBlock:se,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(he[0]):ee(he[0]):he[0]}},ge.link=function(re){var ne=this.rules.inline.link.exec(re);if(ne){var se=oe(ne[2],"()");if(se>-1){var he=ne[0].indexOf("!")===0?5:4,Le=he+ne[1].length+se;ne[2]=ne[2].substring(0,se),ne[0]=ne[0].substring(0,Le).trim(),ne[3]=""}var Se=ne[2],We="";if(this.options.pedantic){var it=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Se);it?(Se=it[1],We=it[3]):We=""}else We=ne[3]?ne[3].slice(1,-1):"";Se=Se.trim().replace(/^<([\s\S]*)>$/,"$1");var ft=fe(ne,{href:Se&&Se.replace(this.rules.inline._escapes,"$1"),title:We&&We.replace(this.rules.inline._escapes,"$1")},ne[0]);return ft}},ge.reflink=function(re,ne){var se;if((se=this.rules.inline.reflink.exec(re))||(se=this.rules.inline.nolink.exec(re))){var he=(se[2]||se[1]).replace(/\s+/g," ");if(he=ne[he.toLowerCase()],!he||!he.href){var Le=se[0].charAt(0);return{type:"text",raw:Le,text:Le}}var Se=fe(se,he,se[0]);return Se}},ge.strong=function(re,ne,se){se===void 0&&(se="");var he=this.rules.inline.strong.start.exec(re);if(he&&(!he[1]||he[1]&&(se===""||this.rules.inline.punctuation.exec(se)))){ne=ne.slice(-1*re.length);var Le=he[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Le.lastIndex=0;for(var Se;(he=Le.exec(ne))!=null;)if(Se=this.rules.inline.strong.middle.exec(ne.slice(0,he.index+3)),Se)return{type:"strong",raw:re.slice(0,Se[0].length),text:re.slice(2,Se[0].length-2)}}},ge.em=function(re,ne,se){se===void 0&&(se="");var he=this.rules.inline.em.start.exec(re);if(he&&(!he[1]||he[1]&&(se===""||this.rules.inline.punctuation.exec(se)))){ne=ne.slice(-1*re.length);var Le=he[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Le.lastIndex=0;for(var Se;(he=Le.exec(ne))!=null;)if(Se=this.rules.inline.em.middle.exec(ne.slice(0,he.index+2)),Se)return{type:"em",raw:re.slice(0,Se[0].length),text:re.slice(1,Se[0].length-1)}}},ge.codespan=function(re){var ne=this.rules.inline.code.exec(re);if(ne){var se=ne[2].replace(/\n/g," "),he=/[^ ]/.test(se),Le=se.startsWith(" ")&&se.endsWith(" ");return he&&Le&&(se=se.substring(1,se.length-1)),se=ee(se,!0),{type:"codespan",raw:ne[0],text:se}}},ge.br=function(re){var ne=this.rules.inline.br.exec(re);if(ne)return{type:"br",raw:ne[0]}},ge.del=function(re){var ne=this.rules.inline.del.exec(re);if(ne)return{type:"del",raw:ne[0],text:ne[1]}},ge.autolink=function(re,ne){var se=this.rules.inline.autolink.exec(re);if(se){var he,Le;return se[2]==="@"?(he=ee(this.options.mangle?ne(se[1]):se[1]),Le="mailto:"+he):(he=ee(se[1]),Le=he),{type:"link",raw:se[0],text:he,href:Le,tokens:[{type:"text",raw:he,text:he}]}}},ge.url=function(re,ne){var se;if(se=this.rules.inline.url.exec(re)){var he,Le;if(se[2]==="@")he=ee(this.options.mangle?ne(se[0]):se[0]),Le="mailto:"+he;else{var Se;do Se=se[0],se[0]=this.rules.inline._backpedal.exec(se[0])[0];while(Se!==se[0]);he=ee(se[0]),se[1]==="www."?Le="http://"+he:Le=he}return{type:"link",raw:se[0],text:he,href:Le,tokens:[{type:"text",raw:he,text:he}]}}},ge.inlineText=function(re,ne,se){var he=this.rules.inline.text.exec(re);if(he){var Le;return ne?Le=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(he[0]):ee(he[0]):he[0]:Le=ee(this.options.smartypants?se(he[0]):he[0]),{type:"text",raw:he[0],text:Le}}},xe}(),Te=V.noopTest,we=V.edit,Ce=V.merge,me={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:Te,table:Te,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};me._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,me._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,me.def=we(me.def).replace("label",me._label).replace("title",me._title).getRegex(),me.bullet=/(?:[*+-]|\d{1,9}[.)])/,me.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,me.item=we(me.item,"gm").replace(/bull/g,me.bullet).getRegex(),me.list=we(me.list).replace(/bull/g,me.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+me.def.source+")").getRegex(),me._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",me._comment=/<!--(?!-?>)[\s\S]*?-->/,me.html=we(me.html,"i").replace("comment",me._comment).replace("tag",me._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),me.paragraph=we(me._paragraph).replace("hr",me.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",me._tag).getRegex(),me.blockquote=we(me.blockquote).replace("paragraph",me.paragraph).getRegex(),me.normal=Ce({},me),me.gfm=Ce({},me.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*|$)"}),me.gfm.nptable=we(me.gfm.nptable).replace("hr",me.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",me._tag).getRegex(),me.gfm.table=we(me.gfm.table).replace("hr",me.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",me._tag).getRegex(),me.pedantic=Ce({},me.normal,{html:we(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",me._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:Te,paragraph:we(me.normal._paragraph).replace("hr",me.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",me.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var ue={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Te,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:Te,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};ue._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",ue.punctuation=we(ue.punctuation).replace(/punctuation/g,ue._punctuation).getRegex(),ue._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",ue._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",ue.em.start=we(ue.em.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.middle=we(ue.em.middle).replace(/punctuation/g,ue._punctuation).replace(/overlapSkip/g,ue._overlapSkip).getRegex(),ue.em.endAst=we(ue.em.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.endUnd=we(ue.em.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.start=we(ue.strong.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.middle=we(ue.strong.middle).replace(/punctuation/g,ue._punctuation).replace(/blockSkip/g,ue._blockSkip).getRegex(),ue.strong.endAst=we(ue.strong.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.endUnd=we(ue.strong.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.blockSkip=we(ue._blockSkip,"g").getRegex(),ue.overlapSkip=we(ue._overlapSkip,"g").getRegex(),ue._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,ue._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,ue._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,ue.autolink=we(ue.autolink).replace("scheme",ue._scheme).replace("email",ue._email).getRegex(),ue._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,ue.tag=we(ue.tag).replace("comment",me._comment).replace("attribute",ue._attribute).getRegex(),ue._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ue._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,ue._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,ue.link=we(ue.link).replace("label",ue._label).replace("href",ue._href).replace("title",ue._title).getRegex(),ue.reflink=we(ue.reflink).replace("label",ue._label).getRegex(),ue.reflinkSearch=we(ue.reflinkSearch,"g").replace("reflink",ue.reflink).replace("nolink",ue.nolink).getRegex(),ue.normal=Ce({},ue),ue.pedantic=Ce({},ue.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:we(/^!?\[(label)\]\((.*?)\)/).replace("label",ue._label).getRegex(),reflink:we(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ue._label).getRegex()}),ue.gfm=Ce({},ue.normal,{escape:we(ue.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),ue.gfm.url=we(ue.gfm.url,"i").replace("email",ue.gfm._extended_email).getRegex(),ue.breaks=Ce({},ue.gfm,{br:we(ue.br).replace("{2,}","*").getRegex(),text:we(ue.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var te={block:me,inline:ue},de=G.defaults,ae=te.block,_e=te.inline;function Re(xe){return xe.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 ye(xe){var ge="",be,re,ne=xe.length;for(be=0;be<ne;be++)re=xe.charCodeAt(be),Math.random()>.5&&(re="x"+re.toString(16)),ge+="&#"+re+";";return ge}var Oe=function(){function xe(be){this.tokens=[],this.tokens.links=Object.create(null),this.options=be||de,this.options.tokenizer=this.options.tokenizer||new Ee,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var re={block:ae.normal,inline:_e.normal};this.options.pedantic?(re.block=ae.pedantic,re.inline=_e.pedantic):this.options.gfm&&(re.block=ae.gfm,this.options.breaks?re.inline=_e.breaks:re.inline=_e.gfm),this.tokenizer.rules=re}xe.lex=function(re,ne){var se=new xe(ne);return se.lex(re)};var ge=xe.prototype;return ge.lex=function(re){return re=re.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(re,this.tokens,!0),this.inline(this.tokens),this.tokens},ge.blockTokens=function(re,ne,se){ne===void 0&&(ne=[]),se===void 0&&(se=!0),re=re.replace(/^ +$/gm,"");for(var he,Le,Se,We;re;){if(he=this.tokenizer.space(re)){re=re.substring(he.raw.length),he.type&&ne.push(he);continue}if(he=this.tokenizer.code(re,ne)){re=re.substring(he.raw.length),he.type?ne.push(he):(We=ne[ne.length-1],We.raw+=`
`+he.raw,We.text+=`
`+he.text);continue}if(he=this.tokenizer.fences(re)){re=re.substring(he.raw.length),ne.push(he);continue}if(he=this.tokenizer.heading(re)){re=re.substring(he.raw.length),ne.push(he);continue}if(he=this.tokenizer.nptable(re)){re=re.substring(he.raw.length),ne.push(he);continue}if(he=this.tokenizer.hr(re)){re=re.substring(he.raw.length),ne.push(he);continue}if(he=this.tokenizer.blockquote(re)){re=re.substring(he.raw.length),he.tokens=this.blockTokens(he.text,[],se),ne.push(he);continue}if(he=this.tokenizer.list(re)){for(re=re.substring(he.raw.length),Se=he.items.length,Le=0;Le<Se;Le++)he.items[Le].tokens=this.blockTokens(he.items[Le].text,[],!1);ne.push(he);continue}if(he=this.tokenizer.html(re)){re=re.substring(he.raw.length),ne.push(he);continue}if(se&&(he=this.tokenizer.def(re))){re=re.substring(he.raw.length),this.tokens.links[he.tag]||(this.tokens.links[he.tag]={href:he.href,title:he.title});continue}if(he=this.tokenizer.table(re)){re=re.substring(he.raw.length),ne.push(he);continue}if(he=this.tokenizer.lheading(re)){re=re.substring(he.raw.length),ne.push(he);continue}if(se&&(he=this.tokenizer.paragraph(re))){re=re.substring(he.raw.length),ne.push(he);continue}if(he=this.tokenizer.text(re,ne)){re=re.substring(he.raw.length),he.type?ne.push(he):(We=ne[ne.length-1],We.raw+=`
`+he.raw,We.text+=`
`+he.text);continue}if(re){var it="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(it);break}else throw new Error(it)}}return ne},ge.inline=function(re){var ne,se,he,Le,Se,We,it=re.length;for(ne=0;ne<it;ne++){We=re[ne];switch(We.type){case"paragraph":case"text":case"heading":{We.tokens=[],this.inlineTokens(We.text,We.tokens);break}case"table":{for(We.tokens={header:[],cells:[]},Le=We.header.length,se=0;se<Le;se++)We.tokens.header[se]=[],this.inlineTokens(We.header[se],We.tokens.header[se]);for(Le=We.cells.length,se=0;se<Le;se++)for(Se=We.cells[se],We.tokens.cells[se]=[],he=0;he<Se.length;he++)We.tokens.cells[se][he]=[],this.inlineTokens(Se[he],We.tokens.cells[se][he]);break}case"blockquote":{this.inline(We.tokens);break}case"list":{for(Le=We.items.length,se=0;se<Le;se++)this.inline(We.items[se].tokens);break}}}return re},ge.inlineTokens=function(re,ne,se,he,Le){ne===void 0&&(ne=[]),se===void 0&&(se=!1),he===void 0&&(he=!1),Le===void 0&&(Le="");var Se,We=re,it;if(this.tokens.links){var ft=Object.keys(this.tokens.links);if(ft.length>0)for(;(it=this.tokenizer.rules.inline.reflinkSearch.exec(We))!=null;)ft.includes(it[0].slice(it[0].lastIndexOf("[")+1,-1))&&(We=We.slice(0,it.index)+"["+"a".repeat(it[0].length-2)+"]"+We.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(it=this.tokenizer.rules.inline.blockSkip.exec(We))!=null;)We=We.slice(0,it.index)+"["+"a".repeat(it[0].length-2)+"]"+We.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;re;){if(Se=this.tokenizer.escape(re)){re=re.substring(Se.raw.length),ne.push(Se);continue}if(Se=this.tokenizer.tag(re,se,he)){re=re.substring(Se.raw.length),se=Se.inLink,he=Se.inRawBlock,ne.push(Se);continue}if(Se=this.tokenizer.link(re)){re=re.substring(Se.raw.length),Se.type==="link"&&(Se.tokens=this.inlineTokens(Se.text,[],!0,he)),ne.push(Se);continue}if(Se=this.tokenizer.reflink(re,this.tokens.links)){re=re.substring(Se.raw.length),Se.type==="link"&&(Se.tokens=this.inlineTokens(Se.text,[],!0,he)),ne.push(Se);continue}if(Se=this.tokenizer.strong(re,We,Le)){re=re.substring(Se.raw.length),Se.tokens=this.inlineTokens(Se.text,[],se,he),ne.push(Se);continue}if(Se=this.tokenizer.em(re,We,Le)){re=re.substring(Se.raw.length),Se.tokens=this.inlineTokens(Se.text,[],se,he),ne.push(Se);continue}if(Se=this.tokenizer.codespan(re)){re=re.substring(Se.raw.length),ne.push(Se);continue}if(Se=this.tokenizer.br(re)){re=re.substring(Se.raw.length),ne.push(Se);continue}if(Se=this.tokenizer.del(re)){re=re.substring(Se.raw.length),Se.tokens=this.inlineTokens(Se.text,[],se,he),ne.push(Se);continue}if(Se=this.tokenizer.autolink(re,ye)){re=re.substring(Se.raw.length),ne.push(Se);continue}if(!se&&(Se=this.tokenizer.url(re,ye))){re=re.substring(Se.raw.length),ne.push(Se);continue}if(Se=this.tokenizer.inlineText(re,he,Re)){re=re.substring(Se.raw.length),Le=Se.raw.slice(-1),ne.push(Se);continue}if(re){var lt="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(lt);break}else throw new Error(lt)}}return ne},Q(xe,null,[{key:"rules",get:function(){return{block:ae,inline:_e}}}]),xe}(),Pe=G.defaults,Ie=V.cleanUrl,je=V.escape,Be=function(){function xe(be){this.options=be||Pe}var ge=xe.prototype;return ge.code=function(re,ne,se){var he=(ne||"").match(/\S*/)[0];if(this.options.highlight){var Le=this.options.highlight(re,he);Le!=null&&Le!==re&&(se=!0,re=Le)}return he?'<pre><code class="'+this.options.langPrefix+je(he,!0)+'">'+(se?re:je(re,!0))+`</code></pre>
`:"<pre><code>"+(se?re:je(re,!0))+`</code></pre>
`},ge.blockquote=function(re){return`<blockquote>
`+re+`</blockquote>
`},ge.html=function(re){return re},ge.heading=function(re,ne,se,he){return this.options.headerIds?"<h"+ne+' id="'+this.options.headerPrefix+he.slug(se)+'">'+re+"</h"+ne+`>
`:"<h"+ne+">"+re+"</h"+ne+`>
`},ge.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},ge.list=function(re,ne,se){var he=ne?"ol":"ul",Le=ne&&se!==1?' start="'+se+'"':"";return"<"+he+Le+`>
`+re+"</"+he+`>
`},ge.listitem=function(re){return"<li>"+re+`</li>
`},ge.checkbox=function(re){return"<input "+(re?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ge.paragraph=function(re){return"<p>"+re+`</p>
`},ge.table=function(re,ne){return ne&&(ne="<tbody>"+ne+"</tbody>"),`<table>
<thead>
`+re+`</thead>
`+ne+`</table>
`},ge.tablerow=function(re){return`<tr>
`+re+`</tr>
`},ge.tablecell=function(re,ne){var se=ne.header?"th":"td",he=ne.align?"<"+se+' align="'+ne.align+'">':"<"+se+">";return he+re+"</"+se+`>
`},ge.strong=function(re){return"<strong>"+re+"</strong>"},ge.em=function(re){return"<em>"+re+"</em>"},ge.codespan=function(re){return"<code>"+re+"</code>"},ge.br=function(){return this.options.xhtml?"<br/>":"<br>"},ge.del=function(re){return"<del>"+re+"</del>"},ge.link=function(re,ne,se){if(re=Ie(this.options.sanitize,this.options.baseUrl,re),re===null)return se;var he='<a href="'+je(re)+'"';return ne&&(he+=' title="'+ne+'"'),he+=">"+se+"</a>",he},ge.image=function(re,ne,se){if(re=Ie(this.options.sanitize,this.options.baseUrl,re),re===null)return se;var he='<img src="'+re+'" alt="'+se+'"';return ne&&(he+=' title="'+ne+'"'),he+=this.options.xhtml?"/>":">",he},ge.text=function(re){return re},xe}(),Ne=function(){function xe(){}var ge=xe.prototype;return ge.strong=function(re){return re},ge.em=function(re){return re},ge.codespan=function(re){return re},ge.del=function(re){return re},ge.html=function(re){return re},ge.text=function(re){return re},ge.link=function(re,ne,se){return""+se},ge.image=function(re,ne,se){return""+se},ge.br=function(){return""},xe}(),et=function(){function xe(){this.seen={}}var ge=xe.prototype;return ge.slug=function(re){var ne=re.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ne)){var se=ne;do this.seen[se]++,ne=se+"-"+this.seen[se];while(this.seen.hasOwnProperty(ne))}return this.seen[ne]=0,ne},xe}(),Ze=G.defaults,$e=V.unescape,Xe=function(){function xe(be){this.options=be||Ze,this.options.renderer=this.options.renderer||new Be,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ne,this.slugger=new et}xe.parse=function(re,ne){var se=new xe(ne);return se.parse(re)};var ge=xe.prototype;return ge.parse=function(re,ne){ne===void 0&&(ne=!0);var se="",he,Le,Se,We,it,ft,lt,wt,St,dt,zt,It,Kt,Wt,_t,Wr,ai,vt,Vr=re.length;for(he=0;he<Vr;he++){dt=re[he];switch(dt.type){case"space":continue;case"hr":{se+=this.renderer.hr();continue}case"heading":{se+=this.renderer.heading(this.parseInline(dt.tokens),dt.depth,$e(this.parseInline(dt.tokens,this.textRenderer)),this.slugger);continue}case"code":{se+=this.renderer.code(dt.text,dt.lang,dt.escaped);continue}case"table":{for(wt="",lt="",We=dt.header.length,Le=0;Le<We;Le++)lt+=this.renderer.tablecell(this.parseInline(dt.tokens.header[Le]),{header:!0,align:dt.align[Le]});for(wt+=this.renderer.tablerow(lt),St="",We=dt.cells.length,Le=0;Le<We;Le++){for(ft=dt.tokens.cells[Le],lt="",it=ft.length,Se=0;Se<it;Se++)lt+=this.renderer.tablecell(this.parseInline(ft[Se]),{header:!1,align:dt.align[Se]});St+=this.renderer.tablerow(lt)}se+=this.renderer.table(wt,St);continue}case"blockquote":{St=this.parse(dt.tokens),se+=this.renderer.blockquote(St);continue}case"list":{for(zt=dt.ordered,It=dt.start,Kt=dt.loose,We=dt.items.length,St="",Le=0;Le<We;Le++)_t=dt.items[Le],Wr=_t.checked,ai=_t.task,Wt="",_t.task&&(vt=this.renderer.checkbox(Wr),Kt?_t.tokens.length>0&&_t.tokens[0].type==="text"?(_t.tokens[0].text=vt+" "+_t.tokens[0].text,_t.tokens[0].tokens&&_t.tokens[0].tokens.length>0&&_t.tokens[0].tokens[0].type==="text"&&(_t.tokens[0].tokens[0].text=vt+" "+_t.tokens[0].tokens[0].text)):_t.tokens.unshift({type:"text",text:vt}):Wt+=vt),Wt+=this.parse(_t.tokens,Kt),St+=this.renderer.listitem(Wt,ai,Wr);se+=this.renderer.list(St,zt,It);continue}case"html":{se+=this.renderer.html(dt.text);continue}case"paragraph":{se+=this.renderer.paragraph(this.parseInline(dt.tokens));continue}case"text":{for(St=dt.tokens?this.parseInline(dt.tokens):dt.text;he+1<Vr&&re[he+1].type==="text";)dt=re[++he],St+=`
`+(dt.tokens?this.parseInline(dt.tokens):dt.text);se+=ne?this.renderer.paragraph(St):St;continue}default:{var nr='Token with "'+dt.type+'" type was not found.';if(this.options.silent){console.error(nr);return}else throw new Error(nr)}}}return se},ge.parseInline=function(re,ne){ne=ne||this.renderer;var se="",he,Le,Se=re.length;for(he=0;he<Se;he++){Le=re[he];switch(Le.type){case"escape":{se+=ne.text(Le.text);break}case"html":{se+=ne.html(Le.text);break}case"link":{se+=ne.link(Le.href,Le.title,this.parseInline(Le.tokens,ne));break}case"image":{se+=ne.image(Le.href,Le.title,Le.text);break}case"strong":{se+=ne.strong(this.parseInline(Le.tokens,ne));break}case"em":{se+=ne.em(this.parseInline(Le.tokens,ne));break}case"codespan":{se+=ne.codespan(Le.text);break}case"br":{se+=ne.br();break}case"del":{se+=ne.del(this.parseInline(Le.tokens,ne));break}case"text":{se+=ne.text(Le.text);break}default:{var We='Token with "'+Le.type+'" type was not found.';if(this.options.silent){console.error(We);return}else throw new Error(We)}}}return se},xe}(),st=V.merge,qe=V.checkSanitizeDeprecation,nt=V.escape,Me=G.getDefaults,ct=G.changeDefaults,at=G.defaults;function Ue(xe,ge,be){if(typeof xe=="undefined"||xe===null)throw new Error("marked(): input parameter is undefined or null");if(typeof xe!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(xe)+", string expected");if(typeof ge=="function"&&(be=ge,ge=null),ge=st({},Ue.defaults,ge||{}),qe(ge),be){var re=ge.highlight,ne;try{ne=Oe.lex(xe,ge)}catch(Se){return be(Se)}var se=function(We){var it;if(!We)try{it=Xe.parse(ne,ge)}catch(ft){We=ft}return ge.highlight=re,We?be(We):be(null,it)};if(!re||re.length<3)return se();if(delete ge.highlight,!ne.length)return se();var he=0;Ue.walkTokens(ne,function(Se){Se.type==="code"&&(he++,setTimeout(function(){re(Se.text,Se.lang,function(We,it){if(We)return se(We);it!=null&&it!==Se.text&&(Se.text=it,Se.escaped=!0),he--,he===0&&se()})},0))}),he===0&&se();return}try{var Le=Oe.lex(xe,ge);return ge.walkTokens&&Ue.walkTokens(Le,ge.walkTokens),Xe.parse(Le,ge)}catch(Se){if(Se.message+=`
Please report this to https://github.com/markedjs/marked.`,ge.silent)return"<p>An error occurred:</p><pre>"+nt(Se.message+"",!0)+"</pre>";throw Se}}Ue.options=Ue.setOptions=function(xe){return st(Ue.defaults,xe),ct(Ue.defaults),Ue},Ue.getDefaults=Me,Ue.defaults=at,Ue.use=function(xe){var ge=st({},xe);if(xe.renderer&&function(){var re=Ue.defaults.renderer||new Be,ne=function(Le){var Se=re[Le];re[Le]=function(){for(var We=arguments.length,it=new Array(We),ft=0;ft<We;ft++)it[ft]=arguments[ft];var lt=xe.renderer[Le].apply(re,it);return lt===!1&&(lt=Se.apply(re,it)),lt}};for(var se in xe.renderer)ne(se);ge.renderer=re}(),xe.tokenizer&&function(){var re=Ue.defaults.tokenizer||new Ee,ne=function(Le){var Se=re[Le];re[Le]=function(){for(var We=arguments.length,it=new Array(We),ft=0;ft<We;ft++)it[ft]=arguments[ft];var lt=xe.tokenizer[Le].apply(re,it);return lt===!1&&(lt=Se.apply(re,it)),lt}};for(var se in xe.tokenizer)ne(se);ge.tokenizer=re}(),xe.walkTokens){var be=Ue.defaults.walkTokens;ge.walkTokens=function(re){xe.walkTokens(re),be&&be(re)}}Ue.setOptions(ge)},Ue.walkTokens=function(xe,ge){for(var be=B(xe),re;!(re=be()).done;){var ne=re.value;ge(ne);switch(ne.type){case"table":{for(var se=B(ne.tokens.header),he;!(he=se()).done;){var Le=he.value;Ue.walkTokens(Le,ge)}for(var Se=B(ne.tokens.cells),We;!(We=Se()).done;)for(var it=We.value,ft=B(it),lt;!(lt=ft()).done;){var wt=lt.value;Ue.walkTokens(wt,ge)}break}case"list":{Ue.walkTokens(ne.items,ge);break}default:ne.tokens&&Ue.walkTokens(ne.tokens,ge)}}},Ue.Parser=Xe,Ue.parser=Xe.parse,Ue.Renderer=Be,Ue.TextRenderer=Ne,Ue.Lexer=Oe,Ue.lexer=Oe.lex,Ue.Tokenizer=Ee,Ue.Slugger=et,Ue.parse=Ue;var Ke=Ue;return Ke})},ELLl:function(bt,Qe,ie){(function(le){le(ie("VrN/"))})(function(le){var Q={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},D=le.Pos;le.defineOption("autoCloseBrackets",!1,function(C,S,d){d&&d!=le.Init&&(C.removeKeyMap(B),C.state.closeBrackets=null),S&&(P(Z(S,"pairs")),C.state.closeBrackets=S,C.addKeyMap(B))});function Z(C,S){return S=="pairs"&&typeof C=="string"?C:typeof C=="object"&&C[S]!=null?C[S]:Q[S]}var B={Backspace:I,Enter:k};function P(C){for(var S=0;S<C.length;S++){var d=C.charAt(S),o="'"+d+"'";B[o]||(B[o]=G(d))}}P(Q.pairs+"`");function G(C){return function(S){return A(S,C)}}function j(C){var S=C.state.closeBrackets;if(!S||S.override)return S;var d=C.getModeAt(C.getCursor());return d.closeBrackets||S}function I(C){var S=j(C);if(!S||C.getOption("disableInput"))return le.Pass;for(var d=Z(S,"pairs"),o=C.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return le.Pass;var h=O(C,o[l].head);if(!h||d.indexOf(h)%2!=0)return le.Pass}for(var l=o.length-1;l>=0;l--){var w=o[l].head;C.replaceRange("",D(w.line,w.ch-1),D(w.line,w.ch+1),"+delete")}}function k(C){var S=j(C),d=S&&Z(S,"explode");if(!d||C.getOption("disableInput"))return le.Pass;for(var o=C.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return le.Pass;var h=O(C,o[l].head);if(!h||d.indexOf(h)%2!=0)return le.Pass}C.operation(function(){var w=C.lineSeparator()||`
`;C.replaceSelection(w+w,null),C.execCommand("goCharLeft"),o=C.listSelections();for(var p=0;p<o.length;p++){var f=o[p].head.line;C.indentLine(f,null,!0),C.indentLine(f+1,null,!0)}})}function y(C){var S=le.cmpPos(C.anchor,C.head)>0;return{anchor:new D(C.anchor.line,C.anchor.ch+(S?-1:1)),head:new D(C.head.line,C.head.ch+(S?1:-1))}}function A(C,S){var d=j(C);if(!d||C.getOption("disableInput"))return le.Pass;var o=Z(d,"pairs"),l=o.indexOf(S);if(l==-1)return le.Pass;for(var h=Z(d,"closeBefore"),w=Z(d,"triples"),p=o.charAt(l+1)==S,f=C.listSelections(),L=l%2==0,g,m=0;m<f.length;m++){var c=f[m],u=c.head,a,x=C.getRange(u,D(u.line,u.ch+1));if(L&&!c.empty())a="surround";else if((p||!L)&&x==S)p&&_(C,u)?a="both":w.indexOf(S)>=0&&C.getRange(u,D(u.line,u.ch+3))==S+S+S?a="skipThree":a="skip";else if(p&&u.ch>1&&w.indexOf(S)>=0&&C.getRange(D(u.line,u.ch-2),u)==S+S){if(u.ch>2&&/\bstring/.test(C.getTokenTypeAt(D(u.line,u.ch-2))))return le.Pass;a="addFour"}else if(p){var b=u.ch==0?" ":C.getRange(D(u.line,u.ch-1),u);if(!le.isWordChar(x)&&b!=S&&!le.isWordChar(b))a="both";else return le.Pass}else if(L&&(x.length===0||/\s/.test(x)||h.indexOf(x)>-1))a="both";else return le.Pass;if(!g)g=a;else if(g!=a)return le.Pass}var E=l%2?o.charAt(l-1):S,N=l%2?S:o.charAt(l+1);C.operation(function(){if(g=="skip")C.execCommand("goCharRight");else if(g=="skipThree")for(var U=0;U<3;U++)C.execCommand("goCharRight");else if(g=="surround"){for(var K=C.getSelections(),U=0;U<K.length;U++)K[U]=E+K[U]+N;C.replaceSelections(K,"around"),K=C.listSelections().slice();for(var U=0;U<K.length;U++)K[U]=y(K[U]);C.setSelections(K)}else g=="both"?(C.replaceSelection(E+N,null),C.triggerElectric(E+N),C.execCommand("goCharLeft")):g=="addFour"&&(C.replaceSelection(E+E+E+E,"before"),C.execCommand("goCharRight"))})}function O(C,S){var d=C.getRange(D(S.line,S.ch-1),D(S.line,S.ch+1));return d.length==2?d:null}function _(C,S){var d=C.getTokenAt(D(S.line,S.ch+1));return/\bstring/.test(d.type)&&d.start==S.ch&&(S.ch==0||!/\bstring/.test(C.getTokenTypeAt(S)))}})},GfqC:function(bt,Qe,ie){"use strict";var le=ie("q1tI"),Q=ie.n(le),D=ie("TSYQ"),Z=ie.n(D);function B(V,R){var M="cannot "+V.method+" "+V.action+" "+R.status+"'",$=new Error(M);return $.status=R.status,$.method=V.method,$.url=V.action,$}function P(V){var R=V.responseText||V.response;if(!R)return R;try{return JSON.parse(R)}catch(M){return R}}function G(V){var R=new XMLHttpRequest;V.onProgress&&R.upload&&(R.upload.onprogress=function(oe){oe.total>0&&(oe.percent=oe.loaded/oe.total*100),V.onProgress(oe)});var M=new FormData;V.data&&Object.keys(V.data).forEach(function(ee){var oe=V.data[ee];if(Array.isArray(oe)){oe.forEach(function(fe){M.append(ee+"[]",fe)});return}M.append(ee,V.data[ee])}),V.file instanceof Blob?M.append(V.filename,V.file,V.file.name):M.append(V.filename,V.file),R.onerror=function(oe){V.onError(oe)},R.onload=function(){return R.status<200||R.status>=300?V.onError(B(V,R),P(R)):V.onSuccess(P(R),R)},R.open(V.method,V.action,!0),V.withCredentials&&"withCredentials"in R&&(R.withCredentials=!0);var $=V.headers||{};return $["X-Requested-With"]!==null&&R.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys($).forEach(function(ee){$[ee]!==null&&R.setRequestHeader(ee,$[ee])}),R.send(M),{abort:function(){R.abort()}}}var j=+new Date,I=0;function k(){return"rc-upload-"+j+"-"+ ++I}function y(V,R){return V.indexOf(R,V.length-R.length)!==-1}var A=function(V,R){if(V&&R){var M=Array.isArray(R)?R:R.split(","),$=V.name||"",ee=V.type||"",oe=ee.replace(/\/.*$/,"");return M.some(function(fe){var ke=fe.trim();return ke.charAt(0)==="."?y($.toLowerCase(),ke.toLowerCase()):/\/\*$/.test(ke)?oe===ke.replace(/\/.*$/,""):ee===ke})}return!0};function O(V,R){var M=V.createReader(),$=[];function ee(){M.readEntries(function(oe){var fe=Array.prototype.slice.apply(oe);$=$.concat(fe);var ke=!fe.length;ke?R($):ee()})}ee()}var _=function(R,M,$){var ee=function oe(fe,ke){ke=ke||"",fe.isFile?fe.file(function(Ee){$(Ee)&&(fe.fullPath&&!Ee.webkitRelativePath&&(Object.defineProperties(Ee,{webkitRelativePath:{writable:!0}}),Ee.webkitRelativePath=fe.fullPath.replace(/^\//,""),Object.defineProperties(Ee,{webkitRelativePath:{writable:!1}})),M([Ee]))}):fe.isDirectory&&O(fe,function(Ee){Ee.forEach(function(Te){oe(Te,""+ke+fe.name+"/")})})};R.forEach(function(oe){ee(oe.webkitGetAsEntry())})},C=_,S=Object.assign||function(V){for(var R=1;R<arguments.length;R++){var M=arguments[R];for(var $ in M)Object.prototype.hasOwnProperty.call(M,$)&&(V[$]=M[$])}return V},d=function(){function V(R,M){var $=[],ee=!0,oe=!1,fe=void 0;try{for(var ke=R[Symbol.iterator](),Ee;!(ee=(Ee=ke.next()).done)&&!($.push(Ee.value),M&&$.length===M);ee=!0);}catch(Te){oe=!0,fe=Te}finally{try{!ee&&ke.return&&ke.return()}finally{if(oe)throw fe}}return $}return function(R,M){if(Array.isArray(R))return R;if(Symbol.iterator in Object(R))return V(R,M);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function V(R,M){for(var $=0;$<M.length;$++){var ee=M[$];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(R,ee.key,ee)}}return function(R,M,$){return M&&V(R.prototype,M),$&&V(R,$),R}}();function l(V,R,M){return R in V?Object.defineProperty(V,R,{value:M,enumerable:!0,configurable:!0,writable:!0}):V[R]=M,V}function h(V,R){var M={};for(var $ in V){if(R.indexOf($)>=0)continue;if(!Object.prototype.hasOwnProperty.call(V,$))continue;M[$]=V[$]}return M}function w(V,R){if(!(V instanceof R))throw new TypeError("Cannot call a class as a function")}function p(V,R){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return R&&(typeof R=="object"||typeof R=="function")?R:V}function f(V,R){if(typeof R!="function"&&R!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof R);V.prototype=Object.create(R&&R.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),R&&(Object.setPrototypeOf?Object.setPrototypeOf(V,R):V.__proto__=R)}var L=function(R){return Object.keys(R).reduce(function(M,$){return($.substr(0,5)==="data-"||$.substr(0,5)==="aria-"||$==="role")&&(M[$]=R[$]),M},{})},g=function(V){f(R,V);function R(){var M,$,ee,oe;w(this,R);for(var fe=arguments.length,ke=Array(fe),Ee=0;Ee<fe;Ee++)ke[Ee]=arguments[Ee];return oe=($=(ee=p(this,(M=R.__proto__||Object.getPrototypeOf(R)).call.apply(M,[this].concat(ke))),ee),ee.state={uid:k()},ee.reqs={},ee.onChange=function(Te){var we=Te.target.files;ee.uploadFiles(we),ee.reset()},ee.onClick=function(Te){var we=ee.fileInput;if(!we)return;var Ce=ee.props,me=Ce.children,ue=Ce.onClick;me&&me.type==="button"&&(we.parentNode.focus(),we.parentNode.querySelector("button").blur()),we.click(),ue&&ue(Te)},ee.onKeyDown=function(Te){Te.key==="Enter"&&ee.onClick()},ee.onFileDrop=function(Te){var we=ee.props.multiple;if(Te.preventDefault(),Te.type==="dragover")return;if(ee.props.directory)C(Array.prototype.slice.call(Te.dataTransfer.items),ee.uploadFiles,function(me){return A(me,ee.props.accept)});else{var Ce=Array.prototype.slice.call(Te.dataTransfer.files).filter(function(me){return A(me,ee.props.accept)});we===!1&&(Ce=Ce.slice(0,1)),ee.uploadFiles(Ce)}},ee.uploadFiles=function(Te){var we=Array.prototype.slice.call(Te);we.map(function(Ce){return Ce.uid=k(),Ce}).forEach(function(Ce){ee.upload(Ce,we)})},ee.saveFileInput=function(Te){ee.fileInput=Te},$),p(ee,oe)}return o(R,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function($,ee){var oe=this,fe=this.props;if(!fe.beforeUpload)return setTimeout(function(){return oe.post($)},0);var ke=fe.beforeUpload($,ee);ke&&ke.then?ke.then(function(Ee){var Te=Object.prototype.toString.call(Ee);return Te==="[object File]"||Te==="[object Blob]"?oe.post(Ee):oe.post($)}).catch(function(Ee){console.log(Ee)}):ke!==!1&&setTimeout(function(){return oe.post($)},0);return}},{key:"post",value:function($){var ee=this;if(!this._isMounted)return;var oe=this.props,fe=oe.onStart,ke=oe.onProgress,Ee=oe.transformFile,Te=Ee===void 0?function(we){return we}:Ee;new Promise(function(we){var Ce=oe.action;return typeof Ce=="function"&&(Ce=Ce($)),we(Ce)}).then(function(we){var Ce=$.uid,me=oe.customRequest||G,ue=Promise.resolve(Te($)).then(function(te){var de=oe.data;return typeof de=="function"&&(de=de(te)),Promise.all([te,de])}).catch(function(te){console.error(te)});ue.then(function(te){var de=d(te,2),ae=de[0],_e=de[1],Re={action:we,filename:oe.name,data:_e,file:ae,headers:oe.headers,withCredentials:oe.withCredentials,method:oe.method||"post",onProgress:ke?function(ye){ke(ye,$)}:null,onSuccess:function(Oe,Pe){delete ee.reqs[Ce],oe.onSuccess(Oe,$,Pe)},onError:function(Oe,Pe){delete ee.reqs[Ce],oe.onError(Oe,Pe,$)}};fe($),ee.reqs[Ce]=me(Re)})})}},{key:"reset",value:function(){this.setState({uid:k()})}},{key:"abort",value:function($){var ee=this.reqs;if($){var oe=$;$&&$.uid&&(oe=$.uid),ee[oe]&&ee[oe].abort&&ee[oe].abort(),delete ee[oe]}else Object.keys(ee).forEach(function(fe){ee[fe]&&ee[fe].abort&&ee[fe].abort(),delete ee[fe]})}},{key:"render",value:function(){var $,ee=this.props,oe=ee.component,fe=ee.prefixCls,ke=ee.className,Ee=ee.disabled,Te=ee.id,we=ee.style,Ce=ee.multiple,me=ee.accept,ue=ee.children,te=ee.directory,de=ee.openFileDialogOnClick,ae=ee.onMouseEnter,_e=ee.onMouseLeave,Re=h(ee,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),ye=Z()(($={},l($,fe,!0),l($,fe+"-disabled",Ee),l($,ke,ke),$)),Oe=Ee?{}:{onClick:de?this.onClick:function(){},onKeyDown:de?this.onKeyDown:function(){},onMouseEnter:ae,onMouseLeave:_e,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return Q.a.createElement(oe,S({},Oe,{className:ye,role:"button",style:we}),Q.a.createElement("input",S({},L(Re),{id:Te,type:"file",ref:this.saveFileInput,onClick:function(Ie){return Ie.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:me,directory:te?"directory":null,webkitdirectory:te?"webkitdirectory":null,multiple:Ce,onChange:this.onChange})),ue)}}]),R}(le.Component),m=g,c=Object.assign||function(V){for(var R=1;R<arguments.length;R++){var M=arguments[R];for(var $ in M)Object.prototype.hasOwnProperty.call(M,$)&&(V[$]=M[$])}return V},u=function(){function V(R,M){for(var $=0;$<M.length;$++){var ee=M[$];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(R,ee.key,ee)}}return function(R,M,$){return M&&V(R.prototype,M),$&&V(R,$),R}}();function a(V,R){if(!(V instanceof R))throw new TypeError("Cannot call a class as a function")}function x(V,R){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return R&&(typeof R=="object"||typeof R=="function")?R:V}function b(V,R){if(typeof R!="function"&&R!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof R);V.prototype=Object.create(R&&R.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),R&&(Object.setPrototypeOf?Object.setPrototypeOf(V,R):V.__proto__=R)}function E(){}var N=function(V){b(R,V);function R(){var M,$,ee,oe;a(this,R);for(var fe=arguments.length,ke=Array(fe),Ee=0;Ee<fe;Ee++)ke[Ee]=arguments[Ee];return oe=($=(ee=x(this,(M=R.__proto__||Object.getPrototypeOf(R)).call.apply(M,[this].concat(ke))),ee),ee.saveUploader=function(Te){ee.uploader=Te},$),x(ee,oe)}return u(R,[{key:"abort",value:function($){this.uploader.abort($)}},{key:"render",value:function(){return Q.a.createElement(m,c({},this.props,{ref:this.saveUploader}))}}]),R}(le.Component);N.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:E,onError:E,onSuccess:E,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var U=N,K=Qe.a=U},HmJG:function(bt,Qe,ie){},LdHM:function(bt,Qe,ie){"use strict";ie.d(Qe,"b",function(){return h}),ie.d(Qe,"a",function(){return p});var le=ie("1OyB"),Q=ie("vuIU"),D=ie("Ji7U"),Z=ie("LK+K"),B=ie("q1tI"),P=ie("rePB"),G=ie("Ff2n"),j=ie("ODXe"),I=ie("4IlW"),k=ie("bX4T"),y=ie("YrtM"),A=ie("TSYQ"),O=ie.n(A),_=ie("+nKL"),C=ie("8OUc"),S=function($,ee){var oe=$.prefixCls,fe=$.id,ke=$.flattenOptions,Ee=$.childrenAsData,Te=$.values,we=$.searchValue,Ce=$.multiple,me=$.defaultActiveFirstOption,ue=$.height,te=$.itemHeight,de=$.notFoundContent,ae=$.open,_e=$.menuItemSelectedIcon,Re=$.virtual,ye=$.onSelect,Oe=$.onToggleOpen,Pe=$.onActiveValue,Ie=$.onScroll,je=$.onMouseEnter,Be="".concat(oe,"-item"),Ne=Object(y.a)(function(){return ke},[ae,ke],function(Ke,xe){return xe[0]&&Ke[1]!==xe[1]}),et=B.useRef(null),Ze=function(xe){xe.preventDefault()},$e=function(xe){et.current&&et.current.scrollTo({index:xe})},Xe=function(xe){for(var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,be=Ne.length,re=0;re<be;re+=1){var ne=(xe+re*ge+be)%be,se=Ne[ne],he=se.group,Le=se.data;if(!he&&!Le.disabled)return ne}return-1},st=B.useState(function(){return Xe(0)}),qe=Object(j.a)(st,2),nt=qe[0],Me=qe[1],ct=function(xe){Me(xe);var ge=Ne[xe];if(!ge){Pe(null,-1);return}Pe(ge.data.value,xe)};B.useEffect(function(){ct(me!==!1?Xe(0):-1)},[Ne.length,we]),B.useEffect(function(){var Ke=setTimeout(function(){if(!Ce&&ae&&Te.size===1){var xe=Array.from(Te)[0],ge=Ne.findIndex(function(be){var re=be.data;return re.value===xe});ct(ge),$e(ge)}});return function(){return clearTimeout(Ke)}},[ae]);var at=function(xe){xe!==void 0&&ye(xe,{selected:!Te.has(xe)}),Ce||Oe(!1)};if(B.useImperativeHandle(ee,function(){return{onKeyDown:function(xe){var ge=xe.which;switch(ge){case I.a.UP:case I.a.DOWN:{var be=0;if(ge===I.a.UP?be=-1:ge===I.a.DOWN&&(be=1),be!==0){var re=Xe(nt+be,be);$e(re),ct(re)}break}case I.a.ENTER:{var ne=Ne[nt];ne&&!ne.data.disabled?at(ne.data.value):at(void 0),ae&&xe.preventDefault();break}case I.a.ESC:Oe(!1)}},onKeyUp:function(){},scrollTo:function(xe){$e(xe)}}}),Ne.length===0)return B.createElement("div",{role:"listbox",id:"".concat(fe,"_list"),className:"".concat(Be,"-empty"),onMouseDown:Ze},de);function Ue(Ke){var xe=Ne[Ke];if(!xe)return null;var ge=xe.data||{},be=ge.value,re=ge.label,ne=ge.children,se=Object(k.a)(ge,!0),he=Ee?ne:re;return xe?B.createElement("div",Object.assign({"aria-label":typeof he=="string"?he:null},se,{key:Ke,role:"option",id:"".concat(fe,"_list_").concat(Ke),"aria-selected":Te.has(be)}),be):null}return B.createElement(B.Fragment,null,B.createElement("div",{role:"listbox",id:"".concat(fe,"_list"),style:{height:0,width:0,overflow:"hidden"}},Ue(nt-1),Ue(nt),Ue(nt+1)),B.createElement(_.a,{itemKey:"key",ref:et,data:Ne,height:ue,itemHeight:te,fullHeight:!1,onMouseDown:Ze,onScroll:Ie,virtual:Re,onMouseEnter:je},function(Ke,xe){var ge,be=Ke.group,re=Ke.groupOption,ne=Ke.data,se=ne.label,he=ne.key;if(be)return B.createElement("div",{className:O()(Be,"".concat(Be,"-group"))},se!==void 0?se:he);var Le=ne.disabled,Se=ne.value,We=ne.title,it=ne.children,ft=ne.style,lt=ne.className,wt=Object(G.a)(ne,["disabled","value","title","children","style","className"]),St=Te.has(Se),dt="".concat(Be,"-option"),zt=O()(Be,dt,lt,(ge={},Object(P.a)(ge,"".concat(dt,"-grouped"),re),Object(P.a)(ge,"".concat(dt,"-active"),nt===xe&&!Le),Object(P.a)(ge,"".concat(dt,"-disabled"),Le),Object(P.a)(ge,"".concat(dt,"-selected"),St),ge)),It=Ee?it:se,Kt=!_e||typeof _e=="function"||St;return B.createElement("div",Object.assign({},wt,{"aria-selected":St,className:zt,title:We,onMouseMove:function(){if(nt===xe||Le)return;ct(xe)},onClick:function(){Le||at(Se)},style:ft}),B.createElement("div",{className:"".concat(dt,"-content")},It||Se),B.isValidElement(_e)||St,Kt&&B.createElement(C.a,{className:"".concat(Be,"-option-state"),customizeIcon:_e,customizeIconProps:{isSelected:St}},St?"\u2713":null))}))},d=B.forwardRef(S);d.displayName="OptionList";var o=d,l=function(){return null};l.isSelectOption=!0;var h=l,w=function(){return null};w.isSelectOptGroup=!0;var p=w,f=ie("VTBJ"),L=ie("Zm9Q");function g(M){var $=M.key,ee=M.props,oe=ee.children,fe=ee.value,ke=Object(G.a)(ee,["children","value"]);return Object(f.a)({key:$,value:fe!==void 0?fe:$,children:oe},ke)}function m(M){var $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(L.a)(M).map(function(ee,oe){if(!B.isValidElement(ee)||!ee.type)return null;var fe=ee.type.isSelectOptGroup,ke=ee.key,Ee=ee.props,Te=Ee.children,we=Object(G.a)(Ee,["children"]);return $||!fe?g(ee):Object(f.a)(Object(f.a)({key:"__RC_SELECT_GRP__".concat(ke===null?oe:ke,"__"),label:ke},we),{},{options:m(Te)})}).filter(function(ee){return ee})}var c=ie("2Qr1"),u=ie("qNPg"),a=ie("U8pU"),x=ie("Kwbf"),b=ie("WKfj");function E(M){var $=M.mode,ee=M.options,oe=M.children,fe=M.backfill,ke=M.allowClear,Ee=M.placeholder,Te=M.getInputElement,we=M.showSearch,Ce=M.onSearch,me=M.defaultOpen,ue=M.autoFocus,te=M.labelInValue,de=M.value,ae=M.inputValue,_e=M.optionLabelProp,Re=$==="multiple"||$==="tags",ye=we!==void 0?we:Re||$==="combobox",Oe=ee||m(oe);if(Object(x.a)($!=="tags"||Oe.every(function(Be){return!Be.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),$==="tags"||$==="combobox"){var Pe=Oe.some(function(Be){return Be.options?Be.options.some(function(Ne){return typeof("value"in Ne?Ne.value:Ne.key)=="number"}):typeof("value"in Be?Be.value:Be.key)=="number"});Object(x.a)(!Pe,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(x.a)($!=="combobox"||!_e,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(x.a)($==="combobox"||!fe,"`backfill` only works with `combobox` mode."),Object(x.a)($==="combobox"||!Te,"`getInputElement` only work with `combobox` mode."),Object(x.b)($!=="combobox"||!Te||!ke||!Ee,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Ce&&!ye&&$!=="combobox"&&$!=="tags"&&Object(x.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(x.b)(!me||ue,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),de!=null){var Ie=Object(b.d)(de);Object(x.a)(!te||Ie.every(function(Be){return Object(a.a)(Be)==="object"&&("key"in Be||"value"in Be)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(x.a)(!Re||Array.isArray(de),"`value` should be array when `mode` is `multiple` or `tags`")}if(oe){var je=null;Object(L.a)(oe).some(function(Be){if(!B.isValidElement(Be)||!Be.type)return!1;var Ne=Be.type;if(Ne.isSelectOption)return!1;if(Ne.isSelectOptGroup){var et=Object(L.a)(Be.props.children).every(function(Ze){return!B.isValidElement(Ze)||!Be.type||Ze.type.isSelectOption?!0:(je=Ze.type,!1)});return!et}return je=Ne,!0}),je&&Object(x.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(je.displayName||je.name||je,"`.")),Object(x.a)(ae===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var N=E,U=Object(u.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:m,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:N,fillOptionsWithMissingValue:c.a}),K=function(M){Object(D.a)(ee,M);var $=Object(Z.a)(ee);function ee(){var oe;return Object(le.a)(this,ee),oe=$.apply(this,arguments),oe.selectRef=B.createRef(),oe.focus=function(){oe.selectRef.current.focus()},oe.blur=function(){oe.selectRef.current.blur()},oe}return Object(Q.a)(ee,[{key:"render",value:function(){return B.createElement(U,Object.assign({ref:this.selectRef},this.props))}}]),ee}(B.Component);K.Option=h,K.OptGroup=p;var V=K,R=Qe.c=V},M8RZ:function(bt,Qe,ie){"use strict";ie.d(Qe,"a",function(){return I});var le=ie("fWQN"),Q=ie("mtLc"),D=ie("yKVA"),Z=ie("879j"),B=ie("q1tI"),P=ie.n(B),G=ie("i8i4"),j=ie.n(G),I=function(k){Object(D.a)(A,k);var y=Object(Z.a)(A);function A(O){var _;Object(le.a)(this,A),_=y.call(this,O);var C=window.document;return _.node=C.createElement("div"),C.body.appendChild(_.node),_}return Object(Q.a)(A,[{key:"render",value:function(){var _=this.props.children;return Object(G.createPortal)(_,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),A}(P.a.Component)},Ot1p:function(bt,Qe,ie){"use strict";var le=ie("2qtc"),Q=ie("kLXV"),D=ie("rAM+"),Z=ie("miYZ"),B=ie("tsqr"),P=ie("9og8"),G=ie("tJVT"),j=ie("jrin"),I=ie("WmNS"),k=ie.n(I),y=ie("q1tI"),A=ie.n(y),O=ie("VrN/"),_=ie.n(O),C=ie("bdgK"),S=ie("p77/"),d=ie("Bd2K"),o=ie("ELLl"),l=ie("19Vz"),h=ie("lZu9"),w=ie("+NIl"),p=ie("kSUc"),f=ie("9Bee"),L=function(Se){var We=Se.value,it=We===void 0?"":We,ft=Se.className,lt=Se.showTextOnly,wt=Se.showLines,St=Se.style,dt=St===void 0?{}:St,zt=Object(y.useMemo)(function(){return""},[it]);return A.a.createElement(A.a.Fragment,null,A.a.createElement("div",{dangerouslySetInnerHTML:{__html:zt}}))},g=ie("0Owb"),m=ie("dejd"),c=ie("C+DQ"),u=ie("1vsH"),a=ie("m3rI"),x=[{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 b(Se){var We=Se.onActionCallback,it=Se.title,ft=Se.icon,lt=Se.actionName,wt=Se.className,St=wt===void 0?"":wt,dt=Se.children;function zt(){We(lt)}return A.a.createElement("a",{title:it,className:St,onClick:zt},A.a.createElement("i",{className:"md-iconfont ".concat(ft)}),dt)}var E=function(Se){var We=Se.watch,it=Se.showNullButton,ft=Se.onActionCallback,lt=Se.fullScreen,wt=Se.insertTemp,St=Se.hidetoolBar,dt=Se.uuid,zt=Se.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(u.D)("_educoder_session_login"),"&_educoder_session=").concat(Object(u.D)("_educoder_session"),"&key=").concat(dt,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var It=[].concat(x,[{title:"".concat(We?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(We?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return A.a.createElement("ul",{className:"markdown-toolbar-container"},!St&&It.map(function(Kt,Wt){return A.a.createElement("li",{key:Wt},Kt.actionName?A.a.createElement(b,Object(g.a)({},Kt,{onActionCallback:ft})):A.a.createElement("span",{className:"v-line"}))}),it?A.a.createElement("li",null,A.a.createElement(b,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:ft},A.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\u586B\u7A7A\u9879"))):null,wt&&A.a.createElement("li",null,A.a.createElement(b,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(wt),onActionCallback:ft},A.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),A.a.createElement("li",{className:"btn-full-screen"},A.a.createElement(b,{icon:"".concat(lt?"icon-shrink":"icon-enlarge"),title:lt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:ft})))},N=ie("M8RZ"),U=ie("+L6B"),K=ie("2/Rp"),V=ie("y8nQ"),R=ie("Vl3Y"),M=ie("5NDa"),$=ie("5rEg"),ee={labelCol:{span:4},wrapperCol:{span:20}},oe=function(Se){var We=Se.callback,it=Se.onCancel;function ft(lt){We(lt)}return A.a.createElement(R.a,Object(g.a)({},ee,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:ft}),A.a.createElement(R.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},A.a.createElement($.a,null)),A.a.createElement(R.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},A.a.createElement($.a,null)),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(K.a,{type:"ghost",onClick:it},"\u53D6\u6D88")))},fe=ie("7ahc"),ke=ie("k1fw"),Ee=ie("HmJG"),Te=ie("BjJ7"),we=R.a.useForm,Ce={width:280,marginRight:10},me={labelCol:{span:5},wrapperCol:{span:19}},ue=function(Se){var We=Se.callback,it=Se.onCancel,ft=we(),lt=Object(G.a)(ft,1),wt=lt[0],St=Object(y.useRef)();function dt(Kt){We(Object(ke.a)(Object(ke.a)({},Kt),{},{name:St.current}))}function zt(Kt,Wt){wt.setFieldsValue({src:"/api/attachments/".concat(Kt.id,"?type=").concat(Kt.content_type),type:Wt.type})}function It(Kt){var Wt=Kt.target.files[0];St.current=Wt.name,de(Wt,zt)}return A.a.createElement(R.a,Object(g.a)({form:wt},me,{className:"upload-image-panel",onFinish:dt}),A.a.createElement(R.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},A.a.createElement("div",{className:"flex-container"},A.a.createElement(R.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},A.a.createElement($.a,{style:Ce})),A.a.createElement(te,{onFileChange:It}))),A.a.createElement(R.a.Item,{label:"\u6587\u4EF6\u63CF\u8FF0",name:"alt"},A.a.createElement($.a,{style:{width:264}})),A.a.createElement(R.a.Item,{style:{textAlign:"right"}},A.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(K.a,{type:"ghost",onClick:it},"\u53D6\u6D88")))};function te(Se){var We=Se.onFileChange;return A.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",A.a.createElement("input",{type:"file",onChange:We}))}function de(Se,We){if(!Se)throw new String("\u6CA1\u6709\u6587\u4EF6");var it=new FormData;it.append("editormd-image-file",Se),it.append("file_param_name","editormd-image-file"),it.append("byxhr","true");var ft=new window.XMLHttpRequest;ft.withCredentials=!0,ft.addEventListener("load",function(lt){We(JSON.parse(lt.target.responseText),Se)},!1),ft.addEventListener("error",function(lt){console.error(lt)},!1),ft.open("POST","".concat(Te.a,"/api/attachments.json")),ft.send(it)}var ae=ie("giR+"),_e=ie("fyUT"),Re=ie("7Kak"),ye=ie("9yH6"),Oe=ye.a.Group,Pe={margin:"0 8px"},Ie=function(Se){var We=Se.callback,it=Se.onCancel;function ft(lt){We(lt)}return A.a.createElement(R.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:ft},A.a.createElement("div",{className:"flex-container"},A.a.createElement("span",{style:Pe},"\u5355\u5143\u683C\u6570\uFF1A"),A.a.createElement("span",{style:Pe},"\u884C\u6570"),A.a.createElement(R.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},A.a.createElement(_e.a,null)),A.a.createElement("span",{style:Pe},"\u5217\u6570"),A.a.createElement(R.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},A.a.createElement(_e.a,null))),A.a.createElement("div",{className:"flex-container",style:{marginTop:12}},A.a.createElement("span",{style:Pe},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),A.a.createElement(R.a.Item,{name:"align"},A.a.createElement(Oe,null,A.a.createElement(ye.a,{value:"default"},A.a.createElement("i",{className:"fa fa-align-justify"})),A.a.createElement(ye.a,{value:"left"},A.a.createElement("i",{className:"fa fa-align-left"})),A.a.createElement(ye.a,{value:"center"},A.a.createElement("i",{className:"fa fa-align-center"})),A.a.createElement(ye.a,{value:"right"},A.a.createElement("i",{className:"fa fa-align-right"}))))),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(K.a,{type:"ghost",onClick:it},"\u53D6\u6D88")))},je=ie("ErOA"),Be=ie("7Cbv"),Ne="link",et="upload-image",Ze="code-block",$e="add-table",Xe="------------",st={default:Xe,left:":".concat(Xe),center:":".concat(Xe,":"),right:"".concat(Xe,":")},qe=ie("9VGf"),nt,Me;function ct(){}var at=0,Ue=1e4,Ke="\u2581",xe=`
**\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 ge(Se){return/^\d+$/.test(Se)?"".concat(Se,"px"):Se}var be=navigator.platform.toUpperCase().indexOf("MAC")>=0,re=be?"Cmd":"Ctrl",ne=["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=(nt={},Object(j.a)(nt,re+"-B","bold"),Object(j.a)(nt,re+"-I","italic"),nt),he=(Me={},Object(j.a)(Me,Ne,"\u6DFB\u52A0\u94FE\u63A5"),Object(j.a)(Me,Ze,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(j.a)(Me,et,"\u6DFB\u52A0\u6587\u4EF6"),Object(j.a)(Me,$e,"\u6DFB\u52A0\u8868\u683C"),Me),Le=Qe.a=function(Se){var We=Se.defaultValue,it=We===void 0?"":We,ft=Se.onChange,lt=Se.width,wt=lt===void 0?"100%":lt,St=Se.height,dt=St===void 0?400:St,zt=Se.miniToolbar,It=zt===void 0?!1:zt,Kt=Se.isFocus,Wt=Kt===void 0?!1:Kt,_t=Se.watch,Wr=Se.insertTemp,ai=Se.mode,vt=ai===void 0?"markdown":ai,Vr=Se.id,nr=Vr===void 0?"markdown-editor-id":Vr,cr=Se.showResizeBar,Hr=cr===void 0?!1:cr,oi=Se.noStorage,si=oi===void 0?!1:oi,Pt=Se.showNullButton,pt=Pt===void 0?!1:Pt,Pr=Se.hidetoolBar,li=Pr===void 0?!1:Pr,xr=Se.fullScreen,Lt=xr===void 0?!1:xr,Mr=Se.onBlur,Xr=Se.onCMBeforeChange,ui=Se.onFullScreen,Ve=Se.className,Ct=Ve===void 0?"":Ve,hi=Se.disablePaste,_i=hi===void 0?!1:hi,di=Se.placeholder,Li=di===void 0?"":di,z=Se.values,s=z===void 0?"":z,v=Object(y.useState)(null),W=Object(G.a)(v,2),X=W[0],H=W[1],ve=Object(y.useState)(it),He=Object(G.a)(ve,2),Je=He[0],ut=He[1],Ge=Object(y.useState)(_t),Et=Object(G.a)(Ge,2),Dt=Et[0],Vt=Et[1],Ir=Object(y.useState)(Lt),Nr=Object(G.a)(Ir,2),ar=Nr[0],Gr=Nr[1],Hi=Object(y.useState)(""),Er=Object(G.a)(Hi,2),Br=Er[0],kr=Er[1],gi=Object(y.useState)(0),Yr=Object(G.a)(gi,2),ci=Yr[0],ei=Yr[1],dn=Object(y.useState)(dt),Gi=Object(G.a)(dn,2),$r=Gi[0],Ur=Gi[1],ki=Object(y.useState)(!1),Di=Object(G.a)(ki,2),cn=Di[0],Zt=Di[1],Nt=Object(y.useRef)(Object(Be.a)()),fr=Object(y.useRef)(!1),Mt=Object(y.useRef)(),er=Object(y.useRef)(),Ft=Object(y.useRef)(),ti=Object(y.useRef)(),Qt=Object(y.useRef)(),Sr=function(){var mt=Object(P.a)(k.a.mark(function Tt(){var yt,kt;return k.a.wrap(function(Ht){for(;;)switch(Ht.prev=Ht.next){case 0:return Ht.next=2,Object(je.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Nt.current}});case 2:kt=Ht.sent,kt!=null&&(yt=kt.attachments)!==null&&yt!==void 0&&yt.length&&(console.log("cm:",X,er),kt.attachments.map(function(Ot){Ot.content_type.indexOf("image")>-1?X.replaceSelection("![,](/api/attachments/".concat(Ot.id,"?type=").concat(Ot.content_type,")")):Ot.content_type.indexOf("video")>-1?X.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Ot.content_type.indexOf("pdf")>-1?X.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ot.id,"?type=").concat(Ot.content_type,'&disposition=inline" target="_blank">').concat(Ot.name,"</a>")):X.replaceSelection("[".concat(Ot.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Ot.id,"?type=").concat(Ot.content_type,")"))}));case 4:case"end":return Ht.stop()}},Tt)}));return function(){return mt.apply(this,arguments)}}();Object(y.useEffect)(function(){ut(s),X==null||X.setValue(s)},[s]),Object(y.useEffect)(function(){ui==null||ui(ar)},[ar]),Object(y.useEffect)(function(){if(er.current){var mt=_.a.fromTextArea(er.current,{mode:vt,lineNumbers:!It,lineWrapping:!0,value:it,autoCloseTags:!0,autoCloseBrackets:!0});Wt&&mt.focus();function Tt(yt,kt){if(_i){kt.preventDefault();return}var Bt=kt.clipboardData;if(Bt){var Ht=Bt.types.toString(),Ot=Bt.items;if(Ht==="Files"||Bt.types.indexOf("Files")>-1){if(kt.preventDefault(),vt=="stex")return;try{var tr,Cr=Ot[1];((tr=Ot[0])===null||tr===void 0?void 0:tr.kind)==="file"&&(Cr=Ot[0]);var Rt=Cr.getAsFile(),yi=Rt.name.split(".").pop();de(Rt,function(Ut){if(Ut.id){var sr,zr,Kr;(Rt==null||((sr=Rt.type)===null||sr===void 0)?void 0:sr.indexOf("image"))>-1?mt.replaceSelection("![,](/api/attachments/".concat(Ut.id,"?type=").concat(Ut.content_type,")")):(Rt==null||((zr=Rt.type)===null||zr===void 0)?void 0:zr.indexOf("video"))>-1?mt.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,'"></video>')):(Rt==null||((Kr=Rt.type)===null||Kr===void 0)?void 0:Kr.indexOf("pdf"))>-1?mt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,"?type=").concat(Rt.type,'&disposition=inline" target="_blank">').concat(Rt.name,"</a>")):ne.includes(yi)?mt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,'?type=office&disposition=inline" target="_blank">').concat(Rt.name,"</a>")):mt.replaceSelection("[".concat(Rt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,"?type=").concat(Ut.content_type,")"))}else(Ut==null?void 0:Ut.status)===401&&(document.location.href="/user/login")})}catch(Ut){B.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return mt.on("paste",Tt),mt.on("dragleave",function(yt,kt){Ft.current.classList.remove("mouse-hover-md")}),mt.on("dragover",function(yt,kt){Ft.current.classList.add("mouse-hover-md")}),mt.on("drop",function(yt,kt){Ft.current.classList.add("mouse-hover-md");var Bt;if(Bt=kt.dataTransfer.files,Bt.length>0){kt.preventDefault(),kt.stopPropagation();for(var Ht=function(Cr){var Rt=Bt[Cr],yi=Rt.name.split(".").pop();de(Rt,function(Ut){if(Ut.id){var sr,zr,Kr;(Rt==null||((sr=Rt.type)===null||sr===void 0)?void 0:sr.indexOf("image"))>-1?mt.replaceSelection("![,](/api/attachments/".concat(Ut.id,"?type=").concat(Ut.content_type,")")):(Rt==null||((zr=Rt.type)===null||zr===void 0)?void 0:zr.indexOf("video"))>-1?mt.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,'"></video>')):(Rt==null||((Kr=Rt.type)===null||Kr===void 0)?void 0:Kr.indexOf("pdf"))>-1?mt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,"?type=").concat(Rt.type,'&disposition=inline" target="_blank">').concat(Rt.name,"</a>")):ne.includes(yi)?mt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,'?type=office&disposition=inline" target="_blank">').concat(Rt.name,"</a>")):mt.replaceSelection("[".concat(Rt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,"?type=").concat(Ut.content_type,")"))}else(Ut==null?void 0:Ut.status)===401&&(document.location.href="/user/login")})},Ot=0;Ot<Bt.length;Ot++)Ht(Ot)}}),H(mt),function(){mt.off("paste",Tt)}}},[]);var zi=Object(y.useCallback)(function(){if(Ft.current)try{}catch(mt){console.log(mt,"---- to set md editor body height")}},[$r,Ft,ar]);Object(y.useEffect)(function(){function mt(){var yt=new C.default(function(kt){var Bt=Object(D.a)(kt),Ht;try{for(Bt.s();!(Ht=Bt.n()).done;){var Ot=Ht.value;(Ot.target.offsetHeight>0||Ot.target.offsetWidth>0)&&(zi(),X.setSize("100%","100%"),X.refresh())}}catch(tr){Bt.e(tr)}finally{Bt.f()}});return yt.observe(er.current.parentElement),yt}if(X){var Tt=mt();return function(){Tt.unobserve(er.current.parentElement)}}},[X,zi]),Object(y.useEffect)(function(){if(X){for(var mt=[],Tt=function(){var Ot=kt[yt];Bt=Object(G.a)(Ot,2);var tr=Bt[0],Cr=Bt[1],Rt=Object(j.a)({},tr,function(){Ki(Cr)});mt.push(Rt),X.addKeyMap(Rt)},yt=0,kt=Object.entries(se);yt<kt.length;yt++){var Bt;Tt()}return Mt.current=setInterval(function(){fr.current&&Sr()},4e3),function(){clearInterval(Mt.current);var Ht=Object(D.a)(mt),Ot;try{for(Ht.s();!(Ot=Ht.n()).done;){var tr=Ot.value;X.removeKeyMap(tr)}}catch(Cr){Ht.e(Cr)}finally{Ht.f()}}}},[X]),Object(y.useEffect)(function(){Lt!==ar&&Gr(Lt)},[Lt]),Object(qe.a)(function(){if(!si&&ci>0){var mt=new Date().getTime(),Tt=window.sessionStorage.getItem(nr);mt>=ci+Ue&&(!Tt||Tt!==Je)&&(window.sessionStorage.setItem(nr,Je),Zt(!0))}},Ue),Object(y.useEffect)(function(){Vt(_t)},[X,_t]),Object(y.useEffect)(function(){X&&(Wt&&X.focus())},[X,Wt]),Object(y.useEffect)(function(){if(Dt&&X){var mt=X.getScrollerElement();function Tt(yt){var kt=yt.target;if(Qt.current){var Bt=kt.scrollTop/kt.scrollHeight;Qt.current.scrollTop=Qt.current.scrollHeight*Bt}}return mt.addEventListener("scroll",Tt),function(){mt.removeEventListener("scroll",Tt)}}},[X,Dt]),Object(y.useEffect)(function(){if(X&&Xr){function mt(Tt,yt){Xr(Tt,yt)}return X.on("beforeChange",mt),function(){X.off("beforeChange",mt)}}},[X,Xr]),Object(y.useEffect)(function(){if(X&&Mr){function mt(){Mr(X.getValue())}return X.on("blur",mt),function(){X.off("blur",mt)}}},[X,Mr]),Object(y.useEffect)(function(){if(X){function mt(Tt){var yt=Tt.getValue();ut(yt),ei(new Date().getTime()),Tt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),ft&&ft(yt)}return X.on("change",mt),function(){X.off("change",mt)}}},[X,ft]),Object(y.useEffect)(function(){X&&(it==null?(X.setValue(""),ut("")):it!==X.getValue()&&(X.setValue(it),ut(it),X.setCursor(X.lineCount(),0)))},[X,it]);var Ki=Object(y.useCallback)(function(mt){var Tt=X.getCursor(),yt=X.getSelection(),kt=yt.split(`
`);switch(mt){case"bold":return X.replaceSelection("**"+yt+"**"),yt===""&&X.setCursor(Tt.line,Tt.ch+2),X.focus();case"italic":return X.replaceSelection("*"+yt+"*"),yt===""&&X.setCursor(Tt.line,Tt.ch+1),X.focus();case"code":return X.replaceSelection("`"+yt+"`"),yt===""&&X.setCursor(Tt.line,Tt.ch+1),X.focus();case"inline-latex":return X.replaceSelection("`$$"+yt+"$$`"),yt===""&&X.setCursor(Tt.line,Tt.ch+3),X.focus();case"latex":return X.replaceSelection("```latex\n"+yt+"\n```"),X.setCursor(Tt.line+1,yt.length+1),X.focus();case"line-break":return X.replaceSelection(`<br/>
`),X.focus();case"list-ul":return yt===""?X.replaceSelection("- "+yt):X.replaceSelection(kt.map(function(Bt){return Bt===""?"":"- ".concat(Bt)}).join(`
`)),X.focus();case"list-ol":return yt===""?X.replaceSelection("1. "+yt):X.replaceSelection(kt.map(function(Bt,Ht){return Bt===""?"":"".concat(Ht+1,". ").concat(Bt)}).join(`
`)),X.focus();case"add-null-ch":return yt===""&&X.setCursor(Tt.line,Tt.ch+1),X.replaceSelection(Ke),X.focus();case"inster-template-1":return yt===""&&X.setCursor(Tt.line,Tt.ch),X.replaceSelection(xe),X.focus();case"eraser":return X.setValue(""),X.focus();case"trigger-watch":return Vt(!Dt),X.focus();case"trigger-full-screen":return Gr(!ar),X.focus();case Ne:kr(Ne);return;case Ze:kr(Ze);return;case et:kr(et);return;case $e:kr($e);return;default:throw new Error}},[X,Dt,ar]),vi=Object(y.useCallback)(function(mt){kr("");switch(Br){case Ne:var Tt=mt.title,yt=mt.link;return X.replaceSelection("[".concat(Tt,"](").concat(yt,")")),X.focus();case Ze:var kt=mt.language,Bt=mt.content;return X.replaceSelection(["```"+kt,Bt,"```"].join(`
`)),X.focus();case et:var Ht=mt.src,Ot=mt.alt,tr=mt.name;return Ht.indexOf("type=image")>-1?X.replaceSelection("![ ".concat(Ot||""," ]( ").concat(Ht,' "').concat(Ot||"",'" )')):Ht.indexOf("type=application/pdf")>-1?X.replaceSelection('<a href="'.concat(Ht,'&disposition=inline" target="_blank">').concat(tr,"</a>")):X.replaceSelection('<a href="'.concat(Ht,'" target="_blank">').concat(tr,"</a>")),X.focus();case $e:for(var Cr=mt.row,Rt=mt.col,yi=mt.align,Ut=`
`,sr=0;sr<Cr;sr++){for(var zr=[],Kr=[],Wn=0;Wn<Rt;Wn++)sr===1&&Kr.push(st[yi]),zr.push(" ");sr===1&&(Ut+="| ".concat(Kr.join(" | "),` |
`)),Ut+="| ".concat(zr.join(Rt===1?"":" | "),` |
`)}return X.replaceSelection(Ut+`
`),X.focus();default:throw new Error}},[X,Br]),Fn=Object(y.useMemo)(function(){switch(Br){case Ne:return A.a.createElement(oe,{callback:vi,onCancel:Dr});case Ze:return A.a.createElement(fe.b,{callback:vi,onCancel:Dr});case et:return A.a.createElement(ue,{callback:vi,onCancel:Dr});case $e:return A.a.createElement(Ie,{callback:vi,onCancel:Dr});default:return null}},[Br]);function Dr(){kr("")}Object(y.useEffect)(function(){if(ti.current){var mt=ti.current,Tt=!1,yt=0;function kt(Ot){Tt=!0,yt=Ot.pageY}function Bt(){Tt=!1}function Ht(Ot){if(Tt){var tr=Ot.pageY-yt;tr<0&&(tr=0),tr>300&&(tr=300);var Cr=dt+tr+"px";Ur(Cr)}}return mt.addEventListener("mousedown",kt),document.addEventListener("mousemove",Ht),document.addEventListener("mouseup",Bt),function(){mt.removeEventListener("mousedown",kt),document.removeEventListener("mousemove",Ht),document.removeEventListener("mouseup",Bt)}}},[X,ti]),Object(y.useEffect)(function(){Ur(dt)},[dt]);var fn=ge(wt),Zr=ge($r),Vi={width:fn,height:Zr},jn=Object(y.useMemo)(function(){if(ci){var mt=new Date(ci),Tt=mt.getHours(),yt=mt.getMinutes(),kt=mt.getSeconds();return Tt=Tt<10?"0"+Tt:Tt,yt=yt<10?"0"+yt:yt,kt=kt<10?"0"+kt:kt,"".concat(Tt,":").concat(yt,":").concat(kt)}return 0},[ci]);function Ri(){window.sessionStorage.removeItem(nr),Zt(!1),ei(0)}function $a(){Zt(!1),ei(0),X.setValue(window.sessionStorage.getItem(nr))}function ha(mt,Tt){var yt=X.getValue();yt=yt.replace(mt,Tt),ut(yt),X==null||X.setValue(yt)}return A.a.createElement(y.Fragment,null,A.a.createElement("div",{className:"markdown-editor-wrapper",ref:Ft},A.a.createElement("div",{className:"markdown-editor-container ".concat(Ct," ").concat(Dt?"on-preview":""," ").concat(It?"mini":""," ").concat(ar?"full-screen":""),style:Vi},A.a.createElement(E,{insertTemp:Wr,watch:Dt,fullScreen:ar,showNullButton:pt,onActionCallback:Ki,hidetoolBar:li,uuid:Nt.current,setOpenPhones:function(){fr.current=!0}}),A.a.createElement("div",{className:"markdown-editor-body"},A.a.createElement("div",{className:"codemirror-container"},A.a.createElement("textarea",{ref:er,placeholder:Li})),Dt?A.a.createElement("div",{ref:Qt,className:"preview-container"},vt==="stex"&&A.a.createElement(L,{value:Je}),vt!=="stex"&&A.a.createElement(f.a,{edit:!0,value:Je,replaces:ha})):null))),Hr?A.a.createElement("a",{ref:ti,className:"editor-resize"}):null,A.a.createElement(N.a,null,he[Br]?A.a.createElement(Q.a,{centered:!0,title:he[Br],visible:!0,onCancel:Dr,footer:null},Fn):null))}},SJMd:function(bt,Qe){/**
* @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 ie,le,Q,D=!1,Z,B;window.PR_SHOULD_USE_CONTINUATION=!0;var P,G;(function(){var j=window,I=["break,continue,do,else,for,if,return,while"],k=[I,"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"],y=[k,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],A=[y,"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"],O=[y,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],_=[y,"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"],C="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",S=[y,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],d="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",o=[I,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],l=[I,"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"],h=[I,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],w=[A,_,O,S,d,o,l,h],p=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,f="str",L="kwd",g="com",m="typ",c="lit",u="pun",a="pln",x="tag",b="dec",E="src",N="atn",U="atv",K="nocode",V="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function R(ye){for(var Oe=0,Pe=!1,Ie=!1,je=0,Be=ye.length;je<Be;++je){var Ne=ye[je];if(Ne.ignoreCase)Ie=!0;else if(/[a-z]/i.test(Ne.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Pe=!0,Ie=!1;break}}var et={b:8,t:9,n:10,v:11,f:12,r:13};function Ze(nt){var Me=nt.charCodeAt(0);if(Me!==92)return Me;var ct=nt.charAt(1);return Me=et[ct],Me||("0"<=ct&&ct<="7"?parseInt(nt.substring(1),8):ct==="u"||ct==="x"?parseInt(nt.substring(2),16):nt.charCodeAt(1))}function $e(nt){if(nt<32)return(nt<16?"\\x0":"\\x")+nt.toString(16);var Me=String.fromCharCode(nt);return Me==="\\"||Me==="-"||Me==="]"||Me==="^"?"\\"+Me:Me}function Xe(nt){var Me=nt.substring(1,nt.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")),ct=[],at=Me[0]==="^",Ue=["["];at&&Ue.push("^");for(var Ke=at?1:0,xe=Me.length;Ke<xe;++Ke){var ge=Me[Ke];if(/\\[bdsw]/i.test(ge))Ue.push(ge);else{var be=Ze(ge),re;Ke+2<xe&&Me[Ke+1]==="-"?(re=Ze(Me[Ke+2]),Ke+=2):re=be,ct.push([be,re]),re<65||be>122||(re<65||be>90||ct.push([Math.max(65,be)|32,Math.min(re,90)|32]),re<97||be>122||ct.push([Math.max(97,be)&~32,Math.min(re,122)&~32]))}}ct.sort(function(Le,Se){return Le[0]-Se[0]||Se[1]-Le[1]});for(var ne=[],se=[],Ke=0;Ke<ct.length;++Ke){var he=ct[Ke];he[0]<=se[1]+1?se[1]=Math.max(se[1],he[1]):ne.push(se=he)}for(var Ke=0;Ke<ne.length;++Ke){var he=ne[Ke];Ue.push($e(he[0])),he[1]>he[0]&&(he[1]+1>he[0]&&Ue.push("-"),Ue.push($e(he[1])))}return Ue.push("]"),Ue.join("")}function st(nt){for(var Me=nt.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")),ct=Me.length,at=[],Ue=0,Ke=0;Ue<ct;++Ue){var xe=Me[Ue];if(xe==="(")++Ke;else if(xe.charAt(0)==="\\"){var ge=+xe.substring(1);ge&&(ge<=Ke?at[ge]=-1:Me[Ue]=$e(ge))}}for(var Ue=1;Ue<at.length;++Ue)at[Ue]===-1&&(at[Ue]=++Oe);for(var Ue=0,Ke=0;Ue<ct;++Ue){var xe=Me[Ue];if(xe==="(")++Ke,at[Ke]||(Me[Ue]="(?:");else if(xe.charAt(0)==="\\"){var ge=+xe.substring(1);ge&&ge<=Ke&&(Me[Ue]="\\"+at[ge])}}for(var Ue=0;Ue<ct;++Ue)Me[Ue]==="^"&&Me[Ue+1]!=="^"&&(Me[Ue]="");if(nt.ignoreCase&&Pe)for(var Ue=0;Ue<ct;++Ue){var xe=Me[Ue],be=xe.charAt(0);xe.length>=2&&be==="["?Me[Ue]=Xe(xe):be!=="\\"&&(Me[Ue]=xe.replace(/[a-zA-Z]/g,function(se){var he=se.charCodeAt(0);return"["+String.fromCharCode(he&~32,he|32)+"]"}))}return Me.join("")}for(var qe=[],je=0,Be=ye.length;je<Be;++je){var Ne=ye[je];if(Ne.global||Ne.multiline)throw new Error(""+Ne);qe.push("(?:"+st(Ne)+")")}return new RegExp(qe.join("|"),Ie?"gi":"g")}function M(ye,Oe){var Pe=/(?:^|\s)nocode(?:\s|$)/,Ie=[],je=0,Be=[],Ne=0;function et(Ze){var $e=Ze.nodeType;if($e==1){if(Pe.test(Ze.className))return;for(var Xe=Ze.firstChild;Xe;Xe=Xe.nextSibling)et(Xe);var st=Ze.nodeName.toLowerCase();(st==="br"||st==="li")&&(Ie[Ne]=`
`,Be[Ne<<1]=je++,Be[Ne++<<1|1]=Ze)}else if($e==3||$e==4){var qe=Ze.nodeValue;qe.length&&(Oe?qe=qe.replace(/\r\n?/g,`
`):qe=qe.replace(/[ \t\r\n]+/g," "),Ie[Ne]=qe,Be[Ne<<1]=je,je+=qe.length,Be[Ne++<<1|1]=Ze)}}return et(ye),{sourceCode:Ie.join("").replace(/\n$/,""),spans:Be}}function $(ye,Oe,Pe,Ie,je){if(!Pe)return;var Be={sourceNode:ye,pre:1,langExtension:null,numberLines:null,sourceCode:Pe,spans:null,basePos:Oe,decorations:null};Ie(Be),je.push.apply(je,Be.decorations)}var ee=/\S/;function oe(ye){for(var Oe=void 0,Pe=ye.firstChild;Pe;Pe=Pe.nextSibling){var Ie=Pe.nodeType;Oe=Ie===1?Oe?ye:Pe:Ie===3&&ee.test(Pe.nodeValue)?ye:Oe}return Oe===ye?void 0:Oe}function fe(ye,Oe){var Pe={},Ie;(function(){for(var Ne=ye.concat(Oe),et=[],Ze={},$e=0,Xe=Ne.length;$e<Xe;++$e){var st=Ne[$e],qe=st[3];if(qe)for(var nt=qe.length;--nt>=0;)Pe[qe.charAt(nt)]=st;var Me=st[1],ct=""+Me;Ze.hasOwnProperty(ct)||(et.push(Me),Ze[ct]=null)}et.push(/[\0-\uffff]/),Ie=R(et)})();var je=Oe.length,Be=function(Ne){for(var et=Ne.sourceCode,Ze=Ne.basePos,$e=Ne.sourceNode,Xe=[Ze,a],st=0,qe=et.match(Ie)||[],nt={},Me=0,ct=qe.length;Me<ct;++Me){var at=qe[Me],Ue=nt[at],Ke=void 0,xe;if(typeof Ue=="string")xe=!1;else{var ge=Pe[at.charAt(0)];if(ge)Ke=at.match(ge[1]),Ue=ge[0];else{for(var be=0;be<je;++be)if(ge=Oe[be],Ke=at.match(ge[1]),Ke){Ue=ge[0];break}Ke||(Ue=a)}xe=Ue.length>=5&&Ue.substring(0,5)==="lang-",xe&&!(Ke&&typeof Ke[1]=="string")&&(xe=!1,Ue=E),xe||(nt[at]=Ue)}var re=st;if(st+=at.length,!xe)Xe.push(Ze+re,Ue);else{var ne=Ke[1],se=at.indexOf(ne),he=se+ne.length;Ke[2]&&(he=at.length-Ke[2].length,se=he-ne.length);var Le=Ue.substring(5);$($e,Ze+re,at.substring(0,se),Be,Xe),$($e,Ze+re+se,ne,ue(Le,ne),Xe),$($e,Ze+re+he,at.substring(he),Be,Xe)}}Ne.decorations=Xe};return Be}function ke(ye){var Oe=[],Pe=[];ye.tripleQuotedStrings?Oe.push([f,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ye.multiLineStrings?Oe.push([f,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Oe.push([f,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ye.verbatimStrings&&Pe.push([f,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ie=ye.hashComments;Ie&&(ye.cStyleComments?(Ie>1?Oe.push([g,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Oe.push([g,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Pe.push([f,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Oe.push([g,/^#[^\r\n]*/,null,"#"])),ye.cStyleComments&&(Pe.push([g,/^\/\/[^\r\n]*/,null]),Pe.push([g,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var je=ye.regexLiterals;if(je){var Be=je>1?"":`
\r`,Ne=Be?".":"[\\S\\s]",et="/(?=[^/*"+Be+"])(?:[^/\\x5B\\x5C"+Be+"]|\\x5C"+Ne+"|\\x5B(?:[^\\x5C\\x5D"+Be+"]|\\x5C"+Ne+")*(?:\\x5D|$))+/";Pe.push(["lang-regex",RegExp("^"+V+"("+et+")")])}var Ze=ye.types;Ze&&Pe.push([m,Ze]);var $e=(""+ye.keywords).replace(/^ | $/g,"");$e.length&&Pe.push([L,new RegExp("^(?:"+$e.replace(/[\s,]+/g,"|")+")\\b"),null]),Oe.push([a,/^\s+/,null,` \r
\xA0`]);var Xe="^.[^\\s\\w.$@'\"`/\\\\]*";return ye.regexLiterals&&(Xe+="(?!s*/)"),Pe.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[m,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[c,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[u,new RegExp(Xe),null]),fe(Oe,Pe)}var Ee=ke({keywords:w,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Te(ye,Oe,Pe){for(var Ie=/(?:^|\s)nocode(?:\s|$)/,je=/\r\n?|\n/,Be=ye.ownerDocument,Ne=Be.createElement("li");ye.firstChild;)Ne.appendChild(ye.firstChild);var et=[Ne];function Ze(Me){var ct=Me.nodeType;if(ct==1&&!Ie.test(Me.className))if(Me.nodeName==="br")$e(Me),Me.parentNode&&Me.parentNode.removeChild(Me);else for(var at=Me.firstChild;at;at=at.nextSibling)Ze(at);else if((ct==3||ct==4)&&Pe){var Ue=Me.nodeValue,Ke=Ue.match(je);if(Ke){var xe=Ue.substring(0,Ke.index);Me.nodeValue=xe;var ge=Ue.substring(Ke.index+Ke[0].length);if(ge){var be=Me.parentNode;be.insertBefore(Be.createTextNode(ge),Me.nextSibling)}$e(Me),xe||Me.parentNode.removeChild(Me)}}}function $e(Me){for(;!Me.nextSibling;)if(Me=Me.parentNode,!Me)return;function ct(Ke,xe){var ge=xe?Ke.cloneNode(!1):Ke,be=Ke.parentNode;if(be){var re=ct(be,1),ne=Ke.nextSibling;re.appendChild(ge);for(var se=ne;se;se=ne)ne=se.nextSibling,re.appendChild(se)}return ge}for(var at=ct(Me.nextSibling,0),Ue;(Ue=at.parentNode)&&Ue.nodeType===1;)at=Ue;et.push(at)}for(var Xe=0;Xe<et.length;++Xe)Ze(et[Xe]);Oe===(Oe|0)&&et[0].setAttribute("value",Oe);var st=Be.createElement("ol");st.className="linenums";for(var qe=Math.max(0,Oe-1|0)||0,Xe=0,nt=et.length;Xe<nt;++Xe)Ne=et[Xe],Ne.className="L"+(Xe+qe)%10,Ne.firstChild||Ne.appendChild(Be.createTextNode("\xA0")),st.appendChild(Ne);ye.appendChild(st)}function we(ye){var Oe=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Oe=Oe&&+Oe[1]<=8;var Pe=/\n/g,Ie=ye.sourceCode,je=Ie.length,Be=0,Ne=ye.spans,et=Ne.length,Ze=0,$e=ye.decorations,Xe=$e.length,st=0;$e[Xe]=je;var qe,nt;for(nt=qe=0;nt<Xe;)$e[nt]!==$e[nt+2]?($e[qe++]=$e[nt++],$e[qe++]=$e[nt++]):nt+=2;for(Xe=qe,nt=qe=0;nt<Xe;){for(var Me=$e[nt],ct=$e[nt+1],at=nt+2;at+2<=Xe&&$e[at+1]===ct;)at+=2;$e[qe++]=Me,$e[qe++]=ct,nt=at}Xe=$e.length=qe;var Ue=ye.sourceNode,Ke="";Ue&&(Ke=Ue.style.display,Ue.style.display="none");try{for(var xe=null;Ze<et;){var ge=Ne[Ze],be=Ne[Ze+2]||je,re=$e[st+2]||je,at=Math.min(be,re),ne=Ne[Ze+1],se;if(ne.nodeType!==1&&(se=Ie.substring(Be,at))){Oe&&(se=se.replace(Pe,"\r")),ne.nodeValue=se;var he=ne.ownerDocument,Le=he.createElement("span");Le.className=$e[st+1];var Se=ne.parentNode;Se.replaceChild(Le,ne),Le.appendChild(ne),Be<be&&(Ne[Ze+1]=ne=he.createTextNode(Ie.substring(at,be)),Se.insertBefore(ne,Le.nextSibling))}Be=at,Be>=be&&(Ze+=2),Be>=re&&(st+=2)}}finally{Ue&&(Ue.style.display=Ke)}}var Ce={};function me(ye,Oe){for(var Pe=Oe.length;--Pe>=0;){var Ie=Oe[Pe];Ce.hasOwnProperty(Ie)?j.console&&console.warn("cannot override language handler %s",Ie):Ce[Ie]=ye}}function ue(ye,Oe){return ye&&Ce.hasOwnProperty(ye)||(ye=/^\s*</.test(Oe)?"default-markup":"default-code"),Ce[ye]}me(Ee,["default-code"]),me(fe([],[[a,/^[^<?]+/],[b,/^<!\w[^>]*(?:>|$)/],[g,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[u,/^(?:<[%?]|[%?]>)/],["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"]),me(fe([[a,/^[\s]+/,null,` \r
`],[U,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[x,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[N,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[u,/^[=<>\/]+/],["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"]),me(fe([],[[U,/^[\s\S]+/]]),["uq.val"]),me(ke({keywords:A,hashComments:!0,cStyleComments:!0,types:p}),["c","cc","cpp","cxx","cyc","m"]),me(ke({keywords:"null,true,false"}),["json"]),me(ke({keywords:_,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:p}),["cs"]),me(ke({keywords:O,cStyleComments:!0}),["java"]),me(ke({keywords:h,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),me(ke({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),me(ke({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),me(ke({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),me(ke({keywords:S,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),me(ke({keywords:C,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),me(fe([],[[f,/^[\s\S]+/]]),["regex"]);function te(ye){var Oe=ye.langExtension;try{var Pe=M(ye.sourceNode,ye.pre),Ie=Pe.sourceCode;ye.sourceCode=Ie,ye.spans=Pe.spans,ye.basePos=0,ue(Oe,Ie)(ye),we(ye)}catch(je){j.console&&console.log(je&&je.stack||je)}}function de(ye,Oe,Pe){var Ie=Pe||!1,je=Oe||null,Be=document.createElement("div");Be.innerHTML="<pre>"+ye+"</pre>",Be=Be.firstChild,Ie&&Te(Be,Ie,!0);var Ne={langExtension:je,numberLines:Ie,sourceNode:Be,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return te(Ne),Be.innerHTML}function ae(ye,Oe){var Pe=Oe||document.body,Ie=Pe.ownerDocument||document;function je(ge){return Pe.getElementsByTagName(ge)}for(var Be=[je("pre"),je("code"),je("xmp")],Ne=[],et=0;et<Be.length;++et)for(var Ze=0,$e=Be[et].length;Ze<$e;++Ze)Ne.push(Be[et][Ze]);Be=null;var Xe=Date;Xe.now||(Xe={now:function(){return+new Date}});var st=0,qe=/\blang(?:uage)?-([\w.]+)(?!\S)/,nt=/\bprettyprint\b/,Me=/\bprettyprinted\b/,ct=/pre|xmp/i,at=/^code$/i,Ue=/^(?:pre|code|xmp)$/i,Ke={};function xe(){for(var ge=j.PR_SHOULD_USE_CONTINUATION?Xe.now()+250:Infinity;st<Ne.length&&Xe.now()<ge;st++){for(var be=Ne[st],re=Ke,ne=be;ne=ne.previousSibling;){var se=ne.nodeType,he=(se===7||se===8)&&ne.nodeValue;if(he?!/^\??prettify\b/.test(he):se!==3||/\S/.test(ne.nodeValue))break;if(he){re={},he.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Wt,_t,Wr){re[_t]=Wr});break}}var Le=be.className;if((re!==Ke||nt.test(Le))&&!Me.test(Le)){for(var Se=!1,We=be.parentNode;We;We=We.parentNode){var it=We.tagName;if(Ue.test(it)&&We.className&&nt.test(We.className)){Se=!0;break}}if(!Se){be.className+=" prettyprinted";var ft=re.lang;if(!ft){ft=Le.match(qe);var lt;!ft&&(lt=oe(be))&&at.test(lt.tagName)&&(ft=lt.className.match(qe)),ft&&(ft=ft[1])}var wt;if(ct.test(be.tagName))wt=1;else{var St=be.currentStyle,dt=Ie.defaultView,zt=St?St.whiteSpace:dt&&dt.getComputedStyle?dt.getComputedStyle(be,null).getPropertyValue("white-space"):0;wt=zt&&zt.substring(0,3)==="pre"}var It=re.linenums;(It=It==="true"||+It)||(It=Le.match(/\blinenums\b(?::(\d+))?/),It=It?It[1]&&It[1].length?+It[1]:!0:!1),It&&Te(be,It,wt);var Kt={langExtension:ft,sourceNode:be,numberLines:It,pre:wt,sourceCode:null,basePos:null,spans:null,decorations:null};te(Kt)}}}st<Ne.length?j.setTimeout(xe,250):typeof ye=="function"&&ye()}xe()}var _e=j.PR={createSimpleLexer:fe,registerLangHandler:me,sourceDecorator:ke,PR_ATTRIB_NAME:N,PR_ATTRIB_VALUE:U,PR_COMMENT:g,PR_DECLARATION:b,PR_KEYWORD:L,PR_LITERAL:c,PR_NOCODE:K,PR_PLAIN:a,PR_PUNCTUATION:u,PR_SOURCE:E,PR_STRING:f,PR_TAG:x,PR_TYPE:m,prettyPrintOne:D?j.prettyPrintOne=de:P=de,prettyPrint:G=D?j.prettyPrint=ae:G=ae},Re=j.define;typeof Re=="function"&&Re.amd&&Re("google-code-prettify",[],function(){return _e})})()},"VrN/":function(bt,Qe,ie){(function(le,Q){bt.exports=Q()})(this,function(){"use strict";var le=navigator.userAgent,Q=navigator.platform,D=/gecko\/\d/i.test(le),Z=/MSIE \d/.test(le),B=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(le),P=/Edge\/(\d+)/.exec(le),G=Z||B||P,j=G&&(Z?document.documentMode||6:+(P||B)[1]),I=!P&&/WebKit\//.test(le),k=I&&/Qt\/\d+\.\d+/.test(le),y=!P&&/Chrome\//.test(le),A=/Opera\//.test(le),O=/Apple Computer/.test(navigator.vendor),_=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(le),C=/PhantomJS/.test(le),S=!P&&/AppleWebKit/.test(le)&&/Mobile\/\w+/.test(le),d=/Android/.test(le),o=S||d||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(le),l=S||/Mac/.test(Q),h=/\bCrOS\b/.test(le),w=/win/i.test(Q),p=A&&le.match(/Version\/(\d*\.\d*)/);p&&(p=Number(p[1])),p&&p>=15&&(A=!1,I=!0);var f=l&&(k||A&&(p==null||p<12.11)),L=D||G&&j>=9;function g(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var m=function(e,t){var i=e.className,r=g(t).exec(i);if(r){var n=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(n?r[1]+n:"")}};function c(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function u(e,t){return c(e).appendChild(t)}function a(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),typeof t=="string")n.appendChild(document.createTextNode(t));else if(t)for(var T=0;T<t.length;++T)n.appendChild(t[T]);return n}function x(e,t,i,r){var n=a(e,t,i,r);return n.setAttribute("role","presentation"),n}var b;document.createRange?b=function(e,t,i,r){var n=document.createRange();return n.setEnd(r||e,i),n.setStart(e,t),n}:b=function(e,t,i){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(n){return r}return r.collapse(!0),r.moveEnd("character",i),r.moveStart("character",t),r};function E(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 N(){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 U(e,t){var i=e.className;g(t).test(i)||(e.className+=(i?" ":"")+t)}function K(e,t){for(var i=e.split(" "),r=0;r<i.length;r++)i[r]&&!g(i[r]).test(t)&&(t+=" "+i[r]);return t}var V=function(e){e.select()};S?V=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:G&&(V=function(e){try{e.select()}catch(t){}});function R(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function M(e,t,i){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(i!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function $(e,t,i,r,n){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var T=r||0,F=n||0;;){var Y=e.indexOf(" ",T);if(Y<0||Y>=t)return F+(t-T);F+=Y-T,F+=i-F%i,T=Y+1}}var ee=function(){this.id=null,this.f=null,this.time=0,this.handler=R(this.onTimeout,this)};ee.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ee.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=i)};function oe(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}var fe=50,ke={toString:function(){return"CodeMirror.Pass"}},Ee={scroll:!1},Te={origin:"*mouse"},we={origin:"+move"};function Ce(e,t,i){for(var r=0,n=0;;){var T=e.indexOf(" ",r);T==-1&&(T=e.length);var F=T-r;if(T==e.length||n+F>=t)return r+Math.min(F,t-n);if(n+=T-r,n+=i-n%i,r=T+1,n>=t)return r}}var me=[""];function ue(e){for(;me.length<=e;)me.push(te(me)+" ");return me[e]}function te(e){return e[e.length-1]}function de(e,t){for(var i=[],r=0;r<e.length;r++)i[r]=t(e[r],r);return i}function ae(e,t,i){for(var r=0,n=i(t);r<e.length&&i(e[r])<=n;)r++;e.splice(r,0,t)}function _e(){}function Re(e,t){var i;return Object.create?i=Object.create(e):(_e.prototype=e,i=new _e),t&&M(t,i),i}var ye=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Oe(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||ye.test(e))}function Pe(e,t){return t?t.source.indexOf("\\w")>-1&&Oe(e)?!0:t.test(e):Oe(e)}function Ie(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var je=/[\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 Be(e){return e.charCodeAt(0)>=768&&je.test(e)}function Ne(e,t,i){for(;(i<0?t>0:t<e.length)&&Be(e.charAt(t));)t+=i;return t}function et(e,t,i){for(var r=t>i?-1:1;;){if(t==i)return t;var n=(t+i)/2,T=r<0?Math.ceil(n):Math.floor(n);if(T==t)return e(T)?t:i;e(T)?i=T:t=T+r}}function Ze(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,T=0;T<e.length;++T){var F=e[T];(F.from<i&&F.to>t||t==i&&F.to==t)&&(r(Math.max(F.from,t),Math.min(F.to,i),F.level==1?"rtl":"ltr",T),n=!0)}n||r(t,i,"ltr")}var $e=null;function Xe(e,t,i){var r;$e=null;for(var n=0;n<e.length;++n){var T=e[n];if(T.from<t&&T.to>t)return n;T.to==t&&(T.from!=T.to&&i=="before"?r=n:$e=n),T.from==t&&(T.from!=T.to&&i!="before"?r=n:$e=n)}return r!=null?r:$e}var st=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(q){return q<=247?e.charAt(q):1424<=q&&q<=1524?"R":1536<=q&&q<=1785?t.charAt(q-1536):1774<=q&&q<=2220?"r":8192<=q&&q<=8203?"w":q==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,T=/[LRr]/,F=/[Lb1n]/,Y=/[1n]/;function J(q,ce,pe){this.level=q,this.from=ce,this.to=pe}return function(q,ce){var pe=ce=="ltr"?"L":"R";if(q.length==0||ce=="ltr"&&!r.test(q))return!1;for(var De=q.length,Ae=[],Fe=0;Fe<De;++Fe)Ae.push(i(q.charCodeAt(Fe)));for(var ze=0,Ye=pe;ze<De;++ze){var tt=Ae[ze];tt=="m"?Ae[ze]=Ye:Ye=tt}for(var ot=0,rt=pe;ot<De;++ot){var ht=Ae[ot];ht=="1"&&rt=="r"?Ae[ot]="n":T.test(ht)&&(rt=ht,ht=="r"&&(Ae[ot]="R"))}for(var xt=1,gt=Ae[0];xt<De-1;++xt){var At=Ae[xt];At=="+"&&gt=="1"&&Ae[xt+1]=="1"?Ae[xt]="1":At==","&&gt==Ae[xt+1]&&(gt=="1"||gt=="n")&&(Ae[xt]=gt),gt=At}for(var Xt=0;Xt<De;++Xt){var hr=Ae[Xt];if(hr==",")Ae[Xt]="N";else if(hr=="%"){var $t=void 0;for($t=Xt+1;$t<De&&Ae[$t]=="%";++$t);for(var Or=Xt&&Ae[Xt-1]=="!"||$t<De&&Ae[$t]=="1"?"1":"N",Ar=Xt;Ar<$t;++Ar)Ae[Ar]=Or;Xt=$t-1}}for(var rr=0,_r=pe;rr<De;++rr){var mr=Ae[rr];_r=="L"&&mr=="1"?Ae[rr]="L":T.test(mr)&&(_r=mr)}for(var or=0;or<De;++or)if(n.test(Ae[or])){var ir=void 0;for(ir=or+1;ir<De&&n.test(Ae[ir]);++ir);for(var Jt=(or?Ae[or-1]:pe)=="L",Lr=(ir<De?Ae[ir]:pe)=="L",un=Jt==Lr?Jt?"L":"R":pe,Ai=or;Ai<ir;++Ai)Ae[Ai]=un;or=ir-1}for(var vr=[],ni,dr=0;dr<De;)if(F.test(Ae[dr])){var Xa=dr;for(++dr;dr<De&&F.test(Ae[dr]);++dr);vr.push(new J(0,Xa,dr))}else{var mi=dr,ji=vr.length,Wi=ce=="rtl"?1:0;for(++dr;dr<De&&Ae[dr]!="L";++dr);for(var br=mi;br<dr;)if(Y.test(Ae[br])){mi<br&&(vr.splice(ji,0,new J(1,mi,br)),ji+=Wi);var hn=br;for(++br;br<dr&&Y.test(Ae[br]);++br);vr.splice(ji,0,new J(2,hn,br)),ji+=Wi,mi=br}else++br;mi<dr&&vr.splice(ji,0,new J(1,mi,dr))}return ce=="ltr"&&(vr[0].level==1&&(ni=q.match(/^\s+/))&&(vr[0].from=ni[0].length,vr.unshift(new J(0,0,ni[0].length))),te(vr).level==1&&(ni=q.match(/\s+$/))&&(te(vr).to-=ni[0].length,vr.push(new J(0,De-ni[0].length,De)))),ce=="rtl"?vr.reverse():vr}}();function qe(e,t){var i=e.order;return i==null&&(i=e.order=st(e.text,t)),i}var nt=[],Me=function(e,t,i){if(e.addEventListener)e.addEventListener(t,i,!1);else if(e.attachEvent)e.attachEvent("on"+t,i);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||nt).concat(i)}};function ct(e,t){return e._handlers&&e._handlers[t]||nt}function at(e,t,i){if(e.removeEventListener)e.removeEventListener(t,i,!1);else if(e.detachEvent)e.detachEvent("on"+t,i);else{var r=e._handlers,n=r&&r[t];if(n){var T=oe(n,i);T>-1&&(r[t]=n.slice(0,T).concat(n.slice(T+1)))}}}function Ue(e,t){var i=ct(e,t);if(!i.length)return;for(var r=Array.prototype.slice.call(arguments,2),n=0;n<i.length;++n)i[n].apply(null,r)}function Ke(e,t,i){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Ue(e,i||t.type,e,t),se(t)||t.codemirrorIgnore}function xe(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var i=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)oe(i,t[r])==-1&&i.push(t[r])}function ge(e,t){return ct(e,t).length>0}function be(e){e.prototype.on=function(t,i){Me(this,t,i)},e.prototype.off=function(t,i){at(this,t,i)}}function re(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ne(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function se(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function he(e){re(e),ne(e)}function Le(e){return e.target||e.srcElement}function Se(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),l&&e.ctrlKey&&t==1&&(t=3),t}var We=function(){if(G&&j<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),it;function ft(e){if(it==null){var t=a("span","\u200B");u(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(it=t.offsetWidth<=1&&t.offsetHeight>2&&!(G&&j<8))}var i=it?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var lt;function wt(e){if(lt!=null)return lt;var t=u(e,document.createTextNode("A\u062EA")),i=b(t,0,1).getBoundingClientRect(),r=b(t,1,2).getBoundingClientRect();return c(e),!i||i.left==i.right?!1:lt=r.right-i.right<3}var St=`
b`.split(/\n/).length!=3?function(e){for(var t=0,i=[],r=e.length;t<=r;){var n=e.indexOf(`
`,t);n==-1&&(n=e.length);var T=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),F=T.indexOf("\r");F!=-1?(i.push(T.slice(0,F)),t+=F+1):(i.push(T),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},dt=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(i){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},zt=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),It=null;function Kt(e){if(It!=null)return It;var t=u(e,a("span","x")),i=t.getBoundingClientRect(),r=b(t,0,1).getBoundingClientRect();return It=Math.abs(i.left-r.left)>1}var Wt={},_t={};function Wr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Wt[e]=t}function ai(e,t){_t[e]=t}function vt(e){if(typeof e=="string"&&_t.hasOwnProperty(e))e=_t[e];else if(e&&typeof e.name=="string"&&_t.hasOwnProperty(e.name)){var t=_t[e.name];typeof t=="string"&&(t={name:t}),e=Re(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return vt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return vt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Vr(e,t){t=vt(t);var i=Wt[t.name];if(!i)return Vr(e,"text/plain");var r=i(e,t);if(nr.hasOwnProperty(t.name)){var n=nr[t.name];for(var T in n){if(!n.hasOwnProperty(T))continue;r.hasOwnProperty(T)&&(r["_"+T]=r[T]),r[T]=n[T]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var F in t.modeProps)r[F]=t.modeProps[F];return r}var nr={};function cr(e,t){var i=nr.hasOwnProperty(e)?nr[e]:nr[e]={};M(t,i)}function Hr(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var n=t[r];n instanceof Array&&(n=n.concat([])),i[r]=n}return i}function oi(e,t){for(var i;e.innerMode&&!(i=e.innerMode(t),!i||i.mode==e);)t=i.state,e=i.mode;return i||{mode:e,state:t}}function si(e,t,i){return e.startState?e.startState(t,i):!0}var Pt=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};Pt.prototype.eol=function(){return this.pos>=this.string.length},Pt.prototype.sol=function(){return this.pos==this.lineStart},Pt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Pt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Pt.prototype.eat=function(e){var t=this.string.charAt(this.pos),i;if(typeof e=="string"?i=t==e:i=t&&(e.test?e.test(t):e(t)),i)return++this.pos,t},Pt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Pt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Pt.prototype.skipToEnd=function(){this.pos=this.string.length},Pt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Pt.prototype.backUp=function(e){this.pos-=e},Pt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=$(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?$(this.string,this.lineStart,this.tabSize):0)},Pt.prototype.indentation=function(){return $(this.string,null,this.tabSize)-(this.lineStart?$(this.string,this.lineStart,this.tabSize):0)},Pt.prototype.match=function(e,t,i){if(typeof e=="string"){var r=function(F){return i?F.toLowerCase():F},n=this.string.substr(this.pos,e.length);if(r(n)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var T=this.string.slice(this.pos).match(e);return T&&T.index>0?null:(T&&t!==!1&&(this.pos+=T[0].length),T)}},Pt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Pt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Pt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Pt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function pt(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 i=e;!i.lines;)for(var r=0;;++r){var n=i.children[r],T=n.chunkSize();if(t<T){i=n;break}t-=T}return i.lines[t]}function Pr(e,t,i){var r=[],n=t.line;return e.iter(t.line,i.line+1,function(T){var F=T.text;n==i.line&&(F=F.slice(0,i.ch)),n==t.line&&(F=F.slice(t.ch)),r.push(F),++n}),r}function li(e,t,i){var r=[];return e.iter(t,i,function(n){r.push(n.text)}),r}function xr(e,t){var i=t-e.height;if(i)for(var r=e;r;r=r.parent)r.height+=i}function Lt(e){if(e.parent==null)return null;for(var t=e.parent,i=oe(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var n=0;!(r.children[n]==t);++n)i+=r.children[n].chunkSize();return i+t.first}function Mr(e,t){var i=e.first;e:do{for(var r=0;r<e.children.length;++r){var n=e.children[r],T=n.height;if(t<T){e=n;continue e}t-=T,i+=n.chunkSize()}return i}while(!e.lines);for(var F=0;F<e.lines.length;++F){var Y=e.lines[F],J=Y.height;if(t<J)break;t-=J}return i+F}function Xr(e,t){return t>=e.first&&t<e.first+e.size}function ui(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ve(e,t,i){if(i===void 0&&(i=null),!(this instanceof Ve))return new Ve(e,t,i);this.line=e,this.ch=t,this.sticky=i}function Ct(e,t){return e.line-t.line||e.ch-t.ch}function hi(e,t){return e.sticky==t.sticky&&Ct(e,t)==0}function _i(e){return Ve(e.line,e.ch)}function di(e,t){return Ct(e,t)<0?t:e}function Li(e,t){return Ct(e,t)<0?e:t}function z(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function s(e,t){if(t.line<e.first)return Ve(e.first,0);var i=e.first+e.size-1;return t.line>i?Ve(i,pt(e,i).text.length):v(t,pt(e,t.line).text.length)}function v(e,t){var i=e.ch;return i==null||i>t?Ve(e.line,t):i<0?Ve(e.line,0):e}function W(e,t){for(var i=[],r=0;r<t.length;r++)i[r]=s(e,t[r]);return i}var X=function(e,t){this.state=e,this.lookAhead=t},H=function(e,t,i,r){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};H.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},H.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}},H.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},H.fromSaved=function(e,t,i){return t instanceof X?new H(e,Hr(e.mode,t.state),i,t.lookAhead):new H(e,Hr(e.mode,t),i)},H.prototype.save=function(e){var t=e!==!1?Hr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new X(t,this.maxLookAhead):t};function ve(e,t,i,r){var n=[e.state.modeGen],T={};Nr(e,t.text,e.doc.mode,i,function(q,ce){return n.push(q,ce)},T,r);for(var F=i.state,Y=function(q){i.baseTokens=n;var ce=e.state.overlays[q],pe=1,De=0;i.state=!0,Nr(e,t.text,ce.mode,i,function(Ae,Fe){for(var ze=pe;De<Ae;){var Ye=n[pe];Ye>Ae&&n.splice(pe,1,Ae,n[pe+1],Ye),pe+=2,De=Math.min(Ae,Ye)}if(!Fe)return;if(ce.opaque)n.splice(ze,pe-ze,Ae,"overlay "+Fe),pe=ze+2;else for(;ze<pe;ze+=2){var tt=n[ze+1];n[ze+1]=(tt?tt+" ":"")+"overlay "+Fe}},T),i.state=F,i.baseTokens=null,i.baseTokenPos=1},J=0;J<e.state.overlays.length;++J)Y(J);return{styles:n,classes:T.bgClass||T.textClass?T:null}}function He(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Je(e,Lt(t)),n=t.text.length>e.options.maxHighlightLength&&Hr(e.doc.mode,r.state),T=ve(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=T.styles,T.classes?t.styleClasses=T.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Je(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new H(r,!0,t);var T=ar(e,t,i),F=T>r.first&&pt(r,T-1).stateAfter,Y=F?H.fromSaved(r,F,T):new H(r,si(r.mode),T);return r.iter(T,t,function(J){ut(e,J.text,Y);var q=Y.line;J.stateAfter=q==t-1||q%5==0||q>=n.viewFrom&&q<n.viewTo?Y.save():null,Y.nextLine()}),i&&(r.modeFrontier=Y.line),Y}function ut(e,t,i,r){var n=e.doc.mode,T=new Pt(t,e.options.tabSize,i);for(T.start=T.pos=r||0,t==""&&Ge(n,i.state);!T.eol();)Et(n,T,i.state),T.start=T.pos}function Ge(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var i=oi(e,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}function Et(e,t,i,r){for(var n=0;n<10;n++){r&&(r[0]=oi(e,i).mode);var T=e.token(t,i);if(t.pos>t.start)return T}throw new Error("Mode "+e.name+" failed to advance stream.")}var Dt=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function Vt(e,t,i,r){var n=e.doc,T=n.mode,F;t=s(n,t);var Y=pt(n,t.line),J=Je(e,t.line,i),q=new Pt(Y.text,e.options.tabSize,J),ce;for(r&&(ce=[]);(r||q.pos<t.ch)&&!q.eol();)q.start=q.pos,F=Et(T,q,J.state),r&&ce.push(new Dt(q,F,Hr(n.mode,J.state)));return r?ce:new Dt(q,F,J.state)}function Ir(e,t){if(e)for(;;){var i=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!i)break;e=e.slice(0,i.index)+e.slice(i.index+i[0].length);var r=i[1]?"bgClass":"textClass";t[r]==null?t[r]=i[2]:new RegExp("(?:^|\\s)"+i[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+i[2])}return e}function Nr(e,t,i,r,n,T,F){var Y=i.flattenSpans;Y==null&&(Y=e.options.flattenSpans);var J=0,q=null,ce=new Pt(t,e.options.tabSize,r),pe,De=e.options.addModeClass&&[null];for(t==""&&Ir(Ge(i,r.state),T);!ce.eol();){if(ce.pos>e.options.maxHighlightLength?(Y=!1,F&&ut(e,t,r,ce.pos),ce.pos=t.length,pe=null):pe=Ir(Et(i,ce,r.state,De),T),De){var Ae=De[0].name;Ae&&(pe="m-"+(pe?Ae+" "+pe:Ae))}if(!Y||q!=pe){for(;J<ce.start;)J=Math.min(ce.start,J+5e3),n(J,q);q=pe}ce.start=ce.pos}for(;J<ce.pos;){var Fe=Math.min(ce.pos,J+5e3);n(Fe,q),J=Fe}}function ar(e,t,i){for(var r,n,T=e.doc,F=i?-1:t-(e.doc.mode.innerMode?1e3:100),Y=t;Y>F;--Y){if(Y<=T.first)return T.first;var J=pt(T,Y-1),q=J.stateAfter;if(q&&(!i||Y+(q instanceof X?q.lookAhead:0)<=T.modeFrontier))return Y;var ce=$(J.text,null,e.options.tabSize);(n==null||r>ce)&&(n=Y-1,r=ce)}return n}function Gr(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var i=e.first,r=t-1;r>i;r--){var n=pt(e,r).stateAfter;if(n&&(!(n instanceof X)||r+n.lookAhead<t)){i=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,i)}var Hi=!1,Er=!1;function Br(){Hi=!0}function kr(){Er=!0}function gi(e,t,i){this.marker=e,this.from=t,this.to=i}function Yr(e,t){if(e)for(var i=0;i<e.length;++i){var r=e[i];if(r.marker==t)return r}}function ci(e,t){for(var i,r=0;r<e.length;++r)e[r]!=t&&(i||(i=[])).push(e[r]);return i}function ei(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function dn(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var T=e[n],F=T.marker,Y=T.from==null||(F.inclusiveLeft?T.from<=t:T.from<t);if(Y||T.from==t&&F.type=="bookmark"&&(!i||!T.marker.insertLeft)){var J=T.to==null||(F.inclusiveRight?T.to>=t:T.to>t);(r||(r=[])).push(new gi(F,T.from,J?null:T.to))}}return r}function Gi(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var T=e[n],F=T.marker,Y=T.to==null||(F.inclusiveRight?T.to>=t:T.to>t);if(Y||T.from==t&&F.type=="bookmark"&&(!i||T.marker.insertLeft)){var J=T.from==null||(F.inclusiveLeft?T.from<=t:T.from<t);(r||(r=[])).push(new gi(F,J?null:T.from-t,T.to==null?null:T.to-t))}}return r}function $r(e,t){if(t.full)return null;var i=Xr(e,t.from.line)&&pt(e,t.from.line).markedSpans,r=Xr(e,t.to.line)&&pt(e,t.to.line).markedSpans;if(!i&&!r)return null;var n=t.from.ch,T=t.to.ch,F=Ct(t.from,t.to)==0,Y=dn(i,n,F),J=Gi(r,T,F),q=t.text.length==1,ce=te(t.text).length+(q?n:0);if(Y)for(var pe=0;pe<Y.length;++pe){var De=Y[pe];if(De.to==null){var Ae=Yr(J,De.marker);Ae?q&&(De.to=Ae.to==null?null:Ae.to+ce):De.to=n}}if(J)for(var Fe=0;Fe<J.length;++Fe){var ze=J[Fe];if(ze.to!=null&&(ze.to+=ce),ze.from==null){var Ye=Yr(Y,ze.marker);Ye||(ze.from=ce,q&&(Y||(Y=[])).push(ze))}else ze.from+=ce,q&&(Y||(Y=[])).push(ze)}Y&&(Y=Ur(Y)),J&&J!=Y&&(J=Ur(J));var tt=[Y];if(!q){var ot=t.text.length-2,rt;if(ot>0&&Y)for(var ht=0;ht<Y.length;++ht)Y[ht].to==null&&(rt||(rt=[])).push(new gi(Y[ht].marker,null,null));for(var xt=0;xt<ot;++xt)tt.push(rt);tt.push(J)}return tt}function Ur(e){for(var t=0;t<e.length;++t){var i=e[t];i.from!=null&&i.from==i.to&&i.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function ki(e,t,i){var r=null;if(e.iter(t.line,i.line+1,function(Ae){if(Ae.markedSpans)for(var Fe=0;Fe<Ae.markedSpans.length;++Fe){var ze=Ae.markedSpans[Fe].marker;ze.readOnly&&(!r||oe(r,ze)==-1)&&(r||(r=[])).push(ze)}}),!r)return null;for(var n=[{from:t,to:i}],T=0;T<r.length;++T)for(var F=r[T],Y=F.find(0),J=0;J<n.length;++J){var q=n[J];if(Ct(q.to,Y.from)<0||Ct(q.from,Y.to)>0)continue;var ce=[J,1],pe=Ct(q.from,Y.from),De=Ct(q.to,Y.to);(pe<0||!F.inclusiveLeft&&!pe)&&ce.push({from:q.from,to:Y.from}),(De>0||!F.inclusiveRight&&!De)&&ce.push({from:Y.to,to:q.to}),n.splice.apply(n,ce),J+=ce.length-3}return n}function Di(e){var t=e.markedSpans;if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.detachLine(e);e.markedSpans=null}function cn(e,t){if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}function Zt(e){return e.inclusiveLeft?-1:0}function Nt(e){return e.inclusiveRight?1:0}function fr(e,t){var i=e.lines.length-t.lines.length;if(i!=0)return i;var r=e.find(),n=t.find(),T=Ct(r.from,n.from)||Zt(e)-Zt(t);if(T)return-T;var F=Ct(r.to,n.to)||Nt(e)-Nt(t);return F||t.id-e.id}function Mt(e,t){var i=Er&&e.markedSpans,r;if(i)for(var n=void 0,T=0;T<i.length;++T)n=i[T],n.marker.collapsed&&(t?n.from:n.to)==null&&(!r||fr(r,n.marker)<0)&&(r=n.marker);return r}function er(e){return Mt(e,!0)}function Ft(e){return Mt(e,!1)}function ti(e,t){var i=Er&&e.markedSpans,r;if(i)for(var n=0;n<i.length;++n){var T=i[n];T.marker.collapsed&&(T.from==null||T.from<t)&&(T.to==null||T.to>t)&&(!r||fr(r,T.marker)<0)&&(r=T.marker)}return r}function Qt(e,t,i,r,n){var T=pt(e,t),F=Er&&T.markedSpans;if(F)for(var Y=0;Y<F.length;++Y){var J=F[Y];if(!J.marker.collapsed)continue;var q=J.marker.find(0),ce=Ct(q.from,i)||Zt(J.marker)-Zt(n),pe=Ct(q.to,r)||Nt(J.marker)-Nt(n);if(ce>=0&&pe<=0||ce<=0&&pe>=0)continue;if(ce<=0&&(J.marker.inclusiveRight&&n.inclusiveLeft?Ct(q.to,i)>=0:Ct(q.to,i)>0)||ce>=0&&(J.marker.inclusiveRight&&n.inclusiveLeft?Ct(q.from,r)<=0:Ct(q.from,r)<0))return!0}}function Sr(e){for(var t;t=er(e);)e=t.find(-1,!0).line;return e}function zi(e){for(var t;t=Ft(e);)e=t.find(1,!0).line;return e}function Ki(e){for(var t,i;t=Ft(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function vi(e,t){var i=pt(e,t),r=Sr(i);return i==r?t:Lt(r)}function Fn(e,t){if(t>e.lastLine())return t;var i=pt(e,t),r;if(!Dr(e,i))return t;for(;r=Ft(i);)i=r.find(1,!0).line;return Lt(i)+1}function Dr(e,t){var i=Er&&t.markedSpans;if(i)for(var r=void 0,n=0;n<i.length;++n){if(r=i[n],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&fn(e,t,r))return!0}}function fn(e,t,i){if(i.to==null){var r=i.marker.find(1,!0);return fn(e,r.line,Yr(r.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(var n=void 0,T=0;T<t.markedSpans.length;++T)if(n=t.markedSpans[T],n.marker.collapsed&&!n.marker.widgetNode&&n.from==i.to&&(n.to==null||n.to!=i.from)&&(n.marker.inclusiveLeft||i.marker.inclusiveRight)&&fn(e,t,n))return!0}function Zr(e){e=Sr(e);for(var t=0,i=e.parent,r=0;r<i.lines.length;++r){var n=i.lines[r];if(n==e)break;t+=n.height}for(var T=i.parent;T;i=T,T=i.parent)for(var F=0;F<T.children.length;++F){var Y=T.children[F];if(Y==i)break;t+=Y.height}return t}function Vi(e){if(e.height==0)return 0;for(var t=e.text.length,i,r=e;i=er(r);){var n=i.find(0,!0);r=n.from.line,t+=n.from.ch-n.to.ch}for(r=e;i=Ft(r);){var T=i.find(0,!0);t-=r.text.length-T.from.ch,r=T.to.line,t+=r.text.length-T.to.ch}return t}function jn(e){var t=e.display,i=e.doc;t.maxLine=pt(i,i.first),t.maxLineLength=Vi(t.maxLine),t.maxLineChanged=!0,i.iter(function(r){var n=Vi(r);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var Ri=function(e,t,i){this.text=e,cn(this,t),this.height=i?i(this):1};Ri.prototype.lineNo=function(){return Lt(this)},be(Ri);function $a(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Di(e),cn(e,i);var n=r?r(e):1;n!=e.height&&xr(e,n)}function ha(e){e.parent=null,Di(e)}var mt={},Tt={};function yt(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?Tt:mt;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function kt(e,t){var i=x("span",null,null,I?"padding-right: .1px":null),r={pre:x("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var T=n?t.rest[n-1]:t.line,F=void 0;r.pos=0,r.addToken=Ht,wt(e.display.measure)&&(F=qe(T,e.doc.direction))&&(r.addToken=tr(r.addToken,F)),r.map=[];var Y=t!=e.display.externalMeasured&&Lt(T);Rt(T,r,He(e,T,Y)),T.styleClasses&&(T.styleClasses.bgClass&&(r.bgClass=K(T.styleClasses.bgClass,r.bgClass||"")),T.styleClasses.textClass&&(r.textClass=K(T.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(ft(e.display.measure))),n==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(I){var J=r.content.lastChild;(/\bcm-tab\b/.test(J.className)||J.querySelector&&J.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Ue(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=K(r.pre.className,r.textClass||"")),r}function Bt(e){var t=a("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Ht(e,t,i,r,n,T,F){if(!t)return;var Y=e.splitSpaces?Ot(t,e.trailingSpace):t,J=e.cm.state.specialChars,q=!1,ce;if(!J.test(t))e.col+=t.length,ce=document.createTextNode(Y),e.map.push(e.pos,e.pos+t.length,ce),G&&j<9&&(q=!0),e.pos+=t.length;else{ce=document.createDocumentFragment();for(var pe=0;;){J.lastIndex=pe;var De=J.exec(t),Ae=De?De.index-pe:t.length-pe;if(Ae){var Fe=document.createTextNode(Y.slice(pe,pe+Ae));G&&j<9?ce.appendChild(a("span",[Fe])):ce.appendChild(Fe),e.map.push(e.pos,e.pos+Ae,Fe),e.col+=Ae,e.pos+=Ae}if(!De)break;pe+=Ae+1;var ze=void 0;if(De[0]==" "){var Ye=e.cm.options.tabSize,tt=Ye-e.col%Ye;ze=ce.appendChild(a("span",ue(tt),"cm-tab")),ze.setAttribute("role","presentation"),ze.setAttribute("cm-text"," "),e.col+=tt}else De[0]=="\r"||De[0]==`
`?(ze=ce.appendChild(a("span",De[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),ze.setAttribute("cm-text",De[0]),e.col+=1):(ze=e.cm.options.specialCharPlaceholder(De[0]),ze.setAttribute("cm-text",De[0]),G&&j<9?ce.appendChild(a("span",[ze])):ce.appendChild(ze),e.col+=1);e.map.push(e.pos,e.pos+1,ze),e.pos++}}if(e.trailingSpace=Y.charCodeAt(t.length-1)==32,i||r||n||q||T||F){var ot=i||"";r&&(ot+=r),n&&(ot+=n);var rt=a("span",[ce],ot,T);if(F)for(var ht in F)F.hasOwnProperty(ht)&&ht!="style"&&ht!="class"&&rt.setAttribute(ht,F[ht]);return e.content.appendChild(rt)}e.content.appendChild(ce)}function Ot(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;n<e.length;n++){var T=e.charAt(n);T==" "&&i&&(n==e.length-1||e.charCodeAt(n+1)==32)&&(T="\xA0"),r+=T,i=T==" "}return r}function tr(e,t){return function(i,r,n,T,F,Y,J){n=n?n+" cm-force-border":"cm-force-border";for(var q=i.pos,ce=q+r.length;;){for(var pe=void 0,De=0;De<t.length&&!(pe=t[De],pe.to>q&&pe.from<=q);De++);if(pe.to>=ce)return e(i,r,n,T,F,Y,J);e(i,r.slice(0,pe.to-q),n,T,null,Y,J),T=null,r=r.slice(pe.to-q),q=pe.to}}}function Cr(e,t,i,r){var n=!r&&i.widgetNode;n&&e.map.push(e.pos,e.pos+t,n),!r&&e.cm.display.input.needsContentAttribute&&(n||(n=e.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",i.id)),n&&(e.cm.display.input.setUneditable(n),e.content.appendChild(n)),e.pos+=t,e.trailingSpace=!1}function Rt(e,t,i){var r=e.markedSpans,n=e.text,T=0;if(!r){for(var F=1;F<i.length;F+=2)t.addToken(t,n.slice(T,T=i[F]),yt(i[F+1],t.cm.options));return}for(var Y=n.length,J=0,q=1,ce="",pe,De,Ae=0,Fe,ze,Ye,tt,ot;;){if(Ae==J){Fe=ze=Ye=De="",ot=null,tt=null,Ae=Infinity;for(var rt=[],ht=void 0,xt=0;xt<r.length;++xt){var gt=r[xt],At=gt.marker;if(At.type=="bookmark"&&gt.from==J&&At.widgetNode)rt.push(At);else if(gt.from<=J&&(gt.to==null||gt.to>J||At.collapsed&&gt.to==J&&gt.from==J)){if(gt.to!=null&&gt.to!=J&&Ae>gt.to&&(Ae=gt.to,ze=""),At.className&&(Fe+=" "+At.className),At.css&&(De=(De?De+";":"")+At.css),At.startStyle&&gt.from==J&&(Ye+=" "+At.startStyle),At.endStyle&&gt.to==Ae&&(ht||(ht=[])).push(At.endStyle,gt.to),At.title&&((ot||(ot={})).title=At.title),At.attributes)for(var Xt in At.attributes)(ot||(ot={}))[Xt]=At.attributes[Xt];At.collapsed&&(!tt||fr(tt.marker,At)<0)&&(tt=gt)}else gt.from>J&&Ae>gt.from&&(Ae=gt.from)}if(ht)for(var hr=0;hr<ht.length;hr+=2)ht[hr+1]==Ae&&(ze+=" "+ht[hr]);if(!tt||tt.from==J)for(var $t=0;$t<rt.length;++$t)Cr(t,0,rt[$t]);if(tt&&(tt.from||0)==J){if(Cr(t,(tt.to==null?Y+1:tt.to)-J,tt.marker,tt.from==null),tt.to==null)return;tt.to==J&&(tt=!1)}}if(J>=Y)break;for(var Or=Math.min(Y,Ae);;){if(ce){var Ar=J+ce.length;if(!tt){var rr=Ar>Or?ce.slice(0,Or-J):ce;t.addToken(t,rr,pe?pe+Fe:Fe,Ye,J+rr.length==Ae?ze:"",De,ot)}if(Ar>=Or){ce=ce.slice(Or-J),J=Or;break}J=Ar,Ye=""}ce=n.slice(T,T=i[q++]),pe=yt(i[q++],t.cm.options)}}}function yi(e,t,i){this.line=t,this.rest=Ki(t),this.size=this.rest?Lt(te(this.rest))-i+1:1,this.node=this.text=null,this.hidden=Dr(e,t)}function Ut(e,t,i){for(var r=[],n,T=t;T<i;T=n){var F=new yi(e.doc,pt(e.doc,T),T);n=T+F.size,r.push(F)}return r}var sr=null;function zr(e){sr?sr.ops.push(e):e.ownsGroup=sr={ops:[e],delayedCallbacks:[]}}function Kr(e){var t=e.delayedCallbacks,i=0;do{for(;i<t.length;i++)t[i].call(null);for(var r=0;r<e.ops.length;r++){var n=e.ops[r];if(n.cursorActivityHandlers)for(;n.cursorActivityCalled<n.cursorActivityHandlers.length;)n.cursorActivityHandlers[n.cursorActivityCalled++].call(null,n.cm)}}while(i<t.length)}function Wn(e,t){var i=e.ownsGroup;if(!i)return;try{Kr(i)}finally{sr=null,t(i)}}var pn=null;function pr(e,t){var i=ct(e,t);if(!i.length)return;var r=Array.prototype.slice.call(arguments,2),n;sr?n=sr.delayedCallbacks:pn?n=pn:(n=pn=[],setTimeout(Os,0));for(var T=function(Y){n.push(function(){return i[Y].apply(null,r)})},F=0;F<i.length;++F)T(F)}function Os(){var e=pn;pn=null;for(var t=0;t<e.length;++t)e[t]()}function Za(e,t,i,r){for(var n=0;n<t.changes.length;n++){var T=t.changes[n];T=="text"?Ms(e,t):T=="gutter"?Qa(e,t,i,r):T=="class"?da(e,t):T=="widget"&&Is(e,t,r)}t.changes=null}function mn(e){return e.node==e.text&&(e.node=a("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),G&&j<8&&(e.node.style.zIndex=2)),e.node}function Ps(e,t){var i=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(i&&(i+=" CodeMirror-linebackground"),t.background)i?t.background.className=i:(t.background.parentNode.removeChild(t.background),t.background=null);else if(i){var r=mn(t);t.background=r.insertBefore(a("div",null,i),r.firstChild),e.display.input.setUneditable(t.background)}}function Ja(e,t){var i=e.display.externalMeasured;return i&&i.line==t.line?(e.display.externalMeasured=null,t.measure=i.measure,i.built):kt(e,t)}function Ms(e,t){var i=t.text.className,r=Ja(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,da(e,t)):i&&(t.text.className=i)}function da(e,t){Ps(e,t),t.line.wrapClass?mn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var i=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=i||""}function Qa(e,t,i,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var n=mn(t);t.gutterBackground=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),n.insertBefore(t.gutterBackground,t.text)}var T=t.line.gutterMarkers;if(e.options.lineNumbers||T){var F=mn(t),Y=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(Y),F.insertBefore(Y,t.text),t.line.gutterClass&&(Y.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!T||!T["CodeMirror-linenumbers"])&&(t.lineNumber=Y.appendChild(a("div",ui(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),T)for(var J=0;J<e.display.gutterSpecs.length;++J){var q=e.display.gutterSpecs[J].className,ce=T.hasOwnProperty(q)&&T[q];ce&&Y.appendChild(a("div",[ce],"CodeMirror-gutter-elt","left: "+r.gutterLeft[q]+"px; width: "+r.gutterWidth[q]+"px"))}}}function Is(e,t,i){t.alignable&&(t.alignable=null);for(var r=g("CodeMirror-linewidget"),n=t.node.firstChild,T=void 0;n;n=T)T=n.nextSibling,r.test(n.className)&&t.node.removeChild(n);qa(e,t,i)}function Ns(e,t,i,r){var n=Ja(e,t);return t.text=t.node=n.pre,n.bgClass&&(t.bgClass=n.bgClass),n.textClass&&(t.textClass=n.textClass),da(e,t),Qa(e,t,i,r),qa(e,t,r),t.node}function qa(e,t,i){if(eo(e,t.line,t,i,!0),t.rest)for(var r=0;r<t.rest.length;r++)eo(e,t.rest[r],t,i,!1)}function eo(e,t,i,r,n){if(!t.widgets)return;for(var T=mn(i),F=0,Y=t.widgets;F<Y.length;++F){var J=Y[F],q=a("div",[J.node],"CodeMirror-linewidget"+(J.className?" "+J.className:""));J.handleMouseEvents||q.setAttribute("cm-ignore-events","true"),Bs(J,q,i,r),e.display.input.setUneditable(q),n&&J.above?T.insertBefore(q,i.gutter||i.text):T.appendChild(q),pr(J,"redraw")}}function Bs(e,t,i,r){if(e.noHScroll){(i.alignable||(i.alignable=[])).push(t);var n=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(n-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=n+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function gn(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!E(document.body,e.node)){var i="position: relative;";e.coverGutter&&(i+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(i+="width: "+t.display.wrapper.clientWidth+"px;"),u(t.display.measure,a("div",[e.node],null,i))}return e.height=e.node.parentNode.offsetHeight}function fi(e,t){for(var i=Le(t);i!=e.wrapper;i=i.parentNode)if(!i||i.nodeType==1&&i.getAttribute("cm-ignore-events")=="true"||i.parentNode==e.sizer&&i!=e.mover)return!0}function Hn(e){return e.lineSpace.offsetTop}function ca(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function to(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=u(e.measure,a("pre","x","CodeMirror-line-like")),i=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(i.paddingLeft),right:parseInt(i.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function ri(e){return fe-e.display.nativeBarWidth}function Oi(e){return e.display.scroller.clientWidth-ri(e)-e.display.barWidth}function fa(e){return e.display.scroller.clientHeight-ri(e)-e.display.barHeight}function Us(e,t,i){var r=e.options.lineWrapping,n=r&&Oi(e);if(!t.measure.heights||r&&t.measure.width!=n){var T=t.measure.heights=[];if(r){t.measure.width=n;for(var F=t.text.firstChild.getClientRects(),Y=0;Y<F.length-1;Y++){var J=F[Y],q=F[Y+1];Math.abs(J.bottom-q.bottom)>2&&T.push((J.bottom+q.top)/2-i.top)}}T.push(i.bottom-i.top)}}function ro(e,t,i){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var n=0;n<e.rest.length;n++)if(Lt(e.rest[n])>i)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Fs(e,t){t=Sr(t);var i=Lt(t),r=e.display.externalMeasured=new yi(e.doc,t,i);r.lineN=i;var n=r.built=kt(e,r);return r.text=n.pre,u(e.display.lineMeasure,n.pre),r}function io(e,t,i,r){return ii(e,Xi(e,t),i,r)}function pa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Ii(e,t)];var i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function Xi(e,t){var i=Lt(t),r=pa(e,i);r&&!r.text?r=null:r&&r.changes&&(Za(e,r,i,xa(e)),e.curOp.forceUpdate=!0),r||(r=Fs(e,t));var n=ro(r,t,i);return{line:t,view:r,rect:null,map:n.map,cache:n.cache,before:n.before,hasHeights:!1}}function ii(e,t,i,r,n){t.before&&(i=-1);var T=i+(r||""),F;return t.cache.hasOwnProperty(T)?F=t.cache[T]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Us(e,t.view,t.rect),t.hasHeights=!0),F=Ws(e,t,i,r),F.bogus||(t.cache[T]=F)),{left:F.left,right:F.right,top:n?F.rtop:F.top,bottom:n?F.rbottom:F.bottom}}var no={left:0,right:0,top:0,bottom:0};function ao(e,t,i){for(var r,n,T,F,Y,J,q=0;q<e.length;q+=3)if(Y=e[q],J=e[q+1],t<Y?(n=0,T=1,F="left"):t<J?(n=t-Y,T=n+1):(q==e.length-3||t==J&&e[q+3]>t)&&(T=J-Y,n=T-1,t>=J&&(F="right")),n!=null){if(r=e[q+2],Y==J&&i==(r.insertLeft?"left":"right")&&(F=i),i=="left"&&n==0)for(;q&&e[q-2]==e[q-3]&&e[q-1].insertLeft;)r=e[(q-=3)+2],F="left";if(i=="right"&&n==J-Y)for(;q<e.length-3&&e[q+3]==e[q+4]&&!e[q+5].insertLeft;)r=e[(q+=3)+2],F="right";break}return{node:r,start:n,end:T,collapse:F,coverStart:Y,coverEnd:J}}function js(e,t){var i=no;if(t=="left")for(var r=0;r<e.length&&!((i=e[r]).left!=i.right);r++);else for(var n=e.length-1;n>=0&&!((i=e[n]).left!=i.right);n--);return i}function Ws(e,t,i,r){var n=ao(t.map,i,r),T=n.node,F=n.start,Y=n.end,J=n.collapse,q;if(T.nodeType==3){for(var ce=0;ce<4;ce++){for(;F&&Be(t.line.text.charAt(n.coverStart+F));)--F;for(;n.coverStart+Y<n.coverEnd&&Be(t.line.text.charAt(n.coverStart+Y));)++Y;if(G&&j<9&&F==0&&Y==n.coverEnd-n.coverStart?q=T.parentNode.getBoundingClientRect():q=js(b(T,F,Y).getClientRects(),r),q.left||q.right||F==0)break;Y=F,F=F-1,J="right"}G&&j<11&&(q=Hs(e.display.measure,q))}else{F>0&&(J=r="right");var pe;e.options.lineWrapping&&(pe=T.getClientRects()).length>1?q=pe[r=="right"?pe.length-1:0]:q=T.getBoundingClientRect()}if(G&&j<9&&!F&&(!q||!q.left&&!q.right)){var De=T.parentNode.getClientRects()[0];De?q={left:De.left,right:De.left+$i(e.display),top:De.top,bottom:De.bottom}:q=no}for(var Ae=q.top-t.rect.top,Fe=q.bottom-t.rect.top,ze=(Ae+Fe)/2,Ye=t.view.measure.heights,tt=0;tt<Ye.length-1&&!(ze<Ye[tt]);tt++);var ot=tt?Ye[tt-1]:0,rt=Ye[tt],ht={left:(J=="right"?q.right:q.left)-t.rect.left,right:(J=="left"?q.left:q.right)-t.rect.left,top:ot,bottom:rt};return!q.left&&!q.right&&(ht.bogus=!0),e.options.singleCursorHeightPerLine||(ht.rtop=Ae,ht.rbottom=Fe),ht}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Kt(e))return t;var i=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*i,right:t.right*i,top:t.top*r,bottom:t.bottom*r}}function oo(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function so(e){e.display.externalMeasure=null,c(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)oo(e.display.view[t])}function vn(e){so(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function lo(){return y&&d?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function uo(){return y&&d?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function ma(e){var t=0;if(e.widgets)for(var i=0;i<e.widgets.length;++i)e.widgets[i].above&&(t+=gn(e.widgets[i]));return t}function Gn(e,t,i,r,n){if(!n){var T=ma(t);i.top+=T,i.bottom+=T}if(r=="line")return i;r||(r="local");var F=Zr(t);if(r=="local"?F+=Hn(e.display):F-=e.display.viewOffset,r=="page"||r=="window"){var Y=e.display.lineSpace.getBoundingClientRect();F+=Y.top+(r=="window"?0:uo());var J=Y.left+(r=="window"?0:lo());i.left+=J,i.right+=J}return i.top+=F,i.bottom+=F,i}function ho(e,t,i){if(i=="div")return t;var r=t.left,n=t.top;if(i=="page")r-=lo(),n-=uo();else if(i=="local"||!i){var T=e.display.sizer.getBoundingClientRect();r+=T.left,n+=T.top}var F=e.display.lineSpace.getBoundingClientRect();return{left:r-F.left,top:n-F.top}}function ga(e,t,i,r,n){return r||(r=pt(e.doc,t.line)),Gn(e,r,io(e,r,t.ch,n),i)}function Jr(e,t,i,r,n,T){r=r||pt(e.doc,t.line),n||(n=Xi(e,r));function F(Fe,ze){var Ye=ii(e,n,Fe,ze?"right":"left",T);return ze?Ye.left=Ye.right:Ye.right=Ye.left,Gn(e,r,Ye,i)}var Y=qe(r,e.doc.direction),J=t.ch,q=t.sticky;if(J>=r.text.length?(J=r.text.length,q="before"):J<=0&&(J=0,q="after"),!Y)return F(q=="before"?J-1:J,q=="before");function ce(Fe,ze,Ye){var tt=Y[ze],ot=tt.level==1;return F(Ye?Fe-1:Fe,ot!=Ye)}var pe=Xe(Y,J,q),De=$e,Ae=ce(J,pe,q=="before");return De!=null&&(Ae.other=ce(J,De,q!="before")),Ae}function co(e,t){var i=0;t=s(e.doc,t),e.options.lineWrapping||(i=$i(e.display)*t.ch);var r=pt(e.doc,t.line),n=Zr(r)+Hn(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function va(e,t,i,r,n){var T=Ve(e,t,i);return T.xRel=n,r&&(T.outside=r),T}function ya(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return va(r.first,0,null,-1,-1);var n=Mr(r,i),T=r.first+r.size-1;if(n>T)return va(r.first+r.size-1,pt(r,T).text.length,null,1,1);t<0&&(t=0);for(var F=pt(r,n);;){var Y=Gs(e,F,n,t,i),J=ti(F,Y.ch+(Y.xRel>0||Y.outside>0?1:0));if(!J)return Y;var q=J.find(1);if(q.line==n)return q;F=pt(r,n=q.line)}}function fo(e,t,i,r){r-=ma(t);var n=t.text.length,T=et(function(F){return ii(e,i,F-1).bottom<=r},n,0);return n=et(function(F){return ii(e,i,F).top>r},T,n),{begin:T,end:n}}function po(e,t,i,r){i||(i=Xi(e,t));var n=Gn(e,t,ii(e,i,r),"line").top;return fo(e,t,i,n)}function ba(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function Gs(e,t,i,r,n){n-=Zr(t);var T=Xi(e,t),F=ma(t),Y=0,J=t.text.length,q=!0,ce=qe(t,e.doc.direction);if(ce){var pe=(e.options.lineWrapping?Ks:zs)(e,t,i,T,ce,r,n);q=pe.level!=1,Y=q?pe.from:pe.to-1,J=q?pe.to:pe.from-1}var De=null,Ae=null,Fe=et(function(xt){var gt=ii(e,T,xt);return gt.top+=F,gt.bottom+=F,ba(gt,r,n,!1)?(gt.top<=n&&gt.left<=r&&(De=xt,Ae=gt),!0):!1},Y,J),ze,Ye,tt=!1;if(Ae){var ot=r-Ae.left<Ae.right-r,rt=ot==q;Fe=De+(rt?0:1),Ye=rt?"after":"before",ze=ot?Ae.left:Ae.right}else{!q&&(Fe==J||Fe==Y)&&Fe++,Ye=Fe==0?"after":Fe==t.text.length?"before":ii(e,T,Fe-(q?1:0)).bottom+F<=n==q?"after":"before";var ht=Jr(e,Ve(i,Fe,Ye),"line",t,T);ze=ht.left,tt=n<ht.top?-1:n>=ht.bottom?1:0}return Fe=Ne(t.text,Fe,1),va(i,Fe,Ye,tt,r-ze)}function zs(e,t,i,r,n,T,F){var Y=et(function(pe){var De=n[pe],Ae=De.level!=1;return ba(Jr(e,Ve(i,Ae?De.to:De.from,Ae?"before":"after"),"line",t,r),T,F,!0)},0,n.length-1),J=n[Y];if(Y>0){var q=J.level!=1,ce=Jr(e,Ve(i,q?J.from:J.to,q?"after":"before"),"line",t,r);ba(ce,T,F,!0)&&ce.top>F&&(J=n[Y-1])}return J}function Ks(e,t,i,r,n,T,F){var Y=fo(e,t,r,F),J=Y.begin,q=Y.end;/\s/.test(t.text.charAt(q-1))&&q--;for(var ce=null,pe=null,De=0;De<n.length;De++){var Ae=n[De];if(Ae.from>=q||Ae.to<=J)continue;var Fe=Ae.level!=1,ze=ii(e,r,Fe?Math.min(q,Ae.to)-1:Math.max(J,Ae.from)).right,Ye=ze<T?T-ze+1e9:ze-T;(!ce||pe>Ye)&&(ce=Ae,pe=Ye)}return ce||(ce=n[n.length-1]),ce.from<J&&(ce={from:J,to:ce.to,level:ce.level}),ce.to>q&&(ce={from:ce.from,to:q,level:ce.level}),ce}var Pi;function Yi(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Pi==null){Pi=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Pi.appendChild(document.createTextNode("x")),Pi.appendChild(a("br"));Pi.appendChild(document.createTextNode("x"))}u(e.measure,Pi);var i=Pi.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),c(e.measure),i||1}function $i(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),i=a("pre",[t],"CodeMirror-line-like");u(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function xa(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,T=t.gutters.firstChild,F=0;T;T=T.nextSibling,++F){var Y=e.display.gutterSpecs[F].className;i[Y]=T.offsetLeft+T.clientLeft+n,r[Y]=T.clientWidth}return{fixedPos:Ea(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ea(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function mo(e){var t=Yi(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/$i(e.display)-3);return function(n){if(Dr(e.doc,n))return 0;var T=0;if(n.widgets)for(var F=0;F<n.widgets.length;F++)n.widgets[F].height&&(T+=n.widgets[F].height);return i?T+(Math.ceil(n.text.length/r)||1)*t:T+t}}function Sa(e){var t=e.doc,i=mo(e);t.iter(function(r){var n=i(r);n!=r.height&&xr(r,n)})}function Mi(e,t,i,r){var n=e.display;if(!i&&Le(t).getAttribute("cm-not-content")=="true")return null;var T,F,Y=n.lineSpace.getBoundingClientRect();try{T=t.clientX-Y.left,F=t.clientY-Y.top}catch(pe){return null}var J=ya(e,T,F),q;if(r&&J.xRel>0&&(q=pt(e.doc,J.line).text).length==J.ch){var ce=$(q,q.length,e.options.tabSize)-q.length;J=Ve(J.line,Math.max(0,Math.round((T-to(e.display).left)/$i(e.display))-ce))}return J}function Ii(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var i=e.display.view,r=0;r<i.length;r++)if(t-=i[r].size,t<0)return r}function Tr(e,t,i,r){t==null&&(t=e.doc.first),i==null&&(i=e.doc.first+e.doc.size),r||(r=0);var n=e.display;if(r&&i<n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>t)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)Er&&vi(e.doc,t)<n.viewTo&&xi(e);else if(i<=n.viewFrom)Er&&Fn(e.doc,i+r)>n.viewFrom?xi(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)xi(e);else if(t<=n.viewFrom){var T=zn(e,i,i+r,1);T?(n.view=n.view.slice(T.index),n.viewFrom=T.lineN,n.viewTo+=r):xi(e)}else if(i>=n.viewTo){var F=zn(e,t,t,-1);F?(n.view=n.view.slice(0,F.index),n.viewTo=F.lineN):xi(e)}else{var Y=zn(e,t,t,-1),J=zn(e,i,i+r,1);Y&&J?(n.view=n.view.slice(0,Y.index).concat(Ut(e,Y.lineN,J.lineN)).concat(n.view.slice(J.index)),n.viewTo+=r):xi(e)}var q=n.externalMeasured;q&&(i<q.lineN?q.lineN+=r:t<q.lineN+q.size&&(n.externalMeasured=null))}function bi(e,t,i){e.curOp.viewChanged=!0;var r=e.display,n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var T=r.view[Ii(e,t)];if(T.node==null)return;var F=T.changes||(T.changes=[]);oe(F,i)==-1&&F.push(i)}function xi(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function zn(e,t,i,r){var n=Ii(e,t),T,F=e.display.view;if(!Er||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var Y=e.display.viewFrom,J=0;J<n;J++)Y+=F[J].size;if(Y!=t){if(r>0){if(n==F.length-1)return null;T=Y+F[n].size-t,n++}else T=Y-t;t+=T,i+=T}for(;vi(e.doc,i)!=i;){if(n==(r<0?0:F.length-1))return null;i+=r*F[n-(r<0?1:0)].size,n+=r}return{index:n,lineN:i}}function Vs(e,t,i){var r=e.display,n=r.view;n.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=Ut(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=Ut(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Ii(e,t))),r.viewFrom=t,r.viewTo<i?r.view=r.view.concat(Ut(e,r.viewTo,i)):r.viewTo>i&&(r.view=r.view.slice(0,Ii(e,i)))),r.viewTo=i}function go(e){for(var t=e.display.view,i=0,r=0;r<t.length;r++){var n=t[r];!n.hidden&&(!n.node||n.changes)&&++i}return i}function yn(e){e.display.input.showSelection(e.display.input.prepareSelection())}function vo(e,t){t===void 0&&(t=!0);for(var i=e.doc,r={},n=r.cursors=document.createDocumentFragment(),T=r.selection=document.createDocumentFragment(),F=0;F<i.sel.ranges.length;F++){if(!t&&F==i.sel.primIndex)continue;var Y=i.sel.ranges[F];if(Y.from().line>=e.display.viewTo||Y.to().line<e.display.viewFrom)continue;var J=Y.empty();(J||e.options.showCursorWhenSelecting)&&yo(e,Y.head,n),J||Xs(e,Y,T)}return r}function yo(e,t,i){var r=Jr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),n=i.appendChild(a("div","\xA0","CodeMirror-cursor"));if(n.style.left=r.left+"px",n.style.top=r.top+"px",n.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var T=i.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));T.style.display="",T.style.left=r.other.left+"px",T.style.top=r.other.top+"px",T.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Kn(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,i){var r=e.display,n=e.doc,T=document.createDocumentFragment(),F=to(e.display),Y=F.left,J=Math.max(r.sizerWidth,Oi(e)-r.sizer.offsetLeft)-F.right,q=n.direction=="ltr";function ce(rt,ht,xt,gt){ht<0&&(ht=0),ht=Math.round(ht),gt=Math.round(gt),T.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+rt+`px;
top: `+ht+"px; width: "+(xt==null?J-rt:xt)+`px;
height: `+(gt-ht)+"px"))}function pe(rt,ht,xt){var gt=pt(n,rt),At=gt.text.length,Xt,hr;function $t(rr,_r){return ga(e,Ve(rt,rr),"div",gt,_r)}function Or(rr,_r,mr){var or=po(e,gt,null,rr),ir=_r=="ltr"==(mr=="after")?"left":"right",Jt=mr=="after"?or.begin:or.end-(/\s/.test(gt.text.charAt(or.end-1))?2:1);return $t(Jt,ir)[ir]}var Ar=qe(gt,n.direction);return Ze(Ar,ht||0,xt==null?At:xt,function(rr,_r,mr,or){var ir=mr=="ltr",Jt=$t(rr,ir?"left":"right"),Lr=$t(_r-1,ir?"right":"left"),un=ht==null&&rr==0,Ai=xt==null&&_r==At,vr=or==0,ni=!Ar||or==Ar.length-1;if(Lr.top-Jt.top<=3){var dr=(q?un:Ai)&&vr,Xa=(q?Ai:un)&&ni,mi=dr?Y:(ir?Jt:Lr).left,ji=Xa?J:(ir?Lr:Jt).right;ce(mi,Jt.top,ji-mi,Jt.bottom)}else{var Wi,br,hn,Ya;ir?(Wi=q&&un&&vr?Y:Jt.left,br=q?J:Or(rr,mr,"before"),hn=q?Y:Or(_r,mr,"after"),Ya=q&&Ai&&ni?J:Lr.right):(Wi=q?Or(rr,mr,"before"):Y,br=!q&&un&&vr?J:Jt.right,hn=!q&&Ai&&ni?Y:Lr.left,Ya=q?Or(_r,mr,"after"):J),ce(Wi,Jt.top,br-Wi,Jt.bottom),Jt.bottom<Lr.top&&ce(Y,Jt.bottom,null,Lr.top),ce(hn,Lr.top,Ya-hn,Lr.bottom)}(!Xt||Kn(Jt,Xt)<0)&&(Xt=Jt),Kn(Lr,Xt)<0&&(Xt=Lr),(!hr||Kn(Jt,hr)<0)&&(hr=Jt),Kn(Lr,hr)<0&&(hr=Lr)}),{start:Xt,end:hr}}var De=t.from(),Ae=t.to();if(De.line==Ae.line)pe(De.line,De.ch,Ae.ch);else{var Fe=pt(n,De.line),ze=pt(n,Ae.line),Ye=Sr(Fe)==Sr(ze),tt=pe(De.line,De.ch,Ye?Fe.text.length+1:null).end,ot=pe(Ae.line,Ye?0:null,Ae.ch).start;Ye&&(tt.top<ot.top-2?(ce(tt.right,tt.top,null,tt.bottom),ce(Y,ot.top,ot.left,ot.bottom)):ce(tt.right,tt.top,ot.left-tt.right,tt.bottom)),tt.bottom<ot.top&&ce(Y,tt.bottom,null,ot.top)}i.appendChild(T)}function Ca(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var i=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Zi(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function bo(e){e.state.focused||(e.display.input.focus(),Ta(e))}function xo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Zi(e))},100)}function Ta(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Ue(e,"focus",e,t),e.state.focused=!0,U(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),I&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ca(e)}function Zi(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Ue(e,"blur",e,t),e.state.focused=!1,m(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Vn(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var n=t.view[r],T=e.options.lineWrapping,F=void 0,Y=0;if(n.hidden)continue;if(G&&j<8){var J=n.node.offsetTop+n.node.offsetHeight;F=J-i,i=J}else{var q=n.node.getBoundingClientRect();F=q.bottom-q.top,!T&&n.text.firstChild&&(Y=n.text.firstChild.getBoundingClientRect().right-q.left-1)}var ce=n.line.height-F;if((ce>.005||ce<-.005)&&(xr(n.line,F),Eo(n.line),n.rest))for(var pe=0;pe<n.rest.length;pe++)Eo(n.rest[pe]);if(Y>e.display.sizerWidth){var De=Math.ceil(Y/$i(e.display));De>e.display.maxLineLength&&(e.display.maxLineLength=De,e.display.maxLine=n.line,e.display.maxLineChanged=!0)}}}function Eo(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var i=e.widgets[t],r=i.node.parentNode;r&&(i.height=r.offsetHeight)}}function Xn(e,t,i){var r=i&&i.top!=null?Math.max(0,i.top):e.scroller.scrollTop;r=Math.floor(r-Hn(e));var n=i&&i.bottom!=null?i.bottom:r+e.wrapper.clientHeight,T=Mr(t,r),F=Mr(t,n);if(i&&i.ensure){var Y=i.ensure.from.line,J=i.ensure.to.line;Y<T?(T=Y,F=Mr(t,Zr(pt(t,Y))+e.wrapper.clientHeight)):Math.min(J,t.lastLine())>=F&&(T=Mr(t,Zr(pt(t,J))-e.wrapper.clientHeight),F=J)}return{from:T,to:Math.max(F,T+1)}}function Ys(e,t){if(Ke(e,"scrollCursorIntoView"))return;var i=e.display,r=i.sizer.getBoundingClientRect(),n=null;if(t.top+r.top<0?n=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(n=!1),n!=null&&!C){var T=a("div","\u200B",null,`position: absolute;
top: `+(t.top-i.viewOffset-Hn(e.display))+`px;
height: `+(t.bottom-t.top+ri(e)+i.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(T),T.scrollIntoView(n),e.display.lineSpace.removeChild(T)}}function $s(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(t=t.ch?Ve(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,i=t.sticky=="before"?Ve(t.line,t.ch+1,"before"):t);for(var T=0;T<5;T++){var F=!1,Y=Jr(e,t),J=!i||i==t?Y:Jr(e,i);n={left:Math.min(Y.left,J.left),top:Math.min(Y.top,J.top)-r,right:Math.max(Y.left,J.left),bottom:Math.max(Y.bottom,J.bottom)+r};var q=wa(e,n),ce=e.doc.scrollTop,pe=e.doc.scrollLeft;if(q.scrollTop!=null&&(xn(e,q.scrollTop),Math.abs(e.doc.scrollTop-ce)>1&&(F=!0)),q.scrollLeft!=null&&(Ni(e,q.scrollLeft),Math.abs(e.doc.scrollLeft-pe)>1&&(F=!0)),!F)break}return n}function Zs(e,t){var i=wa(e,t);i.scrollTop!=null&&xn(e,i.scrollTop),i.scrollLeft!=null&&Ni(e,i.scrollLeft)}function wa(e,t){var i=e.display,r=Yi(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,T=fa(e),F={};t.bottom-t.top>T&&(t.bottom=t.top+T);var Y=e.doc.height+ca(i),J=t.top<r,q=t.bottom>Y-r;if(t.top<n)F.scrollTop=J?0:t.top;else if(t.bottom>n+T){var ce=Math.min(t.top,(q?Y:t.bottom)-T);ce!=n&&(F.scrollTop=ce)}var pe=e.options.fixedGutter?0:i.gutters.offsetWidth,De=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-pe,Ae=Oi(e)-i.gutters.offsetWidth,Fe=t.right-t.left>Ae;return Fe&&(t.right=t.left+Ae),t.left<10?F.scrollLeft=0:t.left<De?F.scrollLeft=Math.max(0,t.left+pe-(Fe?0:10)):t.right>Ae+De-3&&(F.scrollLeft=t.right+(Fe?0:10)-Ae),F}function Aa(e,t){if(t==null)return;Yn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Ji(e){Yn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function bn(e,t,i){(t!=null||i!=null)&&Yn(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Js(e,t){Yn(e),e.curOp.scrollToPos=t}function Yn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=co(e,t.from),r=co(e,t.to);So(e,i,r,t.margin)}}function So(e,t,i,r){var n=wa(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-r,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+r});bn(e,n.scrollLeft,n.scrollTop)}function xn(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;D||La(e,{top:t}),Co(e,t,!0),D&&La(e),Cn(e,100)}function Co(e,t,i){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!i)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function Ni(e,t,i,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,Lo(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function En(e){var t=e.display,i=t.gutters.offsetWidth,r=Math.round(e.doc.height+ca(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?i:0,docHeight:r,scrollHeight:r+ri(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var Bi=function(e,t,i){this.cm=i;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=n.tabIndex=-1,e(r),e(n),Me(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Me(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,G&&j<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Bi.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var n=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+n)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var T=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+T)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?r:0,bottom:t?r:0}},Bi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Bi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Bi.prototype.zeroWidthHack=function(){var e=l&&!_?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ee,this.disableVert=new ee},Bi.prototype.enableZeroWidthBar=function(e,t,i){e.style.pointerEvents="auto";function r(){var n=e.getBoundingClientRect(),T=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);T!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},Bi.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Sn=function(){};Sn.prototype.update=function(){return{bottom:0,right:0}},Sn.prototype.setScrollLeft=function(){},Sn.prototype.setScrollTop=function(){},Sn.prototype.clear=function(){};function Qi(e,t){t||(t=En(e));var i=e.display.barWidth,r=e.display.barHeight;To(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&Vn(e),To(e,En(e)),i=e.display.barWidth,r=e.display.barHeight}function To(e,t){var i=e.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px",i.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}var wo={native:Bi,null:Sn};function Ao(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&m(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new wo[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Me(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?Ni(e,t):xn(e,t)},e),e.display.scrollbars.addClass&&U(e.display.wrapper,e.display.scrollbars.addClass)}var Qs=0;function Ui(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Qs},zr(e.curOp)}function Fi(e){var t=e.curOp;t&&Wn(t,function(i){for(var r=0;r<i.ops.length;r++)i.ops[r].cm.curOp=null;qs(i)})}function qs(e){for(var t=e.ops,i=0;i<t.length;i++)el(t[i]);for(var r=0;r<t.length;r++)tl(t[r]);for(var n=0;n<t.length;n++)rl(t[n]);for(var T=0;T<t.length;T++)il(t[T]);for(var F=0;F<t.length;F++)nl(t[F])}function el(e){var t=e.cm,i=t.display;ol(t),e.updateMaxLine&&jn(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<i.viewFrom||e.scrollToPos.to.line>=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new $n(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&_a(e.cm,e.update)}function rl(e){var t=e.cm,i=t.display;e.updatedDisplay&&Vn(t),e.barMeasure=En(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=io(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+ri(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-Oi(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.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&&Ni(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var i=e.focus&&e.focus==N();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,i),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Qi(t,e.barMeasure),e.updatedDisplay&&Da(t,e.barMeasure),e.selectionChanged&&Ca(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),i&&bo(e.cm)}function nl(e){var t=e.cm,i=t.display,r=t.doc;if(e.updatedDisplay&&_o(t,e.update),i.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(i.wheelStartX=i.wheelStartY=null),e.scrollTop!=null&&Co(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Ni(t,e.scrollLeft,!0,!0),e.scrollToPos){var n=$s(t,s(r,e.scrollToPos.from),s(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,n)}var T=e.maybeHiddenMarkers,F=e.maybeUnhiddenMarkers;if(T)for(var Y=0;Y<T.length;++Y)T[Y].lines.length||Ue(T[Y],"hide");if(F)for(var J=0;J<F.length;++J)F[J].lines.length&&Ue(F[J],"unhide");i.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Ue(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Rr(e,t){if(e.curOp)return t();Ui(e);try{return t()}finally{Fi(e)}}function lr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Ui(e);try{return t.apply(e,arguments)}finally{Fi(e)}}}function yr(e){return function(){if(this.curOp)return e.apply(this,arguments);Ui(this);try{return e.apply(this,arguments)}finally{Fi(this)}}}function ur(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Ui(t);try{return e.apply(this,arguments)}finally{Fi(t)}}}function Cn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,R(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var i=+new Date+e.options.workTime,r=Je(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(T){if(r.line>=e.display.viewFrom){var F=T.styles,Y=T.text.length>e.options.maxHighlightLength?Hr(t.mode,r.state):null,J=ve(e,T,r,!0);Y&&(r.state=Y),T.styles=J.styles;var q=T.styleClasses,ce=J.classes;ce?T.styleClasses=ce:q&&(T.styleClasses=null);for(var pe=!F||F.length!=T.styles.length||q!=ce&&(!q||!ce||q.bgClass!=ce.bgClass||q.textClass!=ce.textClass),De=0;!pe&&De<F.length;++De)pe=F[De]!=T.styles[De];pe&&n.push(r.line),T.stateAfter=r.save(),r.nextLine()}else T.text.length<=e.options.maxHighlightLength&&ut(e,T.text,r),T.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>i)return Cn(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&Rr(e,function(){for(var T=0;T<n.length;T++)bi(e,n[T],"text")})}var $n=function(e,t,i){var r=e.display;this.viewport=t,this.visible=Xn(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Oi(e),this.force=i,this.dims=xa(e),this.events=[]};$n.prototype.signal=function(e,t){ge(e,t)&&this.events.push(arguments)},$n.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Ue.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=ri(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=ri(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=N();if(!t||!E(e.display.lineDiv,t))return null;var i={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&E(e.display.lineDiv,r.anchorNode)&&(i.anchorNode=r.anchorNode,i.anchorOffset=r.anchorOffset,i.focusNode=r.focusNode,i.focusOffset=r.focusOffset)}return i}function ll(e){if(!e||!e.activeElt||e.activeElt==N())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&E(document.body,e.anchorNode)&&E(document.body,e.focusNode)){var t=window.getSelection(),i=document.createRange();i.setEnd(e.anchorNode,e.anchorOffset),i.collapse(!1),t.removeAllRanges(),t.addRange(i),t.extend(e.focusNode,e.focusOffset)}}function _a(e,t){var i=e.display,r=e.doc;if(t.editorIsHidden)return xi(e),!1;if(!t.force&&t.visible.from>=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&go(e)==0)return!1;ko(e)&&(xi(e),t.dims=xa(e));var n=r.first+r.size,T=Math.max(t.visible.from-e.options.viewportMargin,r.first),F=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFrom<T&&T-i.viewFrom<20&&(T=Math.max(r.first,i.viewFrom)),i.viewTo>F&&i.viewTo-F<20&&(F=Math.min(n,i.viewTo)),Er&&(T=vi(e.doc,T),F=Fn(e.doc,F));var Y=T!=i.viewFrom||F!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Vs(e,T,F),i.viewOffset=Zr(pt(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var J=go(e);if(!Y&&J==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var q=sl(e);return J>4&&(i.lineDiv.style.display="none"),ul(e,i.updateLineNumbers,t.dims),J>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,ll(q),c(i.cursorDiv),c(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,Y&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Cn(e,400)),i.updateLineNumbers=null,!0}function _o(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Oi(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+ca(e.display)-fa(e),i.top)}),t.visible=Xn(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Xn(e.display,e.doc,i));if(!_a(e,t))break;Vn(e);var n=En(e);yn(e),Qi(e,n),Da(e,n),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 La(e,t){var i=new $n(e,t);if(_a(e,i)){Vn(e),_o(e,i);var r=En(e);yn(e),Qi(e,r),Da(e,r),i.finish()}}function ul(e,t,i){var r=e.display,n=e.options.lineNumbers,T=r.lineDiv,F=T.firstChild;function Y(Fe){var ze=Fe.nextSibling;return I&&l&&e.display.currentWheelTarget==Fe?Fe.style.display="none":Fe.parentNode.removeChild(Fe),ze}for(var J=r.view,q=r.viewFrom,ce=0;ce<J.length;ce++){var pe=J[ce];if(!pe.hidden)if(!pe.node||pe.node.parentNode!=T){var De=Ns(e,pe,q,i);T.insertBefore(De,F)}else{for(;F!=pe.node;)F=Y(F);var Ae=n&&t!=null&&t<=q&&pe.lineNumber;pe.changes&&(oe(pe.changes,"gutter")>-1&&(Ae=!1),Za(e,pe,q,i)),Ae&&(c(pe.lineNumber),pe.lineNumber.appendChild(document.createTextNode(ui(e.options,q)))),F=pe.node.nextSibling}q+=pe.size}for(;F;)F=Y(F)}function ka(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Da(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+ri(e)+"px"}function Lo(e){var t=e.display,i=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Ea(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,T=r+"px",F=0;F<i.length;F++)if(!i[F].hidden){e.options.fixedGutter&&(i[F].gutter&&(i[F].gutter.style.left=T),i[F].gutterBackground&&(i[F].gutterBackground.style.left=T));var Y=i[F].alignable;if(Y)for(var J=0;J<Y.length;J++)Y[J].style.left=T}e.options.fixedGutter&&(t.gutters.style.left=r+n+"px")}function ko(e){if(!e.options.lineNumbers)return!1;var t=e.doc,i=ui(e.options,t.first+t.size-1),r=e.display;if(i.length!=r.lineNumChars){var n=r.measure.appendChild(a("div",[a("div",i)],"CodeMirror-linenumber CodeMirror-gutter-elt")),T=n.firstChild.offsetWidth,F=n.offsetWidth-T;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(T,r.lineGutter.offsetWidth-F)+1,r.lineNumWidth=r.lineNumInnerWidth+F,r.lineNumChars=r.lineNumInnerWidth?i.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",ka(e.display),!0}return!1}function Ra(e,t){for(var i=[],r=!1,n=0;n<e.length;n++){var T=e[n],F=null;if(typeof T!="string"&&(F=T.style,T=T.className),T=="CodeMirror-linenumbers")if(t)r=!0;else continue;i.push({className:T,style:F})}return t&&!r&&i.push({className:"CodeMirror-linenumbers",style:null}),i}function Do(e){var t=e.gutters,i=e.gutterSpecs;c(t),e.lineGutter=null;for(var r=0;r<i.length;++r){var n=i[r],T=n.className,F=n.style,Y=t.appendChild(a("div",null,"CodeMirror-gutter "+T));F&&(Y.style.cssText=F),T=="CodeMirror-linenumbers"&&(e.lineGutter=Y,Y.style.width=(e.lineNumWidth||1)+"px")}t.style.display=i.length?"":"none",ka(e)}function Tn(e){Do(e.display),Tr(e),Lo(e)}function hl(e,t,i,r){var n=this;this.input=i,n.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=x("div",null,"CodeMirror-code"),n.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=a("div",null,"CodeMirror-cursors"),n.measure=a("div",null,"CodeMirror-measure"),n.lineMeasure=a("div",null,"CodeMirror-measure"),n.lineSpace=x("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none");var T=x("div",[n.lineSpace],"CodeMirror-lines");n.mover=a("div",[T],null,"position: relative"),n.sizer=a("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=a("div",null,null,"position: absolute; height: "+fe+"px; width: 1px;"),n.gutters=a("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=a("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=a("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),G&&j<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),!I&&!(D&&o)&&(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,n.gutterSpecs=Ra(r.gutters,r.lineNumbers),Do(n),i.init(n)}var Zn=0,Fr=null;G?Fr=-.53:D?Fr=15:y?Fr=-.7:O&&(Fr=-1/3);function Ro(e){var t=e.wheelDeltaX,i=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),i==null&&e.detail&&e.axis==e.VERTICAL_AXIS?i=e.detail:i==null&&(i=e.wheelDelta),{x:t,y:i}}function dl(e){var t=Ro(e);return t.x*=Fr,t.y*=Fr,t}function Oo(e,t){var i=Ro(t),r=i.x,n=i.y,T=e.display,F=T.scroller,Y=F.scrollWidth>F.clientWidth,J=F.scrollHeight>F.clientHeight;if(!(r&&Y||n&&J))return;if(n&&l&&I){e:for(var q=t.target,ce=T.view;q!=F;q=q.parentNode)for(var pe=0;pe<ce.length;pe++)if(ce[pe].node==q){e.display.currentWheelTarget=q;break e}}if(r&&!D&&!A&&Fr!=null){n&&J&&xn(e,Math.max(0,F.scrollTop+n*Fr)),Ni(e,Math.max(0,F.scrollLeft+r*Fr)),(!n||n&&J)&&re(t),T.wheelStartX=null;return}if(n&&Fr!=null){var De=n*Fr,Ae=e.doc.scrollTop,Fe=Ae+T.wrapper.clientHeight;De<0?Ae=Math.max(0,Ae+De-50):Fe=Math.min(e.doc.height,Fe+De+50),La(e,{top:Ae,bottom:Fe})}Zn<20&&(T.wheelStartX==null?(T.wheelStartX=F.scrollLeft,T.wheelStartY=F.scrollTop,T.wheelDX=r,T.wheelDY=n,setTimeout(function(){if(T.wheelStartX==null)return;var ze=F.scrollLeft-T.wheelStartX,Ye=F.scrollTop-T.wheelStartY,tt=Ye&&T.wheelDY&&Ye/T.wheelDY||ze&&T.wheelDX&&ze/T.wheelDX;if(T.wheelStartX=T.wheelStartY=null,!tt)return;Fr=(Fr*Zn+tt)/(Zn+1),++Zn},200)):(T.wheelDX+=r,T.wheelDY+=n))}var jr=function(e,t){this.ranges=e,this.primIndex=t};jr.prototype.primary=function(){return this.ranges[this.primIndex]},jr.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var i=this.ranges[t],r=e.ranges[t];if(!hi(i.anchor,r.anchor)||!hi(i.head,r.head))return!1}return!0},jr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new jt(_i(this.ranges[t].anchor),_i(this.ranges[t].head));return new jr(e,this.primIndex)},jr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},jr.prototype.contains=function(e,t){t||(t=e);for(var i=0;i<this.ranges.length;i++){var r=this.ranges[i];if(Ct(t,r.from())>=0&&Ct(e,r.to())<=0)return i}return-1};var jt=function(e,t){this.anchor=e,this.head=t};jt.prototype.from=function(){return Li(this.anchor,this.head)},jt.prototype.to=function(){return di(this.anchor,this.head)},jt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Qr(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(De,Ae){return Ct(De.from(),Ae.from())}),i=oe(t,n);for(var T=1;T<t.length;T++){var F=t[T],Y=t[T-1],J=Ct(Y.to(),F.from());if(r&&!F.empty()?J>0:J>=0){var q=Li(Y.from(),F.from()),ce=di(Y.to(),F.to()),pe=Y.empty()?F.from()==F.head:Y.from()==Y.head;T<=i&&--i,t.splice(--T,2,new jt(pe?ce:q,pe?q:ce))}}return new jr(t,i)}function Ei(e,t){return new jr([new jt(e,t||e)],0)}function Si(e){return e.text?Ve(e.from.line+e.text.length-1,te(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Po(e,t){if(Ct(e,t.from)<0)return e;if(Ct(e,t.to)<=0)return Si(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Si(t).ch-t.to.ch),Ve(i,r)}function Oa(e,t){for(var i=[],r=0;r<e.sel.ranges.length;r++){var n=e.sel.ranges[r];i.push(new jt(Po(n.anchor,t),Po(n.head,t)))}return Qr(e.cm,i,e.sel.primIndex)}function Mo(e,t,i){return e.line==t.line?Ve(i.line,e.ch-t.ch+i.ch):Ve(i.line+(e.line-t.line),e.ch)}function cl(e,t,i){for(var r=[],n=Ve(e.first,0),T=n,F=0;F<t.length;F++){var Y=t[F],J=Mo(Y.from,n,T),q=Mo(Si(Y),n,T);if(n=Y.to,T=q,i=="around"){var ce=e.sel.ranges[F],pe=Ct(ce.head,ce.anchor)<0;r[F]=new jt(pe?q:J,pe?J:q)}else r[F]=new jt(J,J)}return new jr(r,e.sel.primIndex)}function Pa(e){e.doc.mode=Vr(e.options,e.doc.modeOption),wn(e)}function wn(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&&Tr(e)}function Io(e,t){return t.from.ch==0&&t.to.ch==0&&te(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ma(e,t,i,r){function n(ot){return i?i[ot]:null}function T(ot,rt,ht){$a(ot,rt,ht,r),pr(ot,"change",ot,t)}function F(ot,rt){for(var ht=[],xt=ot;xt<rt;++xt)ht.push(new Ri(q[xt],n(xt),r));return ht}var Y=t.from,J=t.to,q=t.text,ce=pt(e,Y.line),pe=pt(e,J.line),De=te(q),Ae=n(q.length-1),Fe=J.line-Y.line;if(t.full)e.insert(0,F(0,q.length)),e.remove(q.length,e.size-q.length);else if(Io(e,t)){var ze=F(0,q.length-1);T(pe,pe.text,Ae),Fe&&e.remove(Y.line,Fe),ze.length&&e.insert(Y.line,ze)}else if(ce==pe)if(q.length==1)T(ce,ce.text.slice(0,Y.ch)+De+ce.text.slice(J.ch),Ae);else{var Ye=F(1,q.length-1);Ye.push(new Ri(De+ce.text.slice(J.ch),Ae,r)),T(ce,ce.text.slice(0,Y.ch)+q[0],n(0)),e.insert(Y.line+1,Ye)}else if(q.length==1)T(ce,ce.text.slice(0,Y.ch)+q[0]+pe.text.slice(J.ch),n(0)),e.remove(Y.line+1,Fe);else{T(ce,ce.text.slice(0,Y.ch)+q[0],n(0)),T(pe,De+pe.text.slice(J.ch),Ae);var tt=F(1,q.length-1);Fe>1&&e.remove(Y.line+1,Fe-1),e.insert(Y.line+1,tt)}pr(e,"change",e,t)}function Ci(e,t,i){function r(n,T,F){if(n.linked)for(var Y=0;Y<n.linked.length;++Y){var J=n.linked[Y];if(J.doc==T)continue;var q=F&&J.sharedHist;if(i&&!q)continue;t(J.doc,q),r(J.doc,n,q)}}r(e,null,!0)}function No(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Sa(e),Pa(e),Bo(e),e.options.lineWrapping||jn(e),e.options.mode=t.modeOption,Tr(e)}function Bo(e){(e.doc.direction=="rtl"?U:m)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Rr(e,function(){Bo(e),Tr(e)})}function Jn(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Ia(e,t){var i={from:_i(t.from),to:Si(t),text:Pr(e,t.from,t.to)};return jo(e,i,t.from.line,t.to.line+1),Ci(e,function(r){return jo(r,i,t.from.line,t.to.line+1)},!0),i}function Uo(e){for(;e.length;){var t=te(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Uo(e.done),te(e.done);if(e.done.length&&!te(e.done).ranges)return te(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),te(e.done)}function Fo(e,t,i,r){var n=e.history;n.undone.length=0;var T=+new Date,F,Y;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>T-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(F=pl(n,n.lastOp==r)))Y=te(F.changes),Ct(t.from,t.to)==0&&Ct(t.from,Y.to)==0?Y.to=Si(t):F.changes.push(Ia(e,t));else{var J=te(n.done);for((!J||!J.ranges)&&Qn(e.sel,n.done),F={changes:[Ia(e,t)],generation:n.generation},n.done.push(F);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(i),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=T,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,Y||Ue(e,"historyAdded")}function ml(e,t,i,r){var n=t.charAt(0);return n=="*"||n=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,i,r){var n=e.history,T=r&&r.origin;i==n.lastSelOp||T&&n.lastSelOrigin==T&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==T||ml(e,T,te(n.done),t))?n.done[n.done.length-1]=t:Qn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=T,n.lastSelOp=i,r&&r.clearRedo!==!1&&Uo(n.undone)}function Qn(e,t){var i=te(t);i&&i.ranges&&i.equals(e)||t.push(e)}function jo(e,t,i,r){var n=t["spans_"+e.id],T=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(F){F.markedSpans&&((n||(n=t["spans_"+e.id]={}))[T]=F.markedSpans),++T})}function vl(e){if(!e)return null;for(var t,i=0;i<e.length;++i)e[i].marker.explicitlyCleared?t||(t=e.slice(0,i)):t&&t.push(e[i]);return t?t.length?t:null:e}function yl(e,t){var i=t["spans_"+e.id];if(!i)return null;for(var r=[],n=0;n<t.text.length;++n)r.push(vl(i[n]));return r}function Wo(e,t){var i=yl(e,t),r=$r(e,t);if(!i)return r;if(!r)return i;for(var n=0;n<i.length;++n){var T=i[n],F=r[n];if(T&&F){e:for(var Y=0;Y<F.length;++Y){for(var J=F[Y],q=0;q<T.length;++q)if(T[q].marker==J.marker)continue e;T.push(J)}}else F&&(i[n]=F)}return i}function qi(e,t,i){for(var r=[],n=0;n<e.length;++n){var T=e[n];if(T.ranges){r.push(i?jr.prototype.deepCopy.call(T):T);continue}var F=T.changes,Y=[];r.push({changes:Y});for(var J=0;J<F.length;++J){var q=F[J],ce=void 0;if(Y.push({from:q.from,to:q.to,text:q.text}),t)for(var pe in q)(ce=pe.match(/^spans_(\d+)$/))&&(oe(t,Number(ce[1]))>-1&&(te(Y)[pe]=q[pe],delete q[pe]))}}return r}function Na(e,t,i,r){if(r){var n=e.anchor;if(i){var T=Ct(t,n)<0;T!=Ct(i,n)<0?(n=t,t=i):T!=Ct(t,i)<0&&(t=i)}return new jt(n,t)}else return new jt(i||t,t)}function qn(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),gr(e,new jr([Na(e.sel.primary(),t,i,n)],0),r)}function Ho(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),T=0;T<e.sel.ranges.length;T++)r[T]=Na(e.sel.ranges[T],t[T],null,n);var F=Qr(e.cm,r,e.sel.primIndex);gr(e,F,i)}function Ba(e,t,i,r){var n=e.sel.ranges.slice(0);n[t]=i,gr(e,Qr(e.cm,n,e.sel.primIndex),r)}function Go(e,t,i,r){gr(e,Ei(t,i),r)}function bl(e,t,i){var r={ranges:t.ranges,update:function(n){this.ranges=[];for(var T=0;T<n.length;T++)this.ranges[T]=new jt(s(e,n[T].anchor),s(e,n[T].head))},origin:i&&i.origin};return Ue(e,"beforeSelectionChange",e,r),e.cm&&Ue(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Qr(e.cm,r.ranges,r.ranges.length-1):t}function zo(e,t,i){var r=e.history.done,n=te(r);n&&n.ranges?(r[r.length-1]=t,ea(e,t,i)):gr(e,t,i)}function gr(e,t,i){ea(e,t,i),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,i)}function ea(e,t,i){(ge(e,"beforeSelectionChange")||e.cm&&ge(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,i));var r=i&&i.bias||(Ct(t.primary().head,e.sel.primary().head)<0?-1:1);Ko(e,Xo(e,t,r,!0)),!(i&&i.scroll===!1)&&e.cm&&Ji(e.cm)}function Ko(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,xe(e.cm)),pr(e,"cursorActivity",e)}function Vo(e){Ko(e,Xo(e,e.sel,null,!1))}function Xo(e,t,i,r){for(var n,T=0;T<t.ranges.length;T++){var F=t.ranges[T],Y=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[T],J=ta(e,F.anchor,Y&&Y.anchor,i,r),q=ta(e,F.head,Y&&Y.head,i,r);(n||J!=F.anchor||q!=F.head)&&(n||(n=t.ranges.slice(0,T)),n[T]=new jt(J,q))}return n?Qr(e.cm,n,t.primIndex):t}function en(e,t,i,r,n){var T=pt(e,t.line);if(T.markedSpans)for(var F=0;F<T.markedSpans.length;++F){var Y=T.markedSpans[F],J=Y.marker,q="selectLeft"in J?!J.selectLeft:J.inclusiveLeft,ce="selectRight"in J?!J.selectRight:J.inclusiveRight;if((Y.from==null||(q?Y.from<=t.ch:Y.from<t.ch))&&(Y.to==null||(ce?Y.to>=t.ch:Y.to>t.ch))){if(n&&(Ue(J,"beforeCursorEnter"),J.explicitlyCleared))if(T.markedSpans){--F;continue}else break;if(!J.atomic)continue;if(i){var pe=J.find(r<0?1:-1),De=void 0;if((r<0?ce:q)&&(pe=Yo(e,pe,-r,pe&&pe.line==t.line?T:null)),pe&&pe.line==t.line&&(De=Ct(pe,i))&&(r<0?De<0:De>0))return en(e,pe,t,r,n)}var Ae=J.find(r<0?-1:1);return(r<0?q:ce)&&(Ae=Yo(e,Ae,r,Ae.line==t.line?T:null)),Ae?en(e,Ae,t,r,n):null}}return t}function ta(e,t,i,r,n){var T=r||1,F=en(e,t,i,T,n)||!n&&en(e,t,i,T,!0)||en(e,t,i,-T,n)||!n&&en(e,t,i,-T,!0);return F||(e.cantEdit=!0,Ve(e.first,0))}function Yo(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?s(e,Ve(t.line-1)):null:i>0&&t.ch==(r||pt(e,t.line)).text.length?t.line<e.first+e.size-1?Ve(t.line+1,0):null:new Ve(t.line,t.ch+i)}function $o(e){e.setSelection(Ve(e.firstLine(),0),Ve(e.lastLine()),Ee)}function Zo(e,t,i){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return i&&(r.update=function(n,T,F,Y){n&&(r.from=s(e,n)),T&&(r.to=s(e,T)),F&&(r.text=F),Y!==void 0&&(r.origin=Y)}),Ue(e,"beforeChange",e,r),e.cm&&Ue(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function tn(e,t,i){if(e.cm){if(!e.cm.curOp)return lr(e.cm,tn)(e,t,i);if(e.cm.state.suppressEdits)return}if((ge(e,"beforeChange")||e.cm&&ge(e.cm,"beforeChange"))&&(t=Zo(e,t,!0),!t))return;var r=Hi&&!i&&ki(e,t.from,t.to);if(r)for(var n=r.length-1;n>=0;--n)Jo(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text,origin:t.origin});else Jo(e,t)}function Jo(e,t){if(t.text.length==1&&t.text[0]==""&&Ct(t.from,t.to)==0)return;var i=Oa(e,t);Fo(e,t,i,e.cm?e.cm.curOp.id:NaN),An(e,t,i,$r(e,t));var r=[];Ci(e,function(n,T){!T&&oe(r,n.history)==-1&&(ts(n.history,t),r.push(n.history)),An(n,t,null,$r(n,t))})}function ra(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!i)return;for(var n=e.history,T,F=e.sel,Y=t=="undo"?n.done:n.undone,J=t=="undo"?n.undone:n.done,q=0;q<Y.length&&!(T=Y[q],i?T.ranges&&!T.equals(e.sel):!T.ranges);q++);if(q==Y.length)return;for(n.lastOrigin=n.lastSelOrigin=null;;)if(T=Y.pop(),T.ranges){if(Qn(T,J),i&&!T.equals(e.sel)){gr(e,T,{clearRedo:!1});return}F=T}else if(r){Y.push(T);return}else break;var ce=[];Qn(F,J),J.push({changes:ce,generation:n.generation}),n.generation=T.generation||++n.maxGeneration;for(var pe=ge(e,"beforeChange")||e.cm&&ge(e.cm,"beforeChange"),De=function(ze){var Ye=T.changes[ze];if(Ye.origin=t,pe&&!Zo(e,Ye,!1))return Y.length=0,{};ce.push(Ia(e,Ye));var tt=ze?Oa(e,Ye):te(Y);An(e,Ye,tt,Wo(e,Ye)),!ze&&e.cm&&e.cm.scrollIntoView({from:Ye.from,to:Si(Ye)});var ot=[];Ci(e,function(rt,ht){!ht&&oe(ot,rt.history)==-1&&(ts(rt.history,Ye),ot.push(rt.history)),An(rt,Ye,null,Wo(rt,Ye))})},Ae=T.changes.length-1;Ae>=0;--Ae){var Fe=De(Ae);if(Fe)return Fe.v}}function Qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new jr(de(e.sel.ranges,function(n){return new jt(Ve(n.anchor.line+t,n.anchor.ch),Ve(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm){Tr(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;r<i.viewTo;r++)bi(e.cm,r,"gutter")}}function An(e,t,i,r){if(e.cm&&!e.cm.curOp)return lr(e.cm,An)(e,t,i,r);if(t.to.line<e.first){Qo(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var n=t.text.length-1-(e.first-t.from.line);Qo(e,n),t={from:Ve(e.first,0),to:Ve(t.to.line+n,t.to.ch),text:[te(t.text)],origin:t.origin}}var T=e.lastLine();t.to.line>T&&(t={from:t.from,to:Ve(T,pt(e,T).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Pr(e,t.from,t.to),i||(i=Oa(e,t)),e.cm?xl(e.cm,t,r):Ma(e,t,r),ea(e,i,Ee),e.cantEdit&&ta(e,Ve(e.firstLine(),0))&&(e.cantEdit=!1)}function xl(e,t,i){var r=e.doc,n=e.display,T=t.from,F=t.to,Y=!1,J=T.line;e.options.lineWrapping||(J=Lt(Sr(pt(r,T.line))),r.iter(J,F.line+1,function(Ae){if(Ae==n.maxLine)return Y=!0,!0})),r.sel.contains(t.from,t.to)>-1&&xe(e),Ma(r,t,i,mo(e)),e.options.lineWrapping||(r.iter(J,T.line+t.text.length,function(Ae){var Fe=Vi(Ae);Fe>n.maxLineLength&&(n.maxLine=Ae,n.maxLineLength=Fe,n.maxLineChanged=!0,Y=!1)}),Y&&(e.curOp.updateMaxLine=!0)),Gr(r,T.line),Cn(e,400);var q=t.text.length-(F.line-T.line)-1;t.full?Tr(e):T.line==F.line&&t.text.length==1&&!Io(e.doc,t)?bi(e,T.line,"text"):Tr(e,T.line,F.line+1,q);var ce=ge(e,"changes"),pe=ge(e,"change");if(pe||ce){var De={from:T,to:F,text:t.text,removed:t.removed,origin:t.origin};pe&&pr(e,"change",e,De),ce&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(De)}e.display.selForContextMenu=null}function rn(e,t,i,r,n){var T;r||(r=i),Ct(r,i)<0&&(T=[r,i],i=T[0],r=T[1]),typeof t=="string"&&(t=e.splitLines(t)),tn(e,{from:i,to:r,text:t,origin:n})}function qo(e,t,i,r){i<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function es(e,t,i,r){for(var n=0;n<e.length;++n){var T=e[n],F=!0;if(T.ranges){T.copied||(T=e[n]=T.deepCopy(),T.copied=!0);for(var Y=0;Y<T.ranges.length;Y++)qo(T.ranges[Y].anchor,t,i,r),qo(T.ranges[Y].head,t,i,r);continue}for(var J=0;J<T.changes.length;++J){var q=T.changes[J];if(i<q.from.line)q.from=Ve(q.from.line+r,q.from.ch),q.to=Ve(q.to.line+r,q.to.ch);else if(t<=q.to.line){F=!1;break}}F||(e.splice(0,n+1),n=0)}}function ts(e,t){var i=t.from.line,r=t.to.line,n=t.text.length-(r-i)-1;es(e.done,i,r,n),es(e.undone,i,r,n)}function _n(e,t,i,r){var n=t,T=t;return typeof t=="number"?T=pt(e,z(e,t)):n=Lt(t),n==null?null:(r(T,n)&&e.cm&&bi(e.cm,n,i),T)}function Ln(e){this.lines=e,this.parent=null;for(var t=0,i=0;i<e.length;++i)e[i].parent=this,t+=e[i].height;this.height=t}Ln.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var i=e,r=e+t;i<r;++i){var n=this.lines[i];this.height-=n.height,ha(n),pr(n,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,i){this.height+=i,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,i){for(var r=e+t;e<r;++e)if(i(this.lines[e]))return!0}};function kn(e){this.children=e;for(var t=0,i=0,r=0;r<e.length;++r){var n=e[r];t+=n.chunkSize(),i+=n.height,n.parent=this}this.size=t,this.height=i,this.parent=null}kn.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var i=0;i<this.children.length;++i){var r=this.children[i],n=r.chunkSize();if(e<n){var T=Math.min(t,n-e),F=r.height;if(r.removeInner(e,T),this.height-=F-r.height,n==T&&(this.children.splice(i--,1),r.parent=null),(t-=T)==0)break;e=0}else e-=n}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Ln))){var Y=[];this.collapse(Y),this.children=[new Ln(Y)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,i){this.size+=t.length,this.height+=i;for(var r=0;r<this.children.length;++r){var n=this.children[r],T=n.chunkSize();if(e<=T){if(n.insertInner(e,t,i),n.lines&&n.lines.length>50){for(var F=n.lines.length%25+25,Y=F;Y<n.lines.length;){var J=new Ln(n.lines.slice(Y,Y+=25));n.height-=J.height,this.children.splice(++r,0,J),J.parent=this}n.lines=n.lines.slice(0,F),this.maybeSpill()}break}e-=T}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),i=new kn(t);if(e.parent){e.size-=i.size,e.height-=i.height;var n=oe(e.parent.children,e);e.parent.children.splice(n+1,0,i)}else{var r=new kn(e.children);r.parent=e,e.children=[r,i],e=r}i.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,i){for(var r=0;r<this.children.length;++r){var n=this.children[r],T=n.chunkSize();if(e<T){var F=Math.min(t,T-e);if(n.iterN(e,F,i))return!0;if((t-=F)==0)break;e=0}else e-=T}}};var Dn=function(e,t,i){if(i)for(var r in i)i.hasOwnProperty(r)&&(this[r]=i[r]);this.doc=e,this.node=t};Dn.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,i=this.line,r=Lt(i);if(r==null||!t)return;for(var n=0;n<t.length;++n)t[n]==this&&t.splice(n--,1);t.length||(i.widgets=null);var T=gn(this);xr(i,Math.max(0,i.height-T)),e&&(Rr(e,function(){rs(e,i,-T),bi(e,r,"widget")}),pr(e,"lineWidgetCleared",e,this,r))},Dn.prototype.changed=function(){var e=this,t=this.height,i=this.doc.cm,r=this.line;this.height=null;var n=gn(this)-t;if(!n)return;Dr(this.doc,r)||xr(r,r.height+n),i&&Rr(i,function(){i.curOp.forceUpdate=!0,rs(i,r,n),pr(i,"lineWidgetChanged",i,e,Lt(r))})},be(Dn);function rs(e,t,i){Zr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Aa(e,i)}function El(e,t,i,r){var n=new Dn(e,i,r),T=e.cm;return T&&n.noHScroll&&(T.display.alignWidgets=!0),_n(e,t,"widget",function(F){var Y=F.widgets||(F.widgets=[]);if(n.insertAt==null?Y.push(n):Y.splice(Math.min(Y.length-1,Math.max(0,n.insertAt)),0,n),n.line=F,T&&!Dr(e,F)){var J=Zr(F)<e.scrollTop;xr(F,F.height+gn(n)),J&&Aa(T,n.height),T.curOp.forceUpdate=!0}return!0}),T&&pr(T,"lineWidgetAdded",T,n,typeof t=="number"?t:Lt(t)),n}var is=0,Ti=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++is};Ti.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&Ui(e),ge(this,"clear")){var i=this.find();i&&pr(this,"clear",i.from,i.to)}for(var r=null,n=null,T=0;T<this.lines.length;++T){var F=this.lines[T],Y=Yr(F.markedSpans,this);e&&!this.collapsed?bi(e,Lt(F),"text"):e&&(Y.to!=null&&(n=Lt(F)),Y.from!=null&&(r=Lt(F))),F.markedSpans=ci(F.markedSpans,Y),Y.from==null&&this.collapsed&&!Dr(this.doc,F)&&e&&xr(F,Yi(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var J=0;J<this.lines.length;++J){var q=Sr(this.lines[J]),ce=Vi(q);ce>e.display.maxLineLength&&(e.display.maxLine=q,e.display.maxLineLength=ce,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Tr(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Vo(e.doc)),e&&pr(e,"markerCleared",e,this,r,n),t&&Fi(e),this.parent&&this.parent.clear()},Ti.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n<this.lines.length;++n){var T=this.lines[n],F=Yr(T.markedSpans,this);if(F.from!=null&&(i=Ve(t?T:Lt(T),F.from),e==-1))return i;if(F.to!=null&&(r=Ve(t?T:Lt(T),F.to),e==1))return r}return i&&{from:i,to:r}},Ti.prototype.changed=function(){var e=this,t=this.find(-1,!0),i=this,r=this.doc.cm;if(!t||!r)return;Rr(r,function(){var n=t.line,T=Lt(t.line),F=pa(r,T);if(F&&(oo(F),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Dr(i.doc,n)&&i.height!=null){var Y=i.height;i.height=null;var J=gn(i)-Y;J&&xr(n,n.height+J)}pr(r,"markerChanged",r,e)})},Ti.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||oe(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Ti.prototype.detachLine=function(e){if(this.lines.splice(oe(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},be(Ti);function nn(e,t,i,r,n){if(r&&r.shared)return Sl(e,t,i,r,n);if(e.cm&&!e.cm.curOp)return lr(e.cm,nn)(e,t,i,r,n);var T=new Ti(e,n),F=Ct(t,i);if(r&&M(r,T,!1),F>0||F==0&&T.clearWhenEmpty!==!1)return T;if(T.replacedWith&&(T.collapsed=!0,T.widgetNode=x("span",[T.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||T.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(T.widgetNode.insertLeft=!0)),T.collapsed){if(Qt(e,t.line,t,i,T)||t.line!=i.line&&Qt(e,i.line,t,i,T))throw new Error("Inserting collapsed marker partially overlapping an existing one");kr()}T.addToHistory&&Fo(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var Y=t.line,J=e.cm,q;if(e.iter(Y,i.line+1,function(pe){J&&T.collapsed&&!J.options.lineWrapping&&Sr(pe)==J.display.maxLine&&(q=!0),T.collapsed&&Y!=t.line&&xr(pe,0),ei(pe,new gi(T,Y==t.line?t.ch:null,Y==i.line?i.ch:null)),++Y}),T.collapsed&&e.iter(t.line,i.line+1,function(pe){Dr(e,pe)&&xr(pe,0)}),T.clearOnEnter&&Me(T,"beforeCursorEnter",function(){return T.clear()}),T.readOnly&&(Br(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),T.collapsed&&(T.id=++is,T.atomic=!0),J){if(q&&(J.curOp.updateMaxLine=!0),T.collapsed)Tr(J,t.line,i.line+1);else if(T.className||T.startStyle||T.endStyle||T.css||T.attributes||T.title)for(var ce=t.line;ce<=i.line;ce++)bi(J,ce,"text");T.atomic&&Vo(J.doc),pr(J,"markerAdded",J,T)}return T}var Rn=function(e,t){this.markers=e,this.primary=t;for(var i=0;i<e.length;++i)e[i].parent=this};Rn.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();pr(this,"clear")},Rn.prototype.find=function(e,t){return this.primary.find(e,t)},be(Rn);function Sl(e,t,i,r,n){r=M(r),r.shared=!1;var T=[nn(e,t,i,r,n)],F=T[0],Y=r.widgetNode;return Ci(e,function(J){Y&&(r.widgetNode=Y.cloneNode(!0)),T.push(nn(J,s(J,t),s(J,i),r,n));for(var q=0;q<J.linked.length;++q)if(J.linked[q].isParent)return;F=te(T)}),new Rn(T,F)}function ns(e){return e.findMarks(Ve(e.first,0),e.clipPos(Ve(e.lastLine())),function(t){return t.parent})}function Cl(e,t){for(var i=0;i<t.length;i++){var r=t[i],n=r.find(),T=e.clipPos(n.from),F=e.clipPos(n.to);if(Ct(T,F)){var Y=nn(e,T,F,r.primary,r.primary.type);r.markers.push(Y),Y.parent=r}}}function Tl(e){for(var t=function(r){var n=e[r],T=[n.primary.doc];Ci(n.primary.doc,function(J){return T.push(J)});for(var F=0;F<n.markers.length;F++){var Y=n.markers[F];oe(T,Y.doc)==-1&&(Y.parent=null,n.markers.splice(F--,1))}},i=0;i<e.length;i++)t(i)}var wl=0,wr=function(e,t,i,r,n){if(!(this instanceof wr))return new wr(e,t,i,r,n);i==null&&(i=0),kn.call(this,[new Ln([new Ri("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=i;var T=Ve(i,0);this.sel=Ei(T),this.history=new Jn(null),this.id=++wl,this.modeOption=t,this.lineSep=r,this.direction=n=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Ma(this,{from:T,to:T,text:e}),gr(this,Ei(T),Ee)};wr.prototype=Re(kn.prototype,{constructor:wr,iter:function(e,t,i){i?this.iterN(e-this.first,t-e,i):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var i=0,r=0;r<t.length;++r)i+=t[r].height;this.insertInner(e-this.first,t,i)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=li(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:ur(function(e){var t=Ve(this.first,0),i=this.first+this.size-1;tn(this,{from:t,to:Ve(i,pt(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&bn(this.cm,0,0),gr(this,Ei(t),Ee)}),replaceRange:function(e,t,i,r){t=s(this,t),i=i?s(this,i):t,rn(this,e,t,i,r)},getRange:function(e,t,i){var r=Pr(this,s(this,e),s(this,t));return i===!1?r:r.join(i||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Xr(this,e))return pt(this,e)},getLineNumber:function(e){return Lt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=pt(this,e)),Sr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return s(this,e)},getCursor:function(e){var t=this.sel.primary(),i;return e==null||e=="head"?i=t.head:e=="anchor"?i=t.anchor:e=="end"||e=="to"||e===!1?i=t.to():i=t.from(),i},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:ur(function(e,t,i){Go(this,s(this,typeof e=="number"?Ve(e,t||0):e),null,i)}),setSelection:ur(function(e,t,i){Go(this,s(this,e),s(this,t||e),i)}),extendSelection:ur(function(e,t,i){qn(this,s(this,e),t&&s(this,t),i)}),extendSelections:ur(function(e,t){Ho(this,W(this,e),t)}),extendSelectionsBy:ur(function(e,t){var i=de(this.sel.ranges,e);Ho(this,W(this,i),t)}),setSelections:ur(function(e,t,i){if(!e.length)return;for(var r=[],n=0;n<e.length;n++)r[n]=new jt(s(this,e[n].anchor),s(this,e[n].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),gr(this,Qr(this.cm,r,t),i)}),addSelection:ur(function(e,t,i){var r=this.sel.ranges.slice(0);r.push(new jt(s(this,e),s(this,t||e))),gr(this,Qr(this.cm,r,r.length-1),i)}),getSelection:function(e){for(var t=this.sel.ranges,i,r=0;r<t.length;r++){var n=Pr(this,t[r].from(),t[r].to());i=i?i.concat(n):n}return e===!1?i:i.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],i=this.sel.ranges,r=0;r<i.length;r++){var n=Pr(this,i[r].from(),i[r].to());e!==!1&&(n=n.join(e||this.lineSeparator())),t[r]=n}return t},replaceSelection:function(e,t,i){for(var r=[],n=0;n<this.sel.ranges.length;n++)r[n]=e;this.replaceSelections(r,t,i||"+input")},replaceSelections:ur(function(e,t,i){for(var r=[],n=this.sel,T=0;T<n.ranges.length;T++){var F=n.ranges[T];r[T]={from:F.from(),to:F.to(),text:this.splitLines(e[T]),origin:i}}for(var Y=t&&t!="end"&&cl(this,r,t),J=r.length-1;J>=0;J--)tn(this,r[J]);Y?zo(this,Y):this.cm&&Ji(this.cm)}),undo:ur(function(){ra(this,"undo")}),redo:ur(function(){ra(this,"redo")}),undoSelection:ur(function(){ra(this,"undo",!0)}),redoSelection:ur(function(){ra(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var n=0;n<e.undone.length;n++)e.undone[n].ranges||++i;return{undo:t,redo:i}},clearHistory:function(){var e=this;this.history=new Jn(this.history.maxGeneration),Ci(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:qi(this.history.done),undone:qi(this.history.undone)}},setHistory:function(e){var t=this.history=new Jn(this.history.maxGeneration);t.done=qi(e.done.slice(0),null,!0),t.undone=qi(e.undone.slice(0),null,!0)},setGutterMarker:ur(function(e,t,i){return _n(this,e,"gutter",function(r){var n=r.gutterMarkers||(r.gutterMarkers={});return n[t]=i,!i&&Ie(n)&&(r.gutterMarkers=null),!0})}),clearGutter:ur(function(e){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&_n(t,i,"gutter",function(){return i.gutterMarkers[e]=null,Ie(i.gutterMarkers)&&(i.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Xr(this,e))return null;if(t=e,e=pt(this,e),!e)return null}else if(t=Lt(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:ur(function(e,t,i){return _n(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[n])r[n]=i;else{if(g(i).test(r[n]))return!1;r[n]+=" "+i}return!0})}),removeLineClass:ur(function(e,t,i){return _n(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",T=r[n];if(T)if(i==null)r[n]=null;else{var F=T.match(g(i));if(!F)return!1;var Y=F.index+F[0].length;r[n]=T.slice(0,F.index)+(!F.index||Y==T.length?"":" ")+T.slice(Y)||null}else return!1;return!0})}),addLineWidget:ur(function(e,t,i){return El(this,e,t,i)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return nn(this,s(this,e),s(this,t),i,i&&i.type||"range")},setBookmark:function(e,t){var i={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=s(this,e),nn(this,e,e,i,"bookmark")},findMarksAt:function(e){e=s(this,e);var t=[],i=pt(this,e.line).markedSpans;if(i)for(var r=0;r<i.length;++r){var n=i[r];(n.from==null||n.from<=e.ch)&&(n.to==null||n.to>=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,i){e=s(this,e),t=s(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(T){var F=T.markedSpans;if(F)for(var Y=0;Y<F.length;Y++){var J=F[Y];!(J.to!=null&&n==e.line&&e.ch>=J.to||J.from==null&&n!=e.line||J.from!=null&&n==t.line&&J.from>=t.ch)&&(!i||i(J.marker))&&r.push(J.marker.parent||J.marker)}++n}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;r<i.length;++r)i[r].from!=null&&e.push(i[r].marker)}),e},posFromIndex:function(e){var t,i=this.first,r=this.lineSeparator().length;return this.iter(function(n){var T=n.text.length+r;if(T>e)return t=e,!0;e-=T,++i}),s(this,Ve(i,t))},indexFromPos:function(e){e=s(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var i=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+i}),t},copy:function(e){var t=new wr(li(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,i=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<i&&(i=e.to);var r=new wr(li(this,t,i),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Cl(r,ns(this)),r},unlinkDoc:function(e){if(e instanceof Yt&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var i=this.linked[t];if(i.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),Tl(ns(this));break}if(e.history==this.history){var r=[e.id];Ci(e,function(n){return r.push(n.id)},!0),e.history=new Jn(null),e.history.done=qi(this.history.done,r),e.history.undone=qi(this.history.undone,r)}},iterLinkedDocs:function(e){Ci(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):St(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:ur(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)})}),wr.prototype.eachLine=wr.prototype.iter;var as=0;function Al(e){var t=this;if(os(t),Ke(t,e)||fi(t.display,e))return;re(e),G&&(as=+new Date);var i=Mi(t,e,!0),r=e.dataTransfer.files;if(!i||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var n=r.length,T=Array(n),F=0,Y=function(){++F==n&&lr(t,function(){i=s(t.doc,i);var Ae={from:i,to:i,text:t.doc.splitLines(T.filter(function(Fe){return Fe!=null}).join(t.doc.lineSeparator())),origin:"paste"};tn(t.doc,Ae),zo(t.doc,Ei(s(t.doc,i),s(t.doc,Si(Ae))))})()},J=function(Ae,Fe){if(t.options.allowDropFileTypes&&oe(t.options.allowDropFileTypes,Ae.type)==-1){Y();return}var ze=new FileReader;ze.onerror=function(){return Y()},ze.onload=function(){var Ye=ze.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Ye)){Y();return}T[Fe]=Ye,Y()},ze.readAsText(Ae)},q=0;q<r.length;q++)J(r[q],q);else{if(t.state.draggingText&&t.doc.sel.contains(i)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var ce=e.dataTransfer.getData("Text");if(ce){var pe;if(t.state.draggingText&&!t.state.draggingText.copy&&(pe=t.listSelections()),ea(t.doc,Ei(i,i)),pe)for(var De=0;De<pe.length;++De)rn(t.doc,"",pe[De].anchor,pe[De].head,"drag");t.replaceSelection(ce,"around","paste"),t.display.input.focus()}}catch(Ae){}}}function _l(e,t){if(G&&(!e.state.draggingText||+new Date-as<100)){he(t);return}if(Ke(e,t)||fi(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!O){var i=a("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",A&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),A&&i.parentNode.removeChild(i)}}function Ll(e,t){var i=Mi(e,t);if(!i)return;var r=document.createDocumentFragment();yo(e,i,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),u(e.display.dragCursor,r)}function os(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ss(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),i=[],r=0;r<t.length;r++){var n=t[r].CodeMirror;n&&i.push(n)}i.length&&i[0].operation(function(){for(var T=0;T<i.length;T++)e(i[T])})}var ls=!1;function kl(){if(ls)return;Dl(),ls=!0}function Dl(){var e;Me(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ss(Rl)},100))}),Me(window,"blur",function(){return ss(Zi)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var wi={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"},On=0;On<10;On++)wi[On+48]=wi[On+96]=String(On);for(var ia=65;ia<=90;ia++)wi[ia]=String.fromCharCode(ia);for(var Pn=1;Pn<=12;Pn++)wi[Pn+111]=wi[Pn+63235]="F"+Pn;var pi={};pi.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"},pi.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"},pi.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"},pi.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"]},pi.default=l?pi.macDefault:pi.pcDefault;function Ol(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var i,r,n,T,F=0;F<t.length-1;F++){var Y=t[F];if(/^(cmd|meta|m)$/i.test(Y))T=!0;else if(/^a(lt)?$/i.test(Y))i=!0;else if(/^(c|ctrl|control)$/i.test(Y))r=!0;else if(/^s(hift)?$/i.test(Y))n=!0;else throw new Error("Unrecognized modifier name: "+Y)}return i&&(e="Alt-"+e),r&&(e="Ctrl-"+e),T&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function Pl(e){var t={};for(var i in e)if(e.hasOwnProperty(i)){var r=e[i];if(/^(name|fallthrough|(de|at)tach)$/.test(i))continue;if(r=="..."){delete e[i];continue}for(var n=de(i.split(" "),Ol),T=0;T<n.length;T++){var F=void 0,Y=void 0;T==n.length-1?(Y=n.join(" "),F=r):(Y=n.slice(0,T+1).join(" "),F="...");var J=t[Y];if(!J)t[Y]=F;else if(J!=F)throw new Error("Inconsistent bindings for "+Y)}delete e[i]}for(var q in t)e[q]=t[q];return e}function an(e,t,i,r){t=na(t);var n=t.call?t.call(e,r):t[e];if(n===!1)return"nothing";if(n==="...")return"multi";if(n!=null&&i(n))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return an(e,t.fallthrough,i,r);for(var T=0;T<t.fallthrough.length;T++){var F=an(e,t.fallthrough[T],i,r);if(F)return F}}}function us(e){var t=typeof e=="string"?e:wi[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function hs(e,t,i){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(f?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(f?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!i&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function ds(e,t){if(A&&e.keyCode==34&&e.char)return!1;var i=wi[e.keyCode];return i==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(i=e.code),hs(i,e,t))}function na(e){return typeof e=="string"?pi[e]:e}function on(e,t){for(var i=e.doc.sel.ranges,r=[],n=0;n<i.length;n++){for(var T=t(i[n]);r.length&&Ct(T.from,te(r).to)<=0;){var F=r.pop();if(Ct(F.from,T.from)<0){T.from=F.from;break}}r.push(T)}Rr(e,function(){for(var Y=r.length-1;Y>=0;Y--)rn(e.doc,"",r[Y].from,r[Y].to,"+delete");Ji(e)})}function Ua(e,t,i){var r=Ne(e.text,t+i,i);return r<0||r>e.text.length?null:r}function Fa(e,t,i){var r=Ua(e,t.ch,i);return r==null?null:new Ve(t.line,r,i<0?"after":"before")}function ja(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var T=qe(i,t.doc.direction);if(T){var F=n<0?te(T):T[0],Y=n<0==(F.level==1),J=Y?"after":"before",q;if(F.level>0||t.doc.direction=="rtl"){var ce=Xi(t,i);q=n<0?i.text.length-1:0;var pe=ii(t,ce,q).top;q=et(function(De){return ii(t,ce,De).top==pe},n<0==(F.level==1)?F.from:F.to-1,q),J=="before"&&(q=Ua(i,q,1))}else q=n<0?F.to:F.from;return new Ve(r,q,J)}}return new Ve(r,n<0?i.text.length:0,n<0?"before":"after")}function Ml(e,t,i,r){var n=qe(t,e.doc.direction);if(!n)return Fa(t,i,r);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var T=Xe(n,i.ch,i.sticky),F=n[T];if(e.doc.direction=="ltr"&&F.level%2==0&&(r>0?F.to>i.ch:F.from<i.ch))return Fa(t,i,r);var Y=function(tt,ot){return Ua(t,tt instanceof Ve?tt.ch:tt,ot)},J,q=function(tt){return e.options.lineWrapping?(J=J||Xi(e,t),po(e,t,J,tt)):{begin:0,end:t.text.length}},ce=q(i.sticky=="before"?Y(i,-1):i.ch);if(e.doc.direction=="rtl"||F.level==1){var pe=F.level==1==r<0,De=Y(i,pe?1:-1);if(De!=null&&(pe?De<=F.to&&De<=ce.end:De>=F.from&&De>=ce.begin)){var Ae=pe?"before":"after";return new Ve(i.line,De,Ae)}}var Fe=function(tt,ot,rt){for(var ht=function(Xt,hr){return hr?new Ve(i.line,Y(Xt,1),"before"):new Ve(i.line,Xt,"after")};tt>=0&&tt<n.length;tt+=ot){var xt=n[tt],gt=ot>0==(xt.level!=1),At=gt?rt.begin:Y(rt.end,-1);if(xt.from<=At&&At<xt.to)return ht(At,gt);if(At=gt?xt.from:Y(xt.to,-1),rt.begin<=At&&At<rt.end)return ht(At,gt)}},ze=Fe(T+r,r,ce);if(ze)return ze;var Ye=r>0?ce.end:Y(ce.begin,-1);return Ye!=null&&!(r>0&&Ye==t.text.length)&&(ze=Fe(r>0?0:n.length-1,r,q(Ye)),ze)?ze:null}var Mn={selectAll:$o,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Ee)},killLine:function(e){return on(e,function(t){if(t.empty()){var i=pt(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line<e.lastLine()?{from:t.head,to:Ve(t.head.line+1,0)}:{from:t.head,to:Ve(t.head.line,i)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return on(e,function(t){return{from:Ve(t.from().line,0),to:s(e.doc,Ve(t.to().line+1,0))}})},delLineLeft:function(e){return on(e,function(t){return{from:Ve(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return on(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return on(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(Ve(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ve(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return cs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return fs(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div")},we)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:i},"div")},we)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return r.ch<e.getLine(r.line).search(/\S/)?fs(e,t.head):r},we)},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=[],i=e.listSelections(),r=e.options.tabSize,n=0;n<i.length;n++){var T=i[n].from(),F=$(e.getLine(T.line),T.ch,r);t.push(ue(r-F%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Rr(e,function(){for(var t=e.listSelections(),i=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var n=t[r].head,T=pt(e.doc,n.line).text;if(T){if(n.ch==T.length&&(n=new Ve(n.line,n.ch-1)),n.ch>0)n=new Ve(n.line,n.ch+1),e.replaceRange(T.charAt(n.ch-1)+T.charAt(n.ch-2),Ve(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var F=pt(e.doc,n.line-1).text;F&&(n=new Ve(n.line,1),e.replaceRange(T.charAt(0)+e.doc.lineSeparator()+F.charAt(F.length-1),Ve(n.line-1,F.length-1),n,"+transpose"))}}i.push(new jt(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return Rr(e,function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);Ji(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function cs(e,t){var i=pt(e.doc,t),r=Sr(i);return r!=i&&(t=Lt(r)),ja(!0,e,r,t,1)}function Il(e,t){var i=pt(e.doc,t),r=zi(i);return r!=i&&(t=Lt(r)),ja(!0,e,i,t,-1)}function fs(e,t){var i=cs(e,t.line),r=pt(e.doc,i.line),n=qe(r,e.doc.direction);if(!n||n[0].level==0){var T=Math.max(i.ch,r.text.search(/\S/)),F=t.line==i.line&&t.ch<=T&&t.ch;return Ve(i.line,F?0:T,i.sticky)}return i}function aa(e,t,i){if(typeof t=="string"&&(t=Mn[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,n=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),i&&(e.display.shift=!1),n=t(e)!=ke}finally{e.display.shift=r,e.state.suppressEdits=!1}return n}function Nl(e,t,i){for(var r=0;r<e.state.keyMaps.length;r++){var n=an(t,e.state.keyMaps[r],i,e);if(n)return n}return e.options.extraKeys&&an(t,e.options.extraKeys,i,e)||an(t,e.options.keyMap,i,e)}var Bl=new ee;function In(e,t,i,r){var n=e.state.keySeq;if(n){if(us(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Bl.set(50,function(){e.state.keySeq==n&&(e.state.keySeq=null,e.display.input.reset())}),ps(e,n+" "+t,i,r))return!0}return ps(e,t,i,r)}function ps(e,t,i,r){var n=Nl(e,t,r);return n=="multi"&&(e.state.keySeq=t),n=="handled"&&pr(e,"keyHandled",e,t,i),(n=="handled"||n=="multi")&&(re(i),Ca(e)),!!n}function ms(e,t){var i=ds(t,!0);return i?t.shiftKey&&!e.state.keySeq?In(e,"Shift-"+i,t,function(r){return aa(e,r,!0)})||In(e,i,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return aa(e,r)}):In(e,i,t,function(r){return aa(e,r)}):!1}function Ul(e,t,i){return In(e,"'"+i+"'",t,function(r){return aa(e,r,!0)})}var Wa=null;function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=N(),Ke(t,e))return;G&&j<11&&e.keyCode==27&&(e.returnValue=!1);var i=e.keyCode;t.display.shift=i==16||e.shiftKey;var r=ms(t,e);A&&(Wa=r?i:null,!r&&i==88&&!zt&&(l?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),D&&!l&&!r&&i==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),i==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Fl(t)}function Fl(e){var t=e.display.lineDiv;U(t,"CodeMirror-crosshair");function i(r){(r.keyCode==18||!r.altKey)&&(m(t,"CodeMirror-crosshair"),at(document,"keyup",i),at(document,"mouseover",i))}Me(document,"keyup",i),Me(document,"mouseover",i)}function vs(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ke(this,e)}function ys(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(fi(t.display,e)||Ke(t,e)||e.ctrlKey&&!e.altKey||l&&e.metaKey)return;var i=e.keyCode,r=e.charCode;if(A&&i==Wa){Wa=null,re(e);return}if(A&&(!e.which||e.which<10)&&ms(t,e))return;var n=String.fromCharCode(r==null?i:r);if(n=="\b")return;if(Ul(t,e,n))return;t.display.input.onKeyPress(e)}var jl=400,Ha=function(e,t,i){this.time=e,this.pos=t,this.button=i};Ha.prototype.compare=function(e,t,i){return this.time+jl>e&&Ct(t,this.pos)==0&&i==this.button};var Nn,Bn;function Wl(e,t){var i=+new Date;return Bn&&Bn.compare(i,e,t)?(Nn=Bn=null,"triple"):Nn&&Nn.compare(i,e,t)?(Bn=new Ha(i,e,t),Nn=null,"double"):(Nn=new Ha(i,e,t),Bn=null,"single")}function bs(e){var t=this,i=t.display;if(Ke(t,e)||i.activeTouch&&i.input.supportsTouch())return;if(i.input.ensurePolled(),i.shift=e.shiftKey,fi(i,e)){I||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(Ga(t,e))return;var r=Mi(t,e),n=Se(e),T=r?Wl(r,n):"single";if(window.focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,n,r,T,e))return;n==1?r?zl(t,r,T,e):Le(e)==i.scroller&&re(e):n==2?(r&&qn(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(L?t.display.input.onContextMenu(e):xo(t))}function Hl(e,t,i,r,n){var T="Click";return r=="double"?T="Double"+T:r=="triple"&&(T="Triple"+T),T=(t==1?"Left":t==2?"Middle":"Right")+T,In(e,hs(T,n),n,function(F){if(typeof F=="string"&&(F=Mn[F]),!F)return!1;var Y=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Y=F(e,i)!=ke}finally{e.state.suppressEdits=!1}return Y})}function Gl(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var T=h?i.shiftKey&&i.metaKey:i.altKey;n.unit=T?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(n.extend==null||e.doc.extend)&&(n.extend=e.doc.extend||i.shiftKey),n.addNew==null&&(n.addNew=l?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(l?i.altKey:i.ctrlKey)),n}function zl(e,t,i,r){G?setTimeout(R(bo,e),0):e.curOp.focus=N();var n=Gl(e,i,r),T=e.doc.sel,F;e.options.dragDrop&&We&&!e.isReadOnly()&&i=="single"&&(F=T.contains(t))>-1&&(Ct((F=T.ranges[F]).from(),t)<0||t.xRel>0)&&(Ct(F.to(),t)>0||t.xRel<0)?Kl(e,r,t,n):Vl(e,r,t,n)}function Kl(e,t,i,r){var n=e.display,T=!1,F=lr(e,function(q){I&&(n.scroller.draggable=!1),e.state.draggingText=!1,at(n.wrapper.ownerDocument,"mouseup",F),at(n.wrapper.ownerDocument,"mousemove",Y),at(n.scroller,"dragstart",J),at(n.scroller,"drop",F),T||(re(q),r.addNew||qn(e.doc,i,null,null,r.extend),I&&!O||G&&j==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),Y=function(q){T=T||Math.abs(t.clientX-q.clientX)+Math.abs(t.clientY-q.clientY)>=10},J=function(){return T=!0};I&&(n.scroller.draggable=!0),e.state.draggingText=F,F.copy=!r.moveOnDrag,n.scroller.dragDrop&&n.scroller.dragDrop(),Me(n.wrapper.ownerDocument,"mouseup",F),Me(n.wrapper.ownerDocument,"mousemove",Y),Me(n.scroller,"dragstart",J),Me(n.scroller,"drop",F),xo(e),setTimeout(function(){return n.input.focus()},20)}function xs(e,t,i){if(i=="char")return new jt(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new jt(Ve(t.line,0),s(e.doc,Ve(t.line+1,0)));var r=i(e,t);return new jt(r.from,r.to)}function Vl(e,t,i,r){var n=e.display,T=e.doc;re(t);var F,Y,J=T.sel,q=J.ranges;if(r.addNew&&!r.extend?(Y=T.sel.contains(i),Y>-1?F=q[Y]:F=new jt(i,i)):(F=T.sel.primary(),Y=T.sel.primIndex),r.unit=="rectangle")r.addNew||(F=new jt(i,i)),i=Mi(e,t,!0,!0),Y=-1;else{var ce=xs(e,i,r.unit);r.extend?F=Na(F,ce.anchor,ce.head,r.extend):F=ce}r.addNew?Y==-1?(Y=q.length,gr(T,Qr(e,q.concat([F]),Y),{scroll:!1,origin:"*mouse"})):q.length>1&&q[Y].empty()&&r.unit=="char"&&!r.extend?(gr(T,Qr(e,q.slice(0,Y).concat(q.slice(Y+1)),0),{scroll:!1,origin:"*mouse"}),J=T.sel):Ba(T,Y,F,Te):(Y=0,gr(T,new jr([F],0),Te),J=T.sel);var pe=i;function De(rt){if(Ct(pe,rt)==0)return;if(pe=rt,r.unit=="rectangle"){for(var ht=[],xt=e.options.tabSize,gt=$(pt(T,i.line).text,i.ch,xt),At=$(pt(T,rt.line).text,rt.ch,xt),Xt=Math.min(gt,At),hr=Math.max(gt,At),$t=Math.min(i.line,rt.line),Or=Math.min(e.lastLine(),Math.max(i.line,rt.line));$t<=Or;$t++){var Ar=pt(T,$t).text,rr=Ce(Ar,Xt,xt);Xt==hr?ht.push(new jt(Ve($t,rr),Ve($t,rr))):Ar.length>rr&&ht.push(new jt(Ve($t,rr),Ve($t,Ce(Ar,hr,xt))))}ht.length||ht.push(new jt(i,i)),gr(T,Qr(e,J.ranges.slice(0,Y).concat(ht),Y),{origin:"*mouse",scroll:!1}),e.scrollIntoView(rt)}else{var _r=F,mr=xs(e,rt,r.unit),or=_r.anchor,ir;Ct(mr.anchor,or)>0?(ir=mr.head,or=Li(_r.from(),mr.anchor)):(ir=mr.anchor,or=di(_r.to(),mr.head));var Jt=J.ranges.slice(0);Jt[Y]=Xl(e,new jt(s(T,or),ir)),gr(T,Qr(e,Jt,Y),Te)}}var Ae=n.wrapper.getBoundingClientRect(),Fe=0;function ze(rt){var ht=++Fe,xt=Mi(e,rt,!0,r.unit=="rectangle");if(!xt)return;if(Ct(xt,pe)!=0){e.curOp.focus=N(),De(xt);var gt=Xn(n,T);(xt.line>=gt.to||xt.line<gt.from)&&setTimeout(lr(e,function(){Fe==ht&&ze(rt)}),150)}else{var At=rt.clientY<Ae.top?-20:rt.clientY>Ae.bottom?20:0;At&&setTimeout(lr(e,function(){if(Fe!=ht)return;n.scroller.scrollTop+=At,ze(rt)}),50)}}function Ye(rt){e.state.selectingText=!1,Fe=Infinity,rt&&(re(rt),n.input.focus()),at(n.wrapper.ownerDocument,"mousemove",tt),at(n.wrapper.ownerDocument,"mouseup",ot),T.history.lastSelOrigin=null}var tt=lr(e,function(rt){rt.buttons===0||!Se(rt)?Ye(rt):ze(rt)}),ot=lr(e,Ye);e.state.selectingText=ot,Me(n.wrapper.ownerDocument,"mousemove",tt),Me(n.wrapper.ownerDocument,"mouseup",ot)}function Xl(e,t){var i=t.anchor,r=t.head,n=pt(e.doc,i.line);if(Ct(i,r)==0&&i.sticky==r.sticky)return t;var T=qe(n);if(!T)return t;var F=Xe(T,i.ch,i.sticky),Y=T[F];if(Y.from!=i.ch&&Y.to!=i.ch)return t;var J=F+(Y.from==i.ch==(Y.level!=1)?0:1);if(J==0||J==T.length)return t;var q;if(r.line!=i.line)q=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ce=Xe(T,r.ch,r.sticky),pe=ce-F||(r.ch-i.ch)*(Y.level==1?-1:1);ce==J-1||ce==J?q=pe<0:q=pe>0}var De=T[J+(q?-1:0)],Ae=q==(De.level==1),Fe=Ae?De.from:De.to,ze=Ae?"after":"before";return i.ch==Fe&&i.sticky==ze?t:new jt(new Ve(i.line,Fe,ze),r)}function Es(e,t,i,r){var n,T;if(t.touches)n=t.touches[0].clientX,T=t.touches[0].clientY;else try{n=t.clientX,T=t.clientY}catch(De){return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&re(t);var F=e.display,Y=F.lineDiv.getBoundingClientRect();if(T>Y.bottom||!ge(e,i))return se(t);T-=Y.top-F.viewOffset;for(var J=0;J<e.display.gutterSpecs.length;++J){var q=F.gutters.childNodes[J];if(q&&q.getBoundingClientRect().right>=n){var ce=Mr(e.doc,T),pe=e.display.gutterSpecs[J];return Ue(e,i,e,ce,pe.className,t),se(t)}}}function Ga(e,t){return Es(e,t,"gutterClick",!0)}function Ss(e,t){if(fi(e.display,t)||Yl(e,t))return;if(Ke(e,t,"contextmenu"))return;L||e.display.input.onContextMenu(t)}function Yl(e,t){return ge(e,"gutterContextMenu")?Es(e,t,"gutterContextMenu",!1):!1}function Cs(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),vn(e)}var sn={toString:function(){return"CodeMirror.Init"}},Ts={},oa={};function $l(e){var t=e.optionHandlers;function i(r,n,T,F){e.defaults[r]=n,T&&(t[r]=F?function(Y,J,q){q!=sn&&T(Y,J,q)}:T)}e.defineOption=i,e.Init=sn,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,Pa(r)},!0),i("indentUnit",2,Pa,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){wn(r),vn(r),Tr(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!n)return;var T=[],F=r.doc.first;r.doc.iter(function(J){for(var q=0;;){var ce=J.text.indexOf(n,q);if(ce==-1)break;q=ce+n.length,T.push(Ve(F,ce))}F++});for(var Y=T.length-1;Y>=0;Y--)rn(r.doc,n,T[Y],Ve(T[Y].line,T[Y].ch+n.length))}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,n,T){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),T!=sn&&r.refresh()}),i("specialCharPlaceholder",Bt,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(r,n){return r.getInputField().spellcheck=n},!0),i("autocorrect",!1,function(r,n){return r.getInputField().autocorrect=n},!0),i("autocapitalize",!1,function(r,n){return r.getInputField().autocapitalize=n},!0),i("rtlMoveVisually",!w),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Cs(r),Tn(r)},!0),i("keyMap","default",function(r,n,T){var F=na(n),Y=T!=sn&&na(T);Y&&Y.detach&&Y.detach(r,F),F.attach&&F.attach(r,Y||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Jl,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=Ra(n,r.options.lineNumbers),Tn(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?Ea(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return Qi(r)},!0),i("scrollbarStyle","native",function(r){Ao(r),Qi(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),i("lineNumbers",!1,function(r,n){r.display.gutterSpecs=Ra(r.options.gutters,n),Tn(r)},!0),i("firstLineNumber",1,Tn,!0),i("lineNumberFormatter",function(r){return r},Tn,!0),i("showCursorWhenSelecting",!1,yn,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,n){n=="nocursor"&&(Zi(r),r.display.input.blur()),r.display.input.readOnlyChanged(n)}),i("screenReaderLabel",null,function(r,n){n=n===""?null:n,r.display.input.screenReaderLabelChanged(n)}),i("disableInput",!1,function(r,n){n||r.display.input.reset()},!0),i("dragDrop",!0,Zl),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,yn,!0),i("singleCursorHeightPerLine",!0,yn,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,wn,!0),i("addModeClass",!1,wn,!0),i("pollInterval",100),i("undoDepth",200,function(r,n){return r.doc.history.undoDepth=n}),i("historyEventDelay",1250),i("viewportMargin",10,function(r){return r.refresh()},!0),i("maxHighlightLength",1e4,wn,!0),i("moveInputWithCursor",!0,function(r,n){n||r.display.input.resetPosition()}),i("tabindex",null,function(r,n){return r.display.input.getField().tabIndex=n||""}),i("autofocus",null),i("direction","ltr",function(r,n){return r.doc.setDirection(n)},!0),i("phrases",null)}function Zl(e,t,i){var r=i&&i!=sn;if(!t!=!r){var n=e.display.dragFunctions,T=t?Me:at;T(e.display.scroller,"dragstart",n.start),T(e.display.scroller,"dragenter",n.enter),T(e.display.scroller,"dragover",n.over),T(e.display.scroller,"dragleave",n.leave),T(e.display.scroller,"drop",n.drop)}}function Jl(e){e.options.lineWrapping?(U(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(m(e.display.wrapper,"CodeMirror-wrap"),jn(e)),Sa(e),Tr(e),vn(e),setTimeout(function(){return Qi(e)},100)}function Yt(e,t){var i=this;if(!(this instanceof Yt))return new Yt(e,t);this.options=t=t?M(t):{},M(Ts,t,!1);var r=t.value;typeof r=="string"?r=new wr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new Yt.inputStyles[t.inputStyle](this),T=this.display=new hl(e,r,n,t);T.wrapper.CodeMirror=this,Cs(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ao(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 ee,keySeq:null,specialChars:null},t.autofocus&&!o&&T.input.focus(),G&&j<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Ql(this),kl(),Ui(this),this.curOp.forceUpdate=!0,No(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&Ta(i)},20):Zi(this);for(var F in oa)oa.hasOwnProperty(F)&&oa[F](this,t[F],sn);ko(this),t.finishInit&&t.finishInit(this);for(var Y=0;Y<za.length;++Y)za[Y](this);Fi(this),I&&t.lineWrapping&&getComputedStyle(T.lineDiv).textRendering=="optimizelegibility"&&(T.lineDiv.style.textRendering="auto")}Yt.defaults=Ts,Yt.optionHandlers=oa;function Ql(e){var t=e.display;Me(t.scroller,"mousedown",lr(e,bs)),G&&j<11?Me(t.scroller,"dblclick",lr(e,function(J){if(Ke(e,J))return;var q=Mi(e,J);if(!q||Ga(e,J)||fi(e.display,J))return;re(J);var ce=e.findWordAt(q);qn(e.doc,ce.anchor,ce.head)})):Me(t.scroller,"dblclick",function(J){return Ke(e,J)||re(J)}),Me(t.scroller,"contextmenu",function(J){return Ss(e,J)}),Me(t.input.getField(),"contextmenu",function(J){t.scroller.contains(J.target)||Ss(e,J)});var i,r={end:0};function n(){t.activeTouch&&(i=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function T(J){if(J.touches.length!=1)return!1;var q=J.touches[0];return q.radiusX<=1&&q.radiusY<=1}function F(J,q){if(q.left==null)return!0;var ce=q.left-J.left,pe=q.top-J.top;return ce*ce+pe*pe>20*20}Me(t.scroller,"touchstart",function(J){if(!Ke(e,J)&&!T(J)&&!Ga(e,J)){t.input.ensurePolled(),clearTimeout(i);var q=+new Date;t.activeTouch={start:q,moved:!1,prev:q-r.end<=300?r:null},J.touches.length==1&&(t.activeTouch.left=J.touches[0].pageX,t.activeTouch.top=J.touches[0].pageY)}}),Me(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Me(t.scroller,"touchend",function(J){var q=t.activeTouch;if(q&&!fi(t,J)&&q.left!=null&&!q.moved&&new Date-q.start<300){var ce=e.coordsChar(t.activeTouch,"page"),pe;!q.prev||F(q,q.prev)?pe=new jt(ce,ce):!q.prev.prev||F(q,q.prev.prev)?pe=e.findWordAt(ce):pe=new jt(Ve(ce.line,0),s(e.doc,Ve(ce.line+1,0))),e.setSelection(pe.anchor,pe.head),e.focus(),re(J)}n()}),Me(t.scroller,"touchcancel",n),Me(t.scroller,"scroll",function(){t.scroller.clientHeight&&(xn(e,t.scroller.scrollTop),Ni(e,t.scroller.scrollLeft,!0),Ue(e,"scroll",e))}),Me(t.scroller,"mousewheel",function(J){return Oo(e,J)}),Me(t.scroller,"DOMMouseScroll",function(J){return Oo(e,J)}),Me(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(J){Ke(e,J)||he(J)},over:function(J){Ke(e,J)||(Ll(e,J),he(J))},start:function(J){return _l(e,J)},drop:lr(e,Al),leave:function(J){Ke(e,J)||os(e)}};var Y=t.input.getField();Me(Y,"keyup",function(J){return vs.call(e,J)}),Me(Y,"keydown",lr(e,gs)),Me(Y,"keypress",lr(e,ys)),Me(Y,"focus",function(J){return Ta(e,J)}),Me(Y,"blur",function(J){return Zi(e,J)})}var za=[];Yt.defineInitHook=function(e){return za.push(e)};function Un(e,t,i,r){var n=e.doc,T;i==null&&(i="add"),i=="smart"&&(n.mode.indent?T=Je(e,t).state:i="prev");var F=e.options.tabSize,Y=pt(n,t),J=$(Y.text,null,F);Y.stateAfter&&(Y.stateAfter=null);var q=Y.text.match(/^\s*/)[0],ce;if(!r&&!/\S/.test(Y.text))ce=0,i="not";else if(i=="smart"&&(ce=n.mode.indent(T,Y.text.slice(q.length),Y.text),ce==ke||ce>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?ce=$(pt(n,t-1).text,null,F):ce=0:i=="add"?ce=J+e.options.indentUnit:i=="subtract"?ce=J-e.options.indentUnit:typeof i=="number"&&(ce=J+i),ce=Math.max(0,ce);var pe="",De=0;if(e.options.indentWithTabs)for(var Ae=Math.floor(ce/F);Ae;--Ae)De+=F,pe+=" ";if(De<ce&&(pe+=ue(ce-De)),pe!=q)return rn(n,pe,Ve(t,0),Ve(t,q.length),"+input"),Y.stateAfter=null,!0;for(var Fe=0;Fe<n.sel.ranges.length;Fe++){var ze=n.sel.ranges[Fe];if(ze.head.line==t&&ze.head.ch<q.length){var Ye=Ve(t,q.length);Ba(n,Fe,new jt(Ye,Ye));break}}}var qr=null;function sa(e){qr=e}function Ka(e,t,i,r,n){var T=e.doc;e.display.shift=!1,r||(r=T.sel);var F=+new Date-200,Y=n=="paste"||e.state.pasteIncoming>F,J=St(t),q=null;if(Y&&r.ranges.length>1)if(qr&&qr.text.join(`
`)==t){if(r.ranges.length%qr.text.length==0){q=[];for(var ce=0;ce<qr.text.length;ce++)q.push(T.splitLines(qr.text[ce]))}}else J.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(q=de(J,function(tt){return[tt]}));for(var pe=e.curOp.updateInput,De=r.ranges.length-1;De>=0;De--){var Ae=r.ranges[De],Fe=Ae.from(),ze=Ae.to();Ae.empty()&&(i&&i>0?Fe=Ve(Fe.line,Fe.ch-i):e.state.overwrite&&!Y?ze=Ve(ze.line,Math.min(pt(T,ze.line).text.length,ze.ch+te(J).length)):Y&&qr&&qr.lineWise&&qr.text.join(`
`)==J.join(`
`)&&(Fe=ze=Ve(Fe.line,0)));var Ye={from:Fe,to:ze,text:q?q[De%q.length]:J,origin:n||(Y?"paste":e.state.cutIncoming>F?"cut":"+input")};tn(e.doc,Ye),pr(e,"inputRead",e,Ye)}t&&!Y&&As(e,t),Ji(e),e.curOp.updateInput<2&&(e.curOp.updateInput=pe),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ws(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Rr(t,function(){return Ka(t,i,0,null,"paste")}),!0}function As(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var i=e.doc.sel,r=i.ranges.length-1;r>=0;r--){var n=i.ranges[r];if(n.head.ch>100||r&&i.ranges[r-1].head.line==n.head.line)continue;var T=e.getModeAt(n.head),F=!1;if(T.electricChars){for(var Y=0;Y<T.electricChars.length;Y++)if(t.indexOf(T.electricChars.charAt(Y))>-1){F=Un(e,n.head.line,"smart");break}}else T.electricInput&&(T.electricInput.test(pt(e.doc,n.head.line).text.slice(0,n.head.ch))&&(F=Un(e,n.head.line,"smart")));F&&pr(e,"electricInput",e,n.head.line)}}function _s(e){for(var t=[],i=[],r=0;r<e.doc.sel.ranges.length;r++){var n=e.doc.sel.ranges[r].head.line,T={anchor:Ve(n,0),head:Ve(n+1,0)};i.push(T),t.push(e.getRange(T.anchor,T.head))}return{text:t,ranges:i}}function Ls(e,t,i,r){e.setAttribute("autocorrect",i?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function ks(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return I?e.style.width="1000px":e.setAttribute("wrap","off"),S&&(e.style.border="1px solid black"),Ls(e),t}function ql(e){var t=e.optionHandlers,i=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,n){var T=this.options,F=T[r];if(T[r]==n&&r!="mode")return;T[r]=n,t.hasOwnProperty(r)&&lr(this,t[r])(this,n,F),Ue(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,n){this.state.keyMaps[n?"push":"unshift"](na(r))},removeKeyMap:function(r){for(var n=this.state.keyMaps,T=0;T<n.length;++T)if(n[T]==r||n[T].name==r)return n.splice(T,1),!0},addOverlay:yr(function(r,n){var T=r.token?r:e.getMode(this.options,r);if(T.startState)throw new Error("Overlays may not be stateful.");ae(this.state.overlays,{mode:T,modeSpec:r,opaque:n&&n.opaque,priority:n&&n.priority||0},function(F){return F.priority}),this.state.modeGen++,Tr(this)}),removeOverlay:yr(function(r){for(var n=this.state.overlays,T=0;T<n.length;++T){var F=n[T].modeSpec;if(F==r||typeof r=="string"&&F.name==r){n.splice(T,1),this.state.modeGen++,Tr(this);return}}}),indentLine:yr(function(r,n,T){typeof n!="string"&&typeof n!="number"&&(n==null?n=this.options.smartIndent?"smart":"prev":n=n?"add":"subtract"),Xr(this.doc,r)&&Un(this,r,n,T)}),indentSelection:yr(function(r){for(var n=this.doc.sel.ranges,T=-1,F=0;F<n.length;F++){var Y=n[F];if(Y.empty())Y.head.line>T&&(Un(this,Y.head.line,r,!0),T=Y.head.line,F==this.doc.sel.primIndex&&Ji(this));else{var J=Y.from(),q=Y.to(),ce=Math.max(T,J.line);T=Math.min(this.lastLine(),q.line-(q.ch?0:1))+1;for(var pe=ce;pe<T;++pe)Un(this,pe,r);var De=this.doc.sel.ranges;J.ch==0&&n.length==De.length&&De[F].from().ch>0&&Ba(this.doc,F,new jt(J,De[F].to()),Ee)}}}),getTokenAt:function(r,n){return Vt(this,r,n)},getLineTokens:function(r,n){return Vt(this,Ve(r),n,!0)},getTokenTypeAt:function(r){r=s(this.doc,r);var n=He(this,pt(this.doc,r.line)),T=0,F=(n.length-1)/2,Y=r.ch,J;if(Y==0)J=n[2];else for(;;){var q=T+F>>1;if((q?n[q*2-1]:0)>=Y)F=q;else if(n[q*2+1]<Y)T=q+1;else{J=n[q*2+2];break}}var ce=J?J.indexOf("overlay "):-1;return ce<0?J:ce==0?null:J.slice(0,ce-1)},getModeAt:function(r){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(r).state).mode:n},getHelper:function(r,n){return this.getHelpers(r,n)[0]},getHelpers:function(r,n){var T=[];if(!i.hasOwnProperty(n))return T;var F=i[n],Y=this.getModeAt(r);if(typeof Y[n]=="string")F[Y[n]]&&T.push(F[Y[n]]);else if(Y[n])for(var J=0;J<Y[n].length;J++){var q=F[Y[n][J]];q&&T.push(q)}else Y.helperType&&F[Y.helperType]?T.push(F[Y.helperType]):F[Y.name]&&T.push(F[Y.name]);for(var ce=0;ce<F._global.length;ce++){var pe=F._global[ce];pe.pred(Y,this)&&oe(T,pe.val)==-1&&T.push(pe.val)}return T},getStateAfter:function(r,n){var T=this.doc;return r=z(T,r==null?T.first+T.size-1:r),Je(this,r+1,n).state},cursorCoords:function(r,n){var T,F=this.doc.sel.primary();return r==null?T=F.head:typeof r=="object"?T=s(this.doc,r):T=r?F.from():F.to(),Jr(this,T,n||"page")},charCoords:function(r,n){return ga(this,s(this.doc,r),n||"page")},coordsChar:function(r,n){return r=ho(this,r,n||"page"),ya(this,r.left,r.top)},lineAtHeight:function(r,n){return r=ho(this,{top:r,left:0},n||"page").top,Mr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,n,T){var F=!1,Y;if(typeof r=="number"){var J=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>J&&(r=J,F=!0),Y=pt(this.doc,r)}else Y=r;return Gn(this,Y,{top:0,left:0},n||"page",T||F).top+(F?this.doc.height-Zr(Y):0)},defaultTextHeight:function(){return Yi(this.display)},defaultCharWidth:function(){return $i(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,T,F,Y){var J=this.display;r=Jr(this,s(this.doc,r));var q=r.bottom,ce=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),J.sizer.appendChild(n),F=="over")q=r.top;else if(F=="above"||F=="near"){var pe=Math.max(J.wrapper.clientHeight,this.doc.height),De=Math.max(J.sizer.clientWidth,J.lineSpace.clientWidth);(F=="above"||r.bottom+n.offsetHeight>pe)&&r.top>n.offsetHeight?q=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=pe&&(q=r.bottom),ce+n.offsetWidth>De&&(ce=De-n.offsetWidth)}n.style.top=q+"px",n.style.left=n.style.right="",Y=="right"?(ce=J.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(Y=="left"?ce=0:Y=="middle"&&(ce=(J.sizer.clientWidth-n.offsetWidth)/2),n.style.left=ce+"px"),T&&Zs(this,{left:ce,top:q,right:ce+n.offsetWidth,bottom:q+n.offsetHeight})},triggerOnKeyDown:yr(gs),triggerOnKeyPress:yr(ys),triggerOnKeyUp:vs,triggerOnMouseDown:yr(bs),execCommand:function(r){if(Mn.hasOwnProperty(r))return Mn[r].call(null,this)},triggerElectric:yr(function(r){As(this,r)}),findPosH:function(r,n,T,F){var Y=1;n<0&&(Y=-1,n=-n);for(var J=s(this.doc,r),q=0;q<n&&!(J=Va(this.doc,J,Y,T,F),J.hitSide);++q);return J},moveH:yr(function(r,n){var T=this;this.extendSelectionsBy(function(F){return T.display.shift||T.doc.extend||F.empty()?Va(T.doc,F.head,r,n,T.options.rtlMoveVisually):r<0?F.from():F.to()},we)}),deleteH:yr(function(r,n){var T=this.doc.sel,F=this.doc;T.somethingSelected()?F.replaceSelection("",null,"+delete"):on(this,function(Y){var J=Va(F,Y.head,r,n,!1);return r<0?{from:J,to:Y.head}:{from:Y.head,to:J}})}),findPosV:function(r,n,T,F){var Y=1,J=F;n<0&&(Y=-1,n=-n);for(var q=s(this.doc,r),ce=0;ce<n;++ce){var pe=Jr(this,q,"div");if(J==null?J=pe.left:pe.left=J,q=Ds(this,pe,Y,T),q.hitSide)break}return q},moveV:yr(function(r,n){var T=this,F=this.doc,Y=[],J=!this.display.shift&&!F.extend&&F.sel.somethingSelected();if(F.extendSelectionsBy(function(ce){if(J)return r<0?ce.from():ce.to();var pe=Jr(T,ce.head,"div");ce.goalColumn!=null&&(pe.left=ce.goalColumn),Y.push(pe.left);var De=Ds(T,pe,r,n);return n=="page"&&ce==F.sel.primary()&&Aa(T,ga(T,De,"div").top-pe.top),De},we),Y.length)for(var q=0;q<F.sel.ranges.length;q++)F.sel.ranges[q].goalColumn=Y[q]}),findWordAt:function(r){var n=this.doc,T=pt(n,r.line).text,F=r.ch,Y=r.ch;if(T){var J=this.getHelper(r,"wordChars");(r.sticky=="before"||Y==T.length)&&F?--F:++Y;for(var q=T.charAt(F),ce=Pe(q,J)?function(pe){return Pe(pe,J)}:/\s/.test(q)?function(pe){return/\s/.test(pe)}:function(pe){return!/\s/.test(pe)&&!Pe(pe)};F>0&&ce(T.charAt(F-1));)--F;for(;Y<T.length&&ce(T.charAt(Y));)++Y}return new jt(Ve(r.line,F),Ve(r.line,Y))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?U(this.display.cursorDiv,"CodeMirror-overwrite"):m(this.display.cursorDiv,"CodeMirror-overwrite"),Ue(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==N()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:yr(function(r,n){bn(this,r,n)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-ri(this)-this.display.barHeight,width:r.scrollWidth-ri(this)-this.display.barWidth,clientHeight:fa(this),clientWidth:Oi(this)}},scrollIntoView:yr(function(r,n){r==null?(r={from:this.doc.sel.primary().head,to:null},n==null&&(n=this.options.cursorScrollMargin)):typeof r=="number"?r={from:Ve(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=n||0,r.from.line!=null?Js(this,r):So(this,r.from,r.to,r.margin)}),setSize:yr(function(r,n){var T=this,F=function(J){return typeof J=="number"||/^\d+$/.test(String(J))?J+"px":J};r!=null&&(this.display.wrapper.style.width=F(r)),n!=null&&(this.display.wrapper.style.height=F(n)),this.options.lineWrapping&&so(this);var Y=this.display.viewFrom;this.doc.iter(Y,this.display.viewTo,function(J){if(J.widgets){for(var q=0;q<J.widgets.length;q++)if(J.widgets[q].noHScroll){bi(T,Y,"widget");break}}++Y}),this.curOp.forceUpdate=!0,Ue(this,"refresh",this)}),operation:function(r){return Rr(this,r)},startOperation:function(){return Ui(this)},endOperation:function(){return Fi(this)},refresh:yr(function(){var r=this.display.cachedTextHeight;Tr(this),this.curOp.forceUpdate=!0,vn(this),bn(this,this.doc.scrollLeft,this.doc.scrollTop),ka(this.display),(r==null||Math.abs(r-Yi(this.display))>.5||this.options.lineWrapping)&&Sa(this),Ue(this,"refresh",this)}),swapDoc:yr(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),No(this,r),vn(this),this.display.input.reset(),bn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,pr(this,"swapDoc",this,n),n}),phrase:function(r){var n=this.options.phrases;return n&&Object.prototype.hasOwnProperty.call(n,r)?n[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},be(e),e.registerHelper=function(r,n,T){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=T},e.registerGlobalHelper=function(r,n,T,F){e.registerHelper(r,n,F),i[r]._global.push({pred:T,val:F})}}function Va(e,t,i,r,n){var T=t,F=i,Y=pt(e,t.line),J=n&&e.direction=="rtl"?-i:i;function q(){var ot=t.line+J;return ot<e.first||ot>=e.first+e.size?!1:(t=new Ve(ot,t.ch,t.sticky),Y=pt(e,ot))}function ce(ot){var rt;if(r=="codepoint"){var ht=Y.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(ht)?rt=null:rt=new Ve(t.line,Math.max(0,Math.min(Y.text.length,t.ch+i*(ht>=55296&&ht<56320?2:1))),-i)}else n?rt=Ml(e.cm,Y,t,i):rt=Fa(Y,t,i);if(rt==null)if(!ot&&q())t=ja(n,e.cm,Y,t.line,J);else return!1;else t=rt;return!0}if(r=="char"||r=="codepoint")ce();else if(r=="column")ce(!0);else if(r=="word"||r=="group")for(var pe=null,De=r=="group",Ae=e.cm&&e.cm.getHelper(t,"wordChars"),Fe=!0;!(i<0&&!ce(!Fe));Fe=!1){var ze=Y.text.charAt(t.ch)||`
`,Ye=Pe(ze,Ae)?"w":De&&ze==`
`?"n":!De||/\s/.test(ze)?null:"p";if(De&&!Fe&&!Ye&&(Ye="s"),pe&&pe!=Ye){i<0&&(i=1,ce(),t.sticky="after");break}if(Ye&&(pe=Ye),i>0&&!ce(!Fe))break}var tt=ta(e,t,T,F,!0);return hi(T,tt)&&(tt.hitSide=!0),tt}function Ds(e,t,i,r){var n=e.doc,T=t.left,F;if(r=="page"){var Y=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),J=Math.max(Y-.5*Yi(e.display),3);F=(i>0?t.bottom:t.top)+i*J}else r=="line"&&(F=i>0?t.bottom+3:t.top-3);for(var q;!(q=ya(e,T,F),!q.outside);){if(i<0?F<=0:F>=n.height){q.hitSide=!0;break}F+=i*5}return q}var Gt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ee,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Gt.prototype.init=function(e){var t=this,i=this,r=i.cm,n=i.div=e.lineDiv;Ls(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function T(Y){for(var J=Y.target;J;J=J.parentNode){if(J==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(J.className))break}return!1}Me(n,"paste",function(Y){if(!T(Y)||Ke(r,Y)||ws(Y,r))return;j<=11&&setTimeout(lr(r,function(){return t.updateFromDOM()}),20)}),Me(n,"compositionstart",function(Y){t.composing={data:Y.data,done:!1}}),Me(n,"compositionupdate",function(Y){t.composing||(t.composing={data:Y.data,done:!1})}),Me(n,"compositionend",function(Y){t.composing&&(Y.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Me(n,"touchstart",function(){return i.forceCompositionEnd()}),Me(n,"input",function(){t.composing||t.readFromDOMSoon()});function F(Y){if(!T(Y)||Ke(r,Y))return;if(r.somethingSelected())sa({lineWise:!1,text:r.getSelections()}),Y.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var J=_s(r);sa({lineWise:!0,text:J.text}),Y.type=="cut"&&r.operation(function(){r.setSelections(J.ranges,0,Ee),r.replaceSelection("",null,"cut")})}else return;if(Y.clipboardData){Y.clipboardData.clearData();var q=qr.text.join(`
`);if(Y.clipboardData.setData("Text",q),Y.clipboardData.getData("Text")==q){Y.preventDefault();return}}var ce=ks(),pe=ce.firstChild;r.display.lineSpace.insertBefore(ce,r.display.lineSpace.firstChild),pe.value=qr.text.join(`
`);var De=document.activeElement;V(pe),setTimeout(function(){r.display.lineSpace.removeChild(ce),De.focus(),De==n&&i.showPrimarySelection()},50)}Me(n,"copy",F),Me(n,"cut",F)},Gt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Gt.prototype.prepareSelection=function(){var e=vo(this.cm,!1);return e.focus=document.activeElement==this.div,e},Gt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Gt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Gt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),n=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||n.line<t.display.viewFrom){e.removeAllRanges();return}var T=la(t,e.anchorNode,e.anchorOffset),F=la(t,e.focusNode,e.focusOffset);if(T&&!T.bad&&F&&!F.bad&&Ct(Li(T,F),r)==0&&Ct(di(T,F),n)==0)return;var Y=t.display.view,J=r.line>=t.display.viewFrom&&Rs(t,r)||{node:Y[0].measure.map[2],offset:0},q=n.line<t.display.viewTo&&Rs(t,n);if(!q){var ce=Y[Y.length-1].measure,pe=ce.maps?ce.maps[ce.maps.length-1]:ce.map;q={node:pe[pe.length-1],offset:pe[pe.length-2]-pe[pe.length-3]}}if(!J||!q){e.removeAllRanges();return}var De=e.rangeCount&&e.getRangeAt(0),Ae;try{Ae=b(J.node,J.offset,q.offset,q.node)}catch(Fe){}Ae&&(!D&&t.state.focused?(e.collapse(J.node,J.offset),Ae.collapsed||(e.removeAllRanges(),e.addRange(Ae))):(e.removeAllRanges(),e.addRange(Ae)),De&&e.anchorNode==null?e.addRange(De):D&&this.startGracePeriod()),this.rememberSelection()},Gt.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)},Gt.prototype.showMultipleSelections=function(e){u(this.cm.display.cursorDiv,e.cursors),u(this.cm.display.selectionDiv,e.selection)},Gt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Gt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return E(this.div,t)},Gt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Gt.prototype.blur=function(){this.div.blur()},Gt.prototype.getField=function(){return this.div},Gt.prototype.supportsTouch=function(){return!0},Gt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Rr(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)},Gt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Gt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(d&&y&&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 i=la(t,e.anchorNode,e.anchorOffset),r=la(t,e.focusNode,e.focusOffset);i&&r&&Rr(t,function(){gr(t.doc,Ei(i,r),Ee),(i.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Gt.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,i=e.doc.sel.primary(),r=i.from(),n=i.to();if(r.ch==0&&r.line>e.firstLine()&&(r=Ve(r.line-1,pt(e.doc,r.line-1).length)),n.ch==pt(e.doc,n.line).text.length&&n.line<e.lastLine()&&(n=Ve(n.line+1,0)),r.line<t.viewFrom||n.line>t.viewTo-1)return!1;var T,F,Y;r.line==t.viewFrom||(T=Ii(e,r.line))==0?(F=Lt(t.view[0].line),Y=t.view[0].node):(F=Lt(t.view[T].line),Y=t.view[T-1].node.nextSibling);var J=Ii(e,n.line),q,ce;if(J==t.view.length-1?(q=t.viewTo-1,ce=t.lineDiv.lastChild):(q=Lt(t.view[J+1].line)-1,ce=t.view[J+1].node.previousSibling),!Y)return!1;for(var pe=e.doc.splitLines(tu(e,Y,ce,F,q)),De=Pr(e.doc,Ve(F,0),Ve(q,pt(e.doc,q).text.length));pe.length>1&&De.length>1;)if(te(pe)==te(De))pe.pop(),De.pop(),q--;else if(pe[0]==De[0])pe.shift(),De.shift(),F++;else break;for(var Ae=0,Fe=0,ze=pe[0],Ye=De[0],tt=Math.min(ze.length,Ye.length);Ae<tt&&ze.charCodeAt(Ae)==Ye.charCodeAt(Ae);)++Ae;for(var ot=te(pe),rt=te(De),ht=Math.min(ot.length-(pe.length==1?Ae:0),rt.length-(De.length==1?Ae:0));Fe<ht&&ot.charCodeAt(ot.length-Fe-1)==rt.charCodeAt(rt.length-Fe-1);)++Fe;if(pe.length==1&&De.length==1&&F==r.line)for(;Ae&&Ae>r.ch&&ot.charCodeAt(ot.length-Fe-1)==rt.charCodeAt(rt.length-Fe-1);)Ae--,Fe++;pe[pe.length-1]=ot.slice(0,ot.length-Fe).replace(/^\u200b+/,""),pe[0]=pe[0].slice(Ae).replace(/\u200b+$/,"");var xt=Ve(F,Ae),gt=Ve(q,De.length?te(De).length-Fe:0);if(pe.length>1||pe[0]||Ct(xt,gt))return rn(e.doc,pe,xt,gt,"+input"),!0},Gt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Gt.prototype.reset=function(){this.forceCompositionEnd()},Gt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Gt.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)},Gt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Rr(this.cm,function(){return Tr(e.cm)})},Gt.prototype.setUneditable=function(e){e.contentEditable="false"},Gt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||lr(this.cm,Ka)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Gt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Gt.prototype.onContextMenu=function(){},Gt.prototype.resetPosition=function(){},Gt.prototype.needsContentAttribute=!0;function Rs(e,t){var i=pa(e,t.line);if(!i||i.hidden)return null;var r=pt(e.doc,t.line),n=ro(i,r,t.line),T=qe(r,e.doc.direction),F="left";if(T){var Y=Xe(T,t.ch);F=Y%2?"right":"left"}var J=ao(n.map,t.ch,F);return J.offset=J.collapse=="right"?J.end:J.start,J}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function ln(e,t){return t&&(e.bad=!0),e}function tu(e,t,i,r,n){var T="",F=!1,Y=e.doc.lineSeparator(),J=!1;function q(Ae){return function(Fe){return Fe.id==Ae}}function ce(){F&&(T+=Y,J&&(T+=Y),F=J=!1)}function pe(Ae){Ae&&(ce(),T+=Ae)}function De(Ae){if(Ae.nodeType==1){var Fe=Ae.getAttribute("cm-text");if(Fe){pe(Fe);return}var ze=Ae.getAttribute("cm-marker"),Ye;if(ze){var tt=e.findMarks(Ve(r,0),Ve(n+1,0),q(+ze));tt.length&&(Ye=tt[0].find(0))&&pe(Pr(e.doc,Ye.from,Ye.to).join(Y));return}if(Ae.getAttribute("contenteditable")=="false")return;var ot=/^(pre|div|p|li|table|br)$/i.test(Ae.nodeName);if(!/^br$/i.test(Ae.nodeName)&&Ae.textContent.length==0)return;ot&&ce();for(var rt=0;rt<Ae.childNodes.length;rt++)De(Ae.childNodes[rt]);/^(pre|p)$/i.test(Ae.nodeName)&&(J=!0),ot&&(F=!0)}else Ae.nodeType==3&&pe(Ae.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(De(t),t==i);)t=t.nextSibling,J=!1;return T}function la(e,t,i){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[i],!r)return ln(e.clipPos(Ve(e.display.viewTo-1)),!0);t=null,i=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var n=0;n<e.display.view.length;n++){var T=e.display.view[n];if(T.node==r)return ru(T,t,i)}}function ru(e,t,i){var r=e.text.firstChild,n=!1;if(!t||!E(r,t))return ln(Ve(Lt(e.line),0),!0);if(t==r&&(n=!0,t=r.childNodes[i],i=0,!t)){var T=e.rest?te(e.rest):e.line;return ln(Ve(Lt(T),T.text.length),n)}var F=t.nodeType==3?t:null,Y=t;for(!F&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(F=t.firstChild,i&&(i=F.nodeValue.length));Y.parentNode!=r;)Y=Y.parentNode;var J=e.measure,q=J.maps;function ce(Ye,tt,ot){for(var rt=-1;rt<(q?q.length:0);rt++)for(var ht=rt<0?J.map:q[rt],xt=0;xt<ht.length;xt+=3){var gt=ht[xt+2];if(gt==Ye||gt==tt){var At=Lt(rt<0?e.line:e.rest[rt]),Xt=ht[xt]+ot;return(ot<0||gt!=Ye)&&(Xt=ht[xt+(ot?1:0)]),Ve(At,Xt)}}}var pe=ce(F,Y,i);if(pe)return ln(pe,n);for(var De=Y.nextSibling,Ae=F?F.nodeValue.length-i:0;De;De=De.nextSibling){if(pe=ce(De,De.firstChild,0),pe)return ln(Ve(pe.line,pe.ch-Ae),n);Ae+=De.textContent.length}for(var Fe=Y.previousSibling,ze=i;Fe;Fe=Fe.previousSibling){if(pe=ce(Fe,Fe.firstChild,-1),pe)return ln(Ve(pe.line,pe.ch+ze),n);ze+=Fe.textContent.length}}var qt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ee,this.hasSelection=!1,this.composing=null};qt.prototype.init=function(e){var t=this,i=this,r=this.cm;this.createField(e);var n=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),S&&(n.style.width="0px"),Me(n,"input",function(){G&&j>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),Me(n,"paste",function(F){if(Ke(r,F)||ws(F,r))return;r.state.pasteIncoming=+new Date,i.fastPoll()});function T(F){if(Ke(r,F))return;if(r.somethingSelected())sa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var Y=_s(r);sa({lineWise:!0,text:Y.text}),F.type=="cut"?r.setSelections(Y.ranges,null,Ee):(i.prevInput="",n.value=Y.text.join(`
`),V(n))}else return;F.type=="cut"&&(r.state.cutIncoming=+new Date)}Me(n,"cut",T),Me(n,"copy",T),Me(e.scroller,"paste",function(F){if(fi(e,F)||Ke(r,F))return;if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var Y=new Event("paste");Y.clipboardData=F.clipboardData,n.dispatchEvent(Y)}),Me(e.lineSpace,"selectstart",function(F){fi(e,F)||re(F)}),Me(n,"compositionstart",function(){var F=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:F,range:r.markText(F,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Me(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},qt.prototype.createField=function(e){this.wrapper=ks(),this.textarea=this.wrapper.firstChild},qt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},qt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=vo(e);if(e.options.moveInputWithCursor){var n=Jr(e,i.sel.primary().head,"div"),T=t.wrapper.getBoundingClientRect(),F=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+F.top-T.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+F.left-T.left))}return r},qt.prototype.showSelection=function(e){var t=this.cm,i=t.display;u(i.cursorDiv,e.cursors),u(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},qt.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&V(this.textarea),G&&j>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",G&&j>=9&&(this.hasSelection=null))},qt.prototype.getField=function(){return this.textarea},qt.prototype.supportsTouch=function(){return!1},qt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||N()!=this.textarea))try{this.textarea.focus()}catch(e){}},qt.prototype.blur=function(){this.textarea.blur()},qt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},qt.prototype.receivedFocus=function(){this.slowPoll()},qt.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()})},qt.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function i(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,i)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,i)},qt.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||dt(i)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var n=i.value;if(n==r&&!t.somethingSelected())return!1;if(G&&j>=9&&this.hasSelection===n||l&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var T=n.charCodeAt(0);if(T==8203&&!r&&(r="\u200B"),T==8666)return this.reset(),this.cm.execCommand("undo")}for(var F=0,Y=Math.min(r.length,n.length);F<Y&&r.charCodeAt(F)==n.charCodeAt(F);)++F;return Rr(t,function(){Ka(t,n.slice(F),r.length-F,null,e.composing?"*compose":null),n.length>1e3||n.indexOf(`
`)>-1?i.value=e.prevInput="":e.prevInput=n,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},qt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},qt.prototype.onKeyPress=function(){G&&j>=9&&(this.hasSelection=null),this.fastPoll()},qt.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var T=Mi(i,e),F=r.scroller.scrollTop;if(!T||A)return;var Y=i.options.resetSelectionOnContextMenu;Y&&i.doc.sel.contains(T)==-1&&lr(i,gr)(i.doc,Ei(T),Ee);var J=n.style.cssText,q=t.wrapper.style.cssText,ce=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-ce.top-5)+"px; left: "+(e.clientX-ce.left-5)+`px;
z-index: 1000; background: `+(G?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var pe;I&&(pe=window.scrollY),r.input.focus(),I&&window.scrollTo(null,pe),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=Ae,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function De(){if(n.selectionStart!=null){var ze=i.somethingSelected(),Ye="\u200B"+(ze?n.value:"");n.value="\u21DA",n.value=Ye,t.prevInput=ze?"":"\u200B",n.selectionStart=1,n.selectionEnd=Ye.length,r.selForContextMenu=i.doc.sel}}function Ae(){if(t.contextMenuPending!=Ae)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=q,n.style.cssText=J,G&&j<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=F),n.selectionStart!=null){(!G||G&&j<9)&&De();var ze=0,Ye=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?lr(i,$o)(i):ze++<10?r.detectingSelectAll=setTimeout(Ye,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Ye,200)}}if(G&&j>=9&&De(),L){he(e);var Fe=function(){at(window,"mouseup",Fe),setTimeout(Ae,20)};Me(window,"mouseup",Fe)}else setTimeout(Ae,50)},qt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},qt.prototype.setUneditable=function(){},qt.prototype.needsContentAttribute=!1;function iu(e,t){if(t=t?M(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 i=N();t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=Y.getValue()}var n;if(e.form&&(Me(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var T=e.form;n=T.submit;try{var F=T.submit=function(){r(),T.submit=n,T.submit(),T.submit=F}}catch(J){}}t.finishInit=function(J){J.save=r,J.getTextArea=function(){return e},J.toTextArea=function(){J.toTextArea=isNaN,r(),e.parentNode.removeChild(J.getWrapperElement()),e.style.display="",e.form&&(at(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var Y=Yt(function(J){return e.parentNode.insertBefore(J,e.nextSibling)},t);return Y}function nu(e){e.off=at,e.on=Me,e.wheelEventPixels=dl,e.Doc=wr,e.splitLines=St,e.countColumn=$,e.findColumn=Ce,e.isWordChar=Oe,e.Pass=ke,e.signal=Ue,e.Line=Ri,e.changeEnd=Si,e.scrollbarModel=wo,e.Pos=Ve,e.cmpPos=Ct,e.modes=Wt,e.mimeModes=_t,e.resolveMode=vt,e.getMode=Vr,e.modeExtensions=nr,e.extendMode=cr,e.copyState=Hr,e.startState=si,e.innerMode=oi,e.commands=Mn,e.keyMap=pi,e.keyName=ds,e.isModifierKey=us,e.lookupKey=an,e.normalizeKeyMap=Pl,e.StringStream=Pt,e.SharedTextMarker=Rn,e.TextMarker=Ti,e.LineWidget=Dn,e.e_preventDefault=re,e.e_stopPropagation=ne,e.e_stop=he,e.addClass=U,e.contains=E,e.rmClass=m,e.keyNames=wi}$l(Yt),ql(Yt);var au="iter insert remove copy getEditor constructor".split(" ");for(var ua in wr.prototype)wr.prototype.hasOwnProperty(ua)&&oe(au,ua)<0&&(Yt.prototype[ua]=function(e){return function(){return e.apply(this.doc,arguments)}}(wr.prototype[ua]));return be(wr),Yt.inputStyles={textarea:qt,contenteditable:Gt},Yt.defineMode=function(e){!Yt.defaults.mode&&e!="null"&&(Yt.defaults.mode=e),Wr.apply(this,arguments)},Yt.defineMIME=ai,Yt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Yt.defineMIME("text/plain","null"),Yt.defineExtension=function(e,t){Yt.prototype[e]=t},Yt.defineDocExtension=function(e,t){wr.prototype[e]=t},Yt.fromTextArea=iu,nu(Yt),Yt.version="5.58.2",Yt})},Y1PL:function(bt,Qe,ie){"use strict";ie.r(Qe),ie.d(Qe,"ResizableTextArea",function(){return oe});var le=ie("wx14"),Q=ie("1OyB"),D=ie("vuIU"),Z=ie("Ji7U"),B=ie("LK+K"),P=ie("q1tI"),G=ie("VTBJ"),j=ie("rePB"),I=ie("Zm9Q"),k=ie("Kwbf"),y=ie("c+Xe"),A=ie("m+aA"),O=ie("bdgK"),_=new Map;function C(Ee){Ee.forEach(function(Te){var we,Ce=Te.target;(we=_.get(Ce))===null||we===void 0||we.forEach(function(me){return me(Ce)})})}var S=new O.default(C),d=null,o=null;function l(Ee,Te){_.has(Ee)||(_.set(Ee,new Set),S.observe(Ee)),_.get(Ee).add(Te)}function h(Ee,Te){_.has(Ee)&&(_.get(Ee).delete(Te),_.get(Ee).size||(S.unobserve(Ee),_.delete(Ee)))}var w=function(Ee){Object(Z.a)(we,Ee);var Te=Object(B.a)(we);function we(){return Object(Q.a)(this,we),Te.apply(this,arguments)}return Object(D.a)(we,[{key:"render",value:function(){return this.props.children}}]),we}(P.Component),p=P.createContext(null);function f(Ee){var Te=Ee.children,we=Ee.onBatchResize,Ce=P.useRef(0),me=P.useRef([]),ue=P.useContext(p),te=P.useCallback(function(de,ae,_e){Ce.current+=1;var Re=Ce.current;me.current.push({size:de,element:ae,data:_e}),Promise.resolve().then(function(){Re===Ce.current&&(we==null||we(me.current),me.current=[])}),ue==null||ue(de,ae,_e)},[we,ue]);return P.createElement(p.Provider,{value:te},Te)}function L(Ee){var Te=Ee.children,we=Ee.disabled,Ce=P.useRef(null),me=P.useRef(null),ue=P.useContext(p),te=P.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),de=P.isValidElement(Te)&&Object(y.c)(Te),ae=de?Te.ref:null,_e=P.useMemo(function(){return Object(y.a)(ae,Ce)},[ae,Ce]),Re=P.useRef(Ee);Re.current=Ee;var ye=P.useCallback(function(Oe){var Pe=Re.current,Ie=Pe.onResize,je=Pe.data,Be=Oe.getBoundingClientRect(),Ne=Be.width,et=Be.height,Ze=Oe.offsetWidth,$e=Oe.offsetHeight,Xe=Math.floor(Ne),st=Math.floor(et);if(te.current.width!==Xe||te.current.height!==st||te.current.offsetWidth!==Ze||te.current.offsetHeight!==$e){var qe={width:Xe,height:st,offsetWidth:Ze,offsetHeight:$e};te.current=qe;var nt=Ze===Math.round(Ne)?Ne:Ze,Me=$e===Math.round(et)?et:$e,ct=Object(G.a)(Object(G.a)({},qe),{},{offsetWidth:nt,offsetHeight:Me});ue==null||ue(ct,Oe,je),Ie&&Promise.resolve().then(function(){Ie(ct,Oe)})}},[]);return P.useEffect(function(){var Oe=Object(A.a)(Ce.current)||Object(A.a)(me.current);return Oe&&!we&&l(Oe,ye),function(){return h(Oe,ye)}},[Ce.current,we]),P.createElement(w,{ref:me},de?P.cloneElement(Te,{ref:_e}):Te)}var g="rc-observer-key";function m(Ee){var Te=Ee.children,we=Object(I.a)(Te);return we.map(function(Ce,me){var ue=(Ce==null?void 0:Ce.key)||"".concat(g,"-").concat(me);return P.createElement(L,Object(le.a)({},Ee,{key:ue}),Ce)})}m.Collection=f;var c=m,u=ie("bT9E"),a=ie("TSYQ"),x=ie.n(a),b=`
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
`,E=["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"],N={},U;function K(Ee){var Te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,we=Ee.getAttribute("id")||Ee.getAttribute("data-reactid")||Ee.getAttribute("name");if(Te&&N[we])return N[we];var Ce=window.getComputedStyle(Ee),me=Ce.getPropertyValue("box-sizing")||Ce.getPropertyValue("-moz-box-sizing")||Ce.getPropertyValue("-webkit-box-sizing"),ue=parseFloat(Ce.getPropertyValue("padding-bottom"))+parseFloat(Ce.getPropertyValue("padding-top")),te=parseFloat(Ce.getPropertyValue("border-bottom-width"))+parseFloat(Ce.getPropertyValue("border-top-width")),de=E.map(function(_e){return"".concat(_e,":").concat(Ce.getPropertyValue(_e))}).join(";"),ae={sizingStyle:de,paddingSize:ue,borderSize:te,boxSizing:me};return Te&&we&&(N[we]=ae),ae}function V(Ee){var Te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,we=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Ce=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;U||(U=document.createElement("textarea"),U.setAttribute("tab-index","-1"),U.setAttribute("aria-hidden","true"),document.body.appendChild(U)),Ee.getAttribute("wrap")?U.setAttribute("wrap",Ee.getAttribute("wrap")):U.removeAttribute("wrap");var me=K(Ee,Te),ue=me.paddingSize,te=me.borderSize,de=me.boxSizing,ae=me.sizingStyle;U.setAttribute("style","".concat(ae,";").concat(b)),U.value=Ee.value||Ee.placeholder||"";var _e=Number.MIN_SAFE_INTEGER,Re=Number.MAX_SAFE_INTEGER,ye=U.scrollHeight,Oe;if(de==="border-box"?ye+=te:de==="content-box"&&(ye-=ue),we!==null||Ce!==null){U.value=" ";var Pe=U.scrollHeight-ue;we!==null&&(_e=Pe*we,de==="border-box"&&(_e=_e+ue+te),ye=Math.max(_e,ye)),Ce!==null&&(Re=Pe*Ce,de==="border-box"&&(Re=Re+ue+te),Oe=ye>Re?"":"hidden",ye=Math.min(Re,ye))}return{height:ye,minHeight:_e,maxHeight:Re,overflowY:Oe,resize:"none"}}var R=ie("Gytx"),M=ie.n(R),$;(function(Ee){Ee[Ee.NONE=0]="NONE",Ee[Ee.RESIZING=1]="RESIZING",Ee[Ee.RESIZED=2]="RESIZED"})($||($={}));var ee=function(Ee){Object(Z.a)(we,Ee);var Te=Object(B.a)(we);function we(Ce){var me;return Object(Q.a)(this,we),me=Te.call(this,Ce),me.nextFrameActionId=void 0,me.resizeFrameId=void 0,me.textArea=void 0,me.saveTextArea=function(ue){me.textArea=ue},me.handleResize=function(ue){var te=me.state.resizeStatus,de=me.props,ae=de.autoSize,_e=de.onResize;if(te!==$.NONE)return;typeof _e=="function"&&_e(ue),ae&&me.resizeOnNextFrame()},me.resizeOnNextFrame=function(){cancelAnimationFrame(me.nextFrameActionId),me.nextFrameActionId=requestAnimationFrame(me.resizeTextarea)},me.resizeTextarea=function(){var ue=me.props.autoSize;if(!ue||!me.textArea)return;var te=ue.minRows,de=ue.maxRows,ae=V(me.textArea,!1,te,de);me.setState({textareaStyles:ae,resizeStatus:$.RESIZING},function(){cancelAnimationFrame(me.resizeFrameId),me.resizeFrameId=requestAnimationFrame(function(){me.setState({resizeStatus:$.RESIZED},function(){me.resizeFrameId=requestAnimationFrame(function(){me.setState({resizeStatus:$.NONE}),me.fixFirefoxAutoScroll()})})})})},me.renderTextArea=function(){var ue=me.props,te=ue.prefixCls,de=te===void 0?"rc-textarea":te,ae=ue.autoSize,_e=ue.onResize,Re=ue.className,ye=ue.disabled,Oe=me.state,Pe=Oe.textareaStyles,Ie=Oe.resizeStatus,je=Object(u.a)(me.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Be=x()(de,Re,Object(j.a)({},"".concat(de,"-disabled"),ye));"value"in je&&(je.value=je.value||"");var Ne=Object(G.a)(Object(G.a)(Object(G.a)({},me.props.style),Pe),Ie===$.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return P.createElement(c,{onResize:me.handleResize,disabled:!(ae||_e)},P.createElement("textarea",Object(le.a)({},je,{className:Be,style:Ne,ref:me.saveTextArea})))},me.state={textareaStyles:{},resizeStatus:$.NONE},me}return Object(D.a)(we,[{key:"componentDidUpdate",value:function(me){(me.value!==this.props.value||!M()(me.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 me=this.textArea.selectionStart,ue=this.textArea.selectionEnd;this.textArea.setSelectionRange(me,ue)}}catch(te){}}},{key:"render",value:function(){return this.renderTextArea()}}]),we}(P.Component),oe=ee,fe=function(Ee){Object(Z.a)(we,Ee);var Te=Object(B.a)(we);function we(Ce){var me;Object(Q.a)(this,we),me=Te.call(this,Ce),me.resizableTextArea=void 0,me.focus=function(){me.resizableTextArea.textArea.focus()},me.saveTextArea=function(te){me.resizableTextArea=te},me.handleChange=function(te){var de=me.props.onChange;me.setValue(te.target.value,function(){me.resizableTextArea.resizeTextarea()}),de&&de(te)},me.handleKeyDown=function(te){var de=me.props,ae=de.onPressEnter,_e=de.onKeyDown;te.keyCode===13&&ae&&ae(te),_e&&_e(te)};var ue=typeof Ce.value=="undefined"||Ce.value===null?Ce.defaultValue:Ce.value;return me.state={value:ue},me}return Object(D.a)(we,[{key:"setValue",value:function(me,ue){"value"in this.props||this.setState({value:me},ue)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return P.createElement(oe,Object(le.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(me){return"value"in me?{value:me.value}:null}}]),we}(P.Component),ke=Qe.default=fe},ZW9T:function(bt,Qe,ie){"use strict";ie.d(Qe,"a",function(){return w});var le=ie("k1fw"),Q=ie("miYZ"),D=ie("tsqr"),Z=ie("rAM+"),B=ie("tJVT"),P=ie("PpiC"),G=ie("q1tI"),j=ie.n(G),I=ie("bdgK");function k(p,f,L,g,m){var c=f.getWordUntilPosition(L),u={startLineNumber:L.lineNumber,endLineNumber:L.lineNumber,startColumn:c.startColumn,endColumn:c.endColumn},a=g.map(function(x){return{label:x,kind:p.languages.CompletionItemKind.Keyword,insertText:x,insertTextRules:p.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:u}});return m.map(function(x){a.push(Object(le.a)(Object(le.a)({},x),{},{range:u}))}),a}var y=function(p){var f={label:"ifelse",kind:p.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`),insertTextRules:p.languages.CompletionItemInsertTextRule.InsertAsSnippet},L=["auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];p.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(u,a){var x=k(p,u,a,L,[f]);return{suggestions:x}}});var g=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];p.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(u,a){var x=[{label:"print",kind:p.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
`),insertTextRules:p.languages.CompletionItemInsertTextRule.InsertAsSnippet}],b=k(p,u,a,g,x);return{suggestions:b}}});var m=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];p.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(u,a){var x=[f,{label:"main",kind:p.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
`),insertTextRules:p.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:p.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
`),insertTextRules:p.languages.CompletionItemInsertTextRule.InsertAsSnippet}],b=k(p,u,a,m,x);return{suggestions:b}}})},A="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",O=ie("LvDl");function _(p){return/^\d+$/.test(p)?"".concat(p,"px"):p}function C(){}var S=!1,d={"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 o(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],f=p;if(Array.isArray(p)){for(var L=0;L<p.length;L++){var g=d[p[L]];if(g)return g}return f[0]}return d[f]||f}var l=null,h=Qe.b=function(p){var f=p.width,L=f===void 0?"100%":f,g=p.height,m=g===void 0?"100%":g,c=p.value,u=p.language,a=u===void 0?"javascript":u,x=p.style,b=x===void 0?{}:x,E=p.options,N=E===void 0?{}:E,U=p.overrideServices,K=U===void 0?{}:U,V=p.theme,R=V===void 0?"vs-dark":V,M=p.onEditBlur,$=p.onSave,ee=p.autoHeight,oe=ee===void 0?!1:ee,fe=p.forbidCopy,ke=fe===void 0?!1:fe,Ee=p.onChange,Te=Ee===void 0?C:Ee,we=p.editorDidMount,Ce=we===void 0?C:we,me=p.onFocus,ue=me===void 0?C:me,te=p.filename,de=te===void 0?"educoder.txt":te,ae=Object(P.a)(p,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),_e=Object(G.useRef)(),Re=Object(G.useRef)({}),ye=Object(G.useRef)(),Oe=Object(G.useRef)(!1),Pe=Object(G.useRef)(),Ie=Object(G.useState)(!1),je=Object(B.a)(Ie,2),Be=je[0],Ne=je[1];function et(){var se;return _e.current&&(se=new I.default(function(he){var Le=Object(Z.a)(he),Se;try{for(Le.s();!(Se=Le.n()).done;){var We=Se.value;(We.target.offsetHeight>0||We.target.offsetWidth>0)&&Re.current.instance.layout()}}catch(it){Le.e(it)}finally{Le.f()}}),se.observe(_e.current)),se}function Ze(){D.b.warn(decodeURIComponent(A))}var $e=function(){var he=Re.current.instance;if(c!=null&&he&&Be){var Le=he.getModel();Le&&c!==Le.getValue()&&(S=!0,Le.setValue(c),he.layout(),S=!1)}};Object(G.useEffect)(function(){ye.current&&clearTimeout(ye.current),ye.current=setTimeout(function(){$e()},500)},[c,Be,Re.current]);function Xe(){var se=Re.current.instance;if(se){var he=se.getSelection(),Le=Re.current.pastePos||{},Se=new l.Range(Le.startLineNumber||he.endLineNumber,Le.startColumn||he.endColumn,Le.endLineNumber||he.endLineNumber,Le.endColumn||he.endColumn);setTimeout(function(){se.executeEdits("",[{range:Se,text:""}])},300)}}function st(se){(window.navigator.platform.match("Mac")?se.metaKey:se.ctrlKey)&&se.keyCode==83&&(se.preventDefault(),$())}var qe=function(){if(oe&&Re.current.instance){var he=Re.current.instance.getContentHeight();re(he<m?m:he)}else re(m)};function nt(se){var he=document.createEvent("MouseEvents");he.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),se.dispatchEvent(he)}function Me(se,he){var Le=window.URL||window.webkitURL||window,Se=new Blob([he]),We=document.createElementNS("http://www.w3.org/1999/xhtml","a");We.href=Le.createObjectURL(Se),We.download=se,nt(We)}Object(G.useEffect)(function(){qe()},[qe]),Object(G.useEffect)(function(){_e.current&&!Be&&ie.e(27).then(ie.t.bind(null,"M/lh",7)).then(function(se){try{l=se,Re.current.instance=l.editor.create(_e.current,{value:c,language:o(a),theme:R,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},K);var he=Re.current.instance;if(Ce(he,l),setTimeout(function(){qe(),Re.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Me(de||"educoder.txt",he.getValue())}})},500),Re.current.subscription=he.onDidChangeModelContent(function(Se){Oe.current?clearTimeout(Pe.current):(qe(),Te(he.getValue(),Se)),Pe.current=setTimeout(function(){Oe.current=!1},500)}),window.Monaco||y(l),ke&&(he.addCommand(l.KeyMod.CtrlCmd|l.KeyMod.Shift|l.KeyCode.KEY_V,function(){return Ze(),null}),he.addCommand(l.KeyMod.CtrlCmd|l.KeyCode.KEY_C,function(){return Ze(),null})),window.Monaco=l,M&&he.onDidBlurEditorWidget(function(){M(he.getValue())}),ue&&he.onDidFocusEditorText(function(){ue(he.getValue())}),ke){he.addCommand(l.KeyMod.CtrlCmd|l.KeyCode.KEY_V,function(){return Ze(),null}),he.onDidPaste(function(Se){Re.current.pastePos=Se});try{window.addEventListener("paste",Xe)}catch(Se){}}var Le=et();return Ne(!0),function(){var Se=Re.current.instance;Se.dispose();var We=Se.getModel();We&&We.dispose(),Re.current.subscription&&Re.current.subscription.dispose(),ke&&window.removeEventListener("paste",Xe),Le.unobserve(_e.current)}}catch(Se){}})},[]),Object(G.useEffect)(function(){var se=Re.current.instance;if(se&&Be)return document.addEventListener("keydown",st,!1),function(){document.removeEventListener("keydown",st)}},[$,Be]),Object(G.useEffect)(function(){var se=Re.current.instance;if(se&&Be){var he=o(a);l.editor.setModelLanguage(se.getModel(),he),console.log("language:",a,se.getModel(),he)}},[a,Be]),Object(G.useEffect)(function(){var se=Re.current.instance;se&&Be&&l.editor.setTheme(R)},[R,Be]),Object(G.useEffect)(function(){var se=Re.current.instance;se&&Be&&(se.updateOptions(Object(le.a)({},N)),setTimeout(function(){se.getModel().updateOptions(Object(le.a)({},N))},200))},[JSON.stringify(N),Be]),Object(G.useEffect)(function(){var se=Re.current.instance;se&&Be&&se.layout()},[L,m,Be]);var ct=Object(G.useState)(_(L)),at=Object(B.a)(ct,2),Ue=at[0],Ke=at[1],xe=Object(G.useState)(_(m)),ge=Object(B.a)(xe,2),be=ge[0],re=ge[1],ne=Object(le.a)(Object(le.a)({},b),{},{width:Ue,height:be});return j.a.createElement("div",{className:"my-monaco-editor",ref:_e,style:ne})};function w(p){var f=p.width,L=f===void 0?"100%":f,g=p.height,m=g===void 0?"100%":g,c=p.original,u=p.modified,a=p.language,x=p.options,b=x===void 0?{}:x,E=Object(G.useRef)(),N=Object(G.useState)(null),U=Object(B.a)(N,2),K=U[0],V=U[1];function R(oe){var fe;return E.current&&(fe=new I.default(function(ke){var Ee=Object(Z.a)(ke),Te;try{for(Ee.s();!(Te=Ee.n()).done;){var we=Te.value;(we.target.offsetHeight>0||we.target.offsetWidth>0)&&oe.layout()}}catch(Ce){Ee.e(Ce)}finally{Ee.f()}}),fe.observe(E.current)),fe}Object(G.useEffect)(function(){E.current&&ie.e(27).then(ie.t.bind(null,"M/lh",7)).then(function(oe){l=oe;var fe=l.editor.createDiffEditor(E.current,Object(le.a)(Object(le.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},b),{},{wordWrap:!0}));V(fe);var ke=R(fe);return function(){fe.dispose();var Ee=fe.getModel();Ee&&Ee.dispose(),ke.unobserve(E.current)}})},[]),Object(G.useEffect)(function(){K&&K.setModel({original:l.editor.createModel(c,a),modified:l.editor.createModel(u,a)})},[c,u,a,K]);var M=_(L),$=_(m),ee={width:M,height:$};return j.a.createElement("div",{className:"my-diff-editor",ref:E,style:ee})}},ZpRC:function(bt,Qe,ie){"use strict";function le(y){return typeof y=="object"&&y!=null&&y.nodeType===1}function Q(y,A){return(!A||y!=="hidden")&&y!=="visible"&&y!=="clip"}function D(y,A){if(y.clientHeight<y.scrollHeight||y.clientWidth<y.scrollWidth){var O=getComputedStyle(y,null);return Q(O.overflowY,A)||Q(O.overflowX,A)||function(_){var C=function(S){if(!S.ownerDocument||!S.ownerDocument.defaultView)return null;try{return S.ownerDocument.defaultView.frameElement}catch(d){return null}}(_);return!!C&&(C.clientHeight<_.scrollHeight||C.clientWidth<_.scrollWidth)}(y)}return!1}function Z(y,A,O,_,C,S,d,o){return S<y&&d>A||S>y&&d<A?0:S<=y&&o<=O||d>=A&&o>=O?S-y-_:d>A&&o<O||S<y&&o>O?d-A+C:0}var B=function(y,A){var O=window,_=A.scrollMode,C=A.block,S=A.inline,d=A.boundary,o=A.skipOverflowHiddenElements,l=typeof d=="function"?d:function(Pe){return Pe!==d};if(!le(y))throw new TypeError("Invalid target");for(var h=document.scrollingElement||document.documentElement,w=[],p=y;le(p)&&l(p);){if((p=p.parentElement)===h){w.push(p);break}p!=null&&p===document.body&&D(p)&&!D(document.documentElement)||p!=null&&D(p,o)&&w.push(p)}for(var f=O.visualViewport?O.visualViewport.width:innerWidth,L=O.visualViewport?O.visualViewport.height:innerHeight,g=window.scrollX||pageXOffset,m=window.scrollY||pageYOffset,c=y.getBoundingClientRect(),u=c.height,a=c.width,x=c.top,b=c.right,E=c.bottom,N=c.left,U=C==="start"||C==="nearest"?x:C==="end"?E:x+u/2,K=S==="center"?N+a/2:S==="end"?b:N,V=[],R=0;R<w.length;R++){var M=w[R],$=M.getBoundingClientRect(),ee=$.height,oe=$.width,fe=$.top,ke=$.right,Ee=$.bottom,Te=$.left;if(_==="if-needed"&&x>=0&&N>=0&&E<=L&&b<=f&&x>=fe&&E<=Ee&&N>=Te&&b<=ke)return V;var we=getComputedStyle(M),Ce=parseInt(we.borderLeftWidth,10),me=parseInt(we.borderTopWidth,10),ue=parseInt(we.borderRightWidth,10),te=parseInt(we.borderBottomWidth,10),de=0,ae=0,_e="offsetWidth"in M?M.offsetWidth-M.clientWidth-Ce-ue:0,Re="offsetHeight"in M?M.offsetHeight-M.clientHeight-me-te:0;if(h===M)de=C==="start"?U:C==="end"?U-L:C==="nearest"?Z(m,m+L,L,me,te,m+U,m+U+u,u):U-L/2,ae=S==="start"?K:S==="center"?K-f/2:S==="end"?K-f:Z(g,g+f,f,Ce,ue,g+K,g+K+a,a),de=Math.max(0,de+m),ae=Math.max(0,ae+g);else{de=C==="start"?U-fe-me:C==="end"?U-Ee+te+Re:C==="nearest"?Z(fe,Ee,ee,me,te+Re,U,U+u,u):U-(fe+ee/2)+Re/2,ae=S==="start"?K-Te-Ce:S==="center"?K-(Te+oe/2)+_e/2:S==="end"?K-ke+ue+_e:Z(Te,ke,oe,Ce,ue+_e,K,K+a,a);var ye=M.scrollLeft,Oe=M.scrollTop;U+=Oe-(de=Math.max(0,Math.min(Oe+de,M.scrollHeight-ee+Re))),K+=ye-(ae=Math.max(0,Math.min(ye+ae,M.scrollWidth-oe+_e)))}V.push({el:M,top:de,left:ae})}return V};function P(y){return y===Object(y)&&Object.keys(y).length!==0}function G(y,A){A===void 0&&(A="auto");var O="scrollBehavior"in document.body.style;y.forEach(function(_){var C=_.el,S=_.top,d=_.left;C.scroll&&O?C.scroll({top:S,left:d,behavior:A}):(C.scrollTop=S,C.scrollLeft=d)})}function j(y){return y===!1?{block:"end",inline:"nearest"}:P(y)?y:{block:"start",inline:"nearest"}}function I(y,A){var O=!y.ownerDocument.documentElement.contains(y);if(P(A)&&typeof A.behavior=="function")return A.behavior(O?[]:B(y,A));if(O)return;var _=j(A);return G(B(y,_),_.behavior)}var k=Qe.a=I},Zss7:function(bt,Qe,ie){var le;(function(Q){var D=/^\s+/,Z=/\s+$/,B=0,P=Q.round,G=Q.min,j=Q.max,I=Q.random;function k(te,de){if(te=te||"",de=de||{},te instanceof k)return te;if(!(this instanceof k))return new k(te,de);var ae=y(te);this._originalInput=te,this._r=ae.r,this._g=ae.g,this._b=ae.b,this._a=ae.a,this._roundA=P(100*this._a)/100,this._format=de.format||ae.format,this._gradientType=de.gradientType,this._r<1&&(this._r=P(this._r)),this._g<1&&(this._g=P(this._g)),this._b<1&&(this._b=P(this._b)),this._ok=ae.ok,this._tc_id=B++}k.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 te=this.toRgb();return(te.r*299+te.g*587+te.b*114)/1e3},getLuminance:function(){var te=this.toRgb(),de,ae,_e,Re,ye,Oe;return de=te.r/255,ae=te.g/255,_e=te.b/255,de<=.03928?Re=de/12.92:Re=Q.pow((de+.055)/1.055,2.4),ae<=.03928?ye=ae/12.92:ye=Q.pow((ae+.055)/1.055,2.4),_e<=.03928?Oe=_e/12.92:Oe=Q.pow((_e+.055)/1.055,2.4),.2126*Re+.7152*ye+.0722*Oe},setAlpha:function(te){return this._a=V(te),this._roundA=P(100*this._a)/100,this},toHsv:function(){var te=C(this._r,this._g,this._b);return{h:te.h*360,s:te.s,v:te.v,a:this._a}},toHsvString:function(){var te=C(this._r,this._g,this._b),de=P(te.h*360),ae=P(te.s*100),_e=P(te.v*100);return this._a==1?"hsv("+de+", "+ae+"%, "+_e+"%)":"hsva("+de+", "+ae+"%, "+_e+"%, "+this._roundA+")"},toHsl:function(){var te=O(this._r,this._g,this._b);return{h:te.h*360,s:te.s,l:te.l,a:this._a}},toHslString:function(){var te=O(this._r,this._g,this._b),de=P(te.h*360),ae=P(te.s*100),_e=P(te.l*100);return this._a==1?"hsl("+de+", "+ae+"%, "+_e+"%)":"hsla("+de+", "+ae+"%, "+_e+"%, "+this._roundA+")"},toHex:function(te){return d(this._r,this._g,this._b,te)},toHexString:function(te){return"#"+this.toHex(te)},toHex8:function(te){return o(this._r,this._g,this._b,this._a,te)},toHex8String:function(te){return"#"+this.toHex8(te)},toRgb:function(){return{r:P(this._r),g:P(this._g),b:P(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+P(this._r)+", "+P(this._g)+", "+P(this._b)+")":"rgba("+P(this._r)+", "+P(this._g)+", "+P(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:P(R(this._r,255)*100)+"%",g:P(R(this._g,255)*100)+"%",b:P(R(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+P(R(this._r,255)*100)+"%, "+P(R(this._g,255)*100)+"%, "+P(R(this._b,255)*100)+"%)":"rgba("+P(R(this._r,255)*100)+"%, "+P(R(this._g,255)*100)+"%, "+P(R(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:U[d(this._r,this._g,this._b,!0)]||!1},toFilter:function(te){var de="#"+l(this._r,this._g,this._b,this._a),ae=de,_e=this._gradientType?"GradientType = 1, ":"";if(te){var Re=k(te);ae="#"+l(Re._r,Re._g,Re._b,Re._a)}return"progid:DXImageTransform.Microsoft.gradient("+_e+"startColorstr="+de+",endColorstr="+ae+")"},toString:function(te){var de=!!te;te=te||this._format;var ae=!1,_e=this._a<1&&this._a>=0,Re=!de&&_e&&(te==="hex"||te==="hex6"||te==="hex3"||te==="hex4"||te==="hex8"||te==="name");return Re?te==="name"&&this._a===0?this.toName():this.toRgbString():(te==="rgb"&&(ae=this.toRgbString()),te==="prgb"&&(ae=this.toPercentageRgbString()),(te==="hex"||te==="hex6")&&(ae=this.toHexString()),te==="hex3"&&(ae=this.toHexString(!0)),te==="hex4"&&(ae=this.toHex8String(!0)),te==="hex8"&&(ae=this.toHex8String()),te==="name"&&(ae=this.toName()),te==="hsl"&&(ae=this.toHslString()),te==="hsv"&&(ae=this.toHsvString()),ae||this.toHexString())},clone:function(){return k(this.toString())},_applyModification:function(te,de){var ae=te.apply(null,[this].concat([].slice.call(de)));return this._r=ae._r,this._g=ae._g,this._b=ae._b,this.setAlpha(ae._a),this},lighten:function(){return this._applyModification(f,arguments)},brighten:function(){return this._applyModification(L,arguments)},darken:function(){return this._applyModification(g,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(w,arguments)},greyscale:function(){return this._applyModification(p,arguments)},spin:function(){return this._applyModification(m,arguments)},_applyCombination:function(te,de){return te.apply(null,[this].concat([].slice.call(de)))},analogous:function(){return this._applyCombination(b,arguments)},complement:function(){return this._applyCombination(c,arguments)},monochromatic:function(){return this._applyCombination(E,arguments)},splitcomplement:function(){return this._applyCombination(x,arguments)},triad:function(){return this._applyCombination(u,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},k.fromRatio=function(te,de){if(typeof te=="object"){var ae={};for(var _e in te)te.hasOwnProperty(_e)&&(_e==="a"?ae[_e]=te[_e]:ae[_e]=ke(te[_e]));te=ae}return k(te,de)};function y(te){var de={r:0,g:0,b:0},ae=1,_e=null,Re=null,ye=null,Oe=!1,Pe=!1;return typeof te=="string"&&(te=me(te)),typeof te=="object"&&(Ce(te.r)&&Ce(te.g)&&Ce(te.b)?(de=A(te.r,te.g,te.b),Oe=!0,Pe=String(te.r).substr(-1)==="%"?"prgb":"rgb"):Ce(te.h)&&Ce(te.s)&&Ce(te.v)?(_e=ke(te.s),Re=ke(te.v),de=S(te.h,_e,Re),Oe=!0,Pe="hsv"):Ce(te.h)&&Ce(te.s)&&Ce(te.l)&&(_e=ke(te.s),ye=ke(te.l),de=_(te.h,_e,ye),Oe=!0,Pe="hsl"),te.hasOwnProperty("a")&&(ae=te.a)),ae=V(ae),{ok:Oe,format:te.format||Pe,r:G(255,j(de.r,0)),g:G(255,j(de.g,0)),b:G(255,j(de.b,0)),a:ae}}function A(te,de,ae){return{r:R(te,255)*255,g:R(de,255)*255,b:R(ae,255)*255}}function O(te,de,ae){te=R(te,255),de=R(de,255),ae=R(ae,255);var _e=j(te,de,ae),Re=G(te,de,ae),ye,Oe,Pe=(_e+Re)/2;if(_e==Re)ye=Oe=0;else{var Ie=_e-Re;Oe=Pe>.5?Ie/(2-_e-Re):Ie/(_e+Re);switch(_e){case te:ye=(de-ae)/Ie+(de<ae?6:0);break;case de:ye=(ae-te)/Ie+2;break;case ae:ye=(te-de)/Ie+4;break}ye/=6}return{h:ye,s:Oe,l:Pe}}function _(te,de,ae){var _e,Re,ye;te=R(te,360),de=R(de,100),ae=R(ae,100);function Oe(je,Be,Ne){return Ne<0&&(Ne+=1),Ne>1&&(Ne-=1),Ne<1/6?je+(Be-je)*6*Ne:Ne<1/2?Be:Ne<2/3?je+(Be-je)*(2/3-Ne)*6:je}if(de===0)_e=Re=ye=ae;else{var Pe=ae<.5?ae*(1+de):ae+de-ae*de,Ie=2*ae-Pe;_e=Oe(Ie,Pe,te+1/3),Re=Oe(Ie,Pe,te),ye=Oe(Ie,Pe,te-1/3)}return{r:_e*255,g:Re*255,b:ye*255}}function C(te,de,ae){te=R(te,255),de=R(de,255),ae=R(ae,255);var _e=j(te,de,ae),Re=G(te,de,ae),ye,Oe,Pe=_e,Ie=_e-Re;if(Oe=_e===0?0:Ie/_e,_e==Re)ye=0;else{switch(_e){case te:ye=(de-ae)/Ie+(de<ae?6:0);break;case de:ye=(ae-te)/Ie+2;break;case ae:ye=(te-de)/Ie+4;break}ye/=6}return{h:ye,s:Oe,v:Pe}}function S(te,de,ae){te=R(te,360)*6,de=R(de,100),ae=R(ae,100);var _e=Q.floor(te),Re=te-_e,ye=ae*(1-de),Oe=ae*(1-Re*de),Pe=ae*(1-(1-Re)*de),Ie=_e%6,je=[ae,Oe,ye,ye,Pe,ae][Ie],Be=[Pe,ae,ae,Oe,ye,ye][Ie],Ne=[ye,ye,Pe,ae,ae,Oe][Ie];return{r:je*255,g:Be*255,b:Ne*255}}function d(te,de,ae,_e){var Re=[fe(P(te).toString(16)),fe(P(de).toString(16)),fe(P(ae).toString(16))];return _e&&Re[0].charAt(0)==Re[0].charAt(1)&&Re[1].charAt(0)==Re[1].charAt(1)&&Re[2].charAt(0)==Re[2].charAt(1)?Re[0].charAt(0)+Re[1].charAt(0)+Re[2].charAt(0):Re.join("")}function o(te,de,ae,_e,Re){var ye=[fe(P(te).toString(16)),fe(P(de).toString(16)),fe(P(ae).toString(16)),fe(Ee(_e))];return Re&&ye[0].charAt(0)==ye[0].charAt(1)&&ye[1].charAt(0)==ye[1].charAt(1)&&ye[2].charAt(0)==ye[2].charAt(1)&&ye[3].charAt(0)==ye[3].charAt(1)?ye[0].charAt(0)+ye[1].charAt(0)+ye[2].charAt(0)+ye[3].charAt(0):ye.join("")}function l(te,de,ae,_e){var Re=[fe(Ee(_e)),fe(P(te).toString(16)),fe(P(de).toString(16)),fe(P(ae).toString(16))];return Re.join("")}k.equals=function(te,de){return!te||!de?!1:k(te).toRgbString()==k(de).toRgbString()},k.random=function(){return k.fromRatio({r:I(),g:I(),b:I()})};function h(te,de){de=de===0?0:de||10;var ae=k(te).toHsl();return ae.s-=de/100,ae.s=M(ae.s),k(ae)}function w(te,de){de=de===0?0:de||10;var ae=k(te).toHsl();return ae.s+=de/100,ae.s=M(ae.s),k(ae)}function p(te){return k(te).desaturate(100)}function f(te,de){de=de===0?0:de||10;var ae=k(te).toHsl();return ae.l+=de/100,ae.l=M(ae.l),k(ae)}function L(te,de){de=de===0?0:de||10;var ae=k(te).toRgb();return ae.r=j(0,G(255,ae.r-P(255*-(de/100)))),ae.g=j(0,G(255,ae.g-P(255*-(de/100)))),ae.b=j(0,G(255,ae.b-P(255*-(de/100)))),k(ae)}function g(te,de){de=de===0?0:de||10;var ae=k(te).toHsl();return ae.l-=de/100,ae.l=M(ae.l),k(ae)}function m(te,de){var ae=k(te).toHsl(),_e=(ae.h+de)%360;return ae.h=_e<0?360+_e:_e,k(ae)}function c(te){var de=k(te).toHsl();return de.h=(de.h+180)%360,k(de)}function u(te){var de=k(te).toHsl(),ae=de.h;return[k(te),k({h:(ae+120)%360,s:de.s,l:de.l}),k({h:(ae+240)%360,s:de.s,l:de.l})]}function a(te){var de=k(te).toHsl(),ae=de.h;return[k(te),k({h:(ae+90)%360,s:de.s,l:de.l}),k({h:(ae+180)%360,s:de.s,l:de.l}),k({h:(ae+270)%360,s:de.s,l:de.l})]}function x(te){var de=k(te).toHsl(),ae=de.h;return[k(te),k({h:(ae+72)%360,s:de.s,l:de.l}),k({h:(ae+216)%360,s:de.s,l:de.l})]}function b(te,de,ae){de=de||6,ae=ae||30;var _e=k(te).toHsl(),Re=360/ae,ye=[k(te)];for(_e.h=(_e.h-(Re*de>>1)+720)%360;--de;)_e.h=(_e.h+Re)%360,ye.push(k(_e));return ye}function E(te,de){de=de||6;for(var ae=k(te).toHsv(),_e=ae.h,Re=ae.s,ye=ae.v,Oe=[],Pe=1/de;de--;)Oe.push(k({h:_e,s:Re,v:ye})),ye=(ye+Pe)%1;return Oe}k.mix=function(te,de,ae){ae=ae===0?0:ae||50;var _e=k(te).toRgb(),Re=k(de).toRgb(),ye=ae/100,Oe={r:(Re.r-_e.r)*ye+_e.r,g:(Re.g-_e.g)*ye+_e.g,b:(Re.b-_e.b)*ye+_e.b,a:(Re.a-_e.a)*ye+_e.a};return k(Oe)},k.readability=function(te,de){var ae=k(te),_e=k(de);return(Q.max(ae.getLuminance(),_e.getLuminance())+.05)/(Q.min(ae.getLuminance(),_e.getLuminance())+.05)},k.isReadable=function(te,de,ae){var _e=k.readability(te,de),Re,ye;ye=!1,Re=ue(ae);switch(Re.level+Re.size){case"AAsmall":case"AAAlarge":ye=_e>=4.5;break;case"AAlarge":ye=_e>=3;break;case"AAAsmall":ye=_e>=7;break}return ye},k.mostReadable=function(te,de,ae){var _e=null,Re=0,ye,Oe,Pe,Ie;ae=ae||{},Oe=ae.includeFallbackColors,Pe=ae.level,Ie=ae.size;for(var je=0;je<de.length;je++)ye=k.readability(te,de[je]),ye>Re&&(Re=ye,_e=k(de[je]));return k.isReadable(te,_e,{level:Pe,size:Ie})||!Oe?_e:(ae.includeFallbackColors=!1,k.mostReadable(te,["#fff","#000"],ae))};var N=k.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"},U=k.hexNames=K(N);function K(te){var de={};for(var ae in te)te.hasOwnProperty(ae)&&(de[te[ae]]=ae);return de}function V(te){return te=parseFloat(te),(isNaN(te)||te<0||te>1)&&(te=1),te}function R(te,de){ee(te)&&(te="100%");var ae=oe(te);return te=G(de,j(0,parseFloat(te))),ae&&(te=parseInt(te*de,10)/100),Q.abs(te-de)<1e-6?1:te%de/parseFloat(de)}function M(te){return G(1,j(0,te))}function $(te){return parseInt(te,16)}function ee(te){return typeof te=="string"&&te.indexOf(".")!=-1&&parseFloat(te)===1}function oe(te){return typeof te=="string"&&te.indexOf("%")!=-1}function fe(te){return te.length==1?"0"+te:""+te}function ke(te){return te<=1&&(te=te*100+"%"),te}function Ee(te){return Q.round(parseFloat(te)*255).toString(16)}function Te(te){return $(te)/255}var we=function(){var te="[-\\+]?\\d+%?",de="[-\\+]?\\d*\\.\\d+%?",ae="(?:"+de+")|(?:"+te+")",_e="[\\s|\\(]+("+ae+")[,|\\s]+("+ae+")[,|\\s]+("+ae+")\\s*\\)?",Re="[\\s|\\(]+("+ae+")[,|\\s]+("+ae+")[,|\\s]+("+ae+")[,|\\s]+("+ae+")\\s*\\)?";return{CSS_UNIT:new RegExp(ae),rgb:new RegExp("rgb"+_e),rgba:new RegExp("rgba"+Re),hsl:new RegExp("hsl"+_e),hsla:new RegExp("hsla"+Re),hsv:new RegExp("hsv"+_e),hsva:new RegExp("hsva"+Re),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 Ce(te){return!!we.CSS_UNIT.exec(te)}function me(te){te=te.replace(D,"").replace(Z,"").toLowerCase();var de=!1;if(N[te])te=N[te],de=!0;else if(te=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var ae;return(ae=we.rgb.exec(te))?{r:ae[1],g:ae[2],b:ae[3]}:(ae=we.rgba.exec(te))?{r:ae[1],g:ae[2],b:ae[3],a:ae[4]}:(ae=we.hsl.exec(te))?{h:ae[1],s:ae[2],l:ae[3]}:(ae=we.hsla.exec(te))?{h:ae[1],s:ae[2],l:ae[3],a:ae[4]}:(ae=we.hsv.exec(te))?{h:ae[1],s:ae[2],v:ae[3]}:(ae=we.hsva.exec(te))?{h:ae[1],s:ae[2],v:ae[3],a:ae[4]}:(ae=we.hex8.exec(te))?{r:$(ae[1]),g:$(ae[2]),b:$(ae[3]),a:Te(ae[4]),format:de?"name":"hex8"}:(ae=we.hex6.exec(te))?{r:$(ae[1]),g:$(ae[2]),b:$(ae[3]),format:de?"name":"hex"}:(ae=we.hex4.exec(te))?{r:$(ae[1]+""+ae[1]),g:$(ae[2]+""+ae[2]),b:$(ae[3]+""+ae[3]),a:Te(ae[4]+""+ae[4]),format:de?"name":"hex8"}:(ae=we.hex3.exec(te))?{r:$(ae[1]+""+ae[1]),g:$(ae[2]+""+ae[2]),b:$(ae[3]+""+ae[3]),format:de?"name":"hex"}:!1}function ue(te){var de,ae;return te=te||{level:"AA",size:"small"},de=(te.level||"AA").toUpperCase(),ae=(te.size||"small").toLowerCase(),de!=="AA"&&de!=="AAA"&&(de="AA"),ae!=="small"&&ae!=="large"&&(ae="small"),{level:de,size:ae}}bt.exports?bt.exports=k:!(le=function(){return k}.call(Qe,ie,Qe,bt),le!==void 0&&(bt.exports=le))})(Math)},bT9E:function(bt,Qe,ie){"use strict";ie.d(Qe,"a",function(){return Q});var le=ie("VTBJ");function Q(D,Z){var B=Object(le.a)({},D);return Array.isArray(Z)&&Z.forEach(function(P){delete B[P]}),B}},c5Ni:function(bt,Qe,ie){},dejd:function(bt,Qe,ie){},dmUQ:function(bt,Qe,ie){"use strict";var le=ie("Ff2n"),Q=ie("rePB"),D=ie("1OyB"),Z=ie("vuIU"),B=ie("Ji7U"),P=ie("md7G"),G=ie("foSv"),j=ie("q1tI"),I=ie.n(j),k=ie("TSYQ"),y=ie.n(k),A=ie("4IlW");function O(u,a){var x=Object.keys(u);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(u);a&&(b=b.filter(function(E){return Object.getOwnPropertyDescriptor(u,E).enumerable})),x.push.apply(x,b)}return x}function _(u){for(var a=1;a<arguments.length;a++){var x=arguments[a]!=null?arguments[a]:{};a%2?O(Object(x),!0).forEach(function(b){Object(Q.a)(u,b,x[b])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(x)):O(Object(x)).forEach(function(b){Object.defineProperty(u,b,Object.getOwnPropertyDescriptor(x,b))})}return u}function C(u){var a=S();return function(){var b=Object(G.a)(u),E;if(a){var N=Object(G.a)(this).constructor;E=Reflect.construct(b,arguments,N)}else E=b.apply(this,arguments);return Object(P.a)(this,E)}}function S(){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(u){return!1}}function d(){}function o(u){u.preventDefault()}var l=function(a){return a.replace(/[^\w.-]+/g,"")},h=200,w=600,p=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,f=function(a){return a!=null},L=function(a,x){return x===a||typeof x=="number"&&typeof a=="number"&&isNaN(x)&&isNaN(a)},g=function(u){Object(B.a)(x,u);var a=C(x);function x(b){var E;Object(D.a)(this,x),E=a.call(this,b),E.onKeyDown=function(K){var V=E.props,R=V.onKeyDown,M=V.onPressEnter;if(K.keyCode===A.a.UP){var $=E.getRatio(K);E.up(K,$,null),E.stop()}else if(K.keyCode===A.a.DOWN){var ee=E.getRatio(K);E.down(K,ee,null),E.stop()}else K.keyCode===A.a.ENTER&&M&&M(K);if(E.recordCursorPosition(),E.lastKeyCode=K.keyCode,R){for(var oe=arguments.length,fe=new Array(oe>1?oe-1:0),ke=1;ke<oe;ke++)fe[ke-1]=arguments[ke];R.apply(void 0,[K].concat(fe))}},E.onKeyUp=function(K){var V=E.props.onKeyUp;if(E.stop(),E.recordCursorPosition(),V){for(var R=arguments.length,M=new Array(R>1?R-1:0),$=1;$<R;$++)M[$-1]=arguments[$];V.apply(void 0,[K].concat(M))}},E.onChange=function(K){var V=E.props.onChange;E.state.focused&&(E.inputting=!0),E.rawInput=E.props.parser(E.getValueFromEvent(K)),E.setState({inputValue:E.rawInput}),V(E.toNumber(E.rawInput))},E.onMouseUp=function(){var K=E.props.onMouseUp;E.recordCursorPosition(),K&&K.apply(void 0,arguments)},E.onFocus=function(){var K;E.setState({focused:!0}),(K=E.props).onFocus.apply(K,arguments)},E.onBlur=function(){var K=E.props.onBlur;E.inputting=!1,E.setState({focused:!1});var V=E.getCurrentValidValue(E.state.inputValue),R=E.setValue(V,d);if(K){var M=E.input.value,$=E.getInputDisplayValue({focus:!1,value:R});E.input.value=$&&Number($),K.apply(void 0,arguments),E.input.value=M}},E.getRatio=function(K){var V=1;return K.metaKey||K.ctrlKey?V=.1:K.shiftKey&&(V=10),V},E.getFullNum=function(K){return isNaN(K)?K:/e/i.test(String(K))?Number(K).toFixed(18).replace(/\.?0+$/,""):K},E.getPrecision=function(K){if(f(E.props.precision))return E.props.precision;var V=String(K);if(V.indexOf("e-")>=0)return parseInt(V.slice(V.indexOf("e-")+2),10);var R=0;return V.indexOf(".")>=0&&(R=V.length-V.indexOf(".")-1),R},E.getInputDisplayValue=function(K){var V=K||E.state,R=V.focused,M=V.inputValue,$=V.value,ee;R?ee=M:ee=E.toPrecisionAsStep($),ee==null&&(ee="");var oe=E.formatWrapper(ee);return f(E.props.decimalSeparator)&&(oe=oe.toString().replace(".",E.props.decimalSeparator)),oe},E.recordCursorPosition=function(){try{E.cursorStart=E.input.selectionStart,E.cursorEnd=E.input.selectionEnd,E.currentValue=E.input.value,E.cursorBefore=E.input.value.substring(0,E.cursorStart),E.cursorAfter=E.input.value.substring(E.cursorEnd)}catch(K){}},E.restoreByAfter=function(K){if(K===void 0)return!1;var V=E.input.value,R=V.lastIndexOf(K);if(R===-1)return!1;var M=E.cursorBefore.length;return E.lastKeyCode===A.a.DELETE&&E.cursorBefore.charAt(M-1)===K[0]?(E.fixCaret(M,M),!0):R+K.length===V.length?(E.fixCaret(R,R),!0):!1},E.partRestoreByAfter=function(K){return K===void 0?!1:Array.prototype.some.call(K,function(V,R){var M=K.substring(R);return E.restoreByAfter(M)})},E.isNotCompleteNumber=function(K){return isNaN(K)||K===""||K===null||K&&K.toString().indexOf(".")===K.toString().length-1},E.stop=function(){E.autoStepTimer&&clearTimeout(E.autoStepTimer)},E.down=function(K,V,R){E.pressingUpOrDown=!0,E.step("down",K,V,R)},E.up=function(K,V,R){E.pressingUpOrDown=!0,E.step("up",K,V,R)},E.saveInput=function(K){E.input=K};var N=b.value;N===void 0&&(N=b.defaultValue),E.state={focused:b.autoFocus};var U=E.getValidValue(E.toNumber(N));return E.state=_(_({},E.state),{},{inputValue:E.toPrecisionAsStep(U),value:U}),E}return Object(Z.a)(x,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(E){var N=this.props,U=N.value,K=N.onChange,V=N.max,R=N.min,M=this.state.focused;if(E){if(!L(E.value,U)||!L(E.max,V)||!L(E.min,R)){var $=M?U:this.getValidValue(U),ee;this.pressingUpOrDown?ee=$:this.inputting?ee=this.rawInput:ee=this.toPrecisionAsStep($),this.setState({value:$,inputValue:ee})}var oe="value"in this.props?U:this.state.value;"max"in this.props&&E.max!==V&&typeof oe=="number"&&oe>V&&K&&K(V),"min"in this.props&&E.min!==R&&typeof oe=="number"&&oe<R&&K&&K(R)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var fe=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===A.a.BACKSPACE?fe=this.cursorStart-1:this.lastKeyCode===A.a.DELETE&&(fe=this.cursorStart):fe=this.input.value.length,this.fixCaret(fe,fe)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case A.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case A.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(ke){}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(E){var N=E;return N===""?N="":this.isNotCompleteNumber(parseFloat(N))?N=this.state.value:N=this.getValidValue(N),this.toNumber(N)}},{key:"getValueFromEvent",value:function(E){var N=E.target.value.trim().replace(/。/g,".");return f(this.props.decimalSeparator)&&(N=N.replace(this.props.decimalSeparator,".")),N}},{key:"getValidValue",value:function(E){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,U=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,K=parseFloat(E);return isNaN(K)?E:(K<N&&(K=N),K>U&&(K=U),K)}},{key:"setValue",value:function(E,N){var U=this.props.precision,K=this.isNotCompleteNumber(parseFloat(E))?null:parseFloat(E),V=this.state.value,R=V===void 0?null:V,M=this.state.inputValue,$=M===void 0?null:M,ee=typeof K=="number"?K.toFixed(U):"".concat(K),oe=K!==R||ee!=="".concat($);return"value"in this.props?($=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:$},N)):this.setState({value:K,inputValue:this.toPrecisionAsStep(E)},N),oe&&this.props.onChange(K),K}},{key:"getMaxPrecision",value:function(E){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.props,K=U.precision,V=U.step;if(f(K))return K;var R=this.getPrecision(N),M=this.getPrecision(V),$=this.getPrecision(E);return E?Math.max($,R+M):R+M}},{key:"getPrecisionFactor",value:function(E){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.getMaxPrecision(E,N);return Math.pow(10,U)}},{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(E){return this.props.formatter?this.props.formatter(E):E}},{key:"toPrecisionAsStep",value:function(E){if(this.isNotCompleteNumber(E)||E==="")return E;var N=Math.abs(this.getMaxPrecision(E));return isNaN(N)?E.toString():Number(E).toFixed(N)}},{key:"toNumber",value:function(E){var N=this.props.precision,U=this.state.focused,K=E&&E.length>16&&U;return this.isNotCompleteNumber(E)||K?E:f(N)?Math.round(E*Math.pow(10,N))/Math.pow(10,N):Number(E)}},{key:"upStep",value:function(E,N){var U=this.props.step,K=this.getPrecisionFactor(E,N),V=Math.abs(this.getMaxPrecision(E,N)),R=((K*E+K*U*N)/K).toFixed(V);return this.toNumber(R)}},{key:"downStep",value:function(E,N){var U=this.props.step,K=this.getPrecisionFactor(E,N),V=Math.abs(this.getMaxPrecision(E,N)),R=((K*E-K*U*N)/K).toFixed(V);return this.toNumber(R)}},{key:"step",value:function(E,N){var U=this,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,V=arguments.length>3?arguments[3]:void 0;this.stop(),N&&(N.persist(),N.preventDefault());var R=this.props;if(R.disabled)return;var M=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(M))return;var $=this["".concat(E,"Step")](M,K),ee=$>R.max||$<R.min;if($>R.max?$=R.max:$<R.min&&($=R.min),this.setValue($,null),this.setState({focused:!0},function(){U.pressingUpOrDown=!1}),ee)return;this.autoStepTimer=setTimeout(function(){U[E](N,K,!0)},V?h:w)}},{key:"fixCaret",value:function(E,N){if(E===void 0||N===void 0||!this.input||!this.input.value)return;try{var U=this.input.selectionStart,K=this.input.selectionEnd;(E!==U||N!==K)&&this.input.setSelectionRange(E,N)}catch(V){}}},{key:"render",value:function(){var E,N=this.props,U=N.prefixCls,K=N.disabled,V=N.readOnly,R=N.useTouch,M=N.autoComplete,$=N.upHandler,ee=N.downHandler,oe=N.className,fe=N.max,ke=N.min,Ee=N.style,Te=N.title,we=N.onMouseEnter,Ce=N.onMouseLeave,me=N.onMouseOver,ue=N.onMouseOut,te=N.required,de=N.onClick,ae=N.tabIndex,_e=N.type,Re=N.placeholder,ye=N.id,Oe=N.inputMode,Pe=N.pattern,Ie=N.step,je=N.maxLength,Be=N.autoFocus,Ne=N.name,et=N.onPaste,Ze=N.onInput,$e=Object(le.a)(N,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),Xe=this.state,st=Xe.value,qe=Xe.focused,nt=y()(U,(E={},Object(Q.a)(E,oe,!!oe),Object(Q.a)(E,"".concat(U,"-disabled"),K),Object(Q.a)(E,"".concat(U,"-focused"),qe),E)),Me={};Object.keys($e).forEach(function(he){(he.substr(0,5)==="data-"||he.substr(0,5)==="aria-"||he==="role")&&(Me[he]=$e[he])});var ct=!V&&!K,at=this.getInputDisplayValue(null),Ue=(st||st===0)&&(isNaN(st)||Number(st)>=fe),Ke=(st||st===0)&&(isNaN(st)||Number(st)<=ke),xe=Ue||K||V,ge=Ke||K||V,be=y()("".concat(U,"-handler"),"".concat(U,"-handler-up"),Object(Q.a)({},"".concat(U,"-handler-up-disabled"),xe)),re=y()("".concat(U,"-handler"),"".concat(U,"-handler-down"),Object(Q.a)({},"".concat(U,"-handler-down-disabled"),ge)),ne=R?{onTouchStart:xe?d:this.up,onTouchEnd:this.stop}:{onMouseDown:xe?d:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},se=R?{onTouchStart:ge?d:this.down,onTouchEnd:this.stop}:{onMouseDown:ge?d:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return I.a.createElement("div",{className:nt,style:Ee,title:Te,onMouseEnter:we,onMouseLeave:Ce,onMouseOver:me,onMouseOut:ue,onFocus:function(){return null},onBlur:function(){return null}},I.a.createElement("div",{className:"".concat(U,"-handler-wrap")},I.a.createElement("span",Object.assign({unselectable:"on"},ne,{role:"button","aria-label":"Increase Value","aria-disabled":xe,className:be}),$||I.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-up-inner"),onClick:o})),I.a.createElement("span",Object.assign({unselectable:"on"},se,{role:"button","aria-label":"Decrease Value","aria-disabled":ge,className:re}),ee||I.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-down-inner"),onClick:o}))),I.a.createElement("div",{className:"".concat(U,"-input-wrap")},I.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":ke,"aria-valuemax":fe,"aria-valuenow":st,required:te,type:_e,placeholder:Re,onPaste:et,onClick:de,onMouseUp:this.onMouseUp,className:"".concat(U,"-input"),tabIndex:ae,autoComplete:M,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:ct?this.onKeyDown:d,onKeyUp:ct?this.onKeyUp:d,autoFocus:Be,maxLength:je,readOnly:V,disabled:K,max:fe,min:ke,step:Ie,name:Ne,title:Te,id:ye,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(at),pattern:Pe,inputMode:Oe,onInput:Ze},Me))))}}]),x}(I.a.Component);g.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:p,min:-p,step:1,style:{},onChange:d,onKeyDown:d,onPressEnter:d,onFocus:d,onBlur:d,parser:l,required:!1,autoComplete:"off"};var m=g,c=Qe.a=m},h78n:function(bt,Qe,ie){"use strict";ie.d(Qe,"a",function(){return E});var le=ie("q1tI"),Q=ie.n(le),D=ie("TSYQ"),Z=ie.n(D),B={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},P=function(K){var V=K.map(function(){return Object(le.useRef)()}),R=Object(le.useRef)();return Object(le.useEffect)(function(){var M=Date.now(),$=!1;Object.keys(V).forEach(function(ee){var oe=V[ee].current;if(!oe)return;$=!0;var fe=oe.style;fe.transitionDuration=".3s, .3s, .3s, .06s",R.current&&M-R.current<100&&(fe.transitionDuration="0s, 0s")}),$&&(R.current=Date.now())}),[V]};function G(){return G=Object.assign||function(U){for(var K=1;K<arguments.length;K++){var V=arguments[K];for(var R in V)Object.prototype.hasOwnProperty.call(V,R)&&(U[R]=V[R])}return U},G.apply(this,arguments)}function j(U,K){return O(U)||A(U,K)||k(U,K)||I()}function I(){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 k(U,K){if(!U)return;if(typeof U=="string")return y(U,K);var V=Object.prototype.toString.call(U).slice(8,-1);if(V==="Object"&&U.constructor&&(V=U.constructor.name),V==="Map"||V==="Set")return Array.from(U);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return y(U,K)}function y(U,K){(K==null||K>U.length)&&(K=U.length);for(var V=0,R=new Array(K);V<K;V++)R[V]=U[V];return R}function A(U,K){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(U)))return;var V=[],R=!0,M=!1,$=void 0;try{for(var ee=U[Symbol.iterator](),oe;!(R=(oe=ee.next()).done)&&!(V.push(oe.value),K&&V.length===K);R=!0);}catch(fe){M=!0,$=fe}finally{try{!R&&ee.return!=null&&ee.return()}finally{if(M)throw $}}return V}function O(U){if(Array.isArray(U))return U}function _(U,K){if(U==null)return{};var V=C(U,K),R,M;if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(U);for(M=0;M<$.length;M++){if(R=$[M],K.indexOf(R)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(U,R))continue;V[R]=U[R]}}return V}function C(U,K){if(U==null)return{};var V={},R=Object.keys(U),M,$;for($=0;$<R.length;$++){if(M=R[$],K.indexOf(M)>=0)continue;V[M]=U[M]}return V}var S=function(K){var V=K.className,R=K.percent,M=K.prefixCls,$=K.strokeColor,ee=K.strokeLinecap,oe=K.strokeWidth,fe=K.style,ke=K.trailColor,Ee=K.trailWidth,Te=K.transition,we=_(K,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete we.gapPosition;var Ce=Array.isArray(R)?R:[R],me=Array.isArray($)?$:[$],ue=P(Ce),te=j(ue,1),de=te[0],ae=oe/2,_e=100-oe/2,Re="M ".concat(ee==="round"?ae:0,",").concat(ae,`
L `).concat(ee==="round"?_e:100,",").concat(ae),ye="0 0 100 ".concat(oe),Oe=0;return Q.a.createElement("svg",G({className:Z()("".concat(M,"-line"),V),viewBox:ye,preserveAspectRatio:"none",style:fe},we),Q.a.createElement("path",{className:"".concat(M,"-line-trail"),d:Re,strokeLinecap:ee,stroke:ke,strokeWidth:Ee||oe,fillOpacity:"0"}),Ce.map(function(Pe,Ie){var je={strokeDasharray:"".concat(Pe,"px, 100px"),strokeDashoffset:"-".concat(Oe,"px"),transition:Te||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Be=me[Ie]||me[me.length-1];return Oe+=Pe,Q.a.createElement("path",{key:Ie,className:"".concat(M,"-line-path"),d:Re,strokeLinecap:ee,stroke:Be,strokeWidth:oe,fillOpacity:"0",ref:de[Ie],style:je})}))};S.defaultProps=B;var d=S;function o(){return o=Object.assign||function(U){for(var K=1;K<arguments.length;K++){var V=arguments[K];for(var R in V)Object.prototype.hasOwnProperty.call(V,R)&&(U[R]=V[R])}return U},o.apply(this,arguments)}function l(U,K){return L(U)||f(U,K)||w(U,K)||h()}function h(){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 w(U,K){if(!U)return;if(typeof U=="string")return p(U,K);var V=Object.prototype.toString.call(U).slice(8,-1);if(V==="Object"&&U.constructor&&(V=U.constructor.name),V==="Map"||V==="Set")return Array.from(U);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return p(U,K)}function p(U,K){(K==null||K>U.length)&&(K=U.length);for(var V=0,R=new Array(K);V<K;V++)R[V]=U[V];return R}function f(U,K){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(U)))return;var V=[],R=!0,M=!1,$=void 0;try{for(var ee=U[Symbol.iterator](),oe;!(R=(oe=ee.next()).done)&&!(V.push(oe.value),K&&V.length===K);R=!0);}catch(fe){M=!0,$=fe}finally{try{!R&&ee.return!=null&&ee.return()}finally{if(M)throw $}}return V}function L(U){if(Array.isArray(U))return U}function g(U,K){if(U==null)return{};var V=m(U,K),R,M;if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(U);for(M=0;M<$.length;M++){if(R=$[M],K.indexOf(R)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(U,R))continue;V[R]=U[R]}}return V}function m(U,K){if(U==null)return{};var V={},R=Object.keys(U),M,$;for($=0;$<R.length;$++){if(M=R[$],K.indexOf(M)>=0)continue;V[M]=U[M]}return V}var c=0;function u(U){return+U.replace("%","")}function a(U){return Array.isArray(U)?U:[U]}function x(U,K,V,R){var M=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,$=arguments.length>5?arguments[5]:void 0,ee=50-R/2,oe=0,fe=-ee,ke=0,Ee=-2*ee;switch($){case"left":oe=-ee,fe=0,ke=2*ee,Ee=0;break;case"right":oe=ee,fe=0,ke=-2*ee,Ee=0;break;case"bottom":fe=ee,Ee=2*ee;break;default:}var Te="M 50,50 m ".concat(oe,",").concat(fe,`
a `).concat(ee,",").concat(ee," 0 1 1 ").concat(ke,",").concat(-Ee,`
a `).concat(ee,",").concat(ee," 0 1 1 ").concat(-ke,",").concat(Ee),we=Math.PI*2*ee,Ce={stroke:V,strokeDasharray:"".concat(K/100*(we-M),"px ").concat(we,"px"),strokeDashoffset:"-".concat(M/2+U/100*(we-M),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:Te,pathStyle:Ce}}var b=function(K){var V=K.prefixCls,R=K.strokeWidth,M=K.trailWidth,$=K.gapDegree,ee=K.gapPosition,oe=K.trailColor,fe=K.strokeLinecap,ke=K.style,Ee=K.className,Te=K.strokeColor,we=K.percent,Ce=g(K,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),me=Object(le.useMemo)(function(){return c+=1,c},[]),ue=x(0,100,oe,R,$,ee),te=ue.pathString,de=ue.pathStyle,ae=a(we),_e=a(Te),Re=_e.find(function(je){return Object.prototype.toString.call(je)==="[object Object]"}),ye=P(ae),Oe=l(ye,1),Pe=Oe[0],Ie=function(){var Be=0;return ae.map(function(Ne,et){var Ze=_e[et]||_e[_e.length-1],$e=Object.prototype.toString.call(Ze)==="[object Object]"?"url(#".concat(V,"-gradient-").concat(me,")"):"",Xe=x(Be,Ne,Ze,R,$,ee);return Be+=Ne,Q.a.createElement("path",{key:et,className:"".concat(V,"-circle-path"),d:Xe.pathString,stroke:$e,strokeLinecap:fe,strokeWidth:R,opacity:Ne===0?0:1,fillOpacity:"0",style:Xe.pathStyle,ref:Pe[et]})})};return Q.a.createElement("svg",o({className:Z()("".concat(V,"-circle"),Ee),viewBox:"0 0 100 100",style:ke},Ce),Re&&Q.a.createElement("defs",null,Q.a.createElement("linearGradient",{id:"".concat(V,"-gradient-").concat(me),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Re).sort(function(je,Be){return u(je)-u(Be)}).map(function(je,Be){return Q.a.createElement("stop",{key:Be,offset:je,stopColor:Re[je]})}))),Q.a.createElement("path",{className:"".concat(V,"-circle-trail"),d:te,stroke:oe,strokeLinecap:fe,strokeWidth:M||R,fillOpacity:"0",style:de}),Ie().reverse())};b.defaultProps=B;var E=b,N={Line:d,Circle:E}},kSUc:function(bt,Qe,ie){},lLeG:function(bt,Qe,ie){bt.exports={bg:"bg___f0e4_",flexRow:"flexRow___1-S6r",flexJustifyCenter:"flexJustifyCenter___3KkrV",flexAlignEnd:"flexAlignEnd___146T7",flexAlignCenter:"flexAlignCenter___2UVve",flexColumn:"flexColumn___nj9sg",formWrap:"formWrap___2eqbH",titleWrap:"titleWrap___1gkN2",fieldWrap:"fieldWrap___2l5q8",mdWrap:"mdWrap___38Ffu",backgroundFa:"backgroundFa___2gBUv",button:"button___3jgMh"}},lZu9:function(bt,Qe,ie){(function(le){le(ie("VrN/"),ie("1eCo"),ie("8EBN"))})(function(le){"use strict";le.defineMode("markdown",function(Q,D){var Z=le.getMode(Q,"text/html"),B=Z.name=="null";function P(R){if(le.findModeByName){var M=le.findModeByName(R);M&&(R=M.mime||M.mimes[0])}var $=le.getMode(Q,R);return $.name=="null"?null:$}D.highlightFormatting===void 0&&(D.highlightFormatting=!1),D.maxBlockquoteDepth===void 0&&(D.maxBlockquoteDepth=0),D.taskLists===void 0&&(D.taskLists=!1),D.strikethrough===void 0&&(D.strikethrough=!1),D.emoji===void 0&&(D.emoji=!1),D.fencedCodeBlockHighlighting===void 0&&(D.fencedCodeBlockHighlighting=!0),D.fencedCodeBlockDefaultMode===void 0&&(D.fencedCodeBlockDefaultMode="text/plain"),D.xml===void 0&&(D.xml=!0),D.tokenTypeOverrides===void 0&&(D.tokenTypeOverrides={});var G={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 j in G)G.hasOwnProperty(j)&&D.tokenTypeOverrides[j]&&(G[j]=D.tokenTypeOverrides[j]);var I=/^([*\-_])(?:\s*\1){2,}\s*$/,k=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,y=/^\[(x| )\](?=\s)/i,A=D.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,O=/^ {0,3}(?:\={1,}|-{2,})\s*$/,_=/^[^#!\[\]*_\\<>` "'(~:]+/,C=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,S=/^\s*\[[^\]]+?\]:.*$/,d=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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]/,o=" ";function l(R,M,$){return M.f=M.inline=$,$(R,M)}function h(R,M,$){return M.f=M.block=$,$(R,M)}function w(R){return!R||!/\S/.test(R.string)}function p(R){if(R.linkTitle=!1,R.linkHref=!1,R.linkText=!1,R.em=!1,R.strong=!1,R.strikethrough=!1,R.quote=0,R.indentedCode=!1,R.f==L){var M=B;if(!M){var $=le.innerMode(Z,R.htmlState);M=$.mode.name=="xml"&&$.state.tagStart===null&&!$.state.context&&$.state.tokenize.isInText}M&&(R.f=u,R.block=f,R.htmlState=null)}return R.trailingSpace=0,R.trailingSpaceNewLine=!1,R.prevLine=R.thisLine,R.thisLine={stream:null},null}function f(R,M){var $=R.column()===M.indentation,ee=w(M.prevLine.stream),oe=M.indentedCode,fe=M.prevLine.hr,ke=M.list!==!1,Ee=(M.listStack[M.listStack.length-1]||0)+3;M.indentedCode=!1;var Te=M.indentation;if(M.indentationDiff===null&&(M.indentationDiff=M.indentation,ke)){for(M.list=null;Te<M.listStack[M.listStack.length-1];)M.listStack.pop(),M.listStack.length?M.indentation=M.listStack[M.listStack.length-1]:M.list=!1;M.list!==!1&&(M.indentationDiff=Te-M.listStack[M.listStack.length-1])}var we=!ee&&!fe&&!M.prevLine.header&&(!ke||!oe)&&!M.prevLine.fencedCodeEnd,Ce=(M.list===!1||fe||ee)&&M.indentation<=Ee&&R.match(I),me=null;if(M.indentationDiff>=4&&(oe||M.prevLine.fencedCodeEnd||M.prevLine.header||ee))return R.skipToEnd(),M.indentedCode=!0,G.code;if(R.eatSpace())return null;if($&&M.indentation<=Ee&&(me=R.match(A))&&me[1].length<=6)return M.quote=0,M.header=me[1].length,M.thisLine.header=!0,D.highlightFormatting&&(M.formatting="header"),M.f=M.inline,m(M);if(M.indentation<=Ee&&R.eat(">"))return M.quote=$?1:M.quote+1,D.highlightFormatting&&(M.formatting="quote"),R.eatSpace(),m(M);if(!Ce&&!M.setext&&$&&M.indentation<=Ee&&(me=R.match(k))){var ue=me[1]?"ol":"ul";return M.indentation=Te+R.current().length,M.list=!0,M.quote=0,M.listStack.push(M.indentation),M.em=!1,M.strong=!1,M.code=!1,M.strikethrough=!1,D.taskLists&&R.match(y,!1)&&(M.taskList=!0),M.f=M.inline,D.highlightFormatting&&(M.formatting=["list","list-"+ue]),m(M)}else{if($&&M.indentation<=Ee&&(me=R.match(C,!0)))return M.quote=0,M.fencedEndRE=new RegExp(me[1]+"+ *$"),M.localMode=D.fencedCodeBlockHighlighting&&P(me[2]||D.fencedCodeBlockDefaultMode),M.localMode&&(M.localState=le.startState(M.localMode)),M.f=M.block=g,D.highlightFormatting&&(M.formatting="code-block"),M.code=-1,m(M);if(M.setext||(!we||!ke)&&!M.quote&&M.list===!1&&!M.code&&!Ce&&!S.test(R.string)&&(me=R.lookAhead(1))&&(me=me.match(O)))return M.setext?(M.header=M.setext,M.setext=0,R.skipToEnd(),D.highlightFormatting&&(M.formatting="header")):(M.header=me[0].charAt(0)=="="?1:2,M.setext=M.header),M.thisLine.header=!0,M.f=M.inline,m(M);if(Ce)return R.skipToEnd(),M.hr=!0,M.thisLine.hr=!0,G.hr;if(R.peek()==="[")return l(R,M,N)}return l(R,M,M.inline)}function L(R,M){var $=Z.token(R,M.htmlState);if(!B){var ee=le.innerMode(Z,M.htmlState);(ee.mode.name=="xml"&&ee.state.tagStart===null&&!ee.state.context&&ee.state.tokenize.isInText||M.md_inside&&R.current().indexOf(">")>-1)&&(M.f=u,M.block=f,M.htmlState=null)}return $}function g(R,M){var $=M.listStack[M.listStack.length-1]||0,ee=M.indentation<$,oe=$+3;if(M.fencedEndRE&&M.indentation<=oe&&(ee||R.match(M.fencedEndRE))){D.highlightFormatting&&(M.formatting="code-block");var fe;return ee||(fe=m(M)),M.localMode=M.localState=null,M.block=f,M.f=u,M.fencedEndRE=null,M.code=0,M.thisLine.fencedCodeEnd=!0,ee?h(R,M,M.block):fe}else return M.localMode?M.localMode.token(R,M.localState):(R.skipToEnd(),G.code)}function m(R){var M=[];if(R.formatting){M.push(G.formatting),typeof R.formatting=="string"&&(R.formatting=[R.formatting]);for(var $=0;$<R.formatting.length;$++)M.push(G.formatting+"-"+R.formatting[$]),R.formatting[$]==="header"&&M.push(G.formatting+"-"+R.formatting[$]+"-"+R.header),R.formatting[$]==="quote"&&(!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=R.quote?M.push(G.formatting+"-"+R.formatting[$]+"-"+R.quote):M.push("error"))}if(R.taskOpen)return M.push("meta"),M.length?M.join(" "):null;if(R.taskClosed)return M.push("property"),M.length?M.join(" "):null;if(R.linkHref?M.push(G.linkHref,"url"):(R.strong&&M.push(G.strong),R.em&&M.push(G.em),R.strikethrough&&M.push(G.strikethrough),R.emoji&&M.push(G.emoji),R.linkText&&M.push(G.linkText),R.code&&M.push(G.code),R.image&&M.push(G.image),R.imageAltText&&M.push(G.imageAltText,"link"),R.imageMarker&&M.push(G.imageMarker)),R.header&&M.push(G.header,G.header+"-"+R.header),R.quote&&(M.push(G.quote),!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=R.quote?M.push(G.quote+"-"+R.quote):M.push(G.quote+"-"+D.maxBlockquoteDepth)),R.list!==!1){var ee=(R.listStack.length-1)%3;ee?ee===1?M.push(G.list2):M.push(G.list3):M.push(G.list1)}return R.trailingSpaceNewLine?M.push("trailing-space-new-line"):R.trailingSpace&&M.push("trailing-space-"+(R.trailingSpace%2?"a":"b")),M.length?M.join(" "):null}function c(R,M){return R.match(_,!0)?m(M):void 0}function u(R,M){var $=M.text(R,M);if(typeof $!="undefined")return $;if(M.list)return M.list=null,m(M);if(M.taskList){var ee=R.match(y,!0)[1]===" ";return ee?M.taskOpen=!0:M.taskClosed=!0,D.highlightFormatting&&(M.formatting="task"),M.taskList=!1,m(M)}if(M.taskOpen=!1,M.taskClosed=!1,M.header&&R.match(/^#+$/,!0))return D.highlightFormatting&&(M.formatting="header"),m(M);var oe=R.next();if(M.linkTitle){M.linkTitle=!1;var fe=oe;oe==="("&&(fe=")"),fe=(fe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var ke="^\\s*(?:[^"+fe+"\\\\]+|\\\\\\\\|\\\\.)"+fe;if(R.match(new RegExp(ke),!0))return G.linkHref}if(oe==="`"){var Ee=M.formatting;D.highlightFormatting&&(M.formatting="code"),R.eatWhile("`");var Te=R.current().length;if(M.code==0&&(!M.quote||Te==1))return M.code=Te,m(M);if(Te==M.code){var we=m(M);return M.code=0,we}else return M.formatting=Ee,m(M)}else if(M.code)return m(M);if(oe==="\\"&&(R.next(),D.highlightFormatting)){var Ce=m(M),me=G.formatting+"-escape";return Ce?Ce+" "+me:me}if(oe==="!"&&R.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return M.imageMarker=!0,M.image=!0,D.highlightFormatting&&(M.formatting="image"),m(M);if(oe==="["&&M.imageMarker&&R.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return M.imageMarker=!1,M.imageAltText=!0,D.highlightFormatting&&(M.formatting="image"),m(M);if(oe==="]"&&M.imageAltText){D.highlightFormatting&&(M.formatting="image");var Ce=m(M);return M.imageAltText=!1,M.image=!1,M.inline=M.f=x,Ce}if(oe==="["&&!M.image)return M.linkText&&R.match(/^.*?\]/)||(M.linkText=!0,D.highlightFormatting&&(M.formatting="link")),m(M);if(oe==="]"&&M.linkText){D.highlightFormatting&&(M.formatting="link");var Ce=m(M);return M.linkText=!1,M.inline=M.f=R.match(/\(.*?\)| ?\[.*?\]/,!1)?x:u,Ce}if(oe==="<"&&R.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){M.f=M.inline=a,D.highlightFormatting&&(M.formatting="link");var Ce=m(M);return Ce?Ce+=" ":Ce="",Ce+G.linkInline}if(oe==="<"&&R.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){M.f=M.inline=a,D.highlightFormatting&&(M.formatting="link");var Ce=m(M);return Ce?Ce+=" ":Ce="",Ce+G.linkEmail}if(D.xml&&oe==="<"&&R.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var ue=R.string.indexOf(">",R.pos);if(ue!=-1){var te=R.string.substring(R.start,ue);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(te)&&(M.md_inside=!0)}return R.backUp(1),M.htmlState=le.startState(Z),h(R,M,L)}if(D.xml&&oe==="<"&&R.match(/^\/\w*?>/))return M.md_inside=!1,"tag";if(oe==="*"||oe==="_"){for(var de=1,ae=R.pos==1?" ":R.string.charAt(R.pos-2);de<3&&R.eat(oe);)de++;var _e=R.peek()||" ",Re=!/\s/.test(_e)&&(!d.test(_e)||/\s/.test(ae)||d.test(ae)),ye=!/\s/.test(ae)&&(!d.test(ae)||/\s/.test(_e)||d.test(_e)),Oe=null,Pe=null;if(de%2&&(!M.em&&Re&&(oe==="*"||!ye||d.test(ae))?Oe=!0:M.em==oe&&ye&&(oe==="*"||!Re||d.test(_e))&&(Oe=!1)),de>1&&(!M.strong&&Re&&(oe==="*"||!ye||d.test(ae))?Pe=!0:M.strong==oe&&ye&&(oe==="*"||!Re||d.test(_e))&&(Pe=!1)),Pe!=null||Oe!=null){D.highlightFormatting&&(M.formatting=Oe==null?"strong":Pe==null?"em":"strong em"),Oe===!0&&(M.em=oe),Pe===!0&&(M.strong=oe);var we=m(M);return Oe===!1&&(M.em=!1),Pe===!1&&(M.strong=!1),we}}else if(oe===" "&&(R.eat("*")||R.eat("_"))){if(R.peek()===" ")return m(M);R.backUp(1)}if(D.strikethrough){if(oe==="~"&&R.eatWhile(oe)){if(M.strikethrough){D.highlightFormatting&&(M.formatting="strikethrough");var we=m(M);return M.strikethrough=!1,we}else if(R.match(/^[^\s]/,!1))return M.strikethrough=!0,D.highlightFormatting&&(M.formatting="strikethrough"),m(M)}else if(oe===" "&&R.match(/^~~/,!0)){if(R.peek()===" ")return m(M);R.backUp(2)}}if(D.emoji&&oe===":"&&R.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){M.emoji=!0,D.highlightFormatting&&(M.formatting="emoji");var Ie=m(M);return M.emoji=!1,Ie}return oe===" "&&(R.match(/^ +$/,!1)?M.trailingSpace++:M.trailingSpace&&(M.trailingSpaceNewLine=!0)),m(M)}function a(R,M){var $=R.next();if($===">"){M.f=M.inline=u,D.highlightFormatting&&(M.formatting="link");var ee=m(M);return ee?ee+=" ":ee="",ee+G.linkInline}return R.match(/^[^>]+/,!0),G.linkInline}function x(R,M){if(R.eatSpace())return null;var $=R.next();return $==="("||$==="["?(M.f=M.inline=E($==="("?")":"]"),D.highlightFormatting&&(M.formatting="link-string"),M.linkHref=!0,m(M)):"error"}var b={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function E(R){return function(M,$){var ee=M.next();if(ee===R){$.f=$.inline=u,D.highlightFormatting&&($.formatting="link-string");var oe=m($);return $.linkHref=!1,oe}return M.match(b[R]),$.linkHref=!0,m($)}}function N(R,M){return R.match(/^([^\]\\]|\\.)*\]:/,!1)?(M.f=U,R.next(),D.highlightFormatting&&(M.formatting="link"),M.linkText=!0,m(M)):l(R,M,u)}function U(R,M){if(R.match(/^\]:/,!0)){M.f=M.inline=K,D.highlightFormatting&&(M.formatting="link");var $=m(M);return M.linkText=!1,$}return R.match(/^([^\]\\]|\\.)+/,!0),G.linkText}function K(R,M){return R.eatSpace()?null:(R.match(/^[^\s]+/,!0),R.peek()===void 0?M.linkTitle=!0:R.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),M.f=M.inline=u,G.linkHref+" url")}var V={startState:function(){return{f,prevLine:{stream:null},thisLine:{stream:null},block:f,htmlState:null,indentation:0,inline:u,text:c,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(R){return{f:R.f,prevLine:R.prevLine,thisLine:R.thisLine,block:R.block,htmlState:R.htmlState&&le.copyState(Z,R.htmlState),indentation:R.indentation,localMode:R.localMode,localState:R.localMode?le.copyState(R.localMode,R.localState):null,inline:R.inline,text:R.text,formatting:!1,linkText:R.linkText,linkTitle:R.linkTitle,linkHref:R.linkHref,code:R.code,em:R.em,strong:R.strong,strikethrough:R.strikethrough,emoji:R.emoji,header:R.header,setext:R.setext,hr:R.hr,taskList:R.taskList,list:R.list,listStack:R.listStack.slice(0),quote:R.quote,indentedCode:R.indentedCode,trailingSpace:R.trailingSpace,trailingSpaceNewLine:R.trailingSpaceNewLine,md_inside:R.md_inside,fencedEndRE:R.fencedEndRE}},token:function(R,M){if(M.formatting=!1,R!=M.thisLine.stream){if(M.header=0,M.hr=!1,R.match(/^\s*$/,!0))return p(M),null;if(M.prevLine=M.thisLine,M.thisLine={stream:R},M.taskList=!1,M.trailingSpace=0,M.trailingSpaceNewLine=!1,!M.localState&&(M.f=M.block,M.f!=L)){var $=R.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(M.indentation=$,M.indentationDiff=null,$>0)return null}}return M.f(R,M)},innerMode:function(R){return R.block==L?{state:R.htmlState,mode:Z}:R.localState?{state:R.localState,mode:R.localMode}:{state:R,mode:V}},indent:function(R,M,$){return R.block==L&&Z.indent?Z.indent(R.htmlState,M,$):R.localState&&R.localMode.indent?R.localMode.indent(R.localState,M,$):le.Pass},blankLine:p,getType:m,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return V},"xml"),le.defineMIME("text/markdown","markdown"),le.defineMIME("text/x-markdown","markdown")})},osHv:function(bt,Qe,ie){(function(le){le(ie("VrN/"))})(function(le){"use strict";var Q=le.Pos;function D(d,o){return d.line-o.line||d.ch-o.ch}var Z="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",B=Z+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",P=new RegExp("<(/?)(["+Z+"]["+B+"]*)","g");function G(d,o,l,h){this.line=o,this.ch=l,this.cm=d,this.text=d.getLine(o),this.min=h?Math.max(h.from,d.firstLine()):d.firstLine(),this.max=h?Math.min(h.to-1,d.lastLine()):d.lastLine()}function j(d,o){var l=d.cm.getTokenTypeAt(Q(d.line,o));return l&&/\btag\b/.test(l)}function I(d){return d.line>=d.max?void 0:(d.ch=0,d.text=d.cm.getLine(++d.line),!0)}function k(d){return d.line<=d.min?void 0:(d.text=d.cm.getLine(--d.line),d.ch=d.text.length,!0)}function y(d){for(;;){var o=d.text.indexOf(">",d.ch);if(o==-1){if(I(d))continue;return}if(!j(d,o+1)){d.ch=o+1;continue}var l=d.text.lastIndexOf("/",o),h=l>-1&&!/\S/.test(d.text.slice(l+1,o));return d.ch=o+1,h?"selfClose":"regular"}}function A(d){for(;;){var o=d.ch?d.text.lastIndexOf("<",d.ch-1):-1;if(o==-1){if(k(d))continue;return}if(!j(d,o+1)){d.ch=o;continue}P.lastIndex=o,d.ch=o;var l=P.exec(d.text);if(l&&l.index==o)return l}}function O(d){for(;;){P.lastIndex=d.ch;var o=P.exec(d.text);if(!o){if(I(d))continue;return}if(!j(d,o.index+1)){d.ch=o.index+1;continue}return d.ch=o.index+o[0].length,o}}function _(d){for(;;){var o=d.ch?d.text.lastIndexOf(">",d.ch-1):-1;if(o==-1){if(k(d))continue;return}if(!j(d,o+1)){d.ch=o;continue}var l=d.text.lastIndexOf("/",o),h=l>-1&&!/\S/.test(d.text.slice(l+1,o));return d.ch=o+1,h?"selfClose":"regular"}}function C(d,o){for(var l=[];;){var h=O(d),w,p=d.line,f=d.ch-(h?h[0].length:0);if(!h||!(w=y(d)))return;if(w=="selfClose")continue;if(h[1]){for(var L=l.length-1;L>=0;--L)if(l[L]==h[2]){l.length=L;break}if(L<0&&(!o||o==h[2]))return{tag:h[2],from:Q(p,f),to:Q(d.line,d.ch)}}else l.push(h[2])}}function S(d,o){for(var l=[];;){var h=_(d);if(!h)return;if(h=="selfClose"){A(d);continue}var w=d.line,p=d.ch,f=A(d);if(!f)return;if(f[1])l.push(f[2]);else{for(var L=l.length-1;L>=0;--L)if(l[L]==f[2]){l.length=L;break}if(L<0&&(!o||o==f[2]))return{tag:f[2],from:Q(d.line,d.ch),to:Q(w,p)}}}}le.registerHelper("fold","xml",function(d,o){for(var l=new G(d,o.line,0);;){var h=O(l);if(!h||l.line!=o.line)return;var w=y(l);if(!w)return;if(!h[1]&&w!="selfClose"){var p=Q(l.line,l.ch),f=C(l,h[2]);return f&&D(f.from,p)>0?{from:p,to:f.from}:null}}}),le.findMatchingTag=function(d,o,l){var h=new G(d,o.line,o.ch,l);if(h.text.indexOf(">")==-1&&h.text.indexOf("<")==-1)return;var w=y(h),p=w&&Q(h.line,h.ch),f=w&&A(h);if(!w||!f||D(h,o)>0)return;var L={from:Q(h.line,h.ch),to:p,tag:f[2]};return w=="selfClose"?{open:L,close:null,at:"open"}:f[1]?{open:S(h,f[2]),close:L,at:"close"}:(h=new G(d,p.line,p.ch,l),{open:L,close:C(h,f[2]),at:"open"})},le.findEnclosingTag=function(d,o,l,h){for(var w=new G(d,o.line,o.ch,l);;){var p=S(w,h);if(!p)break;var f=new G(d,o.line,o.ch,l),L=C(f,p.tag);if(L)return{open:p,close:L}}},le.scanForClosingTag=function(d,o,l,h){var w=new G(d,o.line,o.ch,h?{from:0,to:h}:null);return C(w,l)}})},p5ED:function(bt,Qe,ie){"use strict";var le=ie("+L6B"),Q=ie("2/Rp"),D=ie("5Dmo"),Z=ie("3S7+"),B=ie("k1fw"),P=ie("9og8"),G=ie("tJVT"),j=ie("WmNS"),I=ie.n(j),k=ie("q1tI"),y=ie.n(k),A=ie("vHTk"),O=ie.n(A),_=ie("yEEn"),C=ie("ZW9T"),S=ie("1vsH"),d=ie("V0Rq"),o=ie("m3rI"),l=function(w){var p=w.name,f=w.data,L=w.theme,g=w.type,m=w.filename,c=w.monacoEditor,u=w.className,a=w.style,x=w.close,b=w.onClose,E=w.hasMask,N=w.otherData,U=N===void 0?{}:N,K=Object(k.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),V=Object(G.a)(K,2),R=V[0],M=V[1],$=Object(k.useState)(""),ee=Object(G.a)($,2),oe=ee[0],fe=ee[1],ke=Object(k.useState)(),Ee=Object(G.a)(ke,2),Te=Ee[0],we=Ee[1],Ce=window.ENV==="build"?"/react/build/office.html":"/office.html",me,ue=1024*1024,te=10*ue,de=Object(k.useRef)();g==="office"&&(me=Object(S.P)(f).filesize,me>te&&(g="other")),m&&(c.filename=m),Object(k.useEffect)(function(){var ye,Oe,Pe=(ye=document.cookie)===null||ye===void 0||((Oe=ye.replace(/\s/g,""))===null||Oe===void 0)?void 0:Oe.split(";");Pe==null||Pe.map(function(Ie){var je=Ie.split("=");je[0]==="_educoder_session"&&fe(je[1])})},[]),Object(k.useEffect)(function(){g==="office"&&ae()},[g]);var ae=function(){var ye=Object(P.a)(I.a.mark(function Oe(){var Pe,Ie,je;return I.a.wrap(function(Ne){for(;;)switch(Ne.prev=Ne.next){case 0:return console.log("data:",f),Pe=f,f.startsWith("http")||(Pe=location.origin+Pe),Ie=new URL(Pe).pathname.split("/").pop(),Ne.next=6,Object(d.U)({attachment_id:Ie});case 6:je=Ne.sent,we(je);case 8:case"end":return Ne.stop()}},Oe)}));return function(){return ye.apply(this,arguments)}}(),_e=function(){if(f.startsWith("http")||f.startsWith("blob:")){Re();return}Object(S.x)(m||"educoder",f,m)},Re=function(){Object(S.v)(m||"educoder",decodeURIComponent(f))};return y.a.createElement("div",{style:Object(B.a)({},a||{}),className:"".concat(E&&O.a.bgBlack," ").concat(g?O.a.wrp:"hide")},x&&y.a.createElement("div",{className:O.a.close,ref:de},y.a.createElement(Z.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return de.current}},y.a.createElement("span",{onClick:Re},y.a.createElement("i",{className:"icon-quxiaozhiding"}))),y.a.createElement(Z.a,{title:"\u5173\u95ED",getPopupContainer:function(){return de.current}},y.a.createElement("span",{className:"",onClick:function(){b(),we(null)}},y.a.createElement("i",{className:"icon-guanbi1"})))),y.a.createElement("div",{className:"".concat(O.a[u]," ").concat(u," ").concat(O.a.monaco," ").concat(g==="txt"?"show":"hide")},g==="txt"&&y.a.createElement(C.b,c)),g==="audio"&&y.a.createElement("audio",{src:"".concat((f==null?void 0:f.indexOf("http://"))>-1||(f==null?void 0:f.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(f),autoPlay:!0}),g==="video"&&y.a.createElement(y.a.Fragment,null,(f==null?void 0:f.indexOf("/api"))>-1?y.a.createElement("video",{controls:!0,src:"".concat(f),autoPlay:!0}):y.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(f),autoPlay:!0})),g==="office"&&Te&&y.a.createElement("iframe",{src:"".concat(Ce,"?key=").concat(Te.key,"&url=").concat(o.a.API_SERVER+Te.url,"&callbackUrl=").concat(o.a.API_SERVER+Te.callbackUrl,"&fileType=").concat(Te.fileType,"&title=").concat(Te.title,"&model=view")}),(g==="xlsx"||g==="doc"||g==="pptx"||g==="docx")&&y.a.createElement("iframe",{src:"".concat(Ce,"?key=").concat(U.key,"&url=").concat(o.a.API_SERVER+U.url,"&callbackUrl=").concat(o.a.API_SERVER+U.callbackUrl,"&fileType=").concat(U.fileType,"&title=").concat(U.title,"&model=").concat(U.model)}),g==="html"&&y.a.createElement("iframe",{src:f+"&disposition=inline"}),g==="pdf"&&y.a.createElement("embed",{className:O.a.embed,src:f,type:"application/pdf"}),g==="image"&&y.a.createElement("img",{src:"".concat((f==null?void 0:f.indexOf("http://"))>-1||(f==null?void 0:f.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(f)}),g==="other"&&y.a.createElement("div",null,y.a.createElement(Q.a,{type:"primary",size:"large",onClick:_e},y.a.createElement(_.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),g==="download"&&y.a.createElement(Q.a,{type:"primary",size:"large",onClick:_e},y.a.createElement(_.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))};Qe.a=l},"p77/":function(bt,Qe,ie){},"rAM+":function(bt,Qe,ie){"use strict";ie.d(Qe,"a",function(){return Q});var le=ie("Qw5x");function Q(D,Z){var B;if(typeof Symbol=="undefined"||D[Symbol.iterator]==null){if(Array.isArray(D)||(B=Object(le.a)(D))||Z&&D&&typeof D.length=="number"){B&&(D=B);var P=0,G=function(){};return{s:G,n:function(){return P>=D.length?{done:!0}:{done:!1,value:D[P++]}},e:function(A){throw A},f:G}}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 j=!0,I=!1,k;return{s:function(){B=D[Symbol.iterator]()},n:function(){var A=B.next();return j=A.done,A},e:function(A){I=!0,k=A},f:function(){try{!j&&B.return!=null&&B.return()}finally{if(I)throw k}}}}},rUJ1:function(bt,Qe){const ie=/[&<>"']/,le=/[&<>"']/g,Q=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,Z={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},B=g=>Z[g];function P(g,m){if(m){if(ie.test(g))return g.replace(le,B)}else if(Q.test(g))return g.replace(D,B);return g}const G=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function j(g){return g.replace(G,(m,c)=>(c=c.toLowerCase(),c==="colon"?":":c.charAt(0)==="#"?c.charAt(1)==="x"?String.fromCharCode(parseInt(c.substring(2),16)):String.fromCharCode(+c.substring(1)):""))}const I=/(^|[^\[])\^/g;function k(g,m){g=g.source||g,m=m||"";const c={replace:(u,a)=>(a=a.source||a,a=a.replace(I,"$1"),g=g.replace(u,a),c),getRegex:()=>new RegExp(g,m)};return c}const y=/[^\w:]/g,A=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function O(g,m,c){if(g){let u;try{u=decodeURIComponent(j(c)).replace(y,"").toLowerCase()}catch(a){return null}if(u.indexOf("javascript:")===0||u.indexOf("vbscript:")===0||u.indexOf("data:")===0)return null}m&&!A.test(c)&&(c=o(m,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(u){return null}return c}const _={},C=/^[^:]+:\/*[^/]*$/,S=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(g,m){_[" "+g]||(C.test(g)?_[" "+g]=g+"/":_[" "+g]=p(g,"/",!0)),g=_[" "+g];const c=g.indexOf(":")===-1;return m.substring(0,2)==="//"?c?m:g.replace(S,"$1")+m:m.charAt(0)==="/"?c?m:g.replace(d,"$1")+m:g+m}const l={exec:function(){}};function h(g){let m=1,c,u;for(;m<arguments.length;m++){c=arguments[m];for(u in c)Object.prototype.hasOwnProperty.call(c,u)&&(g[u]=c[u])}return g}function w(g,m){const c=g.replace(/\|/g,(x,b,E)=>{let N=!1,U=b;for(;--U>=0&&E[U]==="\\";)N=!N;return N?"|":" |"}),u=c.split(/ \|/);let a=0;if(u.length>m)u.splice(m);else for(;u.length<m;)u.push("");for(;a<u.length;a++)u[a]=u[a].trim().replace(/\\\|/g,"|");return u}function p(g,m,c){const u=g.length;if(u===0)return"";let a=0;for(;a<u;){const x=g.charAt(u-a-1);if(x===m&&!c)a++;else if(x!==m&&c)a++;else break}return g.substr(0,u-a)}function f(g,m){if(g.indexOf(m[1])===-1)return-1;const c=g.length;let u=0,a=0;for(;a<c;a++)if(g[a]==="\\")a++;else if(g[a]===m[0])u++;else if(g[a]===m[1]&&(u--,u<0))return a;return-1}function L(g){g&&g.sanitize&&!g.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")}bt.exports={escape:P,unescape:j,edit:k,cleanUrl:O,resolveUrl:o,noopTest:l,merge:h,splitCells:w,rtrim:p,findClosingBracket:f,checkSanitizeDeprecation:L}},tt94:function(bt,Qe,ie){"use strict";ie.r(Qe);var le=ie("+L6B"),Q=ie("2/Rp"),D=ie("sRBo"),Z=ie("kaz8"),B=ie("14J3"),P=ie("BMrR"),G=ie("jCWc"),j=ie("kPKH"),I=ie("giR+"),k=ie("fyUT"),y=ie("5NDa"),A=ie("5rEg"),O=ie("sPJy"),_=ie("bE4q"),C=ie("k1fw"),S=ie("miYZ"),d=ie("tsqr"),o=ie("9og8"),l=ie("y8nQ"),h=ie("Vl3Y"),w=ie("tJVT"),p=ie("WmNS"),f=ie.n(p),L=ie("q1tI"),g=ie.n(L),m=ie("9kvl"),c=ie("55Ip"),u=ie("1vsH"),a=ie("Ot1p"),x=ie("XYT7"),b=ie("lLeG"),E=ie.n(b),N=ie("500L"),U=function(V){var R,M=V.shixunHomeworks,$=V.newCourse,ee=V.globalSetting,oe=V.loading,fe=V.dispatch,ke=V.match,Ee=h.a.useForm(),Te=Object(w.a)(Ee,1),we=Te[0],Ce=Object(L.useState)({}),me=Object(w.a)(Ce,2),ue=me[0],te=me[1],de=Object(L.useRef)(),ae=M.commonHomeWorkAddDefaultData;Object(L.useEffect)(function(){setTimeout(function(){document.body.scrollIntoView()},300);var Re=ke.params,ye=Re.coursesId,Oe=Re.categoryId;fe({type:"shixunHomeworks/addCommonHomeWorkDefaultData",payload:{category:Oe,coursesId:ye,type:3}})},[]);var _e=function(){var Re=Object(o.a)(f.a.mark(function ye(Oe){var Pe,Ie,je,Be,Ne,et,Ze;return f.a.wrap(function(Xe){for(;;)switch(Xe.prev=Xe.next){case 0:if(!(ue.min_num>ue.max_num)){Xe.next=3;break}return d.b.info("\u6700\u5927\u4EBA\u6570\u4E0D\u80FD\u5C0F\u4E8E\u6700\u5C0F\u4EBA\u6570"),Xe.abrupt("return");case 3:return Pe=Object(C.a)({},ue),Pe.attachment_ids&&(Pe.attachment_ids=Pe==null||((Ie=Pe.attachment_ids)===null||Ie===void 0)?void 0:Ie.map(function(st){return st.response.id})),Pe.reference_attachment_ids&&(Pe.reference_attachment_ids=Pe==null||((je=Pe.reference_attachment_ids)===null||je===void 0)?void 0:je.map(function(st){return st.response.id})),Be=ke.params,Ne=Be.coursesId,et=Be.categoryId,Xe.next=9,Object(x.a)(Object(C.a)(Object(C.a)({coursesId:Ne,category:et},Pe),{},{type:3}));case 9:Ze=Xe.sent,Ze.status===0&&(Object(u.Y)(["\u6559\u5B66\u8BFE\u5802","\u5206\u7EC4\u4F5C\u4E1A","\u65B0\u5EFA\u5206\u7EC4\u4F5C\u4E1A"]),m.d.push("/classrooms/".concat(Ne,"/group_homework/").concat(Ze.homework_id,"/detail")));case 11:case"end":return Xe.stop()}},ye)}));return function(Oe){return Re.apply(this,arguments)}}();return g.a.createElement("section",{className:E.a.bg},ae.course_name&&g.a.createElement("section",{className:"animated fadeIn"},g.a.createElement("aside",{className:"mt10"},ae.category&&g.a.createElement(_.a,{separator:">"},g.a.createElement(_.a.Item,null,g.a.createElement(c.a,{to:"/classrooms/".concat(ae.course_id,"/group_homework")},ae.course_name)),g.a.createElement(_.a.Item,null,g.a.createElement(c.a,{to:"/classrooms/".concat(ae.course_id,"/group_homework")},ae.category.category_name)),g.a.createElement(_.a.Item,null,"\u65B0\u5EFA\u8BE6\u60C5")))),g.a.createElement("aside",{className:"font24 bold mt20 mb20"},"\u65B0\u5EFA\u5206\u7EC4\u4F5C\u4E1A"),g.a.createElement(h.a,{form:we,className:E.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(){te(Object(C.a)({},we.getFieldsValue()))},initialValues:{base_on_project:!1},onFinish:_e},g.a.createElement("div",{className:E.a.fieldWrap},g.a.createElement(h.a.Item,{name:"name",label:"\u6807\u9898:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6807\u9898"}]},g.a.createElement(A.a,{maxLength:60,suffix:"".concat(((R=ue.name)===null||R===void 0?void 0:R.length)||0,"/60"),placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A"}))),g.a.createElement("div",{className:E.a.mdWrap},g.a.createElement(h.a.Item,{name:"description",label:"\u5185\u5BB9:",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"}]},g.a.createElement(a.a,{watch:!0,defaultValue:ue.intro})),g.a.createElement("div",null,g.a.createElement(h.a.Item,{name:"attachment_ids"},g.a.createElement(N.b,null))),g.a.createElement(P.a,{gutter:[20,20]},g.a.createElement(j.a,{flex:"230px"},g.a.createElement(h.a.Item,{name:"min_num",label:"\u5206\u7EC4\u8BBE\u7F6E",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u6BCF\u7EC4\u6700\u5C0F\u4EBA\u6570"}]},g.a.createElement(k.a,{style:{width:200},min:1,placeholder:"\u8BF7\u586B\u5199\u6BCF\u7EC4\u6700\u5C0F\u4EBA\u6570"}))),g.a.createElement(j.a,{flex:"230px"},g.a.createElement(h.a.Item,{name:"max_num",label:g.a.createElement("div",null,"\xA0"),rules:[{required:!0,message:"\u8BF7\u586B\u5199\u6BCF\u7EC4\u6700\u5927\u4EBA\u6570"}]},g.a.createElement(k.a,{style:{width:200},max:100,placeholder:"\u8BF7\u586B\u5199\u6BCF\u7EC4\u6700\u5927\u4EBA\u6570"}))),g.a.createElement(j.a,null,g.a.createElement("div",{className:"mt30"},"\uFF08\u5B66\u751F\u63D0\u4EA4\u4F5C\u54C1\u65F6\u9700\u8981\u5173\u8054\u540C\u7EC4\u6210\u5458\uFF0C\u7EC4\u5185\u6210\u5458\u4F5C\u54C1\u5171\u4EAB\uFF09"))),g.a.createElement(P.a,null,g.a.createElement(j.a,null,g.a.createElement(h.a.Item,{name:"base_on_project",valuePropName:"checked"},g.a.createElement(Z.a,{value:!0},"\u57FA\u4E8E\u9879\u76EE\u5B9E\u65BD")),g.a.createElement("span",{className:"c-light-black"},"\uFF08\u9009\u4E2D\uFF0C\u5219\u5FC5\u987B\u5728\u672C\u5E73\u53F0\u521B\u5EFA\u9879\u76EE\uFF0C\u9879\u76EE\u7BA1\u7406\u5458\u53EF\u4EE5\u63D0\u4EA4\u4F5C\u54C1\uFF1B\u4E0D\u9009\u4E2D\uFF0C\u65E0\u9700\u5728\u5E73\u53F0\u521B\u5EFA\u9879\u76EE\uFF0C\u4EFB\u610F\u5C0F\u7EC4\u6210\u5458\u5747\u53EF\u4EE5\u63D0\u4EA4\u4F5C\u54C1\uFF09")))),g.a.createElement("div",{className:E.a.mdWrap},g.a.createElement(h.a.Item,{name:"reference_answer",label:"\u53C2\u8003\u7B54\u6848:"},g.a.createElement(a.a,{watch:!0,defaultValue:ue.notice})),g.a.createElement("div",null,g.a.createElement(h.a.Item,{name:"reference_attachment_ids"},g.a.createElement(N.b,null)))),g.a.createElement("div",{className:E.a.backgroundFa},g.a.createElement("div",{className:"pt40 mb30"},g.a.createElement(h.a.Item,null,g.a.createElement(Q.a,{size:"large",type:"primary",className:"".concat(E.a.button," mr20"),htmlType:"submit",loading:oe["newCourse/editCourse"]||oe["newCourse/submitCourse"]},"\u63D0\u4EA4"),g.a.createElement(Q.a,{size:"large",type:"primary",ghost:!0,className:E.a.button,onClick:function(){return m.d.push("/classrooms/".concat(ke.params.coursesId,"/group_homework"))}},"\u53D6\u6D88"))))))};Qe.default=Object(m.a)(function(K){var V=K.shixunHomeworks,R=K.newCourse,M=K.loading,$=K.globalSetting;return{shixunHomeworks:V,newCourse:R,globalSetting:$,loading:M.effects}})(U)},ulZh:function(bt,Qe,ie){typeof window!="undefined"&&function(Q,D){bt.exports=D()}(this,function(){return function(le){var Q={};function D(Z){if(Q[Z])return Q[Z].exports;var B=Q[Z]={i:Z,l:!1,exports:{}};return le[Z].call(B.exports,B,B.exports,D),B.l=!0,B.exports}return D.m=le,D.c=Q,D.d=function(Z,B,P){D.o(Z,B)||Object.defineProperty(Z,B,{enumerable:!0,get:P})},D.r=function(Z){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Z,"__esModule",{value:!0})},D.t=function(Z,B){if(B&1&&(Z=D(Z)),B&8)return Z;if(B&4&&typeof Z=="object"&&Z&&Z.__esModule)return Z;var P=Object.create(null);if(D.r(P),Object.defineProperty(P,"default",{enumerable:!0,value:Z}),B&2&&typeof Z!="string")for(var G in Z)D.d(P,G,function(j){return Z[j]}.bind(null,G));return P},D.n=function(Z){var B=Z&&Z.__esModule?function(){return Z.default}:function(){return Z};return D.d(B,"a",B),B},D.o=function(Z,B){return Object.prototype.hasOwnProperty.call(Z,B)},D.p="/dist/",D(D.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(le,Q,D){"use strict";var Z=Object.prototype.hasOwnProperty,B="~";function P(){}Object.create&&(P.prototype=Object.create(null),new P().__proto__||(B=!1));function G(y,A,O){this.fn=y,this.context=A,this.once=O||!1}function j(y,A,O,_,C){if(typeof O!="function")throw new TypeError("The listener must be a function");var S=new G(O,_||y,C),d=B?B+A:A;return y._events[d]?y._events[d].fn?y._events[d]=[y._events[d],S]:y._events[d].push(S):(y._events[d]=S,y._eventsCount++),y}function I(y,A){--y._eventsCount===0?y._events=new P:delete y._events[A]}function k(){this._events=new P,this._eventsCount=0}k.prototype.eventNames=function(){var A=[],O,_;if(this._eventsCount===0)return A;for(_ in O=this._events)Z.call(O,_)&&A.push(B?_.slice(1):_);return Object.getOwnPropertySymbols?A.concat(Object.getOwnPropertySymbols(O)):A},k.prototype.listeners=function(A){var O=B?B+A:A,_=this._events[O];if(!_)return[];if(_.fn)return[_.fn];for(var C=0,S=_.length,d=new Array(S);C<S;C++)d[C]=_[C].fn;return d},k.prototype.listenerCount=function(A){var O=B?B+A:A,_=this._events[O];return _?_.fn?1:_.length:0},k.prototype.emit=function(A,O,_,C,S,d){var o=B?B+A:A;if(!this._events[o])return!1;var l=this._events[o],h=arguments.length,w,p;if(l.fn){l.once&&this.removeListener(A,l.fn,void 0,!0);switch(h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,O),!0;case 3:return l.fn.call(l.context,O,_),!0;case 4:return l.fn.call(l.context,O,_,C),!0;case 5:return l.fn.call(l.context,O,_,C,S),!0;case 6:return l.fn.call(l.context,O,_,C,S,d),!0}for(p=1,w=new Array(h-1);p<h;p++)w[p-1]=arguments[p];l.fn.apply(l.context,w)}else{var f=l.length,L;for(p=0;p<f;p++){l[p].once&&this.removeListener(A,l[p].fn,void 0,!0);switch(h){case 1:l[p].fn.call(l[p].context);break;case 2:l[p].fn.call(l[p].context,O);break;case 3:l[p].fn.call(l[p].context,O,_);break;case 4:l[p].fn.call(l[p].context,O,_,C);break;default:if(!w)for(L=1,w=new Array(h-1);L<h;L++)w[L-1]=arguments[L];l[p].fn.apply(l[p].context,w)}}}return!0},k.prototype.on=function(A,O,_){return j(this,A,O,_,!1)},k.prototype.once=function(A,O,_){return j(this,A,O,_,!0)},k.prototype.removeListener=function(A,O,_,C){var S=B?B+A:A;if(!this._events[S])return this;if(!O)return I(this,S),this;var d=this._events[S];if(d.fn)d.fn===O&&(!C||d.once)&&(!_||d.context===_)&&I(this,S);else{for(var o=0,l=[],h=d.length;o<h;o++)(d[o].fn!==O||C&&!d[o].once||_&&d[o].context!==_)&&l.push(d[o]);l.length?this._events[S]=l.length===1?l[0]:l:I(this,S)}return this},k.prototype.removeAllListeners=function(A){var O;return A?(O=B?B+A:A,this._events[O]&&I(this,O)):(this._events=new P,this._eventsCount=0),this},k.prototype.off=k.prototype.removeListener,k.prototype.addListener=k.prototype.on,k.prefixed=B,k.EventEmitter=k,le.exports=k},"./node_modules/url-toolkit/src/url-toolkit.js":function(le,Q,D){(function(Z){var B=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,P=/^([^\/?#]*)([^]*)$/,G=/(?:\/|^)\.(?=\/)/g,j=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,I={buildAbsoluteURL:function(k,y,A){if(A=A||{},k=k.trim(),y=y.trim(),!y){if(!A.alwaysNormalize)return k;var O=I.parseURL(k);if(!O)throw new Error("Error trying to parse base URL.");return O.path=I.normalizePath(O.path),I.buildURLFromParts(O)}var _=I.parseURL(y);if(!_)throw new Error("Error trying to parse relative URL.");if(_.scheme)return A.alwaysNormalize?(_.path=I.normalizePath(_.path),I.buildURLFromParts(_)):y;var C=I.parseURL(k);if(!C)throw new Error("Error trying to parse base URL.");if(!C.netLoc&&C.path&&C.path[0]!=="/"){var S=P.exec(C.path);C.netLoc=S[1],C.path=S[2]}C.netLoc&&!C.path&&(C.path="/");var d={scheme:C.scheme,netLoc:_.netLoc,path:null,params:_.params,query:_.query,fragment:_.fragment};if(!_.netLoc&&(d.netLoc=C.netLoc,_.path[0]!=="/"))if(!_.path)d.path=C.path,_.params||(d.params=C.params,_.query||(d.query=C.query));else{var o=C.path,l=o.substring(0,o.lastIndexOf("/")+1)+_.path;d.path=I.normalizePath(l)}return d.path===null&&(d.path=A.alwaysNormalize?I.normalizePath(_.path):_.path),I.buildURLFromParts(d)},parseURL:function(k){var y=B.exec(k);return y?{scheme:y[1]||"",netLoc:y[2]||"",path:y[3]||"",params:y[4]||"",query:y[5]||"",fragment:y[6]||""}:null},normalizePath:function(k){for(k=k.split("").reverse().join("").replace(G,"");k.length!==(k=k.replace(j,"")).length;);return k.split("").reverse().join("")},buildURLFromParts:function(k){return k.scheme+k.netLoc+k.path+k.params+k.query+k.fragment}};le.exports=I})(this)},"./node_modules/webworkify-webpack/index.js":function(le,Q,D){function Z(A){var O={};function _(S){if(O[S])return O[S].exports;var d=O[S]={i:S,l:!1,exports:{}};return A[S].call(d.exports,d,d.exports,_),d.l=!0,d.exports}_.m=A,_.c=O,_.i=function(S){return S},_.d=function(S,d,o){_.o(S,d)||Object.defineProperty(S,d,{configurable:!1,enumerable:!0,get:o})},_.r=function(S){Object.defineProperty(S,"__esModule",{value:!0})},_.n=function(S){var d=S&&S.__esModule?function(){return S.default}:function(){return S};return _.d(d,"a",d),d},_.o=function(S,d){return Object.prototype.hasOwnProperty.call(S,d)},_.p="/",_.oe=function(S){throw console.error(S),S};var C=_(_.s=ENTRY_MODULE);return C.default||C}var B="[\\.|\\-|\\+|\\w|/|@]+",P="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+B+").*?\\)";function G(A){return(A+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function j(A){return!isNaN(1*A)}function I(A,O,_){var C={};C[_]=[];var S=O.toString(),d=S.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!d)return C;for(var o=d[1],l=new RegExp("(\\\\n|\\W)"+G(o)+P,"g"),h;h=l.exec(S);){if(h[3]==="dll-reference")continue;C[_].push(h[3])}for(l=new RegExp("\\("+G(o)+'\\("(dll-reference\\s('+B+'))"\\)\\)'+P,"g");h=l.exec(S);)A[h[2]]||(C[_].push(h[1]),A[h[2]]=D(h[1]).m),C[h[2]]=C[h[2]]||[],C[h[2]].push(h[4]);for(var w=Object.keys(C),p=0;p<w.length;p++)for(var f=0;f<C[w[p]].length;f++)j(C[w[p]][f])&&(C[w[p]][f]=1*C[w[p]][f]);return C}function k(A){var O=Object.keys(A);return O.reduce(function(_,C){return _||A[C].length>0},!1)}function y(A,O){for(var _={main:[O]},C={main:[]},S={main:{}};k(_);)for(var d=Object.keys(_),o=0;o<d.length;o++){var l=d[o],h=_[l],w=h.pop();if(S[l]=S[l]||{},S[l][w]||!A[l][w])continue;S[l][w]=!0,C[l]=C[l]||[],C[l].push(w);for(var p=I(A,A[l][w],l),f=Object.keys(p),L=0;L<f.length;L++)_[f[L]]=_[f[L]]||[],_[f[L]]=_[f[L]].concat(p[f[L]])}return C}le.exports=function(A,O){O=O||{};var _={main:D.m},C=O.all?{main:Object.keys(_.main)}:y(_,A),S="";Object.keys(C).filter(function(w){return w!=="main"}).forEach(function(w){for(var p=0;C[w][p];)p++;C[w].push(p),_[w][p]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",S=S+"var "+w+" = ("+Z.toString().replace("ENTRY_MODULE",JSON.stringify(p))+")({"+C[w].map(function(f){return""+JSON.stringify(f)+": "+_[w][f].toString()}).join(",")+`});
`}),S=S+"new (("+Z.toString().replace("ENTRY_MODULE",JSON.stringify(A))+")({"+C.main.map(function(w){return""+JSON.stringify(w)+": "+_.main[w].toString()}).join(",")+"}))(self);";var d=new window.Blob([S],{type:"text/javascript"});if(O.bare)return d;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,l=o.createObjectURL(d),h=new window.Worker(l);return h.objectURL=l,h}},"./src/config.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"hlsDefaultConfig",function(){return L}),D.d(Q,"mergeConfig",function(){return m}),D.d(Q,"enableStreamingMode",function(){return c});var Z=D("./src/controller/abr-controller.ts"),B=D("./src/controller/audio-stream-controller.ts"),P=D("./src/controller/audio-track-controller.ts"),G=D("./src/controller/subtitle-stream-controller.ts"),j=D("./src/controller/subtitle-track-controller.ts"),I=D("./src/controller/buffer-controller.ts"),k=D("./src/controller/timeline-controller.ts"),y=D("./src/controller/cap-level-controller.ts"),A=D("./src/controller/fps-controller.ts"),O=D("./src/controller/eme-controller.ts"),_=D("./src/controller/cmcd-controller.ts"),C=D("./src/utils/xhr-loader.ts"),S=D("./src/utils/fetch-loader.ts"),d=D("./src/utils/cues.ts"),o=D("./src/utils/mediakeys-helper.ts"),l=D("./src/utils/logger.ts");function h(){return h=Object.assign||function(u){for(var a=1;a<arguments.length;a++){var x=arguments[a];for(var b in x)Object.prototype.hasOwnProperty.call(x,b)&&(u[b]=x[b])}return u},h.apply(this,arguments)}function w(u,a){var x=Object.keys(u);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(u);a&&(b=b.filter(function(E){return Object.getOwnPropertyDescriptor(u,E).enumerable})),x.push.apply(x,b)}return x}function p(u){for(var a=1;a<arguments.length;a++){var x=arguments[a]!=null?arguments[a]:{};a%2?w(Object(x),!0).forEach(function(b){f(u,b,x[b])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(x)):w(Object(x)).forEach(function(b){Object.defineProperty(u,b,Object.getOwnPropertyDescriptor(x,b))})}return u}function f(u,a,x){return a in u?Object.defineProperty(u,a,{value:x,enumerable:!0,configurable:!0,writable:!0}):u[a]=x,u}var L=p(p({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:C.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Z.default,bufferController:I.default,capLevelController:y.default,fpsController:A.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:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},g()),{},{subtitleStreamController:G.SubtitleStreamController,subtitleTrackController:j.default,timelineController:k.TimelineController,audioStreamController:B.default,audioTrackController:P.default,emeController:O.default,cmcdController:_.default});function g(){return{cueHandler:d.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 m(u,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return h({},u,a)}function c(u){var a=u.loader;if(a!==S.default&&a!==C.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),u.progressive=!1;else{var x=Object(S.fetchSupported)();x&&(u.loader=S.default,u.progressive=!0,u.enableSoftwareAES=!0,l.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/polyfills/number.ts"),B=D("./src/utils/ewma-bandwidth-estimator.ts"),P=D("./src/events.ts"),G=D("./src/utils/buffer-helper.ts"),j=D("./src/errors.ts"),I=D("./src/types/loader.ts"),k=D("./src/utils/logger.ts");function y(_,C){for(var S=0;S<C.length;S++){var d=C[S];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(_,d.key,d)}}function A(_,C,S){return C&&y(_.prototype,C),S&&y(_,S),_}var O=function(){function _(S){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=S;var d=S.config;this.bwEstimator=new B.default(d.abrEwmaSlowVoD,d.abrEwmaFastVoD,d.abrEwmaDefaultEstimate),this.registerListeners()}var C=_.prototype;return C.registerListeners=function(){var d=this.hls;d.on(P.Events.FRAG_LOADING,this.onFragLoading,this),d.on(P.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(P.Events.ERROR,this.onError,this)},C.unregisterListeners=function(){var d=this.hls;d.off(P.Events.FRAG_LOADING,this.onFragLoading,this),d.off(P.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(P.Events.ERROR,this.onError,this)},C.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},C.onFragLoading=function(d,o){var l=o.frag;if(l.type===I.PlaylistLevelType.MAIN&&!this.timer){var h;this.fragCurrent=l,this.partCurrent=(h=o.part)!=null?h:null,this.timer=self.setInterval(this.onCheck,100)}},C.onLevelLoaded=function(d,o){var l=this.hls.config;o.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},C._abandonRulesCheck=function(){var d=this.fragCurrent,o=this.partCurrent,l=this.hls,h=l.autoLevelEnabled,w=l.config,p=l.media;if(!d||!p)return;var f=o?o.stats:d.stats,L=o?o.duration:d.duration;if(f.aborted){k.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!h||p.paused||!p.playbackRate||!p.readyState)return;var g=performance.now()-f.loading.start,m=Math.abs(p.playbackRate);if(g<=500*L/m)return;var c=l.levels,u=l.minAutoLevel,a=c[d.level],x=f.total||Math.max(f.loaded,Math.round(L*a.maxBitrate/8)),b=Math.max(1,f.bwEstimate?f.bwEstimate/8:f.loaded*1e3/g),E=(x-f.loaded)/b,N=p.currentTime,U=(G.BufferHelper.bufferInfo(p,N,w.maxBufferHole).end-N)/m;if(U>=2*L/m||E<=U)return;var K=Number.POSITIVE_INFINITY,V;for(V=d.level-1;V>u;V--){var R=c[V].maxBitrate;if(K=L*R/(8*.8*b),K<U)break}if(K>=E)return;var M=this.bwEstimator.getEstimate();k.logger.warn("Fragment "+d.sn+(o?" part "+o.index:"")+" of level "+d.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+V+`
Current BW estimate: `+(Object(Z.isFiniteNumber)(M)?(M/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+E.toFixed(3)+` s
Estimated load time for the next fragment: `+K.toFixed(3)+` s
Time to underbuffer: `+U.toFixed(3)+" s"),l.nextLoadLevel=V,this.bwEstimator.sample(g,f.loaded),this.clearTimer(),d.loader&&(this.fragCurrent=this.partCurrent=null,d.loader.abort()),l.trigger(P.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:o,stats:f})},C.onFragLoaded=function(d,o){var l=o.frag,h=o.part;if(l.type===I.PlaylistLevelType.MAIN&&Object(Z.isFiniteNumber)(l.sn)){var w=h?h.stats:l.stats,p=h?h.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var f=this.hls.levels[l.level],L=(f.loaded?f.loaded.bytes:0)+w.loaded,g=(f.loaded?f.loaded.duration:0)+p;f.loaded={bytes:L,duration:g},f.realBitrate=Math.round(8*L/g)}if(l.bitrateTest){var m={stats:w,frag:l,part:h,id:l.type};this.onFragBuffered(P.Events.FRAG_BUFFERED,m),l.bitrateTest=!1}}},C.onFragBuffered=function(d,o){var l=o.frag,h=o.part,w=h?h.stats:l.stats;if(w.aborted)return;if(l.type!==I.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var p=w.parsing.end-w.loading.start;this.bwEstimator.sample(p,w.loaded),w.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=p/1e3:this.bitrateTestDelay=0},C.onError=function(d,o){switch(o.details){case j.ErrorDetails.FRAG_LOAD_ERROR:case j.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},C.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},C.getNextABRAutoLevel=function(){var d=this.fragCurrent,o=this.partCurrent,l=this.hls,h=l.maxAutoLevel,w=l.config,p=l.minAutoLevel,f=l.media,L=o?o.duration:d?d.duration:0,g=f?f.currentTime:0,m=f&&f.playbackRate!==0?Math.abs(f.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():w.abrEwmaDefaultEstimate,u=(G.BufferHelper.bufferInfo(f,g,w.maxBufferHole).end-g)/m,a=this.findBestLevel(c,p,h,u,w.abrBandWidthFactor,w.abrBandWidthUpFactor);if(a>=0)return a;k.logger.trace((u?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var x=L?Math.min(L,w.maxStarvationDelay):w.maxStarvationDelay,b=w.abrBandWidthFactor,E=w.abrBandWidthUpFactor;if(!u){var N=this.bitrateTestDelay;if(N){var U=L?Math.min(L,w.maxLoadingDelay):w.maxLoadingDelay;x=U-N,k.logger.trace("bitrate test took "+Math.round(1e3*N)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*x)+" ms"),b=E=1}}return a=this.findBestLevel(c,p,h,u+x,b,E),Math.max(a,0)},C.findBestLevel=function(d,o,l,h,w,p){for(var f,L=this.fragCurrent,g=this.partCurrent,m=this.lastLoadedFragLevel,c=this.hls.levels,u=c[m],a=!!(u!=null&&(f=u.details)!==null&&f!==void 0&&f.live),x=u==null?void 0:u.codecSet,b=g?g.duration:L?L.duration:0,E=l;E>=o;E--){var N=c[E];if(!N||x&&N.codecSet!==x)continue;var U=N.details,K=(g?U==null?void 0:U.partTarget:U==null?void 0:U.averagetargetduration)||b,V=void 0;E<=m?V=w*d:V=p*d;var R=c[E].maxBitrate,M=R*K/V;if(k.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+E+"/"+Math.round(V)+"/"+R+"/"+K+"/"+h+"/"+M),V>R&&(!M||a&&!this.bitrateTestDelay||M<h))return E}return-1},A(_,[{key:"nextAutoLevel",get:function(){var d=this._nextAutoLevel,o=this.bwEstimator;if(d!==-1&&(!o||!o.canEstimate()))return d;var l=this.getNextABRAutoLevel();return d!==-1&&(l=Math.min(d,l)),l},set:function(d){this._nextAutoLevel=d}}]),_}();Q.default=O},"./src/controller/audio-stream-controller.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/polyfills/number.ts"),B=D("./src/controller/base-stream-controller.ts"),P=D("./src/events.ts"),G=D("./src/utils/buffer-helper.ts"),j=D("./src/controller/fragment-tracker.ts"),I=D("./src/types/level.ts"),k=D("./src/types/loader.ts"),y=D("./src/loader/fragment.ts"),A=D("./src/demux/chunk-cache.ts"),O=D("./src/demux/transmuxer-interface.ts"),_=D("./src/types/transmuxer.ts"),C=D("./src/controller/fragment-finders.ts"),S=D("./src/utils/discontinuities.ts"),d=D("./src/errors.ts"),o=D("./src/utils/logger.ts");function l(){return l=Object.assign||function(L){for(var g=1;g<arguments.length;g++){var m=arguments[g];for(var c in m)Object.prototype.hasOwnProperty.call(m,c)&&(L[c]=m[c])}return L},l.apply(this,arguments)}function h(L,g){L.prototype=Object.create(g.prototype),L.prototype.constructor=L,w(L,g)}function w(L,g){return w=Object.setPrototypeOf||function(c,u){return c.__proto__=u,c},w(L,g)}var p=100,f=function(L){h(g,L);function g(c,u){var a;return a=L.call(this,c,u,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var m=g.prototype;return m.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},m._registerListeners=function(){var u=this.hls;u.on(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.on(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),u.on(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.on(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on(P.Events.ERROR,this.onError,this),u.on(P.Events.BUFFER_RESET,this.onBufferReset,this),u.on(P.Events.BUFFER_CREATED,this.onBufferCreated,this),u.on(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.on(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},m._unregisterListeners=function(){var u=this.hls;u.off(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.off(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),u.off(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.off(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off(P.Events.ERROR,this.onError,this),u.off(P.Events.BUFFER_RESET,this.onBufferReset,this),u.off(P.Events.BUFFER_CREATED,this.onBufferCreated,this),u.off(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.off(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},m.onInitPtsFound=function(u,a){var x=a.frag,b=a.id,E=a.initPTS;if(b==="main"){var N=x.cc;this.initPTS[x.cc]=E,this.log("InitPTS for cc: "+N+" found from main: "+E),this.videoTrackCC=N,this.state===B.State.WAITING_INIT_PTS&&this.tick()}},m.startLoad=function(u){if(!this.levels){this.startPosition=u,this.state=B.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(p),this.fragLoadError=0,a>0&&u===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=B.State.IDLE):(this.loadedmetadata=!1,this.state=B.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=u,this.tick()},m.doTick=function(){switch(this.state){case B.State.IDLE:this.doTickIdle();break;case B.State.WAITING_TRACK:{var u,a=this.levels,x=this.trackId,b=a==null||((u=a[x])===null||u===void 0)?void 0:u.details;if(b){if(this.waitForCdnTuneIn(b))break;this.state=B.State.WAITING_INIT_PTS}break}case B.State.FRAG_LOADING_WAITING_RETRY:{var E,N=performance.now(),U=this.retryDate;(!U||N>=U||(E=this.media)!==null&&E!==void 0&&E.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=B.State.IDLE);break}case B.State.WAITING_INIT_PTS:{var K=this.waitingData;if(K){var V=K.frag,R=K.part,M=K.cache,$=K.complete;if(this.initPTS[V.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=B.State.FRAG_LOADING;var ee=M.flush(),oe={frag:V,part:R,payload:ee,networkDetails:null};this._handleFragmentLoadProgress(oe),$&&L.prototype._handleFragmentLoadComplete.call(this,oe)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+V.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var fe=this.getLoadPosition(),ke=G.BufferHelper.bufferInfo(this.mediaBuffer,fe,this.config.maxBufferHole),Ee=Object(C.fragmentWithinToleranceTest)(ke.end,this.config.maxFragLookUpTolerance,V);Ee<0&&(o.logger.log("Waiting fragment cc ("+V.cc+") @ "+V.start+" cancelled because another fragment at "+ke.end+" is needed"),this.clearWaitingFragment())}}else this.state=B.State.IDLE}}this.onTickEnd()},m.clearWaitingFragment=function(){var u=this.waitingData;u&&(this.fragmentTracker.removeFragment(u.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=B.State.IDLE)},m.onTickEnd=function(){var u=this.media;if(!u||!u.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:u,x=a.buffered;!this.loadedmetadata&&x.length&&(this.loadedmetadata=!0),this.lastCurrentTime=u.currentTime},m.doTickIdle=function(){var u,a,x=this.hls,b=this.levels,E=this.media,N=this.trackId,U=x.config;if(!b||!b[N])return;if(!E&&(this.startFragRequested||!U.startFragPrefetch))return;var K=b[N],V=K.details;if(!V||V.live&&this.levelLastLoaded!==N||this.waitForCdnTuneIn(V)){this.state=B.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,y.ElementaryStreamTypes.AUDIO,k.PlaylistLevelType.AUDIO));var R=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,k.PlaylistLevelType.AUDIO);if(R===null)return;var M=R.len,$=this.getMaxBufferLength(),ee=this.audioSwitch;if(M>=$&&!ee)return;if(!ee&&this._streamEnded(R,V)){x.trigger(P.Events.BUFFER_EOS,{type:"audio"}),this.state=B.State.ENDED;return}var oe=V.fragments,fe=oe[0].start,ke=R.end;if(ee){var Ee=this.getLoadPosition();ke=Ee,V.PTSKnown&&Ee<fe&&((R.end>fe||R.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),E.currentTime=fe+.05))}var Te=this.getNextFragment(ke,V);if(!Te){this.bufferFlushed=!0;return}((u=Te.decryptdata)===null||u===void 0?void 0:u.keyFormat)==="identity"&&!((a=Te.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(Te,V):this.loadFragment(Te,V,ke)},m.getMaxBufferLength=function(){var u=L.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,k.PlaylistLevelType.MAIN);return a===null?u:Math.max(u,a.len)},m.onMediaDetaching=function(){this.videoBuffer=null,L.prototype.onMediaDetaching.call(this)},m.onAudioTracksUpdated=function(u,a){var x=a.audioTracks;this.resetTransmuxer(),this.levels=x.map(function(b){return new I.Level(b)})},m.onAudioTrackSwitching=function(u,a){var x=!!a.url;this.trackId=a.id;var b=this.fragCurrent;b!=null&&b.loader&&b.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),x?this.setInterval(p):this.resetTransmuxer(),x?(this.audioSwitch=!0,this.state=B.State.IDLE):this.state=B.State.STOPPED,this.tick()},m.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},m.onLevelLoaded=function(u,a){this.mainDetails=a.details},m.onAudioTrackLoaded=function(u,a){var x,b=this.levels,E=a.details,N=a.id;if(!b){this.warn("Audio tracks were reset while loading level "+N);return}this.log("Track "+N+" loaded ["+E.startSN+","+E.endSN+"],duration:"+E.totalduration);var U=b[N],K=0;if(E.live||(x=U.details)!==null&&x!==void 0&&x.live){var V=this.mainDetails;if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed||!V)return;!U.details&&E.hasProgramDateTime&&V.hasProgramDateTime?(Object(S.alignMediaPlaylistByPDT)(E,V),K=E.fragments[0].start):K=this.alignPlaylists(E,U.details)}U.details=E,this.levelLastLoaded=N,!this.startFragRequested&&(this.mainDetails||!E.live)&&this.setStartPosition(U.details,K),this.state===B.State.WAITING_TRACK&&!this.waitForCdnTuneIn(E)&&(this.state=B.State.IDLE),this.tick()},m._handleFragmentLoadProgress=function(u){var a,x=u.frag,b=u.part,E=u.payload,N=this.config,U=this.trackId,K=this.levels;if(!K){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+x.sn+" of level "+x.level+" will not be buffered");return}var V=K[U];console.assert(V,"Audio track is defined on fragment load progress");var R=V.details;console.assert(R,"Audio track details are defined on fragment load progress");var M=N.defaultAudioCodec||V.audioCodec||"mp4a.40.2",$=this.transmuxer;$||($=this.transmuxer=new O.default(this.hls,k.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ee=this.initPTS[x.cc],oe=(a=x.initSegment)===null||a===void 0?void 0:a.data;if(ee!==void 0){var fe=!1,ke=b?b.index:-1,Ee=ke!==-1,Te=new _.ChunkMetadata(x.level,x.sn,x.stats.chunkCount,E.byteLength,ke,Ee);$.push(E,oe,M,"",x,b,R.totalduration,fe,Te,ee)}else{o.logger.log("Unknown video PTS for cc "+x.cc+", waiting for video PTS before demuxing audio frag "+x.sn+" of ["+R.startSN+" ,"+R.endSN+"],track "+U);var we=this.waitingData=this.waitingData||{frag:x,part:b,cache:new A.default,complete:!1},Ce=we.cache;Ce.push(new Uint8Array(E)),this.waitingVideoCC=this.videoTrackCC,this.state=B.State.WAITING_INIT_PTS}},m._handleFragmentLoadComplete=function(u){if(this.waitingData){this.waitingData.complete=!0;return}L.prototype._handleFragmentLoadComplete.call(this,u)},m.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},m.onBufferCreated=function(u,a){var x=a.tracks.audio;x&&(this.mediaBuffer=x.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},m.onFragBuffered=function(u,a){var x=a.frag,b=a.part;if(x.type!==k.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(x)){this.warn("Fragment "+x.sn+(b?" p: "+b.index:"")+" of level "+x.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}x.sn!=="initSegment"&&(this.fragPrevious=x,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(x,b)},m.onError=function(u,a){switch(a.details){case d.ErrorDetails.FRAG_LOAD_ERROR:case d.ErrorDetails.FRAG_LOAD_TIMEOUT:case d.ErrorDetails.KEY_LOAD_ERROR:case d.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(k.PlaylistLevelType.AUDIO,a);break;case d.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case d.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==B.State.ERROR&&this.state!==B.State.STOPPED&&(this.state=a.fatal?B.State.ERROR:B.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case d.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===B.State.PARSING||this.state===B.State.PARSED)){var x=!0,b=this.getFwdBufferInfo(this.mediaBuffer,k.PlaylistLevelType.AUDIO);b&&b.len>.5&&(x=!this.reduceMaxBufferLength(b.len)),x&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},m.onBufferFlushed=function(u,a){var x=a.type;x===y.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},m._handleTransmuxComplete=function(u){var a,x="audio",b=this.hls,E=u.remuxResult,N=u.chunkMeta,U=this.getCurrentContext(N);if(!U){this.warn("The loading context changed while buffering fragment "+N.sn+" of level "+N.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(N.level);return}var K=U.frag,V=U.part,R=E.audio,M=E.text,$=E.id3,ee=E.initSegment;if(this.fragContextChanged(K))return;if(this.state=B.State.PARSING,this.audioSwitch&&R&&this.completeAudioSwitch(),ee!=null&&ee.tracks&&(this._bufferInitSegment(ee.tracks,K,N),b.trigger(P.Events.FRAG_PARSING_INIT_SEGMENT,{frag:K,id:x,tracks:ee.tracks})),R){var oe=R.startPTS,fe=R.endPTS,ke=R.startDTS,Ee=R.endDTS;V&&(V.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:oe,endPTS:fe,startDTS:ke,endDTS:Ee}),K.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,oe,fe,ke,Ee),this.bufferFragmentData(R,K,V,N)}if($!=null&&(a=$.samples)!==null&&a!==void 0&&a.length){var Te=l({frag:K,id:x},$);b.trigger(P.Events.FRAG_PARSING_METADATA,Te)}if(M){var we=l({frag:K,id:x},M);b.trigger(P.Events.FRAG_PARSING_USERDATA,we)}},m._bufferInitSegment=function(u,a,x){if(this.state!==B.State.PARSING)return;u.video&&delete u.video;var b=u.audio;if(!b)return;b.levelCodec=b.codec,b.id="audio",this.log("Init audio buffer, container:"+b.container+", codecs[parsed]=["+b.codec+"]"),this.hls.trigger(P.Events.BUFFER_CODECS,u);var E=b.initSegment;if(E!=null&&E.byteLength){var N={type:"audio",frag:a,part:null,chunkMeta:x,parent:a.type,data:E};this.hls.trigger(P.Events.BUFFER_APPENDING,N)}this.tick()},m.loadFragment=function(u,a,x){var b=this.fragmentTracker.getState(u);this.fragCurrent=u,(this.audioSwitch||b===j.FragmentState.NOT_LOADED||b===j.FragmentState.PARTIAL)&&(u.sn==="initSegment"?this._loadInitSegment(u):a.live&&!Object(Z.isFiniteNumber)(this.initPTS[u.cc])?(this.log("Waiting for video PTS in continuity counter "+u.cc+" of live stream before loading audio fragment "+u.sn+" of level "+this.trackId),this.state=B.State.WAITING_INIT_PTS):(this.startFragRequested=!0,L.prototype.loadFragment.call(this,u,a,x)))},m.completeAudioSwitch=function(){var u=this.hls,a=this.media,x=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,u.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:x})},g}(B.default);Q.default=f},"./src/controller/audio-track-controller.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/events.ts"),B=D("./src/errors.ts"),P=D("./src/controller/base-playlist-controller.ts"),G=D("./src/types/loader.ts");function j(O,_){for(var C=0;C<_.length;C++){var S=_[C];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(O,S.key,S)}}function I(O,_,C){return _&&j(O.prototype,_),C&&j(O,C),O}function k(O,_){O.prototype=Object.create(_.prototype),O.prototype.constructor=O,y(O,_)}function y(O,_){return y=Object.setPrototypeOf||function(S,d){return S.__proto__=d,S},y(O,_)}var A=function(O){k(_,O);function _(S){var d;return d=O.call(this,S,"[audio-track-controller]")||this,d.tracks=[],d.groupId=null,d.tracksInGroup=[],d.trackId=-1,d.trackName="",d.selectDefaultTrack=!0,d.registerListeners(),d}var C=_.prototype;return C.registerListeners=function(){var d=this.hls;d.on(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),d.on(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.on(Z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(Z.Events.ERROR,this.onError,this)},C.unregisterListeners=function(){var d=this.hls;d.off(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),d.off(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.off(Z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(Z.Events.ERROR,this.onError,this)},C.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,O.prototype.destroy.call(this)},C.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},C.onManifestParsed=function(d,o){this.tracks=o.audioTracks||[]},C.onAudioTrackLoaded=function(d,o){var l=o.id,h=o.details,w=this.tracksInGroup[l];if(!w){this.warn("Invalid audio track id "+l);return}var p=w.details;w.details=o.details,this.log("audioTrack "+l+" loaded ["+h.startSN+"-"+h.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,o,p))},C.onLevelLoading=function(d,o){this.switchLevel(o.level)},C.onLevelSwitching=function(d,o){this.switchLevel(o.level)},C.switchLevel=function(d){var o=this.hls.levels[d];if(!(o!=null&&o.audioGroupIds))return;var l=o.audioGroupIds[o.urlId];if(this.groupId!==l){this.groupId=l;var h=this.tracks.filter(function(p){return!l||p.groupId===l});this.selectDefaultTrack&&!h.some(function(p){return p.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=h;var w={audioTracks:h};this.log("Updating audio tracks, "+h.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(Z.Events.AUDIO_TRACKS_UPDATED,w),this.selectInitialTrack()}},C.onError=function(d,o){if(O.prototype.onError.call(this,d,o),o.fatal||!o.context)return;o.context.type===G.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},C.setAudioTrack=function(d){var o=this.tracksInGroup;if(d<0||d>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var l=o[this.trackId];this.log("Now switching to audio-track index "+d);var h=o[d],w=h.id,p=h.groupId,f=p===void 0?"":p,L=h.name,g=h.type,m=h.url;if(this.trackId=d,this.trackName=L,this.selectDefaultTrack=!1,this.hls.trigger(Z.Events.AUDIO_TRACK_SWITCHING,{id:w,groupId:f,name:L,type:g,url:m}),h.details&&!h.details.live)return;var c=this.switchParams(h.url,l==null?void 0:l.details);this.loadPlaylist(c)},C.selectInitialTrack=function(){var d=this.tracksInGroup;console.assert(d.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,l=this.findTrackId(o)||this.findTrackId();l!==-1?this.setAudioTrack(l):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},C.findTrackId=function(d){for(var o=this.tracksInGroup,l=0;l<o.length;l++){var h=o[l];if((!this.selectDefaultTrack||h.default)&&(!d||d===h.name))return h.id}return-1},C.loadPlaylist=function(d){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var l=o.id,h=o.groupId,w=o.url;if(d)try{w=d.addDirectives(w)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger(Z.Events.AUDIO_TRACK_LOADING,{url:w,id:l,groupId:h,deliveryDirectives:d||null})}},I(_,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(d){this.selectDefaultTrack=!1,this.setAudioTrack(d)}}]),_}(P.default);Q.default=A},"./src/controller/base-playlist-controller.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return I});var Z=D("./src/polyfills/number.ts"),B=D("./src/types/level.ts"),P=D("./src/controller/level-helper.ts"),G=D("./src/utils/logger.ts"),j=D("./src/errors.ts"),I=function(){function k(A,O){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=G.logger.log.bind(G.logger,O+":"),this.warn=G.logger.warn.bind(G.logger,O+":"),this.hls=A}var y=k.prototype;return y.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},y.onError=function(O,_){_.fatal&&_.type===j.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},y.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},y.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},y.stopLoad=function(){this.canLoad=!1,this.clearTimer()},y.switchParams=function(O,_){var C=_==null?void 0:_.renditionReports;if(C)for(var S=0;S<C.length;S++){var d=C[S],o=""+d.URI;if(o===O.substr(-o.length)){var l=parseInt(d["LAST-MSN"]),h=parseInt(d["LAST-PART"]);if(_&&this.hls.config.lowLatencyMode){var w=Math.min(_.age-_.partTarget,_.targetduration);h!==void 0&&w>_.partTarget&&(h+=1)}if(Object(Z.isFiniteNumber)(l))return new B.HlsUrlParameters(l,Object(Z.isFiniteNumber)(h)?h:void 0,B.HlsSkip.No)}}},y.loadPlaylist=function(O){},y.shouldLoadTrack=function(O){return this.canLoad&&O&&!!O.url&&(!O.details||O.details.live)},y.playlistLoaded=function(O,_,C){var S=this,d=_.details,o=_.stats,l=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(d.advancedDateTime=Date.now()-l,d.live||C!=null&&C.live){if(d.reloaded(C),C&&this.log("live playlist "+O+" "+(d.advanced?"REFRESHED "+d.lastPartSn+"-"+d.lastPartIndex:"MISSED")),C&&d.fragments.length>0&&Object(P.mergeDetails)(C,d),!this.canLoad||!d.live)return;var h,w=void 0,p=void 0;if(d.canBlockReload&&d.endSN&&d.advanced){var f=this.hls.config.lowLatencyMode,L=d.lastPartSn,g=d.endSN,m=d.lastPartIndex,c=m!==-1,u=L===g,a=f?0:m;c?(w=u?g+1:L,p=u?a:m+1):w=g+1;var x=d.age,b=x+d.ageHeader,E=Math.min(b-d.partTarget,d.targetduration*1.5);if(E>0){if(C&&E>C.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+C.tuneInGoal+" to: "+E+" with playlist age: "+d.age),E=0;else{var N=Math.floor(E/d.targetduration);if(w+=N,p!==void 0){var U=Math.round(E%d.targetduration/d.partTarget);p+=U}this.log("CDN Tune-in age: "+d.ageHeader+"s last advanced "+x.toFixed(2)+"s goal: "+E+" skip sn "+N+" to part "+p)}d.tuneInGoal=E}if(h=this.getDeliveryDirectives(d,_.deliveryDirectives,w,p),f||!u){this.loadPlaylist(h);return}}else h=this.getDeliveryDirectives(d,_.deliveryDirectives,w,p);var K=Object(P.computeReloadInterval)(d,o);w!==void 0&&d.canBlockReload&&(K-=d.partTarget||1),this.log("reload live playlist "+O+" in "+Math.round(K)+" ms"),this.timer=self.setTimeout(function(){return S.loadPlaylist(h)},K)}else this.clearTimer()},y.getDeliveryDirectives=function(O,_,C,S){var d=Object(B.getSkipValue)(O,C);return _!=null&&_.skip&&O.deltaUpdateFailed&&(C=_.msn,S=_.part,d=B.HlsSkip.No),new B.HlsUrlParameters(C,S,d)},y.retryLoadingOrFail=function(O){var _=this,C=this.hls.config,S=this.retryCount<C.levelLoadingMaxRetry;if(S){var d;if(this.retryCount++,O.details.indexOf("LoadTimeOut")>-1&&(d=O.context)!==null&&d!==void 0&&d.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+O.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*C.levelLoadingRetryDelay,C.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return _.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+O.details+'"')}}else this.warn('cannot recover from error "'+O.details+'"'),this.clearTimer(),O.fatal=!0;return S},k}()},"./src/controller/base-stream-controller.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"State",function(){return g}),D.d(Q,"default",function(){return m});var Z=D("./src/polyfills/number.ts"),B=D("./src/task-loop.ts"),P=D("./src/controller/fragment-tracker.ts"),G=D("./src/utils/buffer-helper.ts"),j=D("./src/utils/logger.ts"),I=D("./src/events.ts"),k=D("./src/errors.ts"),y=D("./src/types/transmuxer.ts"),A=D("./src/utils/mp4-tools.ts"),O=D("./src/utils/discontinuities.ts"),_=D("./src/controller/fragment-finders.ts"),C=D("./src/controller/level-helper.ts"),S=D("./src/loader/fragment-loader.ts"),d=D("./src/crypt/decrypter.ts"),o=D("./src/utils/time-ranges.ts"),l=D("./src/types/loader.ts");function h(c,u){for(var a=0;a<u.length;a++){var x=u[a];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(c,x.key,x)}}function w(c,u,a){return u&&h(c.prototype,u),a&&h(c,a),c}function p(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function f(c,u){c.prototype=Object.create(u.prototype),c.prototype.constructor=c,L(c,u)}function L(c,u){return L=Object.setPrototypeOf||function(x,b){return x.__proto__=b,x},L(c,u)}var g={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"},m=function(c){f(u,c);function u(x,b,E){var N;return N=c.call(this)||this,N.hls=void 0,N.fragPrevious=null,N.fragCurrent=null,N.fragmentTracker=void 0,N.transmuxer=null,N._state=g.STOPPED,N.media=void 0,N.mediaBuffer=void 0,N.config=void 0,N.bitrateTest=!1,N.lastCurrentTime=0,N.nextLoadPosition=0,N.startPosition=0,N.loadedmetadata=!1,N.fragLoadError=0,N.retryDate=0,N.levels=null,N.fragmentLoader=void 0,N.levelLastLoaded=null,N.startFragRequested=!1,N.decrypter=void 0,N.initPTS=[],N.onvseeking=null,N.onvended=null,N.logPrefix="",N.log=void 0,N.warn=void 0,N.logPrefix=E,N.log=j.logger.log.bind(j.logger,E+":"),N.warn=j.logger.warn.bind(j.logger,E+":"),N.hls=x,N.fragmentLoader=new S.default(x.config),N.fragmentTracker=b,N.config=x.config,N.decrypter=new d.default(x,x.config),x.on(I.Events.KEY_LOADED,N.onKeyLoaded,p(N)),N}var a=u.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(b){},a.stopLoad=function(){this.fragmentLoader.abort();var b=this.fragCurrent;b&&this.fragmentTracker.removeFragment(b),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=g.STOPPED},a._streamEnded=function(b,E){var N=this.fragCurrent,U=this.fragmentTracker;if(!E.live&&N&&N.sn===E.endSN&&!b.nextStart){var K=U.getState(N);return K===P.FragmentState.PARTIAL||K===P.FragmentState.OK}return!1},a.onMediaAttached=function(b,E){var N=this.media=this.mediaBuffer=E.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),N.addEventListener("seeking",this.onvseeking),N.addEventListener("ended",this.onvended);var U=this.config;this.levels&&U.autoStartLoad&&this.state===g.STOPPED&&this.startLoad(U.startPosition)},a.onMediaDetaching=function(){var b=this.media;b!=null&&b.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),b&&(b.removeEventListener("seeking",this.onvseeking),b.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var b=this.config,E=this.fragCurrent,N=this.media,U=this.mediaBuffer,K=this.state,V=N?N.currentTime:0,R=G.BufferHelper.bufferInfo(U||N,V,b.maxBufferHole);if(this.log("media seeking to "+(Object(Z.isFiniteNumber)(V)?V.toFixed(3):V)+", state: "+K),K===g.ENDED)this.resetLoadingState();else if(E&&!R.len){var M=b.maxFragLookUpTolerance,$=E.start-M,ee=E.start+E.duration+M,oe=V>ee;(V<$||oe)&&(oe&&E.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),E.loader.abort()),this.resetLoadingState())}N&&(this.lastCurrentTime=V),!this.loadedmetadata&&!R.len&&(this.nextLoadPosition=this.startPosition=V),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(b,E){if(this.state!==g.KEY_LOADING||E.frag!==this.fragCurrent||!this.levels)return;this.state=g.IDLE;var N=this.levels[E.frag.level].details;N&&this.loadFragment(E.frag,N,E.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=g.STOPPED,this.hls.off(I.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,c.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(b,E){this.log("Loading key for "+b.sn+" of ["+E.startSN+"-"+E.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+b.level),this.state=g.KEY_LOADING,this.fragCurrent=b,this.hls.trigger(I.Events.KEY_LOADING,{frag:b})},a.loadFragment=function(b,E,N){this._loadFragForPlayback(b,E,N)},a._loadFragForPlayback=function(b,E,N){var U=this,K=function(R){if(U.fragContextChanged(b)){U.warn("Fragment "+b.sn+(R.part?" p: "+R.part.index:"")+" of level "+b.level+" was dropped during download."),U.fragmentTracker.removeFragment(b);return}b.stats.chunkCount++,U._handleFragmentLoadProgress(R)};this._doFragLoad(b,E,N,K).then(function(V){if(!V)return;U.fragLoadError=0;var R=U.state;if(U.fragContextChanged(b)){(R===g.FRAG_LOADING||R===g.BACKTRACKING||!U.fragCurrent&&R===g.PARSING)&&(U.fragmentTracker.removeFragment(b),U.state=g.IDLE);return}if("payload"in V&&(U.log("Loaded fragment "+b.sn+" of level "+b.level),U.hls.trigger(I.Events.FRAG_LOADED,V),U.state===g.BACKTRACKING)){U.fragmentTracker.backtrack(b,V),U.resetFragmentLoading(b);return}U._handleFragmentLoadComplete(V)}).catch(function(V){U.warn(V),U.resetFragmentLoading(b)})},a.flushMainBuffer=function(b,E,N){if(N===void 0&&(N=null),!(b-E))return;var U={startOffset:b,endOffset:E,type:N};this.fragLoadError=0,this.hls.trigger(I.Events.BUFFER_FLUSHING,U)},a._loadInitSegment=function(b){var E=this;this._doFragLoad(b).then(function(N){if(!N||E.fragContextChanged(b)||!E.levels)throw new Error("init load aborted");return N}).then(function(N){var U=E.hls,K=N.payload,V=b.decryptdata;if(K&&K.byteLength>0&&V&&V.key&&V.iv&&V.method==="AES-128"){var R=self.performance.now();return E.decrypter.webCryptoDecrypt(new Uint8Array(K),V.key.buffer,V.iv.buffer).then(function(M){var $=self.performance.now();return U.trigger(I.Events.FRAG_DECRYPTED,{frag:b,payload:M,stats:{tstart:R,tdecrypt:$}}),N.payload=M,N})}return N}).then(function(N){var U=E.fragCurrent,K=E.hls,V=E.levels;if(!V)throw new Error("init load aborted, missing levels");var R=V[b.level].details;console.assert(R,"Level details are defined when init segment is loaded");var M=b.stats;E.state=g.IDLE,E.fragLoadError=0,b.data=new Uint8Array(N.payload),M.parsing.start=M.buffering.start=self.performance.now(),M.parsing.end=M.buffering.end=self.performance.now(),N.frag===U&&K.trigger(I.Events.FRAG_BUFFERED,{stats:M,frag:U,part:null,id:b.type}),E.tick()}).catch(function(N){E.warn(N),E.resetFragmentLoading(b)})},a.fragContextChanged=function(b){var E=this.fragCurrent;return!b||!E||b.level!==E.level||b.sn!==E.sn||b.urlId!==E.urlId},a.fragBufferedComplete=function(b,E){var N=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+b.type+" sn: "+b.sn+(E?" part: "+E.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+b.level+" "+o.default.toString(G.BufferHelper.getBuffered(N))),this.state=g.IDLE,this.tick()},a._handleFragmentLoadComplete=function(b){var E=this.transmuxer;if(!E)return;var N=b.frag,U=b.part,K=b.partsLoaded,V=!K||K.length===0||K.some(function(M){return!M}),R=new y.ChunkMetadata(N.level,N.sn,N.stats.chunkCount+1,0,U?U.index:-1,!V);E.flush(R)},a._handleFragmentLoadProgress=function(b){},a._doFragLoad=function(b,E,N,U){var K=this;if(N===void 0&&(N=null),!this.levels)throw new Error("frag load aborted, missing levels");if(N=Math.max(b.start,N||0),this.config.lowLatencyMode&&E){var V=E.partList;if(V&&U){N>b.end&&E.fragmentHint&&(b=E.fragmentHint);var R=this.getNextPart(V,b,N);if(R>-1){var M=V[R];return this.log("Loading part sn: "+b.sn+" p: "+M.index+" cc: "+b.cc+" of playlist ["+E.startSN+"-"+E.endSN+"] parts [0-"+R+"-"+(V.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+b.level+", target: "+parseFloat(N.toFixed(3))),this.nextLoadPosition=M.start+M.duration,this.state=g.FRAG_LOADING,this.hls.trigger(I.Events.FRAG_LOADING,{frag:b,part:V[R],targetBufferTime:N}),this.doFragPartsLoad(b,V,R,U).catch(function($){return K.handleFragLoadError($)})}else if(!b.url||this.loadedEndOfParts(V,N))return Promise.resolve(null)}}return this.log("Loading fragment "+b.sn+" cc: "+b.cc+" "+(E?"of ["+E.startSN+"-"+E.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+b.level+", target: "+parseFloat(N.toFixed(3))),Object(Z.isFiniteNumber)(b.sn)&&!this.bitrateTest&&(this.nextLoadPosition=b.start+b.duration),this.state=g.FRAG_LOADING,this.hls.trigger(I.Events.FRAG_LOADING,{frag:b,targetBufferTime:N}),this.fragmentLoader.load(b,U).catch(function($){return K.handleFragLoadError($)})},a.doFragPartsLoad=function(b,E,N,U){var K=this;return new Promise(function(V,R){var M=[],$=function ee(oe){var fe=E[oe];K.fragmentLoader.loadPart(b,fe,U).then(function(ke){M[fe.index]=ke;var Ee=ke.part;K.hls.trigger(I.Events.FRAG_LOADED,ke);var Te=E[oe+1];if(Te&&Te.fragment===b)ee(oe+1);else return V({frag:b,part:Ee,partsLoaded:M})}).catch(R)};$(N)})},a.handleFragLoadError=function(b){var E=b.data;return E&&E.details===k.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(E.frag,E.part):this.hls.trigger(I.Events.ERROR,E),null},a._handleTransmuxerFlush=function(b){var E=this.getCurrentContext(b);if(!E||this.state!==g.PARSING){this.fragCurrent||(this.state=g.IDLE);return}var N=E.frag,U=E.part,K=E.level,V=self.performance.now();N.stats.parsing.end=V,U&&(U.stats.parsing.end=V),this.updateLevelTiming(N,U,K,b.partial)},a.getCurrentContext=function(b){var E=this.levels,N=b.level,U=b.sn,K=b.part;if(!E||!E[N])return this.warn("Levels object was unset while buffering fragment "+U+" of level "+N+". The current chunk will not be buffered."),null;var V=E[N],R=K>-1?Object(C.getPartWith)(V,U,K):null,M=R?R.fragment:Object(C.getFragmentWithSN)(V,U,this.fragCurrent);return M?{frag:M,part:R,level:V}:null},a.bufferFragmentData=function(b,E,N,U){if(!b||this.state!==g.PARSING)return;var K=b.data1,V=b.data2,R=K;if(K&&V&&(R=Object(A.appendUint8Array)(K,V)),!R||!R.length)return;var M={type:b.type,frag:E,part:N,chunkMeta:U,parent:E.type,data:R};this.hls.trigger(I.Events.BUFFER_APPENDING,M),b.dropped&&b.independent&&!N&&this.flushBufferGap(E)},a.flushBufferGap=function(b){var E=this.media;if(!E)return;if(!G.BufferHelper.isBuffered(E,E.currentTime)){this.flushMainBuffer(0,b.start);return}var N=E.currentTime,U=G.BufferHelper.bufferInfo(E,N,0),K=b.duration,V=Math.min(this.config.maxFragLookUpTolerance*2,K*.25),R=Math.max(Math.min(b.start-V,U.end-V),N+V);b.start-R>V&&this.flushMainBuffer(R,b.start)},a.getFwdBufferInfo=function(b,E){var N=this.config,U=this.getLoadPosition();if(!Object(Z.isFiniteNumber)(U))return null;var K=G.BufferHelper.bufferInfo(b,U,N.maxBufferHole);if(K.len===0&&K.nextStart!==void 0){var V=this.fragmentTracker.getBufferedFrag(U,E);if(V&&K.nextStart<V.end)return G.BufferHelper.bufferInfo(b,U,Math.max(K.nextStart,N.maxBufferHole))}return K},a.getMaxBufferLength=function(b){var E=this.config,N;return b?N=Math.max(8*E.maxBufferSize/b,E.maxBufferLength):N=E.maxBufferLength,Math.min(N,E.maxMaxBufferLength)},a.reduceMaxBufferLength=function(b){var E=this.config,N=b||E.maxBufferLength;return E.maxMaxBufferLength>=N?(E.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+E.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(b,E){var N,U,K=E.fragments,V=K.length;if(!V)return null;var R=this.config,M=K[0].start,$;if(E.live){var ee=R.initialLiveManifestSize;if(V<ee)return this.warn("Not enough fragments to start playback (have: "+V+", need: "+ee+")"),null;!E.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&($=this.getInitialLiveFragment(E,K),this.startPosition=$?this.hls.liveSyncPosition||$.start:b)}else b<=M&&($=K[0]);if(!$){var oe=R.lowLatencyMode?E.partEnd:E.fragmentEnd;$=this.getFragmentAtPosition(b,oe,E)}return(N=$)!==null&&N!==void 0&&N.initSegment&&!((U=$)!==null&&U!==void 0&&U.initSegment.data)&&!this.bitrateTest&&($=$.initSegment),$},a.getNextPart=function(b,E,N){for(var U=-1,K=!1,V=!0,R=0,M=b.length;R<M;R++){var $=b[R];if(V=V&&!$.independent,U>-1&&N<$.start)break;var ee=$.loaded;!ee&&(K||$.independent||V)&&$.fragment===E&&(U=R),K=ee}return U},a.loadedEndOfParts=function(b,E){var N=b[b.length-1];return N&&E>N.start&&N.loaded},a.getInitialLiveFragment=function(b,E){var N=this.fragPrevious,U=null;if(N){if(b.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+N.programDateTime),U=Object(_.findFragmentByPDT)(E,N.endProgramDateTime,this.config.maxFragLookUpTolerance)),!U){var K=N.sn+1;if(K>=b.startSN&&K<=b.endSN){var V=E[K-b.startSN];N.cc===V.cc&&(U=V,this.log("Live playlist, switching playlist, load frag with next SN: "+U.sn))}U||(U=Object(_.findFragWithCC)(E,N.cc),U&&this.log("Live playlist, switching playlist, load frag with same CC: "+U.sn))}}else{var R=this.hls.liveSyncPosition;R!==null&&(U=this.getFragmentAtPosition(R,this.bitrateTest?b.fragmentEnd:b.edge,b))}return U},a.getFragmentAtPosition=function(b,E,N){var U=this.config,K=this.fragPrevious,V=N.fragments,R=N.endSN,M=N.fragmentHint,$=U.maxFragLookUpTolerance,ee=!!(U.lowLatencyMode&&N.partList&&M);ee&&M&&!this.bitrateTest&&(V=V.concat(M),R=M.sn);var oe;if(b<E){var fe=b>E-$?0:$;oe=Object(_.findFragmentByPTS)(K,V,b,fe)}else oe=V[V.length-1];if(oe){var ke=oe.sn-N.startSN,Ee=K&&oe.level===K.level,Te=V[ke+1],we=this.fragmentTracker.getState(oe);if(we===P.FragmentState.BACKTRACKED){oe=null;for(var Ce=ke;V[Ce]&&this.fragmentTracker.getState(V[Ce])===P.FragmentState.BACKTRACKED;)K?oe=V[Ce--]:oe=V[--Ce];oe||(oe=Te)}else K&&oe.sn===K.sn&&!ee&&(Ee&&(oe.sn<R&&this.fragmentTracker.getState(Te)!==P.FragmentState.OK?(this.log("SN "+oe.sn+" just loaded, load next one: "+Te.sn),oe=Te):oe=null))}return oe},a.synchronizeToLiveEdge=function(b){var E=this.config,N=this.media;if(!N)return;var U=this.hls.liveSyncPosition,K=N.currentTime,V=b.fragments[0].start,R=b.edge,M=K>=V-E.maxFragLookUpTolerance&&K<=R;if(U!==null&&N.duration>U&&(K<U||!M)){var $=E.liveMaxLatencyDuration!==void 0?E.liveMaxLatencyDuration:E.liveMaxLatencyDurationCount*b.targetduration;(!M&&N.readyState<4||K<R-$)&&(this.loadedmetadata||(this.nextLoadPosition=U),N.readyState&&(this.warn("Playback: "+K.toFixed(3)+" is located too far from the end of live sliding playlist: "+R+", reset currentTime to : "+U.toFixed(3)),N.currentTime=U))}},a.alignPlaylists=function(b,E){var N=this.levels,U=this.levelLastLoaded,K=this.fragPrevious,V=U!==null?N[U]:null,R=b.fragments.length;if(!R)return this.warn("No fragments in live playlist"),0;var M=b.fragments[0].start,$=!E,ee=b.alignedSliding&&Object(Z.isFiniteNumber)(M);if($||!ee&&!M){Object(O.alignStream)(K,V,b);var oe=b.fragments[0].start;return this.log("Live playlist sliding: "+oe.toFixed(2)+" start-sn: "+(E?E.startSN:"na")+"->"+b.startSN+" prev-sn: "+(K?K.sn:"na")+" fragments: "+R),oe}return M},a.waitForCdnTuneIn=function(b){var E=3;return b.live&&b.canBlockReload&&b.tuneInGoal>Math.max(b.partHoldBack,b.partTarget*E)},a.setStartPosition=function(b,E){var N=this.startPosition;if(N<E&&(N=-1),N===-1||this.lastCurrentTime===-1){var U=b.startTimeOffset;Object(Z.isFiniteNumber)(U)?(N=E+U,U<0&&(N+=b.totalduration),N=Math.min(Math.max(E,N),E+b.totalduration),this.log("Start time offset "+U+" found in playlist, adjust startPosition to "+N),this.startPosition=N):b.live?N=this.hls.liveSyncPosition||E:this.startPosition=N=0,this.lastCurrentTime=N}this.nextLoadPosition=N},a.getLoadPosition=function(){var b=this.media,E=0;return this.loadedmetadata&&b?E=b.currentTime:this.nextLoadPosition&&(E=this.nextLoadPosition),E},a.handleFragLoadAborted=function(b,E){this.transmuxer&&b.sn!=="initSegment"&&b.stats.aborted&&(this.warn("Fragment "+b.sn+(E?" part"+E.index:"")+" of level "+b.level+" was aborted"),this.resetFragmentLoading(b))},a.resetFragmentLoading=function(b){(!this.fragCurrent||!this.fragContextChanged(b))&&(this.state=g.IDLE)},a.onFragmentOrKeyLoadError=function(b,E){if(E.fatal)return;var N=E.frag;if(!N||N.type!==b)return;var U=this.fragCurrent;console.assert(U&&N.sn===U.sn&&N.level===U.level&&N.urlId===U.urlId,"Frag load error must match current frag to retry");var K=this.config;if(this.fragLoadError+1<=K.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(N.level))return;var V=Math.min(Math.pow(2,this.fragLoadError)*K.fragLoadingRetryDelay,K.fragLoadingMaxRetryTimeout);this.warn("Fragment "+N.sn+" of "+b+" "+N.level+" failed to load, retrying in "+V+"ms"),this.retryDate=self.performance.now()+V,this.fragLoadError++,this.state=g.FRAG_LOADING_WAITING_RETRY}else E.levelRetry?(b===l.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=g.IDLE):(j.logger.error(E.details+" reaches max retry, redispatch as fatal ..."),E.fatal=!0,this.hls.stopLoad(),this.state=g.ERROR)},a.afterBufferFlushed=function(b,E,N){if(!b)return;var U=G.BufferHelper.getBuffered(b);this.fragmentTracker.detectEvictedFragments(E,U,N),this.state===g.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=g.IDLE},a.resetLiveStartWhenNotLoaded=function(b){if(!this.loadedmetadata){this.startFragRequested=!1;var E=this.levels?this.levels[b].details:null;if(E!=null&&E.live)return this.startPosition=-1,this.setStartPosition(E,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(b,E,N,U){var K=this,V=N.details;console.assert(!!V,"level.details must be defined");var R=Object.keys(b.elementaryStreams).reduce(function(M,$){var ee=b.elementaryStreams[$];if(ee){var oe=ee.endPTS-ee.startPTS;if(oe<=0)return K.warn("Could not parse fragment "+b.sn+" "+$+" duration reliably ("+oe+") resetting transmuxer to fallback to playlist timing"),K.resetTransmuxer(),M||!1;var fe=U?0:Object(C.updateFragPTSDTS)(V,b,ee.startPTS,ee.endPTS,ee.startDTS,ee.endDTS);return K.hls.trigger(I.Events.LEVEL_PTS_UPDATED,{details:V,level:N,drift:fe,type:$,frag:b,start:ee.startPTS,end:ee.endPTS}),!0}return M},!1);R?(this.state=g.PARSED,this.hls.trigger(I.Events.FRAG_PARSED,{frag:b,part:E})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},w(u,[{key:"state",get:function(){return this._state},set:function(b){var E=this._state;E!==b&&(this._state=b,this.log(E+"->"+b))}}]),u}(B.default)},"./src/controller/buffer-controller.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return _});var Z=D("./src/polyfills/number.ts"),B=D("./src/events.ts"),P=D("./src/utils/logger.ts"),G=D("./src/errors.ts"),j=D("./src/utils/buffer-helper.ts"),I=D("./src/utils/mediasource-helper.ts"),k=D("./src/loader/fragment.ts"),y=D("./src/controller/buffer-operation-queue.ts"),A=Object(I.getMediaSource)(),O=/([ha]vc.)(?:\.[^.,]+)+/,_=function(){function C(d){var o=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 l=o.hls,h=o.media,w=o.mediaSource;P.logger.log("[buffer-controller]: Media source opened"),h&&(o.updateMediaElementDuration(),l.trigger(B.Events.MEDIA_ATTACHED,{media:h})),w&&w.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){P.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){P.logger.log("[buffer-controller]: Media source ended")},this.hls=d,this._initSourceBuffer(),this.registerListeners()}var S=C.prototype;return S.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},S.destroy=function(){this.unregisterListeners(),this.details=null},S.registerListeners=function(){var o=this.hls;o.on(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(B.Events.BUFFER_RESET,this.onBufferReset,this),o.on(B.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(B.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(B.Events.BUFFER_EOS,this.onBufferEos,this),o.on(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(B.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(B.Events.FRAG_PARSED,this.onFragParsed,this),o.on(B.Events.FRAG_CHANGED,this.onFragChanged,this)},S.unregisterListeners=function(){var o=this.hls;o.off(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(B.Events.BUFFER_RESET,this.onBufferReset,this),o.off(B.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(B.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(B.Events.BUFFER_EOS,this.onBufferEos,this),o.off(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(B.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(B.Events.FRAG_PARSED,this.onFragParsed,this),o.off(B.Events.FRAG_CHANGED,this.onFragChanged,this)},S._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new y.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},S.onManifestParsed=function(o,l){var h=2;(l.audio&&!l.video||!l.altAudio)&&(h=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=h,this.details=null,P.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},S.onMediaAttaching=function(o,l){var h=this.media=l.media;if(h&&A){var w=this.mediaSource=new A;w.addEventListener("sourceopen",this._onMediaSourceOpen),w.addEventListener("sourceended",this._onMediaSourceEnded),w.addEventListener("sourceclose",this._onMediaSourceClose),h.src=self.URL.createObjectURL(w),this._objectUrl=h.src}},S.onMediaDetaching=function(){var o=this.media,l=this.mediaSource,h=this._objectUrl;if(l){if(P.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(w){P.logger.warn("[buffer-controller]: onMediaDetaching: "+w.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(h&&self.URL.revokeObjectURL(h),o.src===h?(o.removeAttribute("src"),o.load()):P.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(B.Events.MEDIA_DETACHED,void 0)},S.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(l){var h=o.sourceBuffer[l];try{h&&(o.removeBufferListeners(l),o.mediaSource&&o.mediaSource.removeSourceBuffer(h),o.sourceBuffer[l]=void 0)}catch(w){P.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",w)}}),this._initSourceBuffer()},S.onBufferCodecs=function(o,l){var h=this,w=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(p){if(w){var f=h.tracks[p];if(f&&typeof f.buffer.changeType=="function"){var L=l[p],g=L.codec,m=L.levelCodec,c=L.container,u=(f.levelCodec||f.codec).replace(O,"$1"),a=(m||g).replace(O,"$1");if(u!==a){var x=c+";codecs="+(m||g);h.appendChangeType(p,x)}}}else h.pendingTracks[p]=l[p]}),w)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},S.appendChangeType=function(o,l){var h=this,w=this.operationQueue,p={execute:function(){var L=h.sourceBuffer[o];L&&(P.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+l),L.changeType(l)),w.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(L){P.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",L)}};w.append(p,o)},S.onBufferAppending=function(o,l){var h=this,w=this.hls,p=this.operationQueue,f=this.tracks,L=l.data,g=l.type,m=l.frag,c=l.part,u=l.chunkMeta,a=u.buffering[g],x=self.performance.now();a.start=x;var b=m.stats.buffering,E=c?c.stats.buffering:null;b.start===0&&(b.start=x),E&&E.start===0&&(E.start=x);var N=f.audio,U=g==="audio"&&u.id===1&&(N==null?void 0:N.container)==="audio/mpeg",K={execute:function(){if(a.executeStart=self.performance.now(),U){var R=h.sourceBuffer[g];if(R){var M=m.start-R.timestampOffset;Math.abs(M)>=.1&&(P.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+m.start+" (delta: "+M+") sn: "+m.sn+")"),R.timestampOffset=m.start)}}h.appendExecutor(L,g)},onStart:function(){},onComplete:function(){var R=self.performance.now();a.executeEnd=a.end=R,b.first===0&&(b.first=R),E&&E.first===0&&(E.first=R);var M=h.sourceBuffer,$={};for(var ee in M)$[ee]=j.BufferHelper.getBuffered(M[ee]);h.appendError=0,h.hls.trigger(B.Events.BUFFER_APPENDED,{type:g,frag:m,part:c,chunkMeta:u,parent:m.type,timeRanges:$})},onError:function(R){P.logger.error("[buffer-controller]: Error encountered while trying to append to the "+g+" SourceBuffer",R);var M={type:G.ErrorTypes.MEDIA_ERROR,parent:m.type,details:G.ErrorDetails.BUFFER_APPEND_ERROR,err:R,fatal:!1};R.code===DOMException.QUOTA_EXCEEDED_ERR?M.details=G.ErrorDetails.BUFFER_FULL_ERROR:(h.appendError++,M.details=G.ErrorDetails.BUFFER_APPEND_ERROR,h.appendError>w.config.appendErrorMaxRetry&&(P.logger.error("[buffer-controller]: Failed "+w.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),M.fatal=!0)),w.trigger(B.Events.ERROR,M)}};p.append(K,g)},S.onBufferFlushing=function(o,l){var h=this,w=this.operationQueue,p=function(L){return{execute:h.removeExecutor.bind(h,L,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){h.hls.trigger(B.Events.BUFFER_FLUSHED,{type:L})},onError:function(m){P.logger.warn("[buffer-controller]: Failed to remove from "+L+" SourceBuffer",m)}}};l.type?w.append(p(l.type),l.type):this.getSourceBufferTypes().forEach(function(f){w.append(p(f),f)})},S.onFragParsed=function(o,l){var h=this,w=l.frag,p=l.part,f=[],L=p?p.elementaryStreams:w.elementaryStreams;L[k.ElementaryStreamTypes.AUDIOVIDEO]?f.push("audiovideo"):(L[k.ElementaryStreamTypes.AUDIO]&&f.push("audio"),L[k.ElementaryStreamTypes.VIDEO]&&f.push("video"));var g=function(){var c=self.performance.now();w.stats.buffering.end=c,p&&(p.stats.buffering.end=c);var u=p?p.stats:w.stats;h.hls.trigger(B.Events.FRAG_BUFFERED,{frag:w,part:p,stats:u,id:w.type})};f.length===0&&P.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+w.type+" level: "+w.level+" sn: "+w.sn),this.blockBuffers(g,f)},S.onFragChanged=function(o,l){this.flushBackBuffer()},S.onBufferEos=function(o,l){var h=this,w=this.getSourceBufferTypes().reduce(function(p,f){var L=h.sourceBuffer[f];return(!l.type||l.type===f)&&(L&&!L.ended&&(L.ended=!0,P.logger.log("[buffer-controller]: "+f+" sourceBuffer now EOS"))),p&&!!(!L||L.ended)},!0);w&&this.blockBuffers(function(){var p=h.mediaSource;if(!p||p.readyState!=="open")return;p.endOfStream()})},S.onLevelUpdated=function(o,l){var h=l.details;if(!h.fragments.length)return;this.details=h,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},S.flushBackBuffer=function(){var o=this.hls,l=this.details,h=this.media,w=this.sourceBuffer;if(!h||l===null)return;var p=this.getSourceBufferTypes();if(!p.length)return;var f=l.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(Z.isFiniteNumber)(f)||f<0)return;var L=h.currentTime,g=l.levelTargetDuration,m=Math.max(f,g),c=Math.floor(L/g)*g-m;p.forEach(function(u){var a=w[u];if(a){var x=j.BufferHelper.getBuffered(a);x.length>0&&c>x.start(0)&&(o.trigger(B.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),l.live&&o.trigger(B.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),o.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:u}))}})},S.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,l=this.hls,h=this.media,w=this.mediaSource,p=o.fragments[0].start+o.totalduration,f=h.duration,L=Object(Z.isFiniteNumber)(w.duration)?w.duration:0;o.live&&l.config.liveDurationInfinity?(P.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),w.duration=Infinity,this.updateSeekableRange(o)):(p>L&&p>f||!Object(Z.isFiniteNumber)(f))&&(P.logger.log("[buffer-controller]: Updating Media Source duration to "+p.toFixed(3)),w.duration=p)},S.updateSeekableRange=function(o){var l=this.mediaSource,h=o.fragments,w=h.length;if(w&&o.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var p=Math.max(0,h[0].start),f=Math.max(p,p+o.totalduration);l.setLiveSeekableRange(p,f)}},S.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,l=this.operationQueue,h=this.pendingTracks,w=Object.keys(h).length;if(w&&!o||w===2){this.createSourceBuffers(h),this.pendingTracks={};var p=this.getSourceBufferTypes();if(p.length===0){this.hls.trigger(B.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}p.forEach(function(f){l.executeNext(f)})}},S.createSourceBuffers=function(o){var l=this.sourceBuffer,h=this.mediaSource;if(!h)throw Error("createSourceBuffers called when mediaSource was null");var w=0;for(var p in o)if(!l[p]){var f=o[p];if(!f)throw Error("source buffer exists for track "+p+", however track does not");var L=f.levelCodec||f.codec,g=f.container+";codecs="+L;P.logger.log("[buffer-controller]: creating sourceBuffer("+g+")");try{var m=l[p]=h.addSourceBuffer(g),c=p;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[p]={buffer:m,codec:L,container:f.container,levelCodec:f.levelCodec,id:f.id},w++}catch(u){P.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+u.message),this.hls.trigger(B.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:u,mimeType:g})}}w&&this.hls.trigger(B.Events.BUFFER_CREATED,{tracks:this.tracks})},S._onSBUpdateStart=function(o){var l=this.operationQueue,h=l.current(o);h.onStart()},S._onSBUpdateEnd=function(o){var l=this.operationQueue,h=l.current(o);h.onComplete(),l.shiftAndExecuteNext(o)},S._onSBUpdateError=function(o,l){P.logger.error("[buffer-controller]: "+o+" SourceBuffer error",l),this.hls.trigger(B.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var h=this.operationQueue.current(o);h&&h.onError(l)},S.removeExecutor=function(o,l,h){var w=this.media,p=this.mediaSource,f=this.operationQueue,L=this.sourceBuffer,g=L[o];if(!w||!p||!g){P.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),f.shiftAndExecuteNext(o);return}var m=Object(Z.isFiniteNumber)(w.duration)?w.duration:Infinity,c=Object(Z.isFiniteNumber)(p.duration)?p.duration:Infinity,u=Math.max(0,l),a=Math.min(h,m,c);a>u?(P.logger.log("[buffer-controller]: Removing ["+u+","+a+"] from the "+o+" SourceBuffer"),console.assert(!g.updating,o+" sourceBuffer must not be updating"),g.remove(u,a)):f.shiftAndExecuteNext(o)},S.appendExecutor=function(o,l){var h=this.operationQueue,w=this.sourceBuffer,p=w[l];if(!p){P.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),h.shiftAndExecuteNext(l);return}p.ended=!1,console.assert(!p.updating,l+" sourceBuffer must not be updating"),p.appendBuffer(o)},S.blockBuffers=function(o,l){var h=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){P.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var w=this.operationQueue,p=l.map(function(f){return w.appendBlocker(f)});Promise.all(p).then(function(){o(),l.forEach(function(f){var L=h.sourceBuffer[f];(!L||!L.updating)&&w.shiftAndExecuteNext(f)})})},S.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},S.addBufferListener=function(o,l,h){var w=this.sourceBuffer[o];if(!w)return;var p=h.bind(this,o);this.listeners[o].push({event:l,listener:p}),w.addEventListener(l,p)},S.removeBufferListeners=function(o){var l=this.sourceBuffer[o];if(!l)return;this.listeners[o].forEach(function(h){l.removeEventListener(h.event,h.listener)})},C}()},"./src/controller/buffer-operation-queue.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return B});var Z=D("./src/utils/logger.ts"),B=function(){function P(j){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=j}var G=P.prototype;return G.append=function(I,k){var y=this.queues[k];y.push(I),y.length===1&&this.buffers[k]&&this.executeNext(k)},G.insertAbort=function(I,k){var y=this.queues[k];y.unshift(I),this.executeNext(k)},G.appendBlocker=function(I){var k,y=new Promise(function(O){k=O}),A={execute:k,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(A,I),y},G.executeNext=function(I){var k=this.buffers,y=this.queues,A=k[I],O=y[I];if(O.length){var _=O[0];try{_.execute()}catch(C){Z.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),_.onError(C),(!A||!A.updating)&&(O.shift(),this.executeNext(I))}}},G.shiftAndExecuteNext=function(I){this.queues[I].shift(),this.executeNext(I)},G.current=function(I){return this.queues[I][0]},P}()},"./src/controller/cap-level-controller.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/events.ts");function B(j,I){for(var k=0;k<I.length;k++){var y=I[k];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(j,y.key,y)}}function P(j,I,k){return I&&B(j.prototype,I),k&&B(j,k),j}var G=function(){function j(k){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=k,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var I=j.prototype;return I.setStreamController=function(y){this.streamController=y},I.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},I.registerListeners=function(){var y=this.hls;y.on(Z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.on(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.on(Z.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},I.unregisterListener=function(){var y=this.hls;y.off(Z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.off(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.off(Z.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},I.onFpsDropLevelCapping=function(y,A){j.isLevelAllowed(A.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(A.droppedLevel)},I.onMediaAttaching=function(y,A){this.media=A.media instanceof HTMLVideoElement?A.media:null},I.onManifestParsed=function(y,A){var O=this.hls;this.restrictedLevels=[],this.firstLevel=A.firstLevel,O.config.capLevelToPlayerSize&&A.video&&this.startCapping()},I.onBufferCodecs=function(y,A){var O=this.hls;O.config.capLevelToPlayerSize&&A.video&&this.startCapping()},I.onMediaDetaching=function(){this.stopCapping()},I.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var y=this.hls.levels;if(y.length){var A=this.hls;A.autoLevelCapping=this.getMaxLevel(y.length-1),A.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=A.autoLevelCapping}}},I.getMaxLevel=function(y){var A=this,O=this.hls.levels;if(!O.length)return-1;var _=O.filter(function(C,S){return j.isLevelAllowed(S,A.restrictedLevels)&&S<=y});return this.clientRect=null,j.getMaxLevelByMediaSize(_,this.mediaWidth,this.mediaHeight)},I.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()},I.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},I.getDimensions=function(){if(this.clientRect)return this.clientRect;var y=this.media,A={width:0,height:0};if(y){var O=y.getBoundingClientRect();A.width=O.width,A.height=O.height,!A.width&&!A.height&&(A.width=O.right-O.left||y.width||0,A.height=O.bottom-O.top||y.height||0)}return this.clientRect=A,A},j.isLevelAllowed=function(y,A){return A===void 0&&(A=[]),A.indexOf(y)===-1},j.getMaxLevelByMediaSize=function(y,A,O){if(!y||!y.length)return-1;for(var _=function(l,h){return h?l.width!==h.width||l.height!==h.height:!0},C=y.length-1,S=0;S<y.length;S+=1){var d=y[S];if((d.width>=A||d.height>=O)&&_(d,y[S+1])){C=S;break}}return C},P(j,[{key:"mediaWidth",get:function(){return this.getDimensions().width*j.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*j.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var y=1;try{y=self.devicePixelRatio}catch(A){}return y}}]),j}();Q.default=G},"./src/controller/cmcd-controller.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return _});var Z=D("./src/events.ts"),B=D("./src/types/cmcd.ts"),P=D("./src/utils/buffer-helper.ts"),G=D("./src/utils/logger.ts");function j(C,S){for(var d=0;d<S.length;d++){var o=S[d];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(C,o.key,o)}}function I(C,S,d){return S&&j(C.prototype,S),d&&j(C,d),C}function k(C,S){var d=typeof Symbol!="undefined"&&C[Symbol.iterator]||C["@@iterator"];if(d)return(d=d.call(C)).next.bind(d);if(Array.isArray(C)||(d=y(C))||S&&C&&typeof C.length=="number"){d&&(C=d);var o=0;return function(){return o>=C.length?{done:!0}:{done:!1,value:C[o++]}}}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 y(C,S){if(!C)return;if(typeof C=="string")return A(C,S);var d=Object.prototype.toString.call(C).slice(8,-1);if(d==="Object"&&C.constructor&&(d=C.constructor.name),d==="Map"||d==="Set")return Array.from(C);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return A(C,S)}function A(C,S){(S==null||S>C.length)&&(S=C.length);for(var d=0,o=new Array(S);d<S;d++)o[d]=C[d];return o}function O(){return O=Object.assign||function(C){for(var S=1;S<arguments.length;S++){var d=arguments[S];for(var o in d)Object.prototype.hasOwnProperty.call(d,o)&&(C[o]=d[o])}return C},O.apply(this,arguments)}var _=function(){function C(d){var o=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(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(w){try{o.apply(w,{ot:B.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(p){G.logger.warn("Could not generate manifest CMCD data.",p)}},this.applyFragmentData=function(w){try{var p=w.frag,f=o.hls.levels[p.level],L=o.getObjectType(p),g={d:p.duration*1e3,ot:L};(L===B.CMCDObjectType.VIDEO||L===B.CMCDObjectType.AUDIO||L==B.CMCDObjectType.MUXED)&&(g.br=f.bitrate/1e3,g.tb=o.getTopBandwidth(L),g.bl=o.getBufferLength(L)),o.apply(w,g)}catch(m){G.logger.warn("Could not generate segment CMCD data.",m)}},this.hls=d;var l=this.config=d.config,h=l.cmcd;h!=null&&(l.pLoader=this.createPlaylistLoader(),l.fLoader=this.createFragmentLoader(),this.sid=h.sessionId||C.uuid(),this.cid=h.contentId,this.useHeaders=h.useHeaders===!0,this.registerListeners())}var S=C.prototype;return S.registerListeners=function(){var o=this.hls;o.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(Z.Events.BUFFER_CREATED,this.onBufferCreated,this)},S.unregisterListeners=function(){var o=this.hls;o.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(Z.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},S.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},S.onMediaAttached=function(o,l){this.media=l.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},S.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},S.onBufferCreated=function(o,l){var h,w;this.audioBuffer=(h=l.tracks.audio)===null||h===void 0?void 0:h.buffer,this.videoBuffer=(w=l.tracks.video)===null||w===void 0?void 0:w.buffer},S.createData=function(){var o;return{v:B.CMCDVersion,sf:B.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},S.apply=function(o,l){l===void 0&&(l={}),O(l,this.createData());var h=l.ot===B.CMCDObjectType.INIT||l.ot===B.CMCDObjectType.VIDEO||l.ot===B.CMCDObjectType.MUXED;if(this.starved&&h&&(l.bs=!0,l.su=!0,this.starved=!1),l.su==null&&(l.su=this.buffering),this.useHeaders){var w=C.toHeaders(l);if(!Object.keys(w).length)return;o.headers||(o.headers={}),O(o.headers,w)}else{var p=C.toQuery(l);if(!p)return;o.url=C.appendQueryToUri(o.url,p)}},S.getObjectType=function(o){var l=o.type;return l==="subtitle"?B.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?B.CMCDObjectType.INIT:l==="audio"?B.CMCDObjectType.AUDIO:l==="main"?this.hls.audioTracks.length?B.CMCDObjectType.VIDEO:B.CMCDObjectType.MUXED:void 0},S.getTopBandwidth=function(o){for(var l=0,h=o===B.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,w=k(h),p;!(p=w()).done;){var f=p.value;f.bitrate>l&&(l=f.bitrate)}return l>0?l:NaN},S.getBufferLength=function(o){var l=this.hls.media,h=o===B.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!h||!l)return NaN;var w=P.BufferHelper.bufferInfo(h,l.currentTime,this.config.maxBufferHole);return w.len*1e3},S.createPlaylistLoader=function(){var o=this.config.pLoader,l=this.applyPlaylistData,h=o||this.config.loader;return function(){function w(f){this.loader=void 0,this.loader=new h(f)}var p=w.prototype;return p.destroy=function(){this.loader.destroy()},p.abort=function(){this.loader.abort()},p.load=function(L,g,m){l(L),this.loader.load(L,g,m)},I(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},S.createFragmentLoader=function(){var o=this.config.fLoader,l=this.applyFragmentData,h=o||this.config.loader;return function(){function w(f){this.loader=void 0,this.loader=new h(f)}var p=w.prototype;return p.destroy=function(){this.loader.destroy()},p.abort=function(){this.loader.abort()},p.load=function(L,g,m){l(L),this.loader.load(L,g,m)},I(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},C.uuid=function(){var o=URL.createObjectURL(new Blob),l=o.toString();return URL.revokeObjectURL(o),l.substr(l.lastIndexOf("/")+1)},C.serialize=function(o){for(var l=[],h=function(U){return!Number.isNaN(U)&&U!=null&&U!==""&&U!==!1},w=function(U){return Math.round(U)},p=function(U){return w(U/100)*100},f=function(U){return encodeURIComponent(U)},L={br:w,d:w,bl:p,dl:p,mtp:p,nor:f,rtp:p,tb:w},g=Object.keys(o||{}).sort(),m=k(g),c;!(c=m()).done;){var u=c.value,a=o[u];if(!h(a))continue;if(u==="v"&&a===1)continue;if(u=="pr"&&a===1)continue;var x=L[u];x&&(a=x(a));var b=typeof a,E=void 0;u==="ot"||u==="sf"||u==="st"?E=u+"="+a:b==="boolean"?E=u:b==="number"?E=u+"="+a:E=u+"="+JSON.stringify(a),l.push(E)}return l.join(",")},C.toHeaders=function(o){for(var l=Object.keys(o),h={},w=["Object","Request","Session","Status"],p=[{},{},{},{}],f={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},L=0,g=l;L<g.length;L++){var m=g[L],c=f[m]!=null?f[m]:1;p[c][m]=o[m]}for(var u=0;u<p.length;u++){var a=C.serialize(p[u]);a&&(h["CMCD-"+w[u]]=a)}return h},C.toQuery=function(o){return"CMCD="+encodeURIComponent(C.serialize(o))},C.appendQueryToUri=function(o,l){if(!l)return o;var h=o.includes("?")?"&":"?";return""+o+h+l},C}()},"./src/controller/eme-controller.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/events.ts"),B=D("./src/errors.ts"),P=D("./src/utils/logger.ts"),G=D("./src/utils/mediakeys-helper.ts");function j(_,C){for(var S=0;S<C.length;S++){var d=C[S];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(_,d.key,d)}}function I(_,C,S){return C&&j(_.prototype,C),S&&j(_,S),_}var k=3,y=function(C,S,d){var o={audioCapabilities:[],videoCapabilities:[]};return C.forEach(function(l){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:d.audioRobustness||""})}),S.forEach(function(l){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:d.videoRobustness||""})}),[o]},A=function(C,S,d,o){switch(C){case G.KeySystems.WIDEVINE:return y(S,d,o);default:throw new Error("Unknown key-system: "+C)}},O=function(){function _(S){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=S,this._config=S.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 C=_.prototype;return C.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},C._registerListeners=function(){this.hls.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},C._unregisterListeners=function(){this.hls.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},C.getLicenseServerUrl=function(d){switch(d){case G.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+d+'"')},C._attemptKeySystemAccess=function(d,o,l){var h=this,w=A(d,o,l,this._drmSystemOptions);P.logger.log("Requesting encrypted media key-system access");var p=this.requestMediaKeySystemAccess(d,w);this.mediaKeysPromise=p.then(function(f){return h._onMediaKeySystemAccessObtained(d,f)}),p.catch(function(f){P.logger.error('Failed to obtain key-system "'+d+'" access:',f)})},C._onMediaKeySystemAccessObtained=function(d,o){var l=this;P.logger.log('Access for key-system "'+d+'" obtained');var h={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:d};this._mediaKeysList.push(h);var w=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(p){return h.mediaKeys=p,P.logger.log('Media-keys created for key-system "'+d+'"'),l._onMediaKeysCreated(),p});return w.catch(function(p){P.logger.error("Failed to create media-keys:",p)}),w},C._onMediaKeysCreated=function(){var d=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),d._onNewMediaKeySession(o.mediaKeysSession))})},C._onNewMediaKeySession=function(d){var o=this;P.logger.log("New key-system session "+d.sessionId),d.addEventListener("message",function(l){o._onKeySessionMessage(d,l.message)},!1)},C._onKeySessionMessage=function(d,o){P.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(l){P.logger.log("Received license data (length: "+(l&&l.byteLength)+"), updating key-session"),d.update(l)})},C.onMediaEncrypted=function(d){var o=this;if(P.logger.log('Media is encrypted using "'+d.initDataType+'" init data type'),!this.mediaKeysPromise){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var l=function(w){if(!o._media)return;o._attemptSetMediaKeys(w),o._generateRequestWithPreferredKeySession(d.initDataType,d.initData)};this.mediaKeysPromise.then(l).catch(l)},C._attemptSetMediaKeys=function(d){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}P.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},C._generateRequestWithPreferredKeySession=function(d,o){var l=this,h=this._mediaKeysList[0];if(!h){P.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(h.mediaKeysSessionInitialized){P.logger.warn("Key-Session already initialized but requested again");return}var w=h.mediaKeysSession;if(!w){P.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){P.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}P.logger.log('Generating key-session request for "'+d+'" init data type'),h.mediaKeysSessionInitialized=!0,w.generateRequest(d,o).then(function(){P.logger.debug("Key-session generation succeeded")}).catch(function(p){P.logger.error("Error generating key-session request:",p),l.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},C._createLicenseXhr=function(d,o,l){var h=new XMLHttpRequest;h.responseType="arraybuffer",h.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,h,d,o,l);var w=this._licenseXhrSetup;if(w)try{w.call(this.hls,h,d),w=void 0}catch(p){P.logger.error(p)}try{h.readyState||h.open("POST",d,!0),w&&w.call(this.hls,h,d)}catch(p){throw new Error("issue setting up KeySystem license XHR "+p)}return h},C._onLicenseRequestReadyStageChange=function(d,o,l,h){switch(d.readyState){case 4:if(d.status===200){this._requestLicenseFailureCount=0,P.logger.log("License request succeeded");var w=d.response,p=this._licenseResponseCallback;if(p)try{w=p.call(this.hls,d,o)}catch(L){P.logger.error(L)}h(w)}else{if(P.logger.error("License Request XHR failed ("+o+"). Status: "+d.status+" ("+d.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>k){this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var f=k-this._requestLicenseFailureCount+1;P.logger.warn("Retrying license request, "+f+" attempts left"),this._requestLicense(l,h)}break}},C._generateLicenseRequestChallenge=function(d,o){switch(d.mediaKeySystemDomain){case G.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+d.mediaKeySystemDomain)},C._requestLicense=function(d,o){P.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){P.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var h=this.getLicenseServerUrl(l.mediaKeySystemDomain),w=this._createLicenseXhr(h,d,o);P.logger.log("Sending license request to URL: "+h);var p=this._generateLicenseRequestChallenge(l,d);w.send(p)}catch(f){P.logger.error("Failure requesting DRM license: "+f),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},C.onMediaAttached=function(d,o){if(!this._emeEnabled)return;var l=o.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},C.onMediaDetached=function(){var d=this._media,o=this._mediaKeysList;if(!d)return;d.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(l){if(l.mediaKeysSession)return l.mediaKeysSession.close().catch(function(){})})).then(function(){return d.setMediaKeys(null)}).catch(function(){})},C.onManifestParsed=function(d,o){if(!this._emeEnabled)return;var l=o.levels.map(function(w){return w.audioCodec}).filter(function(w){return!!w}),h=o.levels.map(function(w){return w.videoCodec}).filter(function(w){return!!w});this._attemptKeySystemAccess(G.KeySystems.WIDEVINE,l,h)},I(_,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),_}();Q.default=O},"./src/controller/fps-controller.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/events.ts"),B=D("./src/utils/logger.ts"),P=function(){function G(I){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=I,this.registerListeners()}var j=G.prototype;return j.setStreamController=function(k){this.streamController=k},j.registerListeners=function(){this.hls.on(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},j.unregisterListeners=function(){this.hls.off(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching)},j.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},j.onMediaAttaching=function(k,y){var A=this.hls.config;if(A.capLevelOnFPSDrop){var O=y.media instanceof self.HTMLVideoElement?y.media:null;this.media=O,O&&typeof O.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),A.fpsDroppedMonitoringPeriod)}},j.checkFPS=function(k,y,A){var O=performance.now();if(y){if(this.lastTime){var _=O-this.lastTime,C=A-this.lastDroppedFrames,S=y-this.lastDecodedFrames,d=1e3*C/_,o=this.hls;if(o.trigger(Z.Events.FPS_DROP,{currentDropped:C,currentDecoded:S,totalDroppedFrames:A}),d>0&&C>o.config.fpsDroppedMonitoringThreshold*S){var l=o.currentLevel;B.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=l)&&(l=l-1,o.trigger(Z.Events.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:o.currentLevel}),o.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=O,this.lastDroppedFrames=A,this.lastDecodedFrames=y}},j.checkFPSInterval=function(){var k=this.media;if(k)if(this.isVideoPlaybackQualityAvailable){var y=k.getVideoPlaybackQuality();this.checkFPS(k,y.totalVideoFrames,y.droppedVideoFrames)}else this.checkFPS(k,k.webkitDecodedFrameCount,k.webkitDroppedFrameCount)},G}();Q.default=P},"./src/controller/fragment-finders.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"findFragmentByPDT",function(){return P}),D.d(Q,"findFragmentByPTS",function(){return G}),D.d(Q,"fragmentWithinToleranceTest",function(){return j}),D.d(Q,"pdtWithinToleranceTest",function(){return I}),D.d(Q,"findFragWithCC",function(){return k});var Z=D("./src/polyfills/number.ts"),B=D("./src/utils/binary-search.ts");function P(y,A,O){if(A===null||!Array.isArray(y)||!y.length||!Object(Z.isFiniteNumber)(A))return null;var _=y[0].programDateTime;if(A<(_||0))return null;var C=y[y.length-1].endProgramDateTime;if(A>=(C||0))return null;O=O||0;for(var S=0;S<y.length;++S){var d=y[S];if(I(A,O,d))return d}return null}function G(y,A,O,_){O===void 0&&(O=0),_===void 0&&(_=0);var C=null;if(y?C=A[y.sn-A[0].sn+1]||null:O===0&&A[0].start===0&&(C=A[0]),C&&j(O,_,C)===0)return C;var S=B.default.search(A,j.bind(null,O,_));return S||C}function j(y,A,O){y===void 0&&(y=0),A===void 0&&(A=0);var _=Math.min(A,O.duration+(O.deltaPTS?O.deltaPTS:0));return O.start+O.duration-_<=y?1:O.start-_>y&&O.start?-1:0}function I(y,A,O){var _=Math.min(A,O.duration+(O.deltaPTS?O.deltaPTS:0))*1e3,C=O.endProgramDateTime||0;return C-_>y}function k(y,A){return B.default.search(y,function(O){return O.cc<A?1:O.cc>A?-1:0})}},"./src/controller/fragment-tracker.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"FragmentState",function(){return P}),D.d(Q,"FragmentTracker",function(){return G});var Z=D("./src/events.ts"),B=D("./src/types/loader.ts"),P;(function(k){k.NOT_LOADED="NOT_LOADED",k.BACKTRACKED="BACKTRACKED",k.APPENDING="APPENDING",k.PARTIAL="PARTIAL",k.OK="OK"})(P||(P={}));var G=function(){function k(A){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=A,this._registerListeners()}var y=k.prototype;return y._registerListeners=function(){var O=this.hls;O.on(Z.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.on(Z.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.on(Z.Events.FRAG_LOADED,this.onFragLoaded,this)},y._unregisterListeners=function(){var O=this.hls;O.off(Z.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.off(Z.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.off(Z.Events.FRAG_LOADED,this.onFragLoaded,this)},y.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},y.getAppendedFrag=function(O,_){if(_===B.PlaylistLevelType.MAIN){var C=this.activeFragment,S=this.activeParts;if(!C)return null;if(S)for(var d=S.length;d--;){var o=S[d],l=o?o.end:C.appendedPTS;if(o.start<=O&&l!==void 0&&O<=l)return d>9&&(this.activeParts=S.slice(d-9)),o}else if(C.start<=O&&C.appendedPTS!==void 0&&O<=C.appendedPTS)return C}return this.getBufferedFrag(O,_)},y.getBufferedFrag=function(O,_){for(var C=this.fragments,S=Object.keys(C),d=S.length;d--;){var o=C[S[d]];if((o==null?void 0:o.body.type)===_&&o.buffered){var l=o.body;if(l.start<=O&&O<=l.end)return l}}return null},y.detectEvictedFragments=function(O,_,C){var S=this;Object.keys(this.fragments).forEach(function(d){var o=S.fragments[d];if(!o)return;if(!o.buffered){o.body.type===C&&S.removeFragment(o.body);return}var l=o.range[O];if(!l)return;l.time.some(function(h){var w=!S.isTimeBuffered(h.startPTS,h.endPTS,_);return w&&S.removeFragment(o.body),w})})},y.detectPartialFragments=function(O){var _=this,C=this.timeRanges,S=O.frag,d=O.part;if(!C||S.sn==="initSegment")return;var o=I(S),l=this.fragments[o];if(!l)return;Object.keys(C).forEach(function(h){var w=S.elementaryStreams[h];if(!w)return;var p=C[h],f=d!==null||w.partial===!0;l.range[h]=_.getBufferedTimes(S,d,f,p)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},y.fragBuffered=function(O){var _=I(O),C=this.fragments[_];C&&(C.backtrack=C.loaded=null,C.buffered=!0)},y.getBufferedTimes=function(O,_,C,S){for(var d={time:[],partial:C},o=_?_.start:O.start,l=_?_.end:O.end,h=O.minEndPTS||l,w=O.maxStartPTS||o,p=0;p<S.length;p++){var f=S.start(p)-this.bufferPadding,L=S.end(p)+this.bufferPadding;if(w>=f&&h<=L){d.time.push({startPTS:Math.max(o,S.start(p)),endPTS:Math.min(l,S.end(p))});break}else if(o<L&&l>f)d.partial=!0,d.time.push({startPTS:Math.max(o,S.start(p)),endPTS:Math.min(l,S.end(p))});else if(l<=f)break}return d},y.getPartialFragment=function(O){var _=null,C,S,d,o=0,l=this.bufferPadding,h=this.fragments;return Object.keys(h).forEach(function(w){var p=h[w];if(!p)return;j(p)&&(S=p.body.start-l,d=p.body.end+l,O>=S&&O<=d&&(C=Math.min(O-S,d-O),o<=C&&(_=p.body,o=C)))}),_},y.getState=function(O){var _=I(O),C=this.fragments[_];return C?C.buffered?j(C)?P.PARTIAL:P.OK:C.backtrack?P.BACKTRACKED:P.APPENDING:P.NOT_LOADED},y.backtrack=function(O,_){var C=I(O),S=this.fragments[C];if(!S||S.backtrack)return null;var d=S.backtrack=_||S.loaded;return S.loaded=null,d},y.getBacktrackData=function(O){var _=I(O),C=this.fragments[_];if(C){var S,d=C.backtrack;if(d!=null&&(S=d.payload)!==null&&S!==void 0&&S.byteLength)return d;this.removeFragment(O)}return null},y.isTimeBuffered=function(O,_,C){for(var S,d,o=0;o<C.length;o++){if(S=C.start(o)-this.bufferPadding,d=C.end(o)+this.bufferPadding,O>=S&&_<=d)return!0;if(_<=S)return!1}return!1},y.onFragLoaded=function(O,_){var C=_.frag,S=_.part;if(C.sn==="initSegment"||C.bitrateTest||S)return;var d=I(C);this.fragments[d]={body:C,loaded:_,backtrack:null,buffered:!1,range:Object.create(null)}},y.onBufferAppended=function(O,_){var C=this,S=_.frag,d=_.part,o=_.timeRanges;if(S.type===B.PlaylistLevelType.MAIN)if(this.activeFragment=S,d){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(d)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(h){var w=o[h];if(C.detectEvictedFragments(h,w),!d)for(var p=0;p<w.length;p++)S.appendedPTS=Math.max(w.end(p),S.appendedPTS||0)})},y.onFragBuffered=function(O,_){this.detectPartialFragments(_)},y.hasFragment=function(O){var _=I(O);return!!this.fragments[_]},y.removeFragmentsInRange=function(O,_,C){var S=this;Object.keys(this.fragments).forEach(function(d){var o=S.fragments[d];if(!o)return;if(o.buffered){var l=o.body;l.type===C&&l.start<_&&l.end>O&&S.removeFragment(l)}})},y.removeFragment=function(O){var _=I(O);O.stats.loaded=0,O.clearElementaryStreamInfo(),delete this.fragments[_]},y.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},k}();function j(k){var y,A;return k.buffered&&(((y=k.range.video)===null||y===void 0?void 0:y.partial)||((A=k.range.audio)===null||A===void 0?void 0:A.partial))}function I(k){return k.type+"_"+k.level+"_"+k.urlId+"_"+k.sn}},"./src/controller/gap-controller.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"STALL_MINIMUM_DURATION_MS",function(){return j}),D.d(Q,"MAX_START_GAP_JUMP",function(){return I}),D.d(Q,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return k}),D.d(Q,"SKIP_BUFFER_RANGE_START",function(){return y}),D.d(Q,"default",function(){return A});var Z=D("./src/utils/buffer-helper.ts"),B=D("./src/errors.ts"),P=D("./src/events.ts"),G=D("./src/utils/logger.ts"),j=250,I=2,k=.1,y=.05,A=function(){function O(C,S,d,o){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=C,this.media=S,this.fragmentTracker=d,this.hls=o}var _=O.prototype;return _.destroy=function(){this.hls=this.fragmentTracker=this.media=null},_.poll=function(S){var d=this.config,o=this.media,l=this.stalled,h=o.currentTime,w=o.seeking,p=this.seeking&&!w,f=!this.seeking&&w;if(this.seeking=w,h!==S){if(this.moved=!0,l!==null){if(this.stallReported){var L=self.performance.now()-l;G.logger.warn("playback not stuck anymore @"+h+", after "+Math.round(L)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((f||p)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!Z.BufferHelper.getBuffered(o).length)return;var g=Z.BufferHelper.bufferInfo(o,h,0),m=g.len>0,c=g.nextStart||0;if(!m&&!c)return;if(w){var u=g.len>I,a=!c||c-h>I&&!this.fragmentTracker.getPartialFragment(h);if(u||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var x,b=Math.max(c,g.start||0)-h,E=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,N=E==null||((x=E.details)===null||x===void 0)?void 0:x.live,U=N?E.details.targetduration*2:I;if(b>0&&b<=U){this._trySkipBufferHole(null);return}}var K=self.performance.now();if(l===null){this.stalled=K;return}var V=K-l;!w&&V>=j&&this._reportStall(g.len);var R=Z.BufferHelper.bufferInfo(o,h,d.maxBufferHole);this._tryFixBufferStall(R,V)},_._tryFixBufferStall=function(S,d){var o=this.config,l=this.fragmentTracker,h=this.media,w=h.currentTime,p=l.getPartialFragment(w);if(p){var f=this._trySkipBufferHole(p);if(f)return}S.len>o.maxBufferHole&&d>o.highBufferWatchdogPeriod*1e3&&(G.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},_._reportStall=function(S){var d=this.hls,o=this.media,l=this.stallReported;l||(this.stallReported=!0,G.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+S+")"),d.trigger(P.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:S}))},_._trySkipBufferHole=function(S){for(var d=this.config,o=this.hls,l=this.media,h=l.currentTime,w=0,p=Z.BufferHelper.getBuffered(l),f=0;f<p.length;f++){var L=p.start(f);if(h+d.maxBufferHole>=w&&h<L){var g=Math.max(L+y,l.currentTime+k);return G.logger.warn("skipping hole, adjusting currentTime from "+h+" to "+g),this.moved=!0,this.stalled=null,l.currentTime=g,S&&o.trigger(P.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+h+" to "+g,frag:S}),g}w=p.end(f)}return 0},_._tryNudgeBuffer=function(){var S=this.config,d=this.hls,o=this.media,l=o.currentTime,h=(this.nudgeRetry||0)+1;if(this.nudgeRetry=h,h<S.nudgeMaxRetry){var w=l+h*S.nudgeOffset;G.logger.warn("Nudging 'currentTime' from "+l+" to "+w),o.currentTime=w,d.trigger(P.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else G.logger.error("Playhead still not moving while enough data buffered @"+l+" after "+S.nudgeMaxRetry+" nudges"),d.trigger(P.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},O}()},"./src/controller/id3-track-controller.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/events.ts"),B=D("./src/utils/texttrack-utils.ts"),P=D("./src/demux/id3.ts"),G=.25,j=function(){function I(y){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=y,this._registerListeners()}var k=I.prototype;return k.destroy=function(){this._unregisterListeners()},k._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.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.on(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},k._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.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.off(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},k.onMediaAttached=function(A,O){this.media=O.media},k.onMediaDetaching=function(){if(!this.id3Track)return;Object(B.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},k.getID3Track=function(A){if(!this.media)return;for(var O=0;O<A.length;O++){var _=A[O];if(_.kind==="metadata"&&_.label==="id3")return Object(B.sendAddTrackEvent)(_,this.media),_}return this.media.addTextTrack("metadata","id3")},k.onFragParsingMetadata=function(A,O){if(!this.media)return;var _=O.frag,C=O.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var S=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,d=0;d<C.length;d++){var o=P.getID3Frames(C[d].data);if(o){var l=C[d].pts,h=d<C.length-1?C[d+1].pts:_.end,w=h-l;w<=0&&(h=l+G);for(var p=0;p<o.length;p++){var f=o[p];if(!P.isTimeStampFrame(f)){var L=new S(l,h,"");L.value=f,this.id3Track.addCue(L)}}}}},k.onBufferFlushing=function(A,O){var _=O.startOffset,C=O.endOffset,S=O.type;if(!S||S==="audio"){var d=this.id3Track;d&&Object(B.removeCuesInRange)(d,_,C)}},I}();Q.default=j},"./src/controller/latency-controller.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return I});var Z=D("./src/errors.ts"),B=D("./src/events.ts"),P=D("./src/utils/logger.ts");function G(k,y){for(var A=0;A<y.length;A++){var O=y[A];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(k,O.key,O)}}function j(k,y,A){return y&&G(k.prototype,y),A&&G(k,A),k}var I=function(){function k(A){var O=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 O.timeupdate()},this.hls=A,this.config=A.config,this.registerListeners()}var y=k.prototype;return y.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},y.registerListeners=function(){this.hls.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(B.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(B.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){this.hls.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(B.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(B.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(B.Events.ERROR,this.onError)},y.onMediaAttached=function(O,_){this.media=_.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},y.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},y.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},y.onLevelUpdated=function(O,_){var C=_.details;this.levelDetails=C,C.advanced&&this.timeupdate(),!C.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},y.onError=function(O,_){if(_.details!==Z.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,P.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},y.timeupdate=function(){var O=this.media,_=this.levelDetails;if(!O||!_)return;this.currentTime=O.currentTime;var C=this.computeLatency();if(C===null)return;this._latency=C;var S=this.config,d=S.lowLatencyMode,o=S.maxLiveSyncPlaybackRate;if(!d||o===1)return;var l=this.targetLatency;if(l===null)return;var h=C-l,w=Math.min(this.maxLatency,l+_.targetduration),p=h<w;if(_.live&&p&&h>.05&&this.forwardBufferLength>1){var f=Math.min(2,Math.max(1,o)),L=Math.round(2/(1+Math.exp(-.75*h-this.edgeStalled))*20)/20;O.playbackRate=Math.min(f,Math.max(1,L))}else O.playbackRate!==1&&O.playbackRate!==0&&(O.playbackRate=1)},y.estimateLiveEdge=function(){var O=this.levelDetails;return O===null?null:O.edge+O.age},y.computeLatency=function(){var O=this.estimateLiveEdge();return O===null?null:O-this.currentTime},j(k,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var O=this.config,_=this.levelDetails;return O.liveMaxLatencyDuration!==void 0?O.liveMaxLatencyDuration:_?O.liveMaxLatencyDurationCount*_.targetduration:0}},{key:"targetLatency",get:function(){var O=this.levelDetails;if(O===null)return null;var _=O.holdBack,C=O.partHoldBack,S=O.targetduration,d=this.config,o=d.liveSyncDuration,l=d.liveSyncDurationCount,h=d.lowLatencyMode,w=this.hls.userConfig,p=h&&C||_;(w.liveSyncDuration||w.liveSyncDurationCount||p===0)&&(p=o!==void 0?o:l*S);var f=S,L=1;return p+Math.min(this.stallCount*L,f)}},{key:"liveSyncPosition",get:function(){var O=this.estimateLiveEdge(),_=this.targetLatency,C=this.levelDetails;if(O===null||_===null||C===null)return null;var S=C.edge,d=O-_-this.edgeStalled,o=S-C.totalduration,l=S-(this.config.lowLatencyMode&&C.partTarget||C.targetduration);return Math.min(Math.max(o,d),l)}},{key:"drift",get:function(){var O=this.levelDetails;return O===null?1:O.drift}},{key:"edgeStalled",get:function(){var O=this.levelDetails;if(O===null)return 0;var _=(this.config.lowLatencyMode&&O.partTarget||O.targetduration)*3;return Math.max(O.age-_,0)}},{key:"forwardBufferLength",get:function(){var O=this.media,_=this.levelDetails;if(!O||!_)return 0;var C=O.buffered.length;return C?O.buffered.end(C-1):_.edge-this.currentTime}}]),k}()},"./src/controller/level-controller.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return d});var Z=D("./src/types/level.ts"),B=D("./src/events.ts"),P=D("./src/errors.ts"),G=D("./src/utils/codecs.ts"),j=D("./src/controller/level-helper.ts"),I=D("./src/controller/base-playlist-controller.ts"),k=D("./src/types/loader.ts");function y(){return y=Object.assign||function(o){for(var l=1;l<arguments.length;l++){var h=arguments[l];for(var w in h)Object.prototype.hasOwnProperty.call(h,w)&&(o[w]=h[w])}return o},y.apply(this,arguments)}function A(o,l){for(var h=0;h<l.length;h++){var w=l[h];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(o,w.key,w)}}function O(o,l,h){return l&&A(o.prototype,l),h&&A(o,h),o}function _(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,C(o,l)}function C(o,l){return C=Object.setPrototypeOf||function(w,p){return w.__proto__=p,w},C(o,l)}var S=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),d=function(o){_(l,o);function l(w){var p;return p=o.call(this,w,"[level-controller]")||this,p._levels=[],p._firstLevel=-1,p._startLevel=void 0,p.currentLevelIndex=-1,p.manualLevelIndex=-1,p.onParsedComplete=void 0,p._registerListeners(),p}var h=l.prototype;return h._registerListeners=function(){var p=this.hls;p.on(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),p.on(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.on(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.on(B.Events.FRAG_LOADED,this.onFragLoaded,this),p.on(B.Events.ERROR,this.onError,this)},h._unregisterListeners=function(){var p=this.hls;p.off(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),p.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.off(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.off(B.Events.FRAG_LOADED,this.onFragLoaded,this),p.off(B.Events.ERROR,this.onError,this)},h.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},h.startLoad=function(){var p=this._levels;p.forEach(function(f){f.loadError=0}),o.prototype.startLoad.call(this)},h.onManifestLoaded=function(p,f){var L=[],g=[],m=[],c,u={},a,x=!1,b=!1,E=!1;if(f.levels.forEach(function(V){var R=V.attrs;x=x||!!(V.width&&V.height),b=b||!!V.videoCodec,E=E||!!V.audioCodec,S&&V.audioCodec&&V.audioCodec.indexOf("mp4a.40.34")!==-1&&(V.audioCodec=void 0);var M=V.bitrate+"-"+V.attrs.RESOLUTION+"-"+V.attrs.CODECS;a=u[M],a?a.url.push(V.url):(a=new Z.Level(V),u[M]=a,L.push(a)),R&&(R.AUDIO&&Object(j.addGroupId)(a,"audio",R.AUDIO),R.SUBTITLES&&Object(j.addGroupId)(a,"text",R.SUBTITLES))}),(x||b)&&E&&(L=L.filter(function(V){var R=V.videoCodec,M=V.width,$=V.height;return!!R||!!(M&&$)})),L=L.filter(function(V){var R=V.audioCodec,M=V.videoCodec;return(!R||Object(G.isCodecSupportedInMp4)(R,"audio"))&&(!M||Object(G.isCodecSupportedInMp4)(M,"video"))}),f.audioTracks&&(g=f.audioTracks.filter(function(V){return!V.audioCodec||Object(G.isCodecSupportedInMp4)(V.audioCodec,"audio")}),Object(j.assignTrackIdsByGroup)(g)),f.subtitles&&(m=f.subtitles,Object(j.assignTrackIdsByGroup)(m)),L.length>0){c=L[0].bitrate,L.sort(function(V,R){return V.bitrate-R.bitrate}),this._levels=L;for(var N=0;N<L.length;N++)if(L[N].bitrate===c){this._firstLevel=N,this.log("manifest loaded, "+L.length+" level(s) found, first bitrate: "+c);break}var U=E&&!b,K={levels:L,audioTracks:g,subtitleTracks:m,firstLevel:this._firstLevel,stats:f.stats,audio:E,video:b,altAudio:!U&&g.some(function(V){return!!V.url})};this.hls.trigger(B.Events.MANIFEST_PARSED,K),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(B.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:f.url,reason:"no level with compatible codecs found in manifest"})},h.onError=function(p,f){if(o.prototype.onError.call(this,p,f),f.fatal)return;var L=f.context,g=this._levels[this.currentLevelIndex];if(L&&(L.type===k.PlaylistContextType.AUDIO_TRACK&&g.audioGroupIds&&L.groupId===g.audioGroupIds[g.urlId]||L.type===k.PlaylistContextType.SUBTITLE_TRACK&&g.textGroupIds&&L.groupId===g.textGroupIds[g.urlId])){this.redundantFailover(this.currentLevelIndex);return}var m=!1,c=!0,u;switch(f.details){case P.ErrorDetails.FRAG_LOAD_ERROR:case P.ErrorDetails.FRAG_LOAD_TIMEOUT:case P.ErrorDetails.KEY_LOAD_ERROR:case P.ErrorDetails.KEY_LOAD_TIMEOUT:if(f.frag){var a=this._levels[f.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(u=f.frag.level)):u=f.frag.level}break;case P.ErrorDetails.LEVEL_LOAD_ERROR:case P.ErrorDetails.LEVEL_LOAD_TIMEOUT:L&&(L.deliveryDirectives&&(c=!1),u=L.level),m=!0;break;case P.ErrorDetails.REMUX_ALLOC_ERROR:u=f.level,m=!0;break}u!==void 0&&this.recoverLevel(f,u,m,c)},h.recoverLevel=function(p,f,L,g){var m=p.details,c=this._levels[f];if(c.loadError++,L){var u=this.retryLoadingOrFail(p);if(u)p.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(g){var a=c.url.length;if(a>1&&c.loadError<a)p.levelRetry=!0,this.redundantFailover(f);else if(this.manualLevelIndex===-1){var x=f===0?this._levels.length-1:f-1;this.currentLevelIndex!==x&&this._levels[x].loadError===0&&(this.warn(m+": switch to "+x),p.levelRetry=!0,this.hls.nextAutoLevel=x)}}},h.redundantFailover=function(p){var f=this._levels[p],L=f.url.length;if(L>1){var g=(f.urlId+1)%L;this.warn("Switching to redundant URL-id "+g),this._levels.forEach(function(m){m.urlId=g}),this.level=p}},h.onFragLoaded=function(p,f){var L=f.frag;if(L!==void 0&&L.type===k.PlaylistLevelType.MAIN){var g=this._levels[L.level];g!==void 0&&(g.fragmentError=0,g.loadError=0)}},h.onLevelLoaded=function(p,f){var L,g=f.level,m=f.details,c=this._levels[g];if(!c){var u;this.warn("Invalid level index "+g),(u=f.deliveryDirectives)!==null&&u!==void 0&&u.skip&&(m.deltaUpdateFailed=!0);return}g===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(g,f,c.details)):(L=f.deliveryDirectives)!==null&&L!==void 0&&L.skip&&(m.deltaUpdateFailed=!0)},h.onAudioTrackSwitched=function(p,f){var L=this.hls.levels[this.currentLevelIndex];if(!L)return;if(L.audioGroupIds){for(var g=-1,m=this.hls.audioTracks[f.id].groupId,c=0;c<L.audioGroupIds.length;c++)if(L.audioGroupIds[c]===m){g=c;break}g!==L.urlId&&(L.urlId=g,this.startLoad())}},h.loadPlaylist=function(p){var f=this.currentLevelIndex,L=this._levels[f];if(this.canLoad&&L&&L.url.length>0){var g=L.urlId,m=L.url[g];if(p)try{m=p.addDirectives(m)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+f+(p?" at sn "+p.msn+" part "+p.part:"")+" with URL-id "+g+" "+m),this.clearTimer(),this.hls.trigger(B.Events.LEVEL_LOADING,{url:m,level:f,id:g,deliveryDirectives:p||null})}},h.removeLevel=function(p,f){var L=function(c,u){return u!==f},g=this._levels.filter(function(m,c){return c!==p?!0:m.url.length>1&&f!==void 0?(m.url=m.url.filter(L),m.audioGroupIds&&(m.audioGroupIds=m.audioGroupIds.filter(L)),m.textGroupIds&&(m.textGroupIds=m.textGroupIds.filter(L)),m.urlId=0,!0):!1}).map(function(m,c){var u=m.details;return u!=null&&u.fragments&&u.fragments.forEach(function(a){a.level=c}),m});this._levels=g,this.hls.trigger(B.Events.LEVELS_UPDATED,{levels:g})},O(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(p){var f,L=this._levels;if(L.length===0)return;if(this.currentLevelIndex===p&&(f=L[p])!==null&&f!==void 0&&f.details)return;if(p<0||p>=L.length){var g=p<0;if(this.hls.trigger(B.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.LEVEL_SWITCH_ERROR,level:p,fatal:g,reason:"invalid level idx"}),g)return;p=Math.min(p,L.length-1)}this.clearTimer();var m=this.currentLevelIndex,c=L[m],u=L[p];this.log("switching to level "+p+" from "+m),this.currentLevelIndex=p;var a=y({},u,{level:p,maxBitrate:u.maxBitrate,uri:u.uri,urlId:u.urlId});delete a._urlId,this.hls.trigger(B.Events.LEVEL_SWITCHING,a);var x=u.details;if(!x||x.live){var b=this.switchParams(u.uri,c==null?void 0:c.details);this.loadPlaylist(b)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(p){this.manualLevelIndex=p,this._startLevel===void 0&&(this._startLevel=p),p!==-1&&(this.level=p)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(p){this._firstLevel=p}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var p=this.hls.config.startLevel;return p!==void 0?p:this._firstLevel}else return this._startLevel},set:function(p){this._startLevel=p}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(p){this.level=p,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=p)}}]),l}(I.default)},"./src/controller/level-helper.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"addGroupId",function(){return P}),D.d(Q,"assignTrackIdsByGroup",function(){return G}),D.d(Q,"updatePTS",function(){return j}),D.d(Q,"updateFragPTSDTS",function(){return k}),D.d(Q,"mergeDetails",function(){return y}),D.d(Q,"mapPartIntersection",function(){return A}),D.d(Q,"mapFragmentIntersection",function(){return O}),D.d(Q,"adjustSliding",function(){return _}),D.d(Q,"addSliding",function(){return C}),D.d(Q,"computeReloadInterval",function(){return S}),D.d(Q,"getFragmentWithSN",function(){return d}),D.d(Q,"getPartWith",function(){return o});var Z=D("./src/polyfills/number.ts"),B=D("./src/utils/logger.ts");function P(l,h,w){switch(h){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(w);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(w);break}}function G(l){var h={};l.forEach(function(w){var p=w.groupId||"";w.id=h[p]=h[p]||0,h[p]++})}function j(l,h,w){var p=l[h],f=l[w];I(p,f)}function I(l,h){var w=h.startPTS;if(Object(Z.isFiniteNumber)(w)){var p=0,f;h.sn>l.sn?(p=w-l.start,f=l):(p=l.start-w,f=h),f.duration!==p&&(f.duration=p)}else if(h.sn>l.sn){var L=l.cc===h.cc;L&&l.minEndPTS?h.start=l.start+(l.minEndPTS-l.start):h.start=l.start+l.duration}else h.start=Math.max(l.start-h.duration,0)}function k(l,h,w,p,f,L){var g=p-w;g<=0&&(B.logger.warn("Fragment should have a positive duration",h),p=w+h.duration,L=f+h.duration);var m=w,c=p,u=h.startPTS,a=h.endPTS;if(Object(Z.isFiniteNumber)(u)){var x=Math.abs(u-w);Object(Z.isFiniteNumber)(h.deltaPTS)?h.deltaPTS=Math.max(x,h.deltaPTS):h.deltaPTS=x,m=Math.max(w,u),w=Math.min(w,u),f=Math.min(f,h.startDTS),c=Math.min(p,a),p=Math.max(p,a),L=Math.max(L,h.endDTS)}h.duration=p-w;var b=w-h.start;h.appendedPTS=p,h.start=h.startPTS=w,h.maxStartPTS=m,h.startDTS=f,h.endPTS=p,h.minEndPTS=c,h.endDTS=L;var E=h.sn;if(!l||E<l.startSN||E>l.endSN)return 0;var N,U=E-l.startSN,K=l.fragments;for(K[U]=h,N=U;N>0;N--)I(K[N],K[N-1]);for(N=U;N<K.length-1;N++)I(K[N],K[N+1]);return l.fragmentHint&&I(K[K.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,b}function y(l,h){for(var w=null,p=l.fragments,f=p.length-1;f>=0;f--){var L=p[f].initSegment;if(L){w=L;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var g=0,m;if(O(l,h,function(N,U){N.relurl&&(g=N.cc-U.cc),Object(Z.isFiniteNumber)(N.startPTS)&&Object(Z.isFiniteNumber)(N.endPTS)&&(U.start=U.startPTS=N.startPTS,U.startDTS=N.startDTS,U.appendedPTS=N.appendedPTS,U.maxStartPTS=N.maxStartPTS,U.endPTS=N.endPTS,U.endDTS=N.endDTS,U.minEndPTS=N.minEndPTS,U.duration=N.endPTS-N.startPTS,U.duration&&(m=U),h.PTSKnown=h.alignedSliding=!0),U.elementaryStreams=N.elementaryStreams,U.loader=N.loader,U.stats=N.stats,U.urlId=N.urlId,N.initSegment&&(U.initSegment=N.initSegment,w=N.initSegment)}),w){var c=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments;c.forEach(function(N){var U;(!N.initSegment||N.initSegment.relurl===((U=w)===null||U===void 0?void 0:U.relurl))&&(N.initSegment=w)})}if(h.skippedSegments&&(h.deltaUpdateFailed=h.fragments.some(function(N){return!N}),h.deltaUpdateFailed)){B.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var u=h.skippedSegments;u--;)h.fragments.shift();h.startSN=h.fragments[0].sn,h.startCC=h.fragments[0].cc}var a=h.fragments;if(g){B.logger.warn("discontinuity sliding from playlist, take drift into account");for(var x=0;x<a.length;x++)a[x].cc+=g}h.skippedSegments&&(h.startCC=h.fragments[0].cc),A(l.partList,h.partList,function(N,U){U.elementaryStreams=N.elementaryStreams,U.stats=N.stats}),m?k(h,m,m.startPTS,m.endPTS,m.startDTS,m.endDTS):_(l,h),a.length&&(h.totalduration=h.edge-a[0].start),h.driftStartTime=l.driftStartTime,h.driftStart=l.driftStart;var b=h.advancedDateTime;if(h.advanced&&b){var E=h.edge;h.driftStart||(h.driftStartTime=b,h.driftStart=E),h.driftEndTime=b,h.driftEnd=E}else h.driftEndTime=l.driftEndTime,h.driftEnd=l.driftEnd,h.advancedDateTime=l.advancedDateTime}function A(l,h,w){if(l&&h)for(var p=0,f=0,L=l.length;f<=L;f++){var g=l[f],m=h[f+p];g&&m&&g.index===m.index&&g.fragment.sn===m.fragment.sn?w(g,m):p--}}function O(l,h,w){for(var p=h.skippedSegments,f=Math.max(l.startSN,h.startSN)-h.startSN,L=(l.fragmentHint?1:0)+(p?h.endSN:Math.min(l.endSN,h.endSN))-h.startSN,g=h.startSN-l.startSN,m=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments,c=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,u=f;u<=L;u++){var a=c[g+u],x=m[u];p&&!x&&u<p&&(x=h.fragments[u]=a),a&&x&&w(a,x)}}function _(l,h){var w=h.startSN+h.skippedSegments-l.startSN,p=l.fragments;if(w<0||w>=p.length)return;C(h,p[w].start)}function C(l,h){if(h){for(var w=l.fragments,p=l.skippedSegments;p<w.length;p++)w[p].start+=h;l.fragmentHint&&(l.fragmentHint.start+=h)}}function S(l,h){var w=1e3*l.levelTargetDuration,p=w/2,f=l.age,L=f>0&&f<w*3,g=h.loading.end-h.loading.start,m,c=l.availabilityDelay;if(l.updated===!1)if(L){var u=333*l.misses;m=Math.max(Math.min(p,g*2),u),l.availabilityDelay=(l.availabilityDelay||0)+m}else m=p;else L?(c=Math.min(c||w/2,f),l.availabilityDelay=c,m=c+w-f):m=w-g;return Math.round(m)}function d(l,h,w){if(!l||!l.details)return null;var p=l.details,f=p.fragments[h-p.startSN];return f||(f=p.fragmentHint,f&&f.sn===h?f:h<p.startSN&&w&&w.sn===h?w:null)}function o(l,h,w){if(!l||!l.details)return null;var p=l.details.partList;if(p)for(var f=p.length;f--;){var L=p[f];if(L.index===w&&L.fragment.sn===h)return L}return null}},"./src/controller/stream-controller.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return p});var Z=D("./src/polyfills/number.ts"),B=D("./src/controller/base-stream-controller.ts"),P=D("./src/is-supported.ts"),G=D("./src/events.ts"),j=D("./src/utils/buffer-helper.ts"),I=D("./src/controller/fragment-tracker.ts"),k=D("./src/types/loader.ts"),y=D("./src/loader/fragment.ts"),A=D("./src/demux/transmuxer-interface.ts"),O=D("./src/types/transmuxer.ts"),_=D("./src/controller/gap-controller.ts"),C=D("./src/errors.ts"),S=D("./src/utils/logger.ts");function d(f,L){for(var g=0;g<L.length;g++){var m=L[g];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(f,m.key,m)}}function o(f,L,g){return L&&d(f.prototype,L),g&&d(f,g),f}function l(f,L){f.prototype=Object.create(L.prototype),f.prototype.constructor=f,h(f,L)}function h(f,L){return h=Object.setPrototypeOf||function(m,c){return m.__proto__=c,m},h(f,L)}var w=100,p=function(f){l(L,f);function L(m,c){var u;return u=f.call(this,m,c,"[stream-controller]")||this,u.audioCodecSwap=!1,u.gapController=null,u.level=-1,u._forceStartLoad=!1,u.altAudio=!1,u.audioOnly=!1,u.fragPlaying=null,u.onvplaying=null,u.onvseeked=null,u.fragLastKbps=0,u.stalled=!1,u.couldBacktrack=!1,u.audioCodecSwitch=!1,u.videoBuffer=null,u._registerListeners(),u}var g=L.prototype;return g._registerListeners=function(){var c=this.hls;c.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(G.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(G.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.on(G.Events.ERROR,this.onError,this),c.on(G.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(G.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(G.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(G.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(G.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.on(G.Events.FRAG_BUFFERED,this.onFragBuffered,this)},g._unregisterListeners=function(){var c=this.hls;c.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(G.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.off(G.Events.ERROR,this.onError,this),c.off(G.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(G.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(G.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(G.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(G.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.off(G.Events.FRAG_BUFFERED,this.onFragBuffered,this)},g.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},g.startLoad=function(c){if(this.levels){var u=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(w),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var x=a.startLevel;x===-1&&(a.config.testBandwidth?(x=0,this.bitrateTest=!0):x=a.nextAutoLevel),this.level=a.nextLoadLevel=x,this.loadedmetadata=!1}u>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),c=u),this.state=B.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=B.State.STOPPED},g.stopLoad=function(){this._forceStartLoad=!1,f.prototype.stopLoad.call(this)},g.doTick=function(){switch(this.state){case B.State.IDLE:this.doTickIdle();break;case B.State.WAITING_LEVEL:{var c,u=this.levels,a=this.level,x=u==null||((c=u[a])===null||c===void 0)?void 0:c.details;if(x&&(!x.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(x))break;this.state=B.State.IDLE;break}break}case B.State.FRAG_LOADING_WAITING_RETRY:{var b,E=self.performance.now(),N=this.retryDate;(!N||E>=N||(b=this.media)!==null&&b!==void 0&&b.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=B.State.IDLE)}break;default:break}this.onTickEnd()},g.onTickEnd=function(){f.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},g.doTickIdle=function(){var c,u,a=this.hls,x=this.levelLastLoaded,b=this.levels,E=this.media,N=a.config,U=a.nextLoadLevel;if(x===null||!E&&(this.startFragRequested||!N.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!b||!b[U])return;var K=b[U];this.level=a.nextLoadLevel=U;var V=K.details;if(!V||this.state===B.State.WAITING_LEVEL||V.live&&this.levelLastLoaded!==U){this.state=B.State.WAITING_LEVEL;return}var R=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:E,k.PlaylistLevelType.MAIN);if(R===null)return;var M=R.len,$=this.getMaxBufferLength(K.maxBitrate);if(M>=$)return;if(this._streamEnded(R,V)){var ee={};this.altAudio&&(ee.type="video"),this.hls.trigger(G.Events.BUFFER_EOS,ee),this.state=B.State.ENDED;return}var oe=R.end,fe=this.getNextFragment(oe,V);if(this.couldBacktrack&&!this.fragPrevious&&fe&&fe.sn!=="initSegment"){var ke=fe.sn-V.startSN;ke>1&&(fe=V.fragments[ke-1],this.fragmentTracker.removeFragment(fe))}if(fe&&this.fragmentTracker.getState(fe)===I.FragmentState.OK&&this.nextLoadPosition>oe){var Ee=this.audioOnly&&!this.altAudio?y.ElementaryStreamTypes.AUDIO:y.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(E,Ee,k.PlaylistLevelType.MAIN),fe=this.getNextFragment(this.nextLoadPosition,V)}if(!fe)return;fe.initSegment&&!fe.initSegment.data&&!this.bitrateTest&&(fe=fe.initSegment),((c=fe.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((u=fe.decryptdata)!==null&&u!==void 0&&u.key)?this.loadKey(fe,V):this.loadFragment(fe,V,oe)},g.loadFragment=function(c,u,a){var x,b=this.fragmentTracker.getState(c);if(this.fragCurrent=c,b===I.FragmentState.BACKTRACKED){var E=this.fragmentTracker.getBacktrackData(c);if(E){this._handleFragmentLoadProgress(E),this._handleFragmentLoadComplete(E);return}else b=I.FragmentState.NOT_LOADED}b===I.FragmentState.NOT_LOADED||b===I.FragmentState.PARTIAL?c.sn==="initSegment"?this._loadInitSegment(c):this.bitrateTest?(c.bitrateTest=!0,this.log("Fragment "+c.sn+" of level "+c.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(c)):(this.startFragRequested=!0,f.prototype.loadFragment.call(this,c,u,a)):b===I.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((x=this.media)===null||x===void 0?void 0:x.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},g.getAppendedFrag=function(c){var u=this.fragmentTracker.getAppendedFrag(c,k.PlaylistLevelType.MAIN);return u&&"fragment"in u?u.fragment:u},g.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,k.PlaylistLevelType.MAIN)},g.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},g.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},g.nextLevelSwitch=function(){var c=this.levels,u=this.media;if(u!=null&&u.readyState){var a,x=this.getAppendedFrag(u.currentTime);if(x&&x.start>1&&this.flushMainBuffer(0,x.start-1),!u.paused&&c){var b=this.hls.nextLoadLevel,E=c[b],N=this.fragLastKbps;N&&this.fragCurrent?a=this.fragCurrent.duration*E.maxBitrate/(1e3*N)+1:a=0}else a=0;var U=this.getBufferedFrag(u.currentTime+a);if(U){var K=this.followingBufferedFrag(U);if(K){this.abortCurrentFrag();var V=K.maxStartPTS?K.maxStartPTS:K.start,R=K.duration,M=Math.max(U.end,V+Math.min(Math.max(R-this.config.maxFragLookUpTolerance,R*.5),R*.75));this.flushMainBuffer(M,Number.POSITIVE_INFINITY)}}}},g.abortCurrentFrag=function(){var c=this.fragCurrent;this.fragCurrent=null,c!=null&&c.loader&&c.loader.abort(),this.state===B.State.KEY_LOADING&&(this.state=B.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},g.flushMainBuffer=function(c,u){f.prototype.flushMainBuffer.call(this,c,u,this.altAudio?"video":null)},g.onMediaAttached=function(c,u){f.prototype.onMediaAttached.call(this,c,u);var a=u.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new _.default(this.config,a,this.fragmentTracker,this.hls)},g.onMediaDetaching=function(){var c=this.media;c&&(c.removeEventListener("playing",this.onvplaying),c.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),f.prototype.onMediaDetaching.call(this)},g.onMediaPlaying=function(){this.tick()},g.onMediaSeeked=function(){var c=this.media,u=c?c.currentTime:null;Object(Z.isFiniteNumber)(u)&&this.log("Media seeked to "+u.toFixed(3)),this.tick()},g.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(G.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},g.onManifestParsed=function(c,u){var a=!1,x=!1,b;u.levels.forEach(function(E){b=E.audioCodec,b&&(b.indexOf("mp4a.40.2")!==-1&&(a=!0),b.indexOf("mp4a.40.5")!==-1&&(x=!0))}),this.audioCodecSwitch=a&&x&&!Object(P.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=u.levels,this.startFragRequested=!1},g.onLevelLoading=function(c,u){var a=this.levels;if(!a||this.state!==B.State.IDLE)return;var x=a[u.level];(!x.details||x.details.live&&this.levelLastLoaded!==u.level||this.waitForCdnTuneIn(x.details))&&(this.state=B.State.WAITING_LEVEL)},g.onLevelLoaded=function(c,u){var a,x=this.levels,b=u.level,E=u.details,N=E.totalduration;if(!x){this.warn("Levels were reset while loading level "+b);return}this.log("Level "+b+" loaded ["+E.startSN+","+E.endSN+"], cc ["+E.startCC+", "+E.endCC+"] duration:"+N);var U=this.fragCurrent;U&&(this.state===B.State.FRAG_LOADING||this.state===B.State.FRAG_LOADING_WAITING_RETRY)&&(U.level!==u.level&&U.loader&&(this.state=B.State.IDLE,U.loader.abort()));var K=x[b],V=0;if(E.live||(a=K.details)!==null&&a!==void 0&&a.live){if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed)return;V=this.alignPlaylists(E,K.details)}if(K.details=E,this.levelLastLoaded=b,this.hls.trigger(G.Events.LEVEL_UPDATED,{details:E,level:b}),this.state===B.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(E))return;this.state=B.State.IDLE}this.startFragRequested?E.live&&this.synchronizeToLiveEdge(E):this.setStartPosition(E,V),this.tick()},g._handleFragmentLoadProgress=function(c){var u,a=c.frag,x=c.part,b=c.payload,E=this.levels;if(!E){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var N=E[a.level],U=N.details;if(!U){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var K=N.videoCodec,V=U.PTSKnown||!U.live,R=(u=a.initSegment)===null||u===void 0?void 0:u.data,M=this._getAudioCodec(N),$=this.transmuxer=this.transmuxer||new A.default(this.hls,k.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ee=x?x.index:-1,oe=ee!==-1,fe=new O.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,b.byteLength,ee,oe),ke=this.initPTS[a.cc];$.push(b,R,M,K,a,x,U.totalduration,V,fe,ke)},g.onAudioTrackSwitching=function(c,u){var a=this.altAudio,x=!!u.url,b=u.id;if(!x){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var E=this.fragCurrent;E!=null&&E.loader&&(this.log("Switching to main audio track, cancel main fragment load"),E.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var N=this.hls;a&&N.trigger(G.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),N.trigger(G.Events.AUDIO_TRACK_SWITCHED,{id:b})}},g.onAudioTrackSwitched=function(c,u){var a=u.id,x=!!this.hls.audioTracks[a].url;if(x){var b=this.videoBuffer;b&&this.mediaBuffer!==b&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=b)}this.altAudio=x,this.tick()},g.onBufferCreated=function(c,u){var a=u.tracks,x,b,E=!1;for(var N in a){var U=a[N];if(U.id==="main"){if(b=N,x=U,N==="video"){var K=a[N];K&&(this.videoBuffer=K.buffer)}}else E=!0}E&&x?(this.log("Alternate track found, use "+b+".buffered to schedule main fragment loading"),this.mediaBuffer=x.buffer):this.mediaBuffer=this.media},g.onFragBuffered=function(c,u){var a=u.frag,x=u.part;if(a&&a.type!==k.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(x?" p: "+x.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===B.State.PARSED&&(this.state=B.State.IDLE);return}var b=x?x.stats:a.stats;this.fragLastKbps=Math.round(8*b.total/(b.buffering.end-b.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,x)},g.onError=function(c,u){switch(u.details){case C.ErrorDetails.FRAG_LOAD_ERROR:case C.ErrorDetails.FRAG_LOAD_TIMEOUT:case C.ErrorDetails.KEY_LOAD_ERROR:case C.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(k.PlaylistLevelType.MAIN,u);break;case C.ErrorDetails.LEVEL_LOAD_ERROR:case C.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==B.State.ERROR&&(u.fatal?(this.warn(""+u.details),this.state=B.State.ERROR):!u.levelRetry&&this.state===B.State.WAITING_LEVEL&&(this.state=B.State.IDLE));break;case C.ErrorDetails.BUFFER_FULL_ERROR:if(u.parent==="main"&&(this.state===B.State.PARSING||this.state===B.State.PARSED)){var a=!0,x=this.getFwdBufferInfo(this.media,k.PlaylistLevelType.MAIN);x&&x.len>.5&&(a=!this.reduceMaxBufferLength(x.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},g.checkBuffer=function(){var c=this.media,u=this.gapController;if(!c||!u||!c.readyState)return;var a=j.BufferHelper.getBuffered(c);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):u.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},g.onFragLoadEmergencyAborted=function(){this.state=B.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},g.onBufferFlushed=function(c,u){var a=u.type;if(a!==y.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var x=(a===y.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(x,a,k.PlaylistLevelType.MAIN)}},g.onLevelsUpdated=function(c,u){this.levels=u.levels},g.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},g.seekToStartPos=function(){var c=this.media,u=c.currentTime,a=this.startPosition;if(a>=0&&u<a){if(c.seeking){S.logger.log("could not seek to "+a+", already seeking at "+u);return}var x=j.BufferHelper.getBuffered(c),b=x.length?x.start(0):0,E=b-a;E>0&&(E<this.config.maxBufferHole||E<this.config.maxFragLookUpTolerance)&&(S.logger.log("adjusting start position by "+E+" to match buffer start"),a+=E,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+u),c.currentTime=a}},g._getAudioCodec=function(c){var u=this.config.defaultAudioCodec||c.audioCodec;return this.audioCodecSwap&&u&&(this.log("Swapping audio codec"),u.indexOf("mp4a.40.5")!==-1?u="mp4a.40.2":u="mp4a.40.5"),u},g._loadBitrateTestFrag=function(c){var u=this;this._doFragLoad(c).then(function(a){var x=u.hls;if(!a||x.nextLoadLevel||u.fragContextChanged(c))return;u.fragLoadError=0,u.state=B.State.IDLE,u.startFragRequested=!1,u.bitrateTest=!1;var b=c.stats;b.parsing.start=b.parsing.end=b.buffering.start=b.buffering.end=self.performance.now(),x.trigger(G.Events.FRAG_LOADED,a)})},g._handleTransmuxComplete=function(c){var u,a="main",x=this.hls,b=c.remuxResult,E=c.chunkMeta,N=this.getCurrentContext(E);if(!N){this.warn("The loading context changed while buffering fragment "+E.sn+" of level "+E.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(E.level);return}var U=N.frag,K=N.part,V=N.level,R=b.video,M=b.text,$=b.id3,ee=b.initSegment,oe=this.altAudio?void 0:b.audio;if(this.fragContextChanged(U))return;if(this.state=B.State.PARSING,ee){ee.tracks&&(this._bufferInitSegment(V,ee.tracks,U,E),x.trigger(G.Events.FRAG_PARSING_INIT_SEGMENT,{frag:U,id:a,tracks:ee.tracks}));var fe=ee.initPTS,ke=ee.timescale;Object(Z.isFiniteNumber)(fe)&&(this.initPTS[U.cc]=fe,x.trigger(G.Events.INIT_PTS_FOUND,{frag:U,id:a,initPTS:fe,timescale:ke}))}if(R&&b.independent!==!1){if(V.details){var Ee=R.startPTS,Te=R.endPTS,we=R.startDTS,Ce=R.endDTS;if(K)K.elementaryStreams[R.type]={startPTS:Ee,endPTS:Te,startDTS:we,endDTS:Ce};else if(R.firstKeyFrame&&R.independent&&(this.couldBacktrack=!0),R.dropped&&R.independent){var me=this.getLoadPosition()+this.config.maxBufferHole;if(me<Ee){this.backtrack(U);return}U.setElementaryStreamInfo(R.type,U.start,Te,U.start,Ce,!0)}U.setElementaryStreamInfo(R.type,Ee,Te,we,Ce),this.bufferFragmentData(R,U,K,E)}}else if(b.independent===!1){this.backtrack(U);return}if(oe){var ue=oe.startPTS,te=oe.endPTS,de=oe.startDTS,ae=oe.endDTS;K&&(K.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:ue,endPTS:te,startDTS:de,endDTS:ae}),U.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,ue,te,de,ae),this.bufferFragmentData(oe,U,K,E)}if($!=null&&(u=$.samples)!==null&&u!==void 0&&u.length){var _e={frag:U,id:a,samples:$.samples};x.trigger(G.Events.FRAG_PARSING_METADATA,_e)}if(M){var Re={frag:U,id:a,samples:M.samples};x.trigger(G.Events.FRAG_PARSING_USERDATA,Re)}},g._bufferInitSegment=function(c,u,a,x){var b=this;if(this.state!==B.State.PARSING)return;this.audioOnly=!!u.audio&&!u.video,this.altAudio&&!this.audioOnly&&delete u.audio;var E=u.audio,N=u.video,U=u.audiovideo;if(E){var K=c.audioCodec,V=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(K&&(K.indexOf("mp4a.40.5")!==-1?K="mp4a.40.2":K="mp4a.40.5"),E.metadata.channelCount!==1&&V.indexOf("firefox")===-1&&(K="mp4a.40.5")),V.indexOf("android")!==-1&&E.container!=="audio/mpeg"&&(K="mp4a.40.2",this.log("Android: force audio codec to "+K)),c.audioCodec&&c.audioCodec!==K&&this.log('Swapping manifest audio codec "'+c.audioCodec+'" for "'+K+'"'),E.levelCodec=K,E.id="main",this.log("Init audio buffer, container:"+E.container+", codecs[selected/level/parsed]=["+(K||"")+"/"+(c.audioCodec||"")+"/"+E.codec+"]")}N&&(N.levelCodec=c.videoCodec,N.id="main",this.log("Init video buffer, container:"+N.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+N.codec+"]")),U&&this.log("Init audiovideo buffer, container:"+U.container+", codecs[level/parsed]=["+(c.attrs.CODECS||"")+"/"+U.codec+"]"),this.hls.trigger(G.Events.BUFFER_CODECS,u),Object.keys(u).forEach(function(R){var M=u[R],$=M.initSegment;$!=null&&$.byteLength&&b.hls.trigger(G.Events.BUFFER_APPENDING,{type:R,data:$,frag:a,part:null,chunkMeta:x,parent:a.type})}),this.tick()},g.backtrack=function(c){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(c);var u=this.fragmentTracker.backtrack(c);this.fragPrevious=null,this.nextLoadPosition=c.start,u?this.resetFragmentLoading(c):this.state=B.State.BACKTRACKING},g.checkFragmentChanged=function(){var c=this.media,u=null;if(c&&c.readyState>1&&c.seeking===!1){var a=c.currentTime;if(j.BufferHelper.isBuffered(c,a)?u=this.getAppendedFrag(a):j.BufferHelper.isBuffered(c,a+.1)&&(u=this.getAppendedFrag(a+.1)),u){var x=this.fragPlaying,b=u.level;(!x||u.sn!==x.sn||x.level!==b||u.urlId!==x.urlId)&&(this.hls.trigger(G.Events.FRAG_CHANGED,{frag:u}),(!x||x.level!==b)&&this.hls.trigger(G.Events.LEVEL_SWITCHED,{level:b}),this.fragPlaying=u)}}},o(L,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var u=this.getAppendedFrag(c.currentTime);if(u)return u.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var u=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(u)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),L}(B.default)},"./src/controller/subtitle-stream-controller.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"SubtitleStreamController",function(){return l});var Z=D("./src/events.ts"),B=D("./src/utils/logger.ts"),P=D("./src/utils/buffer-helper.ts"),G=D("./src/controller/fragment-finders.ts"),j=D("./src/utils/discontinuities.ts"),I=D("./src/controller/level-helper.ts"),k=D("./src/controller/fragment-tracker.ts"),y=D("./src/controller/base-stream-controller.ts"),A=D("./src/types/loader.ts"),O=D("./src/types/level.ts");function _(h,w){for(var p=0;p<w.length;p++){var f=w[p];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(h,f.key,f)}}function C(h,w,p){return w&&_(h.prototype,w),p&&_(h,p),h}function S(h,w){h.prototype=Object.create(w.prototype),h.prototype.constructor=h,d(h,w)}function d(h,w){return d=Object.setPrototypeOf||function(f,L){return f.__proto__=L,f},d(h,w)}var o=500,l=function(h){S(w,h);function w(f,L){var g;return g=h.call(this,f,L,"[subtitle-stream-controller]")||this,g.levels=[],g.currentTrackId=-1,g.tracksBuffered=[],g.mainDetails=null,g._registerListeners(),g}var p=w.prototype;return p.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},p._registerListeners=function(){var L=this.hls;L.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.on(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),L.on(Z.Events.LEVEL_LOADED,this.onLevelLoaded,this),L.on(Z.Events.ERROR,this.onError,this),L.on(Z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),L.on(Z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),L.on(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),L.on(Z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),L.on(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},p._unregisterListeners=function(){var L=this.hls;L.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.off(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),L.off(Z.Events.LEVEL_LOADED,this.onLevelLoaded,this),L.off(Z.Events.ERROR,this.onError,this),L.off(Z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),L.off(Z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),L.off(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),L.off(Z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),L.off(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},p.startLoad=function(){this.stopLoad(),this.state=y.State.IDLE,this.setInterval(o),this.tick()},p.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},p.onLevelLoaded=function(L,g){this.mainDetails=g.details},p.onSubtitleFragProcessed=function(L,g){var m=g.frag,c=g.success;if(this.fragPrevious=m,this.state=y.State.IDLE,!c)return;var u=this.tracksBuffered[this.currentTrackId];if(!u)return;for(var a,x=m.start,b=0;b<u.length;b++)if(x>=u[b].start&&x<=u[b].end){a=u[b];break}var E=m.start+m.duration;a?a.end=E:(a={start:x,end:E},u.push(a)),this.fragmentTracker.fragBuffered(m)},p.onBufferFlushing=function(L,g){var m=g.startOffset,c=g.endOffset;if(m===0&&c!==Number.POSITIVE_INFINITY){var u=this.currentTrackId,a=this.levels;if(!a.length||!a[u]||!a[u].details)return;var x=a[u].details,b=x.targetduration,E=c-b;if(E<=0)return;g.endOffsetSubtitles=Math.max(0,E),this.tracksBuffered.forEach(function(N){for(var U=0;U<N.length;){if(N[U].end<=E){N.shift();continue}else if(N[U].start<E)N[U].start=E;else break;U++}}),this.fragmentTracker.removeFragmentsInRange(m,E,A.PlaylistLevelType.SUBTITLE)}},p.onError=function(L,g){var m,c=g.frag;if(!c||c.type!==A.PlaylistLevelType.SUBTITLE)return;(m=this.fragCurrent)!==null&&m!==void 0&&m.loader&&this.fragCurrent.loader.abort(),this.state=y.State.IDLE},p.onSubtitleTracksUpdated=function(L,g){var m=this,c=g.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(u){return new O.Level(u)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(u){m.tracksBuffered[u.id]=[]}),this.mediaBuffer=null},p.onSubtitleTrackSwitch=function(L,g){if(this.currentTrackId=g.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var m=this.levels[this.currentTrackId];m!=null&&m.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,m&&this.setInterval(o)},p.onSubtitleTrackLoaded=function(L,g){var m,c=g.details,u=g.id,a=this.currentTrackId,x=this.levels;if(!x.length)return;var b=x[a];if(u>=x.length||u!==a||!b)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(m=b.details)!==null&&m!==void 0&&m.live){var E=this.mainDetails;if(c.deltaUpdateFailed||!E)return;var N=E.fragments[0];if(!b.details)c.hasProgramDateTime&&E.hasProgramDateTime?Object(j.alignMediaPlaylistByPDT)(c,E):N&&Object(I.addSliding)(c,N.start);else{var U=this.alignPlaylists(c,b.details);U===0&&N&&Object(I.addSliding)(c,N.start)}}if(b.details=c,this.levelLastLoaded=u,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===y.State.IDLE){var K=Object(G.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);K||(this.warn("Subtitle playlist not aligned with playback"),b.details=void 0)}},p._handleFragmentLoadComplete=function(L){var g=L.frag,m=L.payload,c=g.decryptdata,u=this.hls;if(this.fragContextChanged(g))return;if(m&&m.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(m),c.key.buffer,c.iv.buffer).then(function(x){var b=performance.now();u.trigger(Z.Events.FRAG_DECRYPTED,{frag:g,payload:x,stats:{tstart:a,tdecrypt:b}})})}},p.doTick=function(){if(!this.media){this.state=y.State.IDLE;return}if(this.state===y.State.IDLE){var L,g=this.currentTrackId,m=this.levels;if(!m.length||!m[g]||!m[g].details)return;var c=m[g].details,u=c.targetduration,a=this.config,x=this.media,b=P.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,x.currentTime-u,a.maxBufferHole),E=b.end,N=b.len,U=this.getMaxBufferLength()+u;if(N>U)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var K=c.fragments,V=K.length,R=c.edge,M,$=this.fragPrevious;if(E<R){var ee=a.maxFragLookUpTolerance;$&&c.hasProgramDateTime&&(M=Object(G.findFragmentByPDT)(K,$.endProgramDateTime,ee)),M||(M=Object(G.findFragmentByPTS)($,K,E,ee),!M&&$&&$.start<K[0].start&&(M=K[0]))}else M=K[V-1];(L=M)!==null&&L!==void 0&&L.encrypted?(B.logger.log("Loading key for "+M.sn),this.state=y.State.KEY_LOADING,this.hls.trigger(Z.Events.KEY_LOADING,{frag:M})):M&&this.fragmentTracker.getState(M)===k.FragmentState.NOT_LOADED&&this.loadFragment(M,c,E)}},p.loadFragment=function(L,g,m){this.fragCurrent=L,h.prototype.loadFragment.call(this,L,g,m)},C(w,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),w}(y.default)},"./src/controller/subtitle-track-controller.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/events.ts"),B=D("./src/utils/texttrack-utils.ts"),P=D("./src/controller/base-playlist-controller.ts"),G=D("./src/types/loader.ts");function j(_,C){for(var S=0;S<C.length;S++){var d=C[S];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(_,d.key,d)}}function I(_,C,S){return C&&j(_.prototype,C),S&&j(_,S),_}function k(_,C){_.prototype=Object.create(C.prototype),_.prototype.constructor=_,y(_,C)}function y(_,C){return y=Object.setPrototypeOf||function(d,o){return d.__proto__=o,d},y(_,C)}var A=function(_){k(C,_);function C(d){var o;return o=_.call(this,d,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var S=C.prototype;return S.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,_.prototype.destroy.call(this)},S.registerListeners=function(){var o=this.hls;o.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(Z.Events.ERROR,this.onError,this)},S.unregisterListeners=function(){var o=this.hls;o.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(Z.Events.ERROR,this.onError,this)},S.onMediaAttached=function(o,l){if(this.media=l.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)},S.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},S.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 o=O(this.media.textTracks);o.forEach(function(l){Object(B.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},S.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},S.onManifestParsed=function(o,l){this.tracks=l.subtitleTracks},S.onSubtitleTrackLoaded=function(o,l){var h=l.id,w=l.details,p=this.trackId,f=this.tracksInGroup[p];if(!f){this.warn("Invalid subtitle track id "+h);return}var L=f.details;f.details=l.details,this.log("subtitle track "+h+" loaded ["+w.startSN+"-"+w.endSN+"]"),h===this.trackId&&(this.retryCount=0,this.playlistLoaded(h,l,L))},S.onLevelLoading=function(o,l){this.switchLevel(l.level)},S.onLevelSwitching=function(o,l){this.switchLevel(l.level)},S.switchLevel=function(o){var l=this.hls.levels[o];if(!(l!=null&&l.textGroupIds))return;var h=l.textGroupIds[l.urlId];if(this.groupId!==h){var w=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,p=this.tracks.filter(function(g){return!h||g.groupId===h});this.tracksInGroup=p;var f=this.findTrackId(w==null?void 0:w.name)||this.findTrackId();this.groupId=h;var L={subtitleTracks:p};this.log("Updating subtitle tracks, "+p.length+' track(s) found in "'+h+'" group-id'),this.hls.trigger(Z.Events.SUBTITLE_TRACKS_UPDATED,L),f!==-1&&this.setSubtitleTrack(f,w)}},S.findTrackId=function(o){for(var l=this.tracksInGroup,h=0;h<l.length;h++){var w=l[h];if((!this.selectDefaultTrack||w.default)&&(!o||o===w.name))return w.id}return-1},S.onError=function(o,l){if(_.prototype.onError.call(this,o,l),l.fatal||!l.context)return;l.context.type===G.PlaylistContextType.SUBTITLE_TRACK&&l.context.id===this.trackId&&l.context.groupId===this.groupId&&this.retryLoadingOrFail(l)},S.loadPlaylist=function(o){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var h=l.id,w=l.groupId,p=l.url;if(o)try{p=o.addDirectives(p)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("Loading subtitle playlist for id "+h),this.hls.trigger(Z.Events.SUBTITLE_TRACK_LOADING,{url:p,id:h,groupId:w,deliveryDirectives:o||null})}},S.toggleTrackModes=function(o){var l=this,h=this.media,w=this.subtitleDisplay,p=this.trackId;if(!h)return;var f=O(h.textTracks),L=f.filter(function(c){return c.groupId===l.groupId});if(o===-1)[].slice.call(f).forEach(function(c){c.mode="disabled"});else{var g=L[p];g&&(g.mode="disabled")}var m=L[o];m&&(m.mode=w?"showing":"hidden")},S.setSubtitleTrack=function(o,l){var h,w=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(h=w[o])!==null&&h!==void 0&&h.details)||o<-1||o>=w.length)return;this.clearTimer();var p=w[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,p){var f=p.id,L=p.groupId,g=L===void 0?"":L,m=p.name,c=p.type,u=p.url;this.hls.trigger(Z.Events.SUBTITLE_TRACK_SWITCH,{id:f,groupId:g,name:m,type:c,url:u});var a=this.switchParams(p.url,l==null?void 0:l.details);this.loadPlaylist(a)}else this.hls.trigger(Z.Events.SUBTITLE_TRACK_SWITCH,{id:o})},S.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,l=O(this.media.textTracks),h=0;h<l.length;h++)if(l[h].mode==="hidden")o=h;else if(l[h].mode==="showing"){o=h;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},I(C,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var l=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,l)}}]),C}(P.default);function O(_){for(var C=[],S=0;S<_.length;S++){var d=_[S];d.kind==="subtitles"&&d.label&&C.push(_[S])}return C}Q.default=A},"./src/controller/timeline-controller.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"TimelineController",function(){return O});var Z=D("./src/polyfills/number.ts"),B=D("./src/events.ts"),P=D("./src/utils/cea-608-parser.ts"),G=D("./src/utils/output-filter.ts"),j=D("./src/utils/webvtt-parser.ts"),I=D("./src/utils/texttrack-utils.ts"),k=D("./src/utils/imsc1-ttml-parser.ts"),y=D("./src/types/loader.ts"),A=D("./src/utils/logger.ts"),O=function(){function d(l){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=S(),this.captionsProperties=void 0,this.hls=l,this.config=l.config,this.Cues=l.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 h=new G.default(this,"textTrack1"),w=new G.default(this,"textTrack2"),p=new G.default(this,"textTrack3"),f=new G.default(this,"textTrack4");this.cea608Parser1=new P.default(1,h,w),this.cea608Parser2=new P.default(3,p,f)}l.on(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(B.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.on(B.Events.FRAG_LOADING,this.onFragLoading,this),l.on(B.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(B.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.on(B.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.on(B.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(B.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.on(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=d.prototype;return o.destroy=function(){var h=this.hls;h.off(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),h.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),h.off(B.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),h.off(B.Events.FRAG_LOADING,this.onFragLoading,this),h.off(B.Events.FRAG_LOADED,this.onFragLoaded,this),h.off(B.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),h.off(B.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),h.off(B.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.off(B.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),h.off(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(h,w,p,f,L){for(var g=!1,m=L.length;m--;){var c=L[m],u=C(c[0],c[1],w,p);if(u>=0&&(c[0]=Math.min(c[0],w),c[1]=Math.max(c[1],p),g=!0,u/(p-w)>.5))return}if(g||L.push([w,p]),this.config.renderTextTracksNatively){var a=this.captionsTracks[h];this.Cues.newCue(a,w,p,f)}else{var x=this.Cues.newCue(null,w,p,f);this.hls.trigger(B.Events.CUES_PARSED,{type:"captions",cues:x,track:h})}},o.onInitPtsFound=function(h,w){var p=this,f=w.frag,L=w.id,g=w.initPTS,m=w.timescale,c=this.unparsedVttFrags;L==="main"&&(this.initPTS[f.cc]=g,this.timescale[f.cc]=m),c.length&&(this.unparsedVttFrags=[],c.forEach(function(u){p.onFragLoaded(B.Events.FRAG_LOADED,u)}))},o.getExistingTrack=function(h){var w=this.media;if(w)for(var p=0;p<w.textTracks.length;p++){var f=w.textTracks[p];if(f[h])return f}return null},o.createCaptionsTrack=function(h){this.config.renderTextTracksNatively?this.createNativeTrack(h):this.createNonNativeTrack(h)},o.createNativeTrack=function(h){if(this.captionsTracks[h])return;var w=this.captionsProperties,p=this.captionsTracks,f=this.media,L=w[h],g=L.label,m=L.languageCode,c=this.getExistingTrack(h);if(c)p[h]=c,Object(I.clearCurrentCues)(p[h]),Object(I.sendAddTrackEvent)(p[h],f);else{var u=this.createTextTrack("captions",g,m);u&&(u[h]=!0,p[h]=u)}},o.createNonNativeTrack=function(h){if(this.nonNativeCaptionsTracks[h])return;var w=this.captionsProperties[h];if(!w)return;var p=w.label,f={_id:h,label:p,kind:"captions",default:w.media?!!w.media.default:!1,closedCaptions:w.media};this.nonNativeCaptionsTracks[h]=f,this.hls.trigger(B.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[f]})},o.createTextTrack=function(h,w,p){var f=this.media;return f?f.addTextTrack(h,w,p):void 0},o.onMediaAttaching=function(h,w){this.media=w.media,this._cleanTracks()},o.onMediaDetaching=function(){var h=this.captionsTracks;Object.keys(h).forEach(function(w){Object(I.clearCurrentCues)(h[w]),delete h[w]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=S(),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())},o._cleanTracks=function(){var h=this.media;if(!h)return;var w=h.textTracks;if(w)for(var p=0;p<w.length;p++)Object(I.clearCurrentCues)(w[p])},o.onSubtitleTracksUpdated=function(h,w){var p=this;this.textTracks=[];var f=w.subtitleTracks||[],L=f.some(function(u){return u.textCodec===k.IMSC1_CODEC});if(this.config.enableWebVTT||L&&this.config.enableIMSC1){var g=this.tracks&&f&&this.tracks.length===f.length;if(this.tracks=f||[],this.config.renderTextTracksNatively){var m=this.media?this.media.textTracks:[];this.tracks.forEach(function(u,a){var x;if(a<m.length){for(var b=null,E=0;E<m.length;E++)if(_(m[E],u)){b=m[E];break}b&&(x=b)}x?Object(I.clearCurrentCues)(x):(x=p.createTextTrack("subtitles",u.name,u.lang),x&&(x.mode="disabled")),x&&(x.groupId=u.groupId,p.textTracks.push(x))})}else if(!g&&this.tracks&&this.tracks.length){var c=this.tracks.map(function(u){return{label:u.name,kind:u.type.toLowerCase(),default:u.default,subtitleTrack:u}});this.hls.trigger(B.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},o.onManifestLoaded=function(h,w){var p=this;this.config.enableCEA708Captions&&w.captions&&w.captions.forEach(function(f){var L=/(?:CC|SERVICE)([1-4])/.exec(f.instreamId);if(!L)return;var g="textTrack"+L[1],m=p.captionsProperties[g];if(!m)return;m.label=f.name,f.lang&&(m.languageCode=f.lang),m.media=f})},o.onFragLoading=function(h,w){var p=this.cea608Parser1,f=this.cea608Parser2,L=this.lastSn,g=this.lastPartIndex;if(!this.enabled||!(p&&f))return;if(w.frag.type===y.PlaylistLevelType.MAIN){var m,c,u=w.frag.sn,a=(m=w==null||((c=w.part)===null||c===void 0)?void 0:c.index)!=null?m:-1;u===L+1||u===L&&a===g+1||(p.reset(),f.reset()),this.lastSn=u,this.lastPartIndex=a}},o.onFragLoaded=function(h,w){var p=w.frag,f=w.payload,L=this.initPTS,g=this.unparsedVttFrags;if(p.type===y.PlaylistLevelType.SUBTITLE)if(f.byteLength){if(!Object(Z.isFiniteNumber)(L[p.cc])){g.push(w),L.length&&this.hls.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:p,error:new Error("Missing initial subtitle PTS")});return}var m=p.decryptdata;if(m==null||m.key==null||m.method!=="AES-128"){var c=this.tracks[p.level],u=this.vttCCs;u[p.cc]||(u[p.cc]={start:p.start,prevCC:this.prevCC,new:!0},this.prevCC=p.cc),c&&c.textCodec===k.IMSC1_CODEC?this._parseIMSC1(p,f):this._parseVTTs(p,f,u)}}else this.hls.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:p,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(h,w){var p=this,f=this.hls;Object(k.parseIMSC1)(w,this.initPTS[h.cc],this.timescale[h.cc],function(L){p._appendCues(L,h.level),f.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(L){A.logger.log("Failed to parse IMSC1: "+L),f.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:L})})},o._parseVTTs=function(h,w,p){var f=this,L=this.hls;Object(j.parseWebVTT)(w,this.initPTS[h.cc],this.timescale[h.cc],p,h.cc,h.start,function(g){f._appendCues(g,h.level),L.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(g){f._fallbackToIMSC1(h,w),A.logger.log("Failed to parse VTT cue: "+g),L.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:g})})},o._fallbackToIMSC1=function(h,w){var p=this,f=this.tracks[h.level];f.textCodec||Object(k.parseIMSC1)(w,this.initPTS[h.cc],this.timescale[h.cc],function(){f.textCodec=k.IMSC1_CODEC,p._parseIMSC1(h,w)},function(){f.textCodec="wvtt"})},o._appendCues=function(h,w){var p=this.hls;if(this.config.renderTextTracksNatively){var f=this.textTracks[w];if(f.mode==="disabled")return;h.forEach(function(m){return Object(I.addCueToTrack)(f,m)})}else{var L=this.tracks[w],g=L.default?"default":"subtitles"+w;p.trigger(B.Events.CUES_PARSED,{type:"subtitles",cues:h,track:g})}},o.onFragDecrypted=function(h,w){var p=w.frag;if(p.type===y.PlaylistLevelType.SUBTITLE){if(!Object(Z.isFiniteNumber)(this.initPTS[p.cc])){this.unparsedVttFrags.push(w);return}this.onFragLoaded(B.Events.FRAG_LOADED,w)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(h,w){var p=this.cea608Parser1,f=this.cea608Parser2;if(!this.enabled||!(p&&f))return;for(var L=0;L<w.samples.length;L++){var g=w.samples[L].bytes;if(g){var m=this.extractCea608Data(g);p.addData(w.samples[L].pts,m[0]),f.addData(w.samples[L].pts,m[1])}}},o.onBufferFlushing=function(h,w){var p=w.startOffset,f=w.endOffset,L=w.endOffsetSubtitles,g=w.type,m=this.media;if(!m||m.currentTime<f)return;if(!g||g==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(a){return Object(I.removeCuesInRange)(c[a],p,f)})}if(this.config.renderTextTracksNatively&&(p===0&&L!==void 0)){var u=this.textTracks;Object.keys(u).forEach(function(a){return Object(I.removeCuesInRange)(u[a],p,L)})}},o.extractCea608Data=function(h){for(var w=h[0]&31,p=2,f=[[],[]],L=0;L<w;L++){var g=h[p++],m=127&h[p++],c=127&h[p++],u=(4&g)!==0,a=3&g;if(m===0&&c===0)continue;u&&((a===0||a===1)&&(f[a].push(m),f[a].push(c)))}return f},d}();function _(d,o){return d&&d.label===o.name&&!(d.textTrack1||d.textTrack2)}function C(d,o,l,h){return Math.min(o,h)-Math.max(d,l)}function S(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return Z});var Z=function(){function B(G,j){this.subtle=void 0,this.aesIV=void 0,this.subtle=G,this.aesIV=j}var P=B.prototype;return P.decrypt=function(j,I){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},I,j)},B}()},"./src/crypt/aes-decryptor.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"removePadding",function(){return B}),D.d(Q,"default",function(){return P});var Z=D("./src/utils/typed-array.ts");function B(G){var j=G.byteLength,I=j&&new DataView(G.buffer).getUint8(j-1);return I?Object(Z.sliceUint8)(G,0,j-I):G}var P=function(){function G(){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 j=G.prototype;return j.uint8ArrayToUint32Array_=function(k){for(var y=new DataView(k),A=new Uint32Array(4),O=0;O<4;O++)A[O]=y.getUint32(O*4);return A},j.initTable=function(){var k=this.sBox,y=this.invSBox,A=this.subMix,O=A[0],_=A[1],C=A[2],S=A[3],d=this.invSubMix,o=d[0],l=d[1],h=d[2],w=d[3],p=new Uint32Array(256),f=0,L=0,g=0;for(g=0;g<256;g++)g<128?p[g]=g<<1:p[g]=g<<1^283;for(g=0;g<256;g++){var m=L^L<<1^L<<2^L<<3^L<<4;m=m>>>8^m&255^99,k[f]=m,y[m]=f;var c=p[f],u=p[c],a=p[u],x=p[m]*257^m*16843008;O[f]=x<<24|x>>>8,_[f]=x<<16|x>>>16,C[f]=x<<8|x>>>24,S[f]=x,x=a*16843009^u*65537^c*257^f*16843008,o[m]=x<<24|x>>>8,l[m]=x<<16|x>>>16,h[m]=x<<8|x>>>24,w[m]=x,f?(f=c^p[p[p[a^c]]],L^=p[p[L]]):f=L=1}},j.expandKey=function(k){for(var y=this.uint8ArrayToUint32Array_(k),A=!0,O=0;O<y.length&&A;)A=y[O]===this.key[O],O++;if(A)return;this.key=y;var _=this.keySize=y.length;if(_!==4&&_!==6&&_!==8)throw new Error("Invalid aes key size="+_);var C=this.ksRows=(_+6+1)*4,S,d,o=this.keySchedule=new Uint32Array(C),l=this.invKeySchedule=new Uint32Array(C),h=this.sBox,w=this.rcon,p=this.invSubMix,f=p[0],L=p[1],g=p[2],m=p[3],c,u;for(S=0;S<C;S++){if(S<_){c=o[S]=y[S];continue}u=c,S%_===0?(u=u<<8|u>>>24,u=h[u>>>24]<<24|h[u>>>16&255]<<16|h[u>>>8&255]<<8|h[u&255],u^=w[S/_|0]<<24):_>6&&S%_===4&&(u=h[u>>>24]<<24|h[u>>>16&255]<<16|h[u>>>8&255]<<8|h[u&255]),o[S]=c=(o[S-_]^u)>>>0}for(d=0;d<C;d++)S=C-d,d&3?u=o[S]:u=o[S-4],d<4||S<=4?l[d]=u:l[d]=f[h[u>>>24]]^L[h[u>>>16&255]]^g[h[u>>>8&255]]^m[h[u&255]],l[d]=l[d]>>>0},j.networkToHostOrderSwap=function(k){return k<<24|(k&65280)<<8|(k&16711680)>>8|k>>>24},j.decrypt=function(k,y,A){for(var O=this.keySize+6,_=this.invKeySchedule,C=this.invSBox,S=this.invSubMix,d=S[0],o=S[1],l=S[2],h=S[3],w=this.uint8ArrayToUint32Array_(A),p=w[0],f=w[1],L=w[2],g=w[3],m=new Int32Array(k),c=new Int32Array(m.length),u,a,x,b,E,N,U,K,V,R,M,$,ee,oe,fe=this.networkToHostOrderSwap;y<m.length;){for(V=fe(m[y]),R=fe(m[y+1]),M=fe(m[y+2]),$=fe(m[y+3]),E=V^_[0],N=$^_[1],U=M^_[2],K=R^_[3],ee=4,oe=1;oe<O;oe++)u=d[E>>>24]^o[N>>16&255]^l[U>>8&255]^h[K&255]^_[ee],a=d[N>>>24]^o[U>>16&255]^l[K>>8&255]^h[E&255]^_[ee+1],x=d[U>>>24]^o[K>>16&255]^l[E>>8&255]^h[N&255]^_[ee+2],b=d[K>>>24]^o[E>>16&255]^l[N>>8&255]^h[U&255]^_[ee+3],E=u,N=a,U=x,K=b,ee=ee+4;u=C[E>>>24]<<24^C[N>>16&255]<<16^C[U>>8&255]<<8^C[K&255]^_[ee],a=C[N>>>24]<<24^C[U>>16&255]<<16^C[K>>8&255]<<8^C[E&255]^_[ee+1],x=C[U>>>24]<<24^C[K>>16&255]<<16^C[E>>8&255]<<8^C[N&255]^_[ee+2],b=C[K>>>24]<<24^C[E>>16&255]<<16^C[N>>8&255]<<8^C[U&255]^_[ee+3],c[y]=fe(u^p),c[y+1]=fe(b^f),c[y+2]=fe(x^L),c[y+3]=fe(a^g),p=V,f=R,L=M,g=$,y=y+4}return c.buffer},G}()},"./src/crypt/decrypter.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return y});var Z=D("./src/crypt/aes-crypto.ts"),B=D("./src/crypt/fast-aes-key.ts"),P=D("./src/crypt/aes-decryptor.ts"),G=D("./src/utils/logger.ts"),j=D("./src/utils/mp4-tools.ts"),I=D("./src/utils/typed-array.ts"),k=16,y=function(){function A(_,C,S){var d=S===void 0?{}:S,o=d.removePKCS7Padding,l=o===void 0?!0:o;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=_,this.config=C,this.removePKCS7Padding=l,l)try{var h=self.crypto;h&&(this.subtle=h.subtle||h.webkitSubtle)}catch(w){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var O=A.prototype;return O.destroy=function(){this.observer=null},O.isSync=function(){return this.config.enableSoftwareAES},O.flush=function(){var C=this.currentResult;if(!C){this.reset();return}var S=new Uint8Array(C);return this.reset(),this.removePKCS7Padding?Object(P.removePadding)(S):S},O.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},O.decrypt=function(C,S,d,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(C),S,d);var l=this.flush();l&&o(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(C),S,d).then(o)},O.softwareDecrypt=function(C,S,d){var o=this.currentIV,l=this.currentResult,h=this.remainderData;this.logOnce("JS AES decrypt"),h&&(C=Object(j.appendUint8Array)(h,C),this.remainderData=null);var w=this.getValidChunk(C);if(!w.length)return null;o&&(d=o);var p=this.softwareDecrypter;p||(p=this.softwareDecrypter=new P.default),p.expandKey(S);var f=l;return this.currentResult=p.decrypt(w.buffer,0,d),this.currentIV=Object(I.sliceUint8)(w,-16).buffer,f||null},O.webCryptoDecrypt=function(C,S,d){var o=this,l=this.subtle;return(this.key!==S||!this.fastAesKey)&&(this.key=S,this.fastAesKey=new B.default(l,S)),this.fastAesKey.expandKey().then(function(h){if(!l)return Promise.reject(new Error("web crypto not initialized"));var w=new Z.default(l,d);return w.decrypt(C.buffer,h)}).catch(function(h){return o.onWebCryptoError(h,C,S,d)})},O.onWebCryptoError=function(C,S,d,o){return G.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",C),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(S,d,o)},O.getValidChunk=function(C){var S=C,d=C.length-C.length%k;return d!==C.length&&(S=Object(I.sliceUint8)(C,0,d),this.remainderData=Object(I.sliceUint8)(C,d)),S},O.logOnce=function(C){if(!this.logEnabled)return;G.logger.log("[decrypter.ts]: "+C),this.logEnabled=!1},A}()},"./src/crypt/fast-aes-key.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return Z});var Z=function(){function B(G,j){this.subtle=void 0,this.key=void 0,this.subtle=G,this.key=j}var P=B.prototype;return P.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},B}()},"./src/demux/aacdemuxer.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/demux/base-audio-demuxer.ts"),B=D("./src/demux/adts.ts"),P=D("./src/utils/logger.ts"),G=D("./src/demux/id3.ts");function j(y,A){y.prototype=Object.create(A.prototype),y.prototype.constructor=y,I(y,A)}function I(y,A){return I=Object.setPrototypeOf||function(_,C){return _.__proto__=C,_},I(y,A)}var k=function(y){j(A,y);function A(_,C){var S;return S=y.call(this)||this,S.observer=void 0,S.config=void 0,S.observer=_,S.config=C,S}var O=A.prototype;return O.resetInitSegment=function(C,S,d){y.prototype.resetInitSegment.call(this,C,S,d),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:C,duration:d,inputTimeScale:9e4,dropped:0}},A.probe=function(C){if(!C)return!1;for(var S=G.getID3Data(C,0)||[],d=S.length,o=C.length;d<o;d++)if(B.probe(C,d))return P.logger.log("ADTS sync word found !"),!0;return!1},O.canParse=function(C,S){return B.canParse(C,S)},O.appendFrame=function(C,S,d){B.initTrackConfig(C,this.observer,S,d,C.manifestCodec);var o=B.appendFrame(C,S,d,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},A}(Z.default);k.minProbeByteLength=9,Q.default=k},"./src/demux/adts.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"getAudioConfig",function(){return G}),D.d(Q,"isHeaderPattern",function(){return j}),D.d(Q,"getHeaderLength",function(){return I}),D.d(Q,"getFullFrameLength",function(){return k}),D.d(Q,"canGetFrameLength",function(){return y}),D.d(Q,"isHeader",function(){return A}),D.d(Q,"canParse",function(){return O}),D.d(Q,"probe",function(){return _}),D.d(Q,"initTrackConfig",function(){return C}),D.d(Q,"getFrameDuration",function(){return S}),D.d(Q,"parseFrameHeader",function(){return d}),D.d(Q,"appendFrame",function(){return o});var Z=D("./src/utils/logger.ts"),B=D("./src/errors.ts"),P=D("./src/events.ts");function G(l,h,w,p){var f,L,g,m,c=navigator.userAgent.toLowerCase(),u=p,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];f=((h[w+2]&192)>>>6)+1;var x=(h[w+2]&60)>>>2;if(x>a.length-1){l.trigger(P.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+x});return}return g=(h[w+2]&1)<<2,g|=(h[w+3]&192)>>>6,Z.logger.log("manifest codec:"+p+", ADTS type:"+f+", samplingIndex:"+x),/firefox/i.test(c)?x>=6?(f=5,m=new Array(4),L=x-3):(f=2,m=new Array(2),L=x):c.indexOf("android")!==-1?(f=2,m=new Array(2),L=x):(f=5,m=new Array(4),p&&(p.indexOf("mp4a.40.29")!==-1||p.indexOf("mp4a.40.5")!==-1)||!p&&x>=6?L=x-3:((p&&p.indexOf("mp4a.40.2")!==-1&&(x>=6&&g===1||/vivaldi/i.test(c))||!p&&g===1)&&(f=2,m=new Array(2)),L=x)),m[0]=f<<3,m[0]|=(x&14)>>1,m[1]|=(x&1)<<7,m[1]|=g<<3,f===5&&(m[1]|=(L&14)>>1,m[2]=(L&1)<<7,m[2]|=2<<2,m[3]=0),{config:m,samplerate:a[x],channelCount:g,codec:"mp4a.40."+f,manifestCodec:u}}function j(l,h){return l[h]===255&&(l[h+1]&246)===240}function I(l,h){return l[h+1]&1?7:9}function k(l,h){return(l[h+3]&3)<<11|l[h+4]<<3|(l[h+5]&224)>>>5}function y(l,h){return h+5<l.length}function A(l,h){return h+1<l.length&&j(l,h)}function O(l,h){return y(l,h)&&j(l,h)&&k(l,h)<=l.length-h}function _(l,h){if(A(l,h)){var w=I(l,h);if(h+w>=l.length)return!1;var p=k(l,h);if(p<=w)return!1;var f=h+p;return f===l.length||A(l,f)}return!1}function C(l,h,w,p,f){if(!l.samplerate){var L=G(h,w,p,f);if(!L)return;l.config=L.config,l.samplerate=L.samplerate,l.channelCount=L.channelCount,l.codec=L.codec,l.manifestCodec=L.manifestCodec,Z.logger.log("parsed codec:"+l.codec+", rate:"+L.samplerate+", channels:"+L.channelCount)}}function S(l){return 1024*9e4/l}function d(l,h,w,p,f){var L=I(l,h),g=k(l,h);if(g-=L,g>0){var m=w+p*f;return{headerLength:L,frameLength:g,stamp:m}}}function o(l,h,w,p,f){var L=S(l.samplerate),g=d(h,w,p,f,L);if(g){var m=g.frameLength,c=g.headerLength,u=g.stamp,a=c+m,x=Math.max(0,w+a-h.length),b;x?(b=new Uint8Array(a-c),b.set(h.subarray(w+c,h.length),0)):b=h.subarray(w+c,w+a);var E={unit:b,pts:u};return x||l.samples.push(E),{sample:E,length:a,missing:x}}}},"./src/demux/base-audio-demuxer.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"initPTSFn",function(){return k});var Z=D("./src/polyfills/number.ts"),B=D("./src/demux/id3.ts"),P=D("./src/demux/dummy-demuxed-track.ts"),G=D("./src/utils/mp4-tools.ts"),j=D("./src/utils/typed-array.ts"),I=function(){function y(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var A=y.prototype;return A.resetInitSegment=function(_,C,S){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},A.resetTimeStamp=function(){},A.resetContiguity=function(){},A.canParse=function(_,C){return!1},A.appendFrame=function(_,C,S){},A.demux=function(_,C){this.cachedData&&(_=Object(G.appendUint8Array)(this.cachedData,_),this.cachedData=null);var S=B.getID3Data(_,0),d=S?S.length:0,o,l,h=this._audioTrack,w=this._id3Track,p=S?B.getTimeStamp(S):void 0,f=_.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=k(p,C)),S&&S.length>0&&w.samples.push({pts:this.initPTS,dts:this.initPTS,data:S}),l=this.initPTS;d<f;){if(this.canParse(_,d)){var L=this.appendFrame(h,_,d);L?(this.frameIndex++,l=L.sample.pts,d+=L.length,o=d):d=f}else B.canParse(_,d)?(S=B.getID3Data(_,d),w.samples.push({pts:l,dts:l,data:S}),d+=S.length,o=d):d++;if(d===f&&o!==f){var g=Object(j.sliceUint8)(_,o);this.cachedData?this.cachedData=Object(G.appendUint8Array)(this.cachedData,g):this.cachedData=g}}return{audioTrack:h,avcTrack:Object(P.dummyTrack)(),id3Track:w,textTrack:Object(P.dummyTrack)()}},A.demuxSampleAes=function(_,C,S){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},A.flush=function(_){var C=this.cachedData;return C&&(this.cachedData=null,this.demux(C,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(P.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(P.dummyTrack)()}},A.destroy=function(){},y}(),k=function(A,O){return Object(Z.isFiniteNumber)(A)?A*90:O*9e4};Q.default=I},"./src/demux/chunk-cache.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return Z});var Z=function(){function P(){this.chunks=[],this.dataLength=0}var G=P.prototype;return G.push=function(I){this.chunks.push(I),this.dataLength+=I.length},G.flush=function(){var I=this.chunks,k=this.dataLength,y;if(I.length)I.length===1?y=I[0]:y=B(I,k);else return new Uint8Array(0);return this.reset(),y},G.reset=function(){this.chunks.length=0,this.dataLength=0},P}();function B(P,G){for(var j=new Uint8Array(G),I=0,k=0;k<P.length;k++){var y=P[k];j.set(y,I),I+=y.length}return j}},"./src/demux/dummy-demuxed-track.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"dummyTrack",function(){return Z});function Z(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/utils/logger.ts"),B=function(){function P(j){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=j,this.bytesAvailable=j.byteLength,this.word=0,this.bitsAvailable=0}var G=P.prototype;return G.loadWord=function(){var I=this.data,k=this.bytesAvailable,y=I.byteLength-k,A=new Uint8Array(4),O=Math.min(4,k);if(O===0)throw new Error("no bytes available");A.set(I.subarray(y,y+O)),this.word=new DataView(A.buffer).getUint32(0),this.bitsAvailable=O*8,this.bytesAvailable-=O},G.skipBits=function(I){var k;this.bitsAvailable>I?(this.word<<=I,this.bitsAvailable-=I):(I-=this.bitsAvailable,k=I>>3,I-=k>>3,this.bytesAvailable-=k,this.loadWord(),this.word<<=I,this.bitsAvailable-=I)},G.readBits=function(I){var k=Math.min(this.bitsAvailable,I),y=this.word>>>32-k;return I>32&&Z.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=k,this.bitsAvailable>0?this.word<<=k:this.bytesAvailable>0&&this.loadWord(),k=I-k,k>0&&this.bitsAvailable?y<<k|this.readBits(k):y},G.skipLZ=function(){var I;for(I=0;I<this.bitsAvailable;++I)if((this.word&2147483648>>>I)!==0)return this.word<<=I,this.bitsAvailable-=I,I;return this.loadWord(),I+this.skipLZ()},G.skipUEG=function(){this.skipBits(1+this.skipLZ())},G.skipEG=function(){this.skipBits(1+this.skipLZ())},G.readUEG=function(){var I=this.skipLZ();return this.readBits(I+1)-1},G.readEG=function(){var I=this.readUEG();return 1&I?1+I>>>1:-1*(I>>>1)},G.readBoolean=function(){return this.readBits(1)===1},G.readUByte=function(){return this.readBits(8)},G.readUShort=function(){return this.readBits(16)},G.readUInt=function(){return this.readBits(32)},G.skipScalingList=function(I){for(var k=8,y=8,A,O=0;O<I;O++)y!==0&&(A=this.readEG(),y=(k+A+256)%256),k=y===0?k:y},G.readSPS=function(){var I=0,k=0,y=0,A=0,O,_,C,S=this.readUByte.bind(this),d=this.readBits.bind(this),o=this.readUEG.bind(this),l=this.readBoolean.bind(this),h=this.skipBits.bind(this),w=this.skipEG.bind(this),p=this.skipUEG.bind(this),f=this.skipScalingList.bind(this);S();var L=S();if(d(5),h(3),S(),p(),L===100||L===110||L===122||L===244||L===44||L===83||L===86||L===118||L===128){var g=o();if(g===3&&h(1),p(),p(),h(1),l())for(_=g!==3?8:12,C=0;C<_;C++)l()&&(C<6?f(16):f(64))}p();var m=o();if(m===0)o();else if(m===1)for(h(1),w(),w(),O=o(),C=0;C<O;C++)w();p(),h(1);var c=o(),u=o(),a=d(1);a===0&&h(1),h(1),l()&&(I=o(),k=o(),y=o(),A=o());var x=[1,1];if(l()&&l()){var b=S();switch(b){case 1:x=[1,1];break;case 2:x=[12,11];break;case 3:x=[10,11];break;case 4:x=[16,11];break;case 5:x=[40,33];break;case 6:x=[24,11];break;case 7:x=[20,11];break;case 8:x=[32,11];break;case 9:x=[80,33];break;case 10:x=[18,11];break;case 11:x=[15,11];break;case 12:x=[64,33];break;case 13:x=[160,99];break;case 14:x=[4,3];break;case 15:x=[3,2];break;case 16:x=[2,1];break;case 255:{x=[S()<<8|S(),S()<<8|S()];break}}}return{width:Math.ceil((c+1)*16-I*2-k*2),height:(2-a)*(u+1)*16-(a?2:4)*(y+A),pixelRatio:x}},G.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},P}();Q.default=B},"./src/demux/id3.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"isHeader",function(){return Z}),D.d(Q,"isFooter",function(){return B}),D.d(Q,"getID3Data",function(){return P}),D.d(Q,"canParse",function(){return j}),D.d(Q,"getTimeStamp",function(){return I}),D.d(Q,"isTimeStampFrame",function(){return k}),D.d(Q,"getID3Frames",function(){return A}),D.d(Q,"decodeFrame",function(){return O}),D.d(Q,"utf8ArrayToStr",function(){return o}),D.d(Q,"testables",function(){return l});var Z=function(f,L){return L+10<=f.length&&(f[L]===73&&f[L+1]===68&&f[L+2]===51&&(f[L+3]<255&&f[L+4]<255&&(f[L+6]<128&&f[L+7]<128&&f[L+8]<128&&f[L+9]<128)))},B=function(f,L){return L+10<=f.length&&(f[L]===51&&f[L+1]===68&&f[L+2]===73&&(f[L+3]<255&&f[L+4]<255&&(f[L+6]<128&&f[L+7]<128&&f[L+8]<128&&f[L+9]<128)))},P=function(f,L){for(var g=L,m=0;Z(f,L);){m+=10;var c=G(f,L+6);m+=c,B(f,L+10)&&(m+=10),L+=m}return m>0?f.subarray(g,g+m):void 0},G=function(f,L){var g=0;return g=(f[L]&127)<<21,g|=(f[L+1]&127)<<14,g|=(f[L+2]&127)<<7,g|=f[L+3]&127,g},j=function(f,L){return Z(f,L)&&G(f,L+6)+10<=f.length-L},I=function(f){for(var L=A(f),g=0;g<L.length;g++){var m=L[g];if(k(m))return d(m)}return},k=function(f){return f&&f.key==="PRIV"&&f.info==="com.apple.streaming.transportStreamTimestamp"},y=function(f){var L=String.fromCharCode(f[0],f[1],f[2],f[3]),g=G(f,4),m=10;return{type:L,size:g,data:f.subarray(m,m+g)}},A=function(f){for(var L=0,g=[];Z(f,L);){var m=G(f,L+6);L+=10;for(var c=L+m;L+8<c;){var u=y(f.subarray(L)),a=O(u);a&&g.push(a),L+=u.size+10}B(f,L)&&(L+=10)}return g},O=function(f){return f.type==="PRIV"?_(f):f.type[0]==="W"?S(f):C(f)},_=function(f){if(f.size<2)return;var L=o(f.data,!0),g=new Uint8Array(f.data.subarray(L.length+1));return{key:f.type,info:L,data:g.buffer}},C=function(f){if(f.size<2)return;if(f.type==="TXXX"){var L=1,g=o(f.data.subarray(L),!0);L+=g.length+1;var m=o(f.data.subarray(L));return{key:f.type,info:g,data:m}}var c=o(f.data.subarray(1));return{key:f.type,data:c}},S=function(f){if(f.type==="WXXX"){if(f.size<2)return;var L=1,g=o(f.data.subarray(L),!0);L+=g.length+1;var m=o(f.data.subarray(L));return{key:f.type,info:g,data:m}}var c=o(f.data);return{key:f.type,data:c}},d=function(f){if(f.data.byteLength===8){var L=new Uint8Array(f.data),g=L[3]&1,m=(L[4]<<23)+(L[5]<<15)+(L[6]<<7)+L[7];return m/=45,g&&(m+=4772185884e-2),Math.round(m)}return},o=function(f,L){L===void 0&&(L=!1);var g=w();if(g){var m=g.decode(f);if(L){var c=m.indexOf("\0");return c!==-1?m.substring(0,c):m}return m.replace(/\0/g,"")}for(var u=f.length,a,x,b,E="",N=0;N<u;){if(a=f[N++],a===0&&L)return E;if(a===0||a===3)continue;switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:E+=String.fromCharCode(a);break;case 12:case 13:x=f[N++],E+=String.fromCharCode((a&31)<<6|x&63);break;case 14:x=f[N++],b=f[N++],E+=String.fromCharCode((a&15)<<12|(x&63)<<6|(b&63)<<0);break;default:}}return E},l={decodeTextFrame:C},h;function w(){return!h&&typeof self.TextDecoder!="undefined"&&(h=new self.TextDecoder("utf-8")),h}},"./src/demux/mp3demuxer.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/demux/base-audio-demuxer.ts"),B=D("./src/demux/id3.ts"),P=D("./src/utils/logger.ts"),G=D("./src/demux/mpegaudio.ts");function j(y,A){y.prototype=Object.create(A.prototype),y.prototype.constructor=y,I(y,A)}function I(y,A){return I=Object.setPrototypeOf||function(_,C){return _.__proto__=C,_},I(y,A)}var k=function(y){j(A,y);function A(){return y.apply(this,arguments)||this}var O=A.prototype;return O.resetInitSegment=function(C,S,d){y.prototype.resetInitSegment.call(this,C,S,d),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:C,duration:d,inputTimeScale:9e4,dropped:0}},A.probe=function(C){if(!C)return!1;for(var S=B.getID3Data(C,0)||[],d=S.length,o=C.length;d<o;d++)if(G.probe(C,d))return P.logger.log("MPEG Audio sync word found !"),!0;return!1},O.canParse=function(C,S){return G.canParse(C,S)},O.appendFrame=function(C,S,d){return this.initPTS===null?void 0:G.appendFrame(C,S,d,this.initPTS,this.frameIndex)},A}(Z.default);k.minProbeByteLength=4,Q.default=k},"./src/demux/mp4demuxer.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/utils/mp4-tools.ts"),B=D("./src/demux/dummy-demuxed-track.ts"),P=function(){function G(I,k){this.remainderData=null,this.config=void 0,this.config=k}var j=G.prototype;return j.resetTimeStamp=function(){},j.resetInitSegment=function(){},j.resetContiguity=function(){},G.probe=function(k){return Object(Z.findBox)({data:k,start:0,end:Math.min(k.length,16384)},["moof"]).length>0},j.demux=function(k){var y=k,A=Object(B.dummyTrack)();if(this.config.progressive){this.remainderData&&(y=Object(Z.appendUint8Array)(this.remainderData,k));var O=Object(Z.segmentValidRange)(y);this.remainderData=O.remainder,A.samples=O.valid||new Uint8Array}else A.samples=y;return{audioTrack:Object(B.dummyTrack)(),avcTrack:A,id3Track:Object(B.dummyTrack)(),textTrack:Object(B.dummyTrack)()}},j.flush=function(){var k=Object(B.dummyTrack)();return k.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(B.dummyTrack)(),avcTrack:k,id3Track:Object(B.dummyTrack)(),textTrack:Object(B.dummyTrack)()}},j.demuxSampleAes=function(k,y,A){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},j.destroy=function(){},G}();P.minProbeByteLength=1024,Q.default=P},"./src/demux/mpegaudio.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"appendFrame",function(){return I}),D.d(Q,"parseHeader",function(){return k}),D.d(Q,"isHeaderPattern",function(){return y}),D.d(Q,"isHeader",function(){return A}),D.d(Q,"canParse",function(){return O}),D.d(Q,"probe",function(){return _});var Z=null,B=[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],P=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],G=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],j=[0,1,1,4];function I(C,S,d,o,l){if(d+24>S.length)return;var h=k(S,d);if(h&&d+h.frameLength<=S.length){var w=h.samplesPerFrame*9e4/h.sampleRate,p=o+l*w,f={unit:S.subarray(d,d+h.frameLength),pts:p,dts:p};return C.config=[],C.channelCount=h.channelCount,C.samplerate=h.sampleRate,C.samples.push(f),{sample:f,length:h.frameLength,missing:0}}}function k(C,S){var d=C[S+1]>>3&3,o=C[S+1]>>1&3,l=C[S+2]>>4&15,h=C[S+2]>>2&3;if(d!==1&&l!==0&&l!==15&&h!==3){var w=C[S+2]>>1&1,p=C[S+3]>>6,f=d===3?3-o:o===3?3:4,L=B[f*14+l-1]*1e3,g=d===3?0:d===2?1:2,m=P[g*3+h],c=p===3?1:2,u=G[d][o],a=j[o],x=u*8*a,b=Math.floor(u*L/m+w)*a;if(Z===null){var E=navigator.userAgent||"",N=E.match(/Chrome\/(\d+)/i);Z=N?parseInt(N[1]):0}var U=!!Z&&Z<=87;return U&&o===2&&L>=224e3&&p===0&&(C[S+3]=C[S+3]|128),{sampleRate:m,channelCount:c,frameLength:b,samplesPerFrame:x}}}function y(C,S){return C[S]===255&&(C[S+1]&224)===224&&(C[S+1]&6)!==0}function A(C,S){return S+1<C.length&&y(C,S)}function O(C,S){var d=4;return y(C,S)&&d<=C.length-S}function _(C,S){if(S+1<C.length&&y(C,S)){var d=4,o=k(C,S),l=d;o!=null&&o.frameLength&&(l=o.frameLength);var h=S+l;return h===C.length||A(C,h)}return!1}},"./src/demux/sample-aes.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/crypt/decrypter.ts"),B=D("./src/demux/tsdemuxer.ts"),P=function(){function G(I,k,y){this.keyData=void 0,this.decrypter=void 0,this.keyData=y,this.decrypter=new Z.default(I,k,{removePKCS7Padding:!1})}var j=G.prototype;return j.decryptBuffer=function(k,y){this.decrypter.decrypt(k,this.keyData.key.buffer,this.keyData.iv.buffer,y)},j.decryptAacSample=function(k,y,A,O){var _=k[y].unit,C=_.subarray(16,_.length-_.length%16),S=C.buffer.slice(C.byteOffset,C.byteOffset+C.length),d=this;this.decryptBuffer(S,function(o){var l=new Uint8Array(o);_.set(l,16),O||d.decryptAacSamples(k,y+1,A)})},j.decryptAacSamples=function(k,y,A){for(;;y++){if(y>=k.length){A();return}if(k[y].unit.length<32)continue;var O=this.decrypter.isSync();if(this.decryptAacSample(k,y,A,O),!O)return}},j.getAvcEncryptedData=function(k){for(var y=Math.floor((k.length-48)/160)*16+16,A=new Int8Array(y),O=0,_=32;_<=k.length-16;_+=160,O+=16)A.set(k.subarray(_,_+16),O);return A},j.getAvcDecryptedUnit=function(k,y){for(var A=new Uint8Array(y),O=0,_=32;_<=k.length-16;_+=160,O+=16)k.set(A.subarray(O,O+16),_);return k},j.decryptAvcSample=function(k,y,A,O,_,C){var S=Object(B.discardEPB)(_.data),d=this.getAvcEncryptedData(S),o=this;this.decryptBuffer(d.buffer,function(l){_.data=o.getAvcDecryptedUnit(S,l),C||o.decryptAvcSamples(k,y,A+1,O)})},j.decryptAvcSamples=function(k,y,A,O){if(k instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;y++,A=0){if(y>=k.length){O();return}for(var _=k[y].units;!(A>=_.length);A++){var C=_[A];if(C.data.length<=48||C.type!==1&&C.type!==5)continue;var S=this.decrypter.isSync();if(this.decryptAvcSample(k,y,A,O,C,S),!S)return}}},G}();Q.default=P},"./src/demux/transmuxer-interface.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return _});var Z=D("./node_modules/webworkify-webpack/index.js"),B=D.n(Z),P=D("./src/events.ts"),G=D("./src/demux/transmuxer.ts"),j=D("./src/utils/logger.ts"),I=D("./src/errors.ts"),k=D("./src/utils/mediasource-helper.ts"),y=D("./node_modules/eventemitter3/index.js"),A=D.n(y),O=Object(k.getMediaSource)()||{isTypeSupported:function(){return!1}},_=function(){function C(d,o,l,h){var w=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=d,this.id=o,this.onTransmuxComplete=l,this.onFlush=h;var p=d.config,f=function(u,a){a=a||{},a.frag=w.frag,a.id=w.id,d.trigger(u,a)};this.observer=new y.EventEmitter,this.observer.on(P.Events.FRAG_DECRYPTED,f),this.observer.on(P.Events.ERROR,f);var L={mp4:O.isTypeSupported("video/mp4"),mpeg:O.isTypeSupported("audio/mpeg"),mp3:O.isTypeSupported('audio/mp4; codecs="mp3"')},g=navigator.vendor;if(p.enableWorker&&typeof Worker!="undefined"){j.logger.log("demuxing in webworker");var m;try{m=this.worker=Z("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),m.addEventListener("message",this.onwmsg),m.onerror=function(c){d.trigger(P.Events.ERROR,{type:I.ErrorTypes.OTHER_ERROR,details:I.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},m.postMessage({cmd:"init",typeSupported:L,vendor:g,id:o,config:JSON.stringify(p)})}catch(c){j.logger.warn("Error in worker:",c),j.logger.error("Error while initializing DemuxerWorker, fallback to inline"),m&&self.URL.revokeObjectURL(m.objectURL),this.transmuxer=new G.default(this.observer,L,p,g,o),this.worker=null}}else this.transmuxer=new G.default(this.observer,L,p,g,o)}var S=C.prototype;return S.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var l=this.transmuxer;l&&(l.destroy(),this.transmuxer=null)}var h=this.observer;h&&h.removeAllListeners(),this.observer=null},S.push=function(o,l,h,w,p,f,L,g,m,c){var u=this;m.transmuxing.start=self.performance.now();var a=this.transmuxer,x=this.worker,b=f?f.start:p.start,E=p.decryptdata,N=this.frag,U=!(N&&p.cc===N.cc),K=!(N&&m.level===N.level),V=N?m.sn-N.sn:-1,R=this.part?m.part-this.part.index:1,M=!K&&(V===1||V===0&&R===1),$=self.performance.now();(K||V||p.stats.parsing.start===0)&&(p.stats.parsing.start=$),f&&(R||!M)&&(f.stats.parsing.start=$);var ee=new G.TransmuxState(U,M,g,K,b);if(!M||U){j.logger.log("[transmuxer-interface, "+p.type+"]: Starting new transmux session for sn: "+m.sn+" p: "+m.part+" level: "+m.level+" id: "+m.id+`
discontinuity: `+U+`
trackSwitch: `+K+`
contiguous: `+M+`
accurateTimeOffset: `+g+`
timeOffset: `+b);var oe=new G.TransmuxConfig(h,w,l,L,c);this.configureTransmuxer(oe)}if(this.frag=p,this.part=f,x)x.postMessage({cmd:"demux",data:o,decryptdata:E,chunkMeta:m,state:ee},o instanceof ArrayBuffer?[o]:[]);else if(a){var fe=a.push(o,E,m,ee);Object(G.isPromise)(fe)?fe.then(function(ke){u.handleTransmuxComplete(ke)}):this.handleTransmuxComplete(fe)}},S.flush=function(o){var l=this;o.transmuxing.start=self.performance.now();var h=this.transmuxer,w=this.worker;if(w)w.postMessage({cmd:"flush",chunkMeta:o});else if(h){var p=h.flush(o);Object(G.isPromise)(p)?p.then(function(f){l.handleFlushResult(f,o)}):this.handleFlushResult(p,o)}},S.handleFlushResult=function(o,l){var h=this;o.forEach(function(w){h.handleTransmuxComplete(w)}),this.onFlush(l)},S.onWorkerMessage=function(o){var l=o.data,h=this.hls;switch(l.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(l.data);break}case"flush":{this.onFlush(l.data);break}default:{l.data=l.data||{},l.data.frag=this.frag,l.data.id=this.id,h.trigger(l.event,l.data);break}}},S.configureTransmuxer=function(o){var l=this.worker,h=this.transmuxer;l?l.postMessage({cmd:"configure",config:o}):h&&h.configure(o)},S.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},C}()},"./src/demux/transmuxer-worker.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return I});var Z=D("./src/demux/transmuxer.ts"),B=D("./src/events.ts"),P=D("./src/utils/logger.ts"),G=D("./node_modules/eventemitter3/index.js"),j=D.n(G);function I(_){var C=new G.EventEmitter,S=function(o,l){_.postMessage({event:o,data:l})};C.on(B.Events.FRAG_DECRYPTED,S),C.on(B.Events.ERROR,S),_.addEventListener("message",function(d){var o=d.data;switch(o.cmd){case"init":{var l=JSON.parse(o.config);_.transmuxer=new Z.default(C,o.typeSupported,l,o.vendor,o.id),Object(P.enableLogs)(l.debug),S("init",null);break}case"configure":{_.transmuxer.configure(o.config);break}case"demux":{var h=_.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(Z.isPromise)(h)?h.then(function(f){k(_,f)}):k(_,h);break}case"flush":{var w=o.chunkMeta,p=_.transmuxer.flush(w);Object(Z.isPromise)(p)?p.then(function(f){A(_,f,w)}):A(_,p,w);break}default:break}})}function k(_,C){if(O(C.remuxResult))return;var S=[],d=C.remuxResult,o=d.audio,l=d.video;o&&y(S,o),l&&y(S,l),_.postMessage({event:"transmuxComplete",data:C},S)}function y(_,C){C.data1&&_.push(C.data1.buffer),C.data2&&_.push(C.data2.buffer)}function A(_,C,S){C.forEach(function(d){k(_,d)}),_.postMessage({event:"flush",data:S})}function O(_){return!_.audio&&!_.video&&!_.text&&!_.id3&&!_.initSegment}},"./src/demux/transmuxer.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return l}),D.d(Q,"isPromise",function(){return p}),D.d(Q,"TransmuxConfig",function(){return f}),D.d(Q,"TransmuxState",function(){return L});var Z=D("./src/events.ts"),B=D("./src/errors.ts"),P=D("./src/crypt/decrypter.ts"),G=D("./src/demux/aacdemuxer.ts"),j=D("./src/demux/mp4demuxer.ts"),I=D("./src/demux/tsdemuxer.ts"),k=D("./src/demux/mp3demuxer.ts"),y=D("./src/remux/mp4-remuxer.ts"),A=D("./src/remux/passthrough-remuxer.ts"),O=D("./src/demux/chunk-cache.ts"),_=D("./src/utils/mp4-tools.ts"),C=D("./src/utils/logger.ts"),S;try{S=self.performance.now.bind(self.performance)}catch(g){C.logger.debug("Unable to use Performance API on this environment"),S=self.Date.now}var d=[{demux:I.default,remux:y.default},{demux:j.default,remux:A.default},{demux:G.default,remux:y.default},{demux:k.default,remux:y.default}],o=1024;d.forEach(function(g){var m=g.demux;o=Math.max(o,m.minProbeByteLength)});var l=function(){function g(c,u,a,x,b){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 O.default,this.observer=c,this.typeSupported=u,this.config=a,this.vendor=x,this.id=b}var m=g.prototype;return m.configure=function(u){this.transmuxConfig=u,this.decrypter&&this.decrypter.reset()},m.push=function(u,a,x,b){var E=this,N=x.transmuxing;N.executeStart=S();var U=new Uint8Array(u),K=this.cache,V=this.config,R=this.currentTransmuxState,M=this.transmuxConfig;b&&(this.currentTransmuxState=b);var $=h(U,a);if($&&$.method==="AES-128"){var ee=this.getDecrypter();if(V.enableSoftwareAES){var oe=ee.softwareDecrypt(U,$.key.buffer,$.iv.buffer);if(!oe)return N.executeEnd=S(),w(x);U=new Uint8Array(oe)}else return this.decryptionPromise=ee.webCryptoDecrypt(U,$.key.buffer,$.iv.buffer).then(function(Oe){var Pe=E.push(Oe,null,x);return E.decryptionPromise=null,Pe}),this.decryptionPromise}var fe=b||R,ke=fe.contiguous,Ee=fe.discontinuity,Te=fe.trackSwitch,we=fe.accurateTimeOffset,Ce=fe.timeOffset,me=M.audioCodec,ue=M.videoCodec,te=M.defaultInitPts,de=M.duration,ae=M.initSegmentData;if((Ee||Te)&&this.resetInitSegment(ae,me,ue,de),Ee&&this.resetInitialTimestamp(te),ke||this.resetContiguity(),this.needsProbing(U,Ee,Te)){if(K.dataLength){var _e=K.flush();U=Object(_.appendUint8Array)(_e,U)}this.configureTransmuxer(U,M)}var Re=this.transmux(U,$,Ce,we,x),ye=this.currentTransmuxState;return ye.contiguous=!0,ye.discontinuity=!1,ye.trackSwitch=!1,N.executeEnd=S(),Re},m.flush=function(u){var a=this,x=u.transmuxing;x.executeStart=S();var b=this.decrypter,E=this.cache,N=this.currentTransmuxState,U=this.decryptionPromise;if(U)return U.then(function(){return a.flush(u)});var K=[],V=N.timeOffset;if(b){var R=b.flush();R&&K.push(this.push(R,null,u))}var M=E.dataLength;E.reset();var $=this.demuxer,ee=this.remuxer;if(!$||!ee)return M>=o&&this.observer.emit(Z.Events.ERROR,Z.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),x.executeEnd=S(),[w(u)];var oe=$.flush(V);return p(oe)?oe.then(function(fe){return a.flushRemux(K,fe,u),K}):(this.flushRemux(K,oe,u),K)},m.flushRemux=function(u,a,x){var b=a.audioTrack,E=a.avcTrack,N=a.id3Track,U=a.textTrack,K=this.currentTransmuxState,V=K.accurateTimeOffset,R=K.timeOffset;C.logger.log("[transmuxer.ts]: Flushed fragment "+x.sn+(x.part>-1?" p: "+x.part:"")+" of level "+x.level);var M=this.remuxer.remux(b,E,N,U,R,V,!0,this.id);u.push({remuxResult:M,chunkMeta:x}),x.transmuxing.executeEnd=S()},m.resetInitialTimestamp=function(u){var a=this.demuxer,x=this.remuxer;if(!a||!x)return;a.resetTimeStamp(u),x.resetTimeStamp(u)},m.resetContiguity=function(){var u=this.demuxer,a=this.remuxer;if(!u||!a)return;u.resetContiguity(),a.resetNextTimestamp()},m.resetInitSegment=function(u,a,x,b){var E=this.demuxer,N=this.remuxer;if(!E||!N)return;E.resetInitSegment(a,x,b),N.resetInitSegment(u,a,x)},m.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},m.transmux=function(u,a,x,b,E){var N;return a&&a.method==="SAMPLE-AES"?N=this.transmuxSampleAes(u,a,x,b,E):N=this.transmuxUnencrypted(u,x,b,E),N},m.transmuxUnencrypted=function(u,a,x,b){var E=this.demuxer.demux(u,a,!1,!this.config.progressive),N=E.audioTrack,U=E.avcTrack,K=E.id3Track,V=E.textTrack,R=this.remuxer.remux(N,U,K,V,a,x,!1,this.id);return{remuxResult:R,chunkMeta:b}},m.transmuxSampleAes=function(u,a,x,b,E){var N=this;return this.demuxer.demuxSampleAes(u,a,x).then(function(U){var K=N.remuxer.remux(U.audioTrack,U.avcTrack,U.id3Track,U.textTrack,x,b,!1,N.id);return{remuxResult:K,chunkMeta:E}})},m.configureTransmuxer=function(u,a){for(var x=this.config,b=this.observer,E=this.typeSupported,N=this.vendor,U=a.audioCodec,K=a.defaultInitPts,V=a.duration,R=a.initSegmentData,M=a.videoCodec,$,ee=0,oe=d.length;ee<oe;ee++)if(d[ee].demux.probe(u)){$=d[ee];break}$||(C.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),$={demux:j.default,remux:A.default});var fe=this.demuxer,ke=this.remuxer,Ee=$.remux,Te=$.demux;(!ke||!(ke instanceof Ee))&&(this.remuxer=new Ee(b,x,E,N)),(!fe||!(fe instanceof Te))&&(this.demuxer=new Te(b,x,E),this.probe=Te.probe),this.resetInitSegment(R,U,M,V),this.resetInitialTimestamp(K)},m.needsProbing=function(u,a,x){return!this.demuxer||!this.remuxer||a||x},m.getDecrypter=function(){var u=this.decrypter;return u||(u=this.decrypter=new P.default(this.observer,this.config)),u},g}();function h(g,m){var c=null;return g.byteLength>0&&m!=null&&m.key!=null&&m.iv!==null&&m.method!=null&&(c=m),c}var w=function(m){return{remuxResult:{},chunkMeta:m}};function p(g){return"then"in g&&g.then instanceof Function}var f=function(m,c,u,a,x){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=m,this.videoCodec=c,this.initSegmentData=u,this.duration=a,this.defaultInitPts=x},L=function(m,c,u,a,x){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=m,this.contiguous=c,this.accurateTimeOffset=u,this.trackSwitch=a,this.timeOffset=x}},"./src/demux/tsdemuxer.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"discardEPB",function(){return w});var Z=D("./src/demux/adts.ts"),B=D("./src/demux/mpegaudio.ts"),P=D("./src/demux/exp-golomb.ts"),G=D("./src/demux/id3.ts"),j=D("./src/demux/sample-aes.ts"),I=D("./src/events.ts"),k=D("./src/utils/mp4-tools.ts"),y=D("./src/utils/logger.ts"),A=D("./src/errors.ts"),O={video:1,audio:2,id3:3,text:4},_=function(){function p(L,g,m){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=L,this.config=g,this.typeSupported=m}p.probe=function(g){var m=p.syncOffset(g);return m<0?!1:(m&&y.logger.warn("MPEG2-TS detected but first sync word found @ offset "+m+", junk ahead ?"),!0)},p.syncOffset=function(g){for(var m=Math.min(1e3,g.length-3*188),c=0;c<m;){if(g[c]===71&&g[c+188]===71&&g[c+2*188]===71)return c;c++}return-1},p.createTrack=function(g,m){return{container:g==="video"||g==="audio"?"video/mp2t":void 0,type:g,id:O[g],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:g==="audio"?m:void 0}};var f=p.prototype;return f.resetInitSegment=function(g,m,c){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=p.createTrack("video",c),this._audioTrack=p.createTrack("audio",c),this._id3Track=p.createTrack("id3",c),this._txtTrack=p.createTrack("text",c),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=g,this.videoCodec=m,this._duration=c},f.resetTimeStamp=function(){},f.resetContiguity=function(){var g=this._audioTrack,m=this._avcTrack,c=this._id3Track;g&&(g.pesData=null),m&&(m.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},f.demux=function(g,m,c,u){c===void 0&&(c=!1),u===void 0&&(u=!1),c||(this.sampleAes=null);var a,x=this._avcTrack,b=this._audioTrack,E=this._id3Track,N=x.pid,U=x.pesData,K=b.pid,V=E.pid,R=b.pesData,M=E.pesData,$=!1,ee=this.pmtParsed,oe=this._pmtId,fe=g.length;if(this.remainderData&&(g=Object(k.appendUint8Array)(this.remainderData,g),fe=g.length,this.remainderData=null),fe<188&&!u)return this.remainderData=g,{audioTrack:b,avcTrack:x,id3Track:E,textTrack:this._txtTrack};var ke=Math.max(0,p.syncOffset(g));fe-=(fe+ke)%188,fe<g.byteLength&&!u&&(this.remainderData=new Uint8Array(g.buffer,fe,g.buffer.byteLength-fe));for(var Ee=ke;Ee<fe;Ee+=188)if(g[Ee]===71){var Te=!!(g[Ee+1]&64),we=((g[Ee+1]&31)<<8)+g[Ee+2],Ce=(g[Ee+3]&48)>>4,me=void 0;if(Ce>1){if(me=Ee+5+g[Ee+4],me===Ee+188)continue}else me=Ee+4;switch(we){case N:Te&&(U&&(a=o(U))&&this.parseAVCPES(a,!1),U={data:[],size:0}),U&&(U.data.push(g.subarray(me,Ee+188)),U.size+=Ee+188-me);break;case K:Te&&(R&&(a=o(R))&&(b.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),R={data:[],size:0}),R&&(R.data.push(g.subarray(me,Ee+188)),R.size+=Ee+188-me);break;case V:Te&&(M&&(a=o(M))&&this.parseID3PES(a),M={data:[],size:0}),M&&(M.data.push(g.subarray(me,Ee+188)),M.size+=Ee+188-me);break;case 0:Te&&(me+=g[me]+1),oe=this._pmtId=S(g,me);break;case oe:{Te&&(me+=g[me]+1);var ue=d(g,me,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);N=ue.avc,N>0&&(x.pid=N),K=ue.audio,K>0&&(b.pid=K,b.isAAC=ue.isAAC),V=ue.id3,V>0&&(E.pid=V),$&&!ee&&(y.logger.log("reparse from beginning"),$=!1,Ee=ke-188),ee=this.pmtParsed=!0;break}case 17:case 8191:break;default:$=!0;break}}else this.observer.emit(I.Events.ERROR,I.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});x.pesData=U,b.pesData=R,E.pesData=M;var te={audioTrack:b,avcTrack:x,id3Track:E,textTrack:this._txtTrack};return u&&this.extractRemainingSamples(te),te},f.flush=function(){var g=this.remainderData;this.remainderData=null;var m;return g?m=this.demux(g,-1,!1,!0):m={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(m),this.sampleAes?this.decrypt(m,this.sampleAes):m},f.extractRemainingSamples=function(g){var m=g.audioTrack,c=g.avcTrack,u=g.id3Track,a=c.pesData,x=m.pesData,b=u.pesData,E;a&&(E=o(a))?(this.parseAVCPES(E,!0),c.pesData=null):c.pesData=a,x&&(E=o(x))?(m.isAAC?this.parseAACPES(E):this.parseMPEGPES(E),m.pesData=null):(x!=null&&x.size&&y.logger.log("last AAC PES packet truncated,might overlap between fragments"),m.pesData=x),b&&(E=o(b))?(this.parseID3PES(E),u.pesData=null):u.pesData=b},f.demuxSampleAes=function(g,m,c){var u=this.demux(g,c,!0,!this.config.progressive),a=this.sampleAes=new j.default(this.observer,this.config,m);return this.decrypt(u,a)},f.decrypt=function(g,m){return new Promise(function(c){var u=g.audioTrack,a=g.avcTrack;u.samples&&u.isAAC?m.decryptAacSamples(u.samples,0,function(){a.samples?m.decryptAvcSamples(a.samples,0,0,function(){c(g)}):c(g)}):a.samples&&m.decryptAvcSamples(a.samples,0,0,function(){c(g)})})},f.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},f.parseAVCPES=function(g,m){var c=this,u=this._avcTrack,a=this.parseAVCNALu(g.data),x=!1,b=this.avcSample,E,N=!1;g.data=null,b&&a.length&&!u.audFound&&(l(b,u),b=this.avcSample=C(!1,g.pts,g.dts,"")),a.forEach(function(U){switch(U.type){case 1:{E=!0,b||(b=c.avcSample=C(!0,g.pts,g.dts,"")),x&&(b.debug+="NDR "),b.frame=!0;var K=U.data;if(N&&K.length>4){var V=new P.default(K).readSliceType();(V===2||V===4||V===7||V===9)&&(b.key=!0)}break}case 5:E=!0,b||(b=c.avcSample=C(!0,g.pts,g.dts,"")),x&&(b.debug+="IDR "),b.key=!0,b.frame=!0;break;case 6:{E=!0,x&&b&&(b.debug+="SEI ");var R=new P.default(w(U.data));R.readUByte();for(var M=0,$=0,ee=!1,oe=0;!ee&&R.bytesAvailable>1;){M=0;do oe=R.readUByte(),M+=oe;while(oe===255);$=0;do oe=R.readUByte(),$+=oe;while(oe===255);if(M===4&&R.bytesAvailable!==0){ee=!0;var fe=R.readUByte();if(fe===181){var ke=R.readUShort();if(ke===49){var Ee=R.readUInt();if(Ee===1195456820){var Te=R.readUByte();if(Te===3){for(var we=R.readUByte(),Ce=R.readUByte(),me=31&we,ue=[we,Ce],te=0;te<me;te++)ue.push(R.readUByte()),ue.push(R.readUByte()),ue.push(R.readUByte());h(c._txtTrack.samples,{type:3,pts:g.pts,bytes:ue})}}}}}else if(M===5&&R.bytesAvailable!==0){if(ee=!0,$>16){for(var de=[],ae=0;ae<16;ae++)de.push(R.readUByte().toString(16)),(ae===3||ae===5||ae===7||ae===9)&&de.push("-");for(var _e=$-16,Re=new Uint8Array(_e),ye=0;ye<_e;ye++)Re[ye]=R.readUByte();h(c._txtTrack.samples,{pts:g.pts,payloadType:M,uuid:de.join(""),userData:Object(G.utf8ArrayToStr)(Re),userDataBytes:Re})}}else if($<R.bytesAvailable)for(var Oe=0;Oe<$;Oe++)R.readUByte()}break}case 7:if(E=!0,N=!0,x&&b&&(b.debug+="SPS "),!u.sps){var Pe=new P.default(U.data),Ie=Pe.readSPS();u.width=Ie.width,u.height=Ie.height,u.pixelRatio=Ie.pixelRatio,u.sps=[U.data],u.duration=c._duration;for(var je=U.data.subarray(1,4),Be="avc1.",Ne=0;Ne<3;Ne++){var et=je[Ne].toString(16);et.length<2&&(et="0"+et),Be+=et}u.codec=Be}break;case 8:E=!0,x&&b&&(b.debug+="PPS "),u.pps||(u.pps=[U.data]);break;case 9:E=!1,u.audFound=!0,b&&l(b,u),b=c.avcSample=C(!1,g.pts,g.dts,x?"AUD ":"");break;case 12:E=!1;break;default:E=!1,b&&(b.debug+="unknown NAL "+U.type+" ");break}if(b&&E){var Ze=b.units;Ze.push(U)}}),m&&b&&(l(b,u),this.avcSample=null)},f.getLastNalUnit=function(){var g,m=this.avcSample,c;if(!m||m.units.length===0){var u=this._avcTrack.samples;m=u[u.length-1]}if((g=m)!==null&&g!==void 0&&g.units){var a=m.units;c=a[a.length-1]}return c},f.parseAVCNALu=function(g){var m=g.byteLength,c=this._avcTrack,u=c.naluState||0,a=u,x=[],b=0,E,N,U,K=-1,V=0;for(u===-1&&(K=0,V=g[0]&31,u=0,b=1);b<m;){if(E=g[b++],!u){u=E?0:1;continue}if(u===1){u=E?0:2;continue}if(!E)u=3;else if(E===1){if(K>=0){var R={data:g.subarray(K,b-u-1),type:V};x.push(R)}else{var M=this.getLastNalUnit();if(M&&(a&&b<=4-a&&(M.state&&(M.data=M.data.subarray(0,M.data.byteLength-a))),N=b-u-1,N>0)){var $=new Uint8Array(M.data.byteLength+N);$.set(M.data,0),$.set(g.subarray(0,N),M.data.byteLength),M.data=$,M.state=0}}b<m?(U=g[b]&31,K=b,V=U,u=0):u=-1}else u=0}if(K>=0&&u>=0){var ee={data:g.subarray(K,m),type:V,state:u};x.push(ee)}if(x.length===0){var oe=this.getLastNalUnit();if(oe){var fe=new Uint8Array(oe.data.byteLength+g.byteLength);fe.set(oe.data,0),fe.set(g,oe.data.byteLength),oe.data=fe}}return c.naluState=u,x},f.parseAACPES=function(g){var m=0,c=this._audioTrack,u=this.aacOverFlow,a=g.data;if(u){this.aacOverFlow=null;var x=u.sample.unit.byteLength,b=Math.min(u.missing,x),E=x-b;u.sample.unit.set(a.subarray(0,b),E),c.samples.push(u.sample),m=u.missing}var N,U;for(N=m,U=a.length;N<U-1&&!Z.isHeader(a,N);N++);if(N!==m){var K,V;if(N<U-1?(K="AAC PES did not start with ADTS header,offset:"+N,V=!1):(K="no ADTS header found in AAC PES",V=!0),y.logger.warn("parsing error:"+K),this.observer.emit(I.Events.ERROR,I.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:V,reason:K}),V)return}Z.initTrackConfig(c,this.observer,a,N,this.audioCodec);var R;if(g.pts!==void 0)R=g.pts;else if(u){var M=Z.getFrameDuration(c.samplerate);R=u.sample.pts+M}else{y.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var $=0;N<U;)if(Z.isHeader(a,N)){if(N+5<U){var ee=Z.appendFrame(c,a,N,R,$);if(ee)if(ee.missing)this.aacOverFlow=ee;else{N+=ee.length,$++;continue}}break}else N++},f.parseMPEGPES=function(g){var m=g.data,c=m.length,u=0,a=0,x=g.pts;if(x===void 0){y.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<c;)if(B.isHeader(m,a)){var b=B.appendFrame(this._audioTrack,m,a,x,u);if(b)a+=b.length,u++;else break}else a++},f.parseID3PES=function(g){if(g.pts===void 0){y.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(g)},p}();_.minProbeByteLength=188;function C(p,f,L,g){return{key:p,frame:!1,pts:f,dts:L,units:[],debug:g,length:0}}function S(p,f){return(p[f+10]&31)<<8|p[f+11]}function d(p,f,L,g){var m={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(p[f+1]&15)<<8|p[f+2],u=f+3+c-4,a=(p[f+10]&15)<<8|p[f+11];for(f+=12+a;f<u;){var x=(p[f+1]&31)<<8|p[f+2];switch(p[f]){case 207:if(!g){y.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:m.audio===-1&&(m.audio=x);break;case 21:m.id3===-1&&(m.id3=x);break;case 219:if(!g){y.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:m.avc===-1&&(m.avc=x);break;case 3:case 4:L?m.audio===-1&&(m.audio=x,m.isAAC=!1):y.logger.log("MPEG audio found, not supported in this browser");break;case 36:y.logger.warn("Unsupported HEVC stream type found");break;default:break}f+=((p[f+3]&15)<<8|p[f+4])+5}return m}function o(p){var f=0,L,g,m,c,u,a=p.data;if(!p||p.size===0)return null;for(;a[0].length<19&&a.length>1;){var x=new Uint8Array(a[0].length+a[1].length);x.set(a[0]),x.set(a[1],a[0].length),a[0]=x,a.splice(1,1)}L=a[0];var b=(L[0]<<16)+(L[1]<<8)+L[2];if(b===1){if(g=(L[4]<<8)+L[5],g&&g>p.size-6)return null;var E=L[7];E&192&&(c=(L[9]&14)*536870912+(L[10]&255)*4194304+(L[11]&254)*16384+(L[12]&255)*128+(L[13]&254)/2,E&64?(u=(L[14]&14)*536870912+(L[15]&255)*4194304+(L[16]&254)*16384+(L[17]&255)*128+(L[18]&254)/2,c-u>60*9e4&&(y.logger.warn(Math.round((c-u)/9e4)+"s delta between PTS and DTS, align them"),c=u)):u=c),m=L[8];var N=m+9;if(p.size<=N)return null;p.size-=N;for(var U=new Uint8Array(p.size),K=0,V=a.length;K<V;K++){L=a[K];var R=L.byteLength;if(N)if(N>R){N-=R;continue}else L=L.subarray(N),R-=N,N=0;U.set(L,f),f+=R}return g&&(g-=m+3),{data:U,pts:c,dts:u,len:g}}return null}function l(p,f){if(p.units.length&&p.frame){if(p.pts===void 0){var L=f.samples,g=L.length;if(g){var m=L[g-1];p.pts=m.pts,p.dts=m.dts}else{f.dropped++;return}}f.samples.push(p)}p.debug.length&&y.logger.log(p.pts+"/"+p.dts+":"+p.debug)}function h(p,f){var L=p.length;if(L>0){if(f.pts>=p[L-1].pts)p.push(f);else for(var g=L-1;g>=0;g--)if(f.pts<p[g].pts){p.splice(g,0,f);break}}else p.push(f)}function w(p){for(var f=p.byteLength,L=[],g=1;g<f-2;)p[g]===0&&p[g+1]===0&&p[g+2]===3?(L.push(g+2),g+=2):g++;if(L.length===0)return p;var m=f-L.length,c=new Uint8Array(m),u=0;for(g=0;g<m;u++,g++)u===L[0]&&(u++,L.shift()),c[g]=p[u];return c}Q.default=_},"./src/errors.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"ErrorTypes",function(){return Z}),D.d(Q,"ErrorDetails",function(){return B});var Z;(function(P){P.NETWORK_ERROR="networkError",P.MEDIA_ERROR="mediaError",P.KEY_SYSTEM_ERROR="keySystemError",P.MUX_ERROR="muxError",P.OTHER_ERROR="otherError"})(Z||(Z={}));var B;(function(P){P.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",P.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",P.KEY_SYSTEM_NO_SESSION="keySystemNoSession",P.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",P.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",P.MANIFEST_LOAD_ERROR="manifestLoadError",P.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",P.MANIFEST_PARSING_ERROR="manifestParsingError",P.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",P.LEVEL_EMPTY_ERROR="levelEmptyError",P.LEVEL_LOAD_ERROR="levelLoadError",P.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",P.LEVEL_SWITCH_ERROR="levelSwitchError",P.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",P.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",P.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",P.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",P.FRAG_LOAD_ERROR="fragLoadError",P.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",P.FRAG_DECRYPT_ERROR="fragDecryptError",P.FRAG_PARSING_ERROR="fragParsingError",P.REMUX_ALLOC_ERROR="remuxAllocError",P.KEY_LOAD_ERROR="keyLoadError",P.KEY_LOAD_TIMEOUT="keyLoadTimeOut",P.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",P.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",P.BUFFER_APPEND_ERROR="bufferAppendError",P.BUFFER_APPENDING_ERROR="bufferAppendingError",P.BUFFER_STALLED_ERROR="bufferStalledError",P.BUFFER_FULL_ERROR="bufferFullError",P.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",P.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",P.INTERNAL_EXCEPTION="internalException",P.INTERNAL_ABORTED="aborted",P.UNKNOWN="unknown"})(B||(B={}))},"./src/events.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"Events",function(){return Z});var Z;(function(B){B.MEDIA_ATTACHING="hlsMediaAttaching",B.MEDIA_ATTACHED="hlsMediaAttached",B.MEDIA_DETACHING="hlsMediaDetaching",B.MEDIA_DETACHED="hlsMediaDetached",B.BUFFER_RESET="hlsBufferReset",B.BUFFER_CODECS="hlsBufferCodecs",B.BUFFER_CREATED="hlsBufferCreated",B.BUFFER_APPENDING="hlsBufferAppending",B.BUFFER_APPENDED="hlsBufferAppended",B.BUFFER_EOS="hlsBufferEos",B.BUFFER_FLUSHING="hlsBufferFlushing",B.BUFFER_FLUSHED="hlsBufferFlushed",B.MANIFEST_LOADING="hlsManifestLoading",B.MANIFEST_LOADED="hlsManifestLoaded",B.MANIFEST_PARSED="hlsManifestParsed",B.LEVEL_SWITCHING="hlsLevelSwitching",B.LEVEL_SWITCHED="hlsLevelSwitched",B.LEVEL_LOADING="hlsLevelLoading",B.LEVEL_LOADED="hlsLevelLoaded",B.LEVEL_UPDATED="hlsLevelUpdated",B.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",B.LEVELS_UPDATED="hlsLevelsUpdated",B.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",B.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",B.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",B.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",B.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",B.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",B.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",B.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",B.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",B.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",B.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",B.CUES_PARSED="hlsCuesParsed",B.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",B.INIT_PTS_FOUND="hlsInitPtsFound",B.FRAG_LOADING="hlsFragLoading",B.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",B.FRAG_LOADED="hlsFragLoaded",B.FRAG_DECRYPTED="hlsFragDecrypted",B.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",B.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",B.FRAG_PARSING_METADATA="hlsFragParsingMetadata",B.FRAG_PARSED="hlsFragParsed",B.FRAG_BUFFERED="hlsFragBuffered",B.FRAG_CHANGED="hlsFragChanged",B.FPS_DROP="hlsFpsDrop",B.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",B.ERROR="hlsError",B.DESTROYING="hlsDestroying",B.KEY_LOADING="hlsKeyLoading",B.KEY_LOADED="hlsKeyLoaded",B.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",B.BACK_BUFFER_REACHED="hlsBackBufferReached"})(Z||(Z={}))},"./src/hls.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return p});var Z=D("./node_modules/url-toolkit/src/url-toolkit.js"),B=D.n(Z),P=D("./src/loader/playlist-loader.ts"),G=D("./src/loader/key-loader.ts"),j=D("./src/controller/id3-track-controller.ts"),I=D("./src/controller/latency-controller.ts"),k=D("./src/controller/level-controller.ts"),y=D("./src/controller/fragment-tracker.ts"),A=D("./src/controller/stream-controller.ts"),O=D("./src/is-supported.ts"),_=D("./src/utils/logger.ts"),C=D("./src/config.ts"),S=D("./node_modules/eventemitter3/index.js"),d=D.n(S),o=D("./src/events.ts"),l=D("./src/errors.ts");function h(f,L){for(var g=0;g<L.length;g++){var m=L[g];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(f,m.key,m)}}function w(f,L,g){return L&&h(f.prototype,L),g&&h(f,g),f}var p=function(){f.isSupported=function(){return Object(O.isSupported)()};function f(g){g===void 0&&(g={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new S.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 m=this.config=Object(C.mergeConfig)(f.DefaultConfig,g);this.userConfig=g,Object(_.enableLogs)(m.debug),this._autoLevelCapping=-1,m.progressive&&Object(C.enableStreamingMode)(m);var c=m.abrController,u=m.bufferController,a=m.capLevelController,x=m.fpsController,b=this.abrController=new c(this),E=this.bufferController=new u(this),N=this.capLevelController=new a(this),U=new x(this),K=new P.default(this),V=new G.default(this),R=new j.default(this),M=this.levelController=new k.default(this),$=new y.FragmentTracker(this),ee=this.streamController=new A.default(this,$);N.setStreamController(ee),U.setStreamController(ee);var oe=[M,ee];this.networkControllers=oe;var fe=[K,V,b,E,N,U,R,$];this.audioTrackController=this.createController(m.audioTrackController,null,oe),this.createController(m.audioStreamController,$,oe),this.subtitleTrackController=this.createController(m.subtitleTrackController,null,oe),this.createController(m.subtitleStreamController,$,oe),this.createController(m.timelineController,null,fe),this.emeController=this.createController(m.emeController,null,fe),this.cmcdController=this.createController(m.cmcdController,null,fe),this.latencyController=this.createController(I.default,null,fe),this.coreComponents=fe}var L=f.prototype;return L.createController=function(m,c,u){if(m){var a=c?new m(this,c):new m(this);return u&&u.push(a),a}return null},L.on=function(m,c,u){u===void 0&&(u=this),this._emitter.on(m,c,u)},L.once=function(m,c,u){u===void 0&&(u=this),this._emitter.once(m,c,u)},L.removeAllListeners=function(m){this._emitter.removeAllListeners(m)},L.off=function(m,c,u,a){u===void 0&&(u=this),this._emitter.off(m,c,u,a)},L.listeners=function(m){return this._emitter.listeners(m)},L.emit=function(m,c,u){return this._emitter.emit(m,c,u)},L.trigger=function(m,c){if(this.config.debug)return this.emit(m,m,c);try{return this.emit(m,m,c)}catch(u){_.logger.error("An internal error happened while handling event "+m+'. Error message: "'+u.message+'". Here is a stacktrace:',u),this.trigger(o.Events.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:m,error:u})}return!1},L.listenerCount=function(m){return this._emitter.listenerCount(m)},L.destroy=function(){_.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(m){return m.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(m){return m.destroy()}),this.coreComponents.length=0},L.attachMedia=function(m){_.logger.log("attachMedia"),this._media=m,this.trigger(o.Events.MEDIA_ATTACHING,{media:m})},L.detachMedia=function(){_.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},L.loadSource=function(m){this.stopLoad();var c=this.media,u=this.url,a=this.url=Z.buildAbsoluteURL(self.location.href,m,{alwaysNormalize:!0});_.logger.log("loadSource:"+a),c&&u&&u!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(o.Events.MANIFEST_LOADING,{url:m})},L.startLoad=function(m){m===void 0&&(m=-1),_.logger.log("startLoad("+m+")"),this.networkControllers.forEach(function(c){c.startLoad(m)})},L.stopLoad=function(){_.logger.log("stopLoad"),this.networkControllers.forEach(function(m){m.stopLoad()})},L.swapAudioCodec=function(){_.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},L.recoverMediaError=function(){_.logger.log("recoverMediaError");var m=this._media;this.detachMedia(),m&&this.attachMedia(m)},L.removeLevel=function(m,c){c===void 0&&(c=0),this.levelController.removeLevel(m,c)},w(f,[{key:"levels",get:function(){var m=this.levelController.levels;return m||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(m){_.logger.log("set currentLevel:"+m),this.loadLevel=m,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(m){_.logger.log("set nextLevel:"+m),this.levelController.manualLevel=m,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(m){_.logger.log("set loadLevel:"+m),this.levelController.manualLevel=m}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(m){this.levelController.nextLoadLevel=m}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(m){_.logger.log("set firstLevel:"+m),this.levelController.firstLevel=m}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(m){_.logger.log("set startLevel:"+m),m!==-1&&(m=Math.max(m,this.minAutoLevel)),this.levelController.startLevel=m}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(m){var c=!!m;c!==this.config.capLevelToPlayerSize&&(c?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=c)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(m){this._autoLevelCapping!==m&&(_.logger.log("set autoLevelCapping:"+m),this._autoLevelCapping=m)}},{key:"bandwidthEstimate",get:function(){var m=this.abrController.bwEstimator;return m?m.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var m=this.levels,c=this.config.minAutoBitrate;if(!m)return 0;for(var u=m.length,a=0;a<u;a++)if(m[a].maxBitrate>c)return a;return 0}},{key:"maxAutoLevel",get:function(){var m=this.levels,c=this.autoLevelCapping,u;return c===-1&&m&&m.length?u=m.length-1:u=c,u}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(m){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,m)}},{key:"audioTracks",get:function(){var m=this.audioTrackController;return m?m.audioTracks:[]}},{key:"audioTrack",get:function(){var m=this.audioTrackController;return m?m.audioTrack:-1},set:function(m){var c=this.audioTrackController;c&&(c.audioTrack=m)}},{key:"subtitleTracks",get:function(){var m=this.subtitleTrackController;return m?m.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var m=this.subtitleTrackController;return m?m.subtitleTrack:-1},set:function(m){var c=this.subtitleTrackController;c&&(c.subtitleTrack=m)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var m=this.subtitleTrackController;return m?m.subtitleDisplay:!1},set:function(m){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=m)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(m){this.config.lowLatencyMode=m}},{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 o.Events}},{key:"ErrorTypes",get:function(){return l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return f.defaultConfig?f.defaultConfig:C.hlsDefaultConfig},set:function(m){f.defaultConfig=m}}]),f}();p.defaultConfig=void 0},"./src/is-supported.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"isSupported",function(){return P}),D.d(Q,"changeTypeSupported",function(){return G});var Z=D("./src/utils/mediasource-helper.ts");function B(){return self.SourceBuffer||self.WebKitSourceBuffer}function P(){var j=Object(Z.getMediaSource)();if(!j)return!1;var I=B(),k=j&&typeof j.isTypeSupported=="function"&&j.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),y=!I||I.prototype&&typeof I.prototype.appendBuffer=="function"&&typeof I.prototype.remove=="function";return!!k&&!!y}function G(){var j,I=B();return typeof(I==null||((j=I.prototype)===null||j===void 0)?void 0:j.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return _}),D.d(Q,"LoadError",function(){return S});var Z=D("./src/polyfills/number.ts"),B=D("./src/errors.ts");function P(d,o){d.prototype=Object.create(o.prototype),d.prototype.constructor=d,y(d,o)}function G(d){var o=typeof Map=="function"?new Map:void 0;return G=function(h){if(h===null||!k(h))return h;if(typeof h!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(h))return o.get(h);o.set(h,w)}function w(){return j(h,arguments,A(this).constructor)}return w.prototype=Object.create(h.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),y(w,h)},G(d)}function j(d,o,l){return I()?j=Reflect.construct:j=function(w,p,f){var L=[null];L.push.apply(L,p);var g=Function.bind.apply(w,L),m=new g;return f&&y(m,f.prototype),m},j.apply(null,arguments)}function I(){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(d){return!1}}function k(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function y(d,o){return y=Object.setPrototypeOf||function(h,w){return h.__proto__=w,h},y(d,o)}function A(d){return A=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},A(d)}var O=Math.pow(2,17),_=function(){function d(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}var o=d.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(h,w){var p=this,f=h.url;if(!f)return Promise.reject(new S({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,networkDetails:null},"Fragment does not have a "+(f?"part list":"url")));this.abort();var L=this.config,g=L.fLoader,m=L.loader;return new Promise(function(c,u){p.loader&&p.loader.destroy();var a=p.loader=h.loader=g?new g(L):new m(L),x=C(h),b={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:O};h.stats=a.stats,a.load(x,b,{onSuccess:function(N,U,K,V){p.resetLoader(h,a),c({frag:h,part:null,payload:N.data,networkDetails:V})},onError:function(N,U,K){p.resetLoader(h,a),u(new S({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,response:N,networkDetails:K}))},onAbort:function(N,U,K){p.resetLoader(h,a),u(new S({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,networkDetails:K}))},onTimeout:function(N,U,K){p.resetLoader(h,a),u(new S({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,networkDetails:K}))},onProgress:function(N,U,K,V){w&&w({frag:h,part:null,payload:K,networkDetails:V})}})})},o.loadPart=function(h,w,p){var f=this;this.abort();var L=this.config,g=L.fLoader,m=L.loader;return new Promise(function(c,u){f.loader&&f.loader.destroy();var a=f.loader=h.loader=g?new g(L):new m(L),x=C(h,w),b={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:O};w.stats=a.stats,a.load(x,b,{onSuccess:function(N,U,K,V){f.resetLoader(h,a),f.updateStatsFromPart(h,w);var R={frag:h,part:w,payload:N.data,networkDetails:V};p(R),c(R)},onError:function(N,U,K){f.resetLoader(h,a),u(new S({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,part:w,response:N,networkDetails:K}))},onAbort:function(N,U,K){h.stats.aborted=w.stats.aborted,f.resetLoader(h,a),u(new S({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,part:w,networkDetails:K}))},onTimeout:function(N,U,K){f.resetLoader(h,a),u(new S({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,part:w,networkDetails:K}))}})})},o.updateStatsFromPart=function(h,w){var p=h.stats,f=w.stats,L=f.total;if(p.loaded+=f.loaded,L){var g=Math.round(h.duration/w.duration),m=Math.min(Math.round(p.loaded/L),g),c=g-m,u=c*Math.round(p.loaded/m);p.total=p.loaded+u}else p.total=Math.max(p.loaded,p.total);var a=p.loading,x=f.loading;a.start?a.first+=x.first-x.start:(a.start=x.start,a.first=x.first),a.end=x.end},o.resetLoader=function(h,w){h.loader=null,this.loader===w&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),w.destroy()},d}();function C(d,o){o===void 0&&(o=null);var l=o||d,h={frag:d,part:o,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},w=l.byteRangeStartOffset,p=l.byteRangeEndOffset;return Object(Z.isFiniteNumber)(w)&&Object(Z.isFiniteNumber)(p)&&(h.rangeStart=w,h.rangeEnd=p),h}var S=function(d){P(o,d);function o(l){for(var h,w=arguments.length,p=new Array(w>1?w-1:0),f=1;f<w;f++)p[f-1]=arguments[f];return h=d.call.apply(d,[this].concat(p))||this,h.data=void 0,h.data=l,h}return o}(G(Error))},"./src/loader/fragment.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"ElementaryStreamTypes",function(){return _}),D.d(Q,"BaseSegment",function(){return C}),D.d(Q,"Fragment",function(){return S}),D.d(Q,"Part",function(){return d});var Z=D("./src/polyfills/number.ts"),B=D("./node_modules/url-toolkit/src/url-toolkit.js"),P=D.n(B),G=D("./src/utils/logger.ts"),j=D("./src/loader/level-key.ts"),I=D("./src/loader/load-stats.ts");function k(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,y(o,l)}function y(o,l){return y=Object.setPrototypeOf||function(w,p){return w.__proto__=p,w},y(o,l)}function A(o,l){for(var h=0;h<l.length;h++){var w=l[h];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(o,w.key,w)}}function O(o,l,h){return l&&A(o.prototype,l),h&&A(o,h),o}var _;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(_||(_={}));var C=function(){function o(h){var w;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(w={},w[_.AUDIO]=null,w[_.VIDEO]=null,w[_.AUDIOVIDEO]=null,w),this.baseurl=h}var l=o.prototype;return l.setByteRange=function(w,p){var f=w.split("@",2),L=[];f.length===1?L[0]=p?p.byteRangeEndOffset:0:L[0]=parseInt(f[1]),L[1]=parseInt(f[0])+L[0],this._byteRange=L},O(o,[{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(B.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(w){this._url=w}}]),o}(),S=function(o){k(l,o);function l(w,p){var f;return f=o.call(this,p)||this,f._decryptdata=null,f.rawProgramDateTime=null,f.programDateTime=null,f.tagList=[],f.duration=0,f.sn=0,f.levelkey=void 0,f.type=void 0,f.loader=null,f.level=-1,f.cc=0,f.startPTS=void 0,f.endPTS=void 0,f.appendedPTS=void 0,f.startDTS=void 0,f.endDTS=void 0,f.start=0,f.deltaPTS=void 0,f.maxStartPTS=void 0,f.minEndPTS=void 0,f.stats=new I.LoadStats,f.urlId=0,f.data=void 0,f.bitrateTest=!1,f.title=null,f.initSegment=null,f.type=w,f}var h=l.prototype;return h.createInitializationVector=function(p){for(var f=new Uint8Array(16),L=12;L<16;L++)f[L]=p>>8*(15-L)&255;return f},h.setDecryptDataFromLevelKey=function(p,f){var L=p;return(p==null?void 0:p.method)==="AES-128"&&p.uri&&!p.iv&&(L=j.LevelKey.fromURI(p.uri),L.method=p.method,L.iv=this.createInitializationVector(f),L.keyFormat="identity"),L},h.setElementaryStreamInfo=function(p,f,L,g,m,c){c===void 0&&(c=!1);var u=this.elementaryStreams,a=u[p];if(!a){u[p]={startPTS:f,endPTS:L,startDTS:g,endDTS:m,partial:c};return}a.startPTS=Math.min(a.startPTS,f),a.endPTS=Math.max(a.endPTS,L),a.startDTS=Math.min(a.startDTS,g),a.endDTS=Math.max(a.endDTS,m)},h.clearElementaryStreamInfo=function(){var p=this.elementaryStreams;p[_.AUDIO]=null,p[_.VIDEO]=null,p[_.AUDIOVIDEO]=null},O(l,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var p=this.sn;typeof p!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&G.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),p=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,p)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(Z.isFiniteNumber)(this.programDateTime))return null;var p=Object(Z.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+p*1e3}},{key:"encrypted",get:function(){var p;return!!((p=this.decryptdata)!==null&&p!==void 0&&p.keyFormat&&this.decryptdata.uri)}}]),l}(C),d=function(o){k(l,o);function l(h,w,p,f,L){var g;g=o.call(this,p)||this,g.fragOffset=0,g.duration=0,g.gap=!1,g.independent=!1,g.relurl=void 0,g.fragment=void 0,g.index=void 0,g.stats=new I.LoadStats,g.duration=h.decimalFloatingPoint("DURATION"),g.gap=h.bool("GAP"),g.independent=h.bool("INDEPENDENT"),g.relurl=h.enumeratedString("URI"),g.fragment=w,g.index=f;var m=h.enumeratedString("BYTERANGE");return m&&g.setByteRange(m,L),L&&(g.fragOffset=L.fragOffset+L.duration),g}return O(l,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var w=this.elementaryStreams;return!!(w.audio||w.video||w.audiovideo)}}]),l}(C)},"./src/loader/key-loader.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return G});var Z=D("./src/events.ts"),B=D("./src/errors.ts"),P=D("./src/utils/logger.ts"),G=function(){function j(k){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=k,this._registerListeners()}var I=j.prototype;return I._registerListeners=function(){this.hls.on(Z.Events.KEY_LOADING,this.onKeyLoading,this)},I._unregisterListeners=function(){this.hls.off(Z.Events.KEY_LOADING,this.onKeyLoading)},I.destroy=function(){this._unregisterListeners();for(var y in this.loaders){var A=this.loaders[y];A&&A.destroy()}this.loaders={}},I.onKeyLoading=function(y,A){var O=A.frag,_=O.type,C=this.loaders[_];if(!O.decryptdata){P.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var S=O.decryptdata.uri;if(S!==this.decrypturl||this.decryptkey===null){var d=this.hls.config;if(C&&(P.logger.warn("abort previous key loader for type:"+_),C.abort()),!S){P.logger.warn("key uri is falsy");return}var o=d.loader,l=O.loader=this.loaders[_]=new o(d);this.decrypturl=S,this.decryptkey=null;var h={url:S,frag:O,responseType:"arraybuffer"},w={timeout:d.fragLoadingTimeOut,maxRetry:0,retryDelay:d.fragLoadingRetryDelay,maxRetryDelay:d.fragLoadingMaxRetryTimeout,highWaterMark:0},p={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(h,w,p)}else this.decryptkey&&(O.decryptdata.key=this.decryptkey,this.hls.trigger(Z.Events.KEY_LOADED,{frag:O}))},I.loadsuccess=function(y,A,O){var _=O.frag;if(!_.decryptdata){P.logger.error("after key load, decryptdata unset");return}this.decryptkey=_.decryptdata.key=new Uint8Array(y.data),_.loader=null,delete this.loaders[_.type],this.hls.trigger(Z.Events.KEY_LOADED,{frag:_})},I.loaderror=function(y,A){var O=A.frag,_=O.loader;_&&_.abort(),delete this.loaders[O.type],this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:O,response:y})},I.loadtimeout=function(y,A){var O=A.frag,_=O.loader;_&&_.abort(),delete this.loaders[O.type],this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:O})},j}()},"./src/loader/level-details.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"LevelDetails",function(){return j});var Z=D("./src/polyfills/number.ts");function B(I,k){for(var y=0;y<k.length;y++){var A=k[y];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(I,A.key,A)}}function P(I,k,y){return k&&B(I.prototype,k),y&&B(I,y),I}var G=10,j=function(){function I(y){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=y}var k=I.prototype;return k.reloaded=function(A){if(!A){this.advanced=!0,this.updated=!0;return}var O=this.lastPartSn-A.lastPartSn,_=this.lastPartIndex-A.lastPartIndex;this.updated=this.endSN!==A.endSN||!!_||!!O,this.advanced=this.endSN>A.endSN||O>0||O===0&&_>0,this.updated||this.advanced?this.misses=Math.floor(A.misses*.6):this.misses=A.misses+1,this.availabilityDelay=A.availabilityDelay},P(I,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(Z.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||G}},{key:"drift",get:function(){var A=this.driftEndTime-this.driftStartTime;if(A>0){var O=this.driftEnd-this.driftStart;return O*1e3/A}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var A;return(A=this.fragments)!==null&&A!==void 0&&A.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 A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),I}()},"./src/loader/level-key.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"LevelKey",function(){return j});var Z=D("./node_modules/url-toolkit/src/url-toolkit.js"),B=D.n(Z);function P(I,k){for(var y=0;y<k.length;y++){var A=k[y];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(I,A.key,A)}}function G(I,k,y){return k&&P(I.prototype,k),y&&P(I,y),I}var j=function(){I.fromURL=function(y,A){return new I(y,A)},I.fromURI=function(y){return new I(y)};function I(k,y){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,y?this._uri=Object(Z.buildAbsoluteURL)(k,y,{alwaysNormalize:!0}):this._uri=k}return G(I,[{key:"uri",get:function(){return this._uri}}]),I}()},"./src/loader/load-stats.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"LoadStats",function(){return Z});var Z=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(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return l});var Z=D("./src/polyfills/number.ts"),B=D("./node_modules/url-toolkit/src/url-toolkit.js"),P=D.n(B),G=D("./src/loader/fragment.ts"),j=D("./src/loader/level-details.ts"),I=D("./src/loader/level-key.ts"),k=D("./src/utils/attr-list.ts"),y=D("./src/utils/logger.ts"),A=D("./src/utils/codecs.ts"),O=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,_=/#EXT-X-MEDIA:(.*)/g,C=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),S=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("|")),d=/\.(mp4|m4s|m4v|m4a)$/i;function o(L){var g,m;return d.test((g=(m=B.parseURL(L))===null||m===void 0?void 0:m.path)!=null?g:"")}var l=function(){function L(){}return L.findGroup=function(m,c){for(var u=0;u<m.length;u++){var a=m[u];if(a.id===c)return a}},L.convertAVC1ToAVCOTI=function(m){var c=m.split(".");if(c.length>2){var u=c.shift()+".";return u+=parseInt(c.shift()).toString(16),u+=("000"+parseInt(c.shift()).toString(16)).substr(-4),u}return m},L.resolve=function(m,c){return B.buildAbsoluteURL(c,m,{alwaysNormalize:!0})},L.parseMasterPlaylist=function(m,c){var u=[],a={},x=!1;O.lastIndex=0;for(var b;(b=O.exec(m))!=null;)if(b[1]){var E=new k.AttrList(b[1]),N={attrs:E,bitrate:E.decimalInteger("AVERAGE-BANDWIDTH")||E.decimalInteger("BANDWIDTH"),name:E.NAME,url:L.resolve(b[2],c)},U=E.decimalResolution("RESOLUTION");U&&(N.width=U.width,N.height=U.height),h((E.CODECS||"").split(/[ ,]+/).filter(function(V){return V}),N),N.videoCodec&&N.videoCodec.indexOf("avc1")!==-1&&(N.videoCodec=L.convertAVC1ToAVCOTI(N.videoCodec)),u.push(N)}else if(b[3]){var K=new k.AttrList(b[3]);K["DATA-ID"]&&(x=!0,a[K["DATA-ID"]]=K)}return{levels:u,sessionData:x?a:null}},L.parseMasterPlaylistMedia=function(m,c,u,a){a===void 0&&(a=[]);var x,b=[],E=0;for(_.lastIndex=0;(x=_.exec(m))!==null;){var N=new k.AttrList(x[1]);if(N.TYPE===u){var U={attrs:N,bitrate:0,id:E++,groupId:N["GROUP-ID"],instreamId:N["INSTREAM-ID"],name:N.NAME||N.LANGUAGE||"",type:u,default:N.bool("DEFAULT"),autoselect:N.bool("AUTOSELECT"),forced:N.bool("FORCED"),lang:N.LANGUAGE,url:N.URI?L.resolve(N.URI,c):""};if(a.length){var K=L.findGroup(a,U.groupId)||a[0];w(U,K,"audioCodec"),w(U,K,"textCodec")}b.push(U)}}return b},L.parseLevelPlaylist=function(m,c,u,a,x){var b=new j.LevelDetails(c),E=b.fragments,N=null,U=0,K=0,V=0,R=0,M=null,$=new G.Fragment(a,c),ee,oe,fe,ke=-1,Ee=!1;for(C.lastIndex=0,b.m3u8=m;(ee=C.exec(m))!==null;){Ee&&(Ee=!1,$=new G.Fragment(a,c),$.start=V,$.sn=U,$.cc=R,$.level=u,N&&($.initSegment=N,$.rawProgramDateTime=N.rawProgramDateTime));var Te=ee[1];if(Te){$.duration=parseFloat(Te);var we=(" "+ee[2]).slice(1);$.title=we||null,$.tagList.push(we?["INF",Te,we]:["INF",Te])}else if(ee[3])Object(Z.isFiniteNumber)($.duration)&&($.start=V,fe&&($.levelkey=fe),$.sn=U,$.level=u,$.cc=R,$.urlId=x,E.push($),$.relurl=(" "+ee[3]).slice(1),f($,M),M=$,V+=$.duration,U++,K=0,Ee=!0);else if(ee[4]){var Ce=(" "+ee[4]).slice(1);M?$.setByteRange(Ce,M):$.setByteRange(Ce)}else if(ee[5])$.rawProgramDateTime=(" "+ee[5]).slice(1),$.tagList.push(["PROGRAM-DATE-TIME",$.rawProgramDateTime]),ke===-1&&(ke=E.length);else{if(ee=ee[0].match(S),!ee){y.logger.warn("No matches on slow regex match for level playlist!");continue}for(oe=1;oe<ee.length&&!(typeof ee[oe]!="undefined");oe++);var me=(" "+ee[oe]).slice(1),ue=(" "+ee[oe+1]).slice(1),te=ee[oe+2]?(" "+ee[oe+2]).slice(1):"";switch(me){case"PLAYLIST-TYPE":b.type=ue.toUpperCase();break;case"MEDIA-SEQUENCE":U=b.startSN=parseInt(ue);break;case"SKIP":{var de=new k.AttrList(ue),ae=de.decimalInteger("SKIPPED-SEGMENTS");if(Object(Z.isFiniteNumber)(ae)){b.skippedSegments=ae;for(var _e=ae;_e--;)E.unshift(null);U+=ae}var Re=de.enumeratedString("RECENTLY-REMOVED-DATERANGES");Re&&(b.recentlyRemovedDateranges=Re.split(" "));break}case"TARGETDURATION":b.targetduration=parseFloat(ue);break;case"VERSION":b.version=parseInt(ue);break;case"EXTM3U":break;case"ENDLIST":b.live=!1;break;case"#":(ue||te)&&$.tagList.push(te?[ue,te]:[ue]);break;case"DIS":R++;case"GAP":$.tagList.push([me]);break;case"BITRATE":$.tagList.push([me,ue]);break;case"DISCONTINUITY-SEQ":R=parseInt(ue);break;case"KEY":{var ye,Oe=new k.AttrList(ue),Pe=Oe.enumeratedString("METHOD"),Ie=Oe.URI,je=Oe.hexadecimalInteger("IV"),Be=Oe.enumeratedString("KEYFORMATVERSIONS"),Ne=Oe.enumeratedString("KEYID"),et=(ye=Oe.enumeratedString("KEYFORMAT"))!=null?ye:"identity",Ze=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ze.indexOf(et)>-1){y.logger.warn("Keyformat "+et+" is not supported from the manifest");continue}else if(et!=="identity")continue;Pe&&(fe=I.LevelKey.fromURL(c,Ie),Ie&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Pe)>=0&&(fe.method=Pe,fe.keyFormat=et,Ne&&(fe.keyID=Ne),Be&&(fe.keyFormatVersions=Be),fe.iv=je));break}case"START":{var $e=new k.AttrList(ue),Xe=$e.decimalFloatingPoint("TIME-OFFSET");Object(Z.isFiniteNumber)(Xe)&&(b.startTimeOffset=Xe);break}case"MAP":{var st=new k.AttrList(ue);$.relurl=st.URI,st.BYTERANGE&&$.setByteRange(st.BYTERANGE),$.level=u,$.sn="initSegment",fe&&($.levelkey=fe),$.initSegment=null,N=$,Ee=!0;break}case"SERVER-CONTROL":{var qe=new k.AttrList(ue);b.canBlockReload=qe.bool("CAN-BLOCK-RELOAD"),b.canSkipUntil=qe.optionalFloat("CAN-SKIP-UNTIL",0),b.canSkipDateRanges=b.canSkipUntil>0&&qe.bool("CAN-SKIP-DATERANGES"),b.partHoldBack=qe.optionalFloat("PART-HOLD-BACK",0),b.holdBack=qe.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var nt=new k.AttrList(ue);b.partTarget=nt.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Me=b.partList;Me||(Me=b.partList=[]);var ct=K>0?Me[Me.length-1]:void 0,at=K++,Ue=new G.Part(new k.AttrList(ue),$,c,at,ct);Me.push(Ue),$.duration+=Ue.duration;break}case"PRELOAD-HINT":{var Ke=new k.AttrList(ue);b.preloadHint=Ke;break}case"RENDITION-REPORT":{var xe=new k.AttrList(ue);b.renditionReports=b.renditionReports||[],b.renditionReports.push(xe);break}default:y.logger.warn("line parsed but not handled: "+ee);break}}}M&&!M.relurl?(E.pop(),V-=M.duration,b.partList&&(b.fragmentHint=M)):b.partList&&(f($,M),$.cc=R,b.fragmentHint=$);var ge=E.length,be=E[0],re=E[ge-1];if(V+=b.skippedSegments*b.targetduration,V>0&&ge&&re){b.averagetargetduration=V/ge;var ne=re.sn;b.endSN=ne!=="initSegment"?ne:0,be&&(b.startCC=be.cc,be.initSegment||b.fragments.every(function(se){return se.relurl&&o(se.relurl)})&&(y.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),$=new G.Fragment(a,c),$.relurl=re.relurl,$.level=u,$.sn="initSegment",be.initSegment=$,b.needSidxRanges=!0))}else b.endSN=0,b.startCC=0;return b.fragmentHint&&(V+=b.fragmentHint.duration),b.totalduration=V,b.endCC=R,ke>0&&p(E,ke),b},L}();function h(L,g){["video","audio","text"].forEach(function(m){var c=L.filter(function(a){return Object(A.isCodecType)(a,m)});if(c.length){var u=c.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});g[m+"Codec"]=u.length>0?u[0]:c[0],L=L.filter(function(a){return c.indexOf(a)===-1})}}),g.unknownCodecs=L}function w(L,g,m){var c=g[m];c&&(L[m]=c)}function p(L,g){for(var m=L[g],c=g;c--;){var u=L[c];if(!u)return;u.programDateTime=m.programDateTime-u.duration*1e3,m=u}}function f(L,g){L.rawProgramDateTime?L.programDateTime=Date.parse(L.rawProgramDateTime):g!=null&&g.programDateTime&&(L.programDateTime=g.endProgramDateTime),Object(Z.isFiniteNumber)(L.programDateTime)||(L.programDateTime=null,L.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/polyfills/number.ts"),B=D("./src/events.ts"),P=D("./src/errors.ts"),G=D("./src/utils/logger.ts"),j=D("./src/utils/mp4-tools.ts"),I=D("./src/loader/m3u8-parser.ts"),k=D("./src/types/loader.ts"),y=D("./src/utils/attr-list.ts");function A(C){var S=C.type;switch(S){case k.PlaylistContextType.AUDIO_TRACK:return k.PlaylistLevelType.AUDIO;case k.PlaylistContextType.SUBTITLE_TRACK:return k.PlaylistLevelType.SUBTITLE;default:return k.PlaylistLevelType.MAIN}}function O(C,S){var d=C.url;return(d===void 0||d.indexOf("data:")===0)&&(d=S.url),d}var _=function(){function C(d){this.hls=void 0,this.loaders=Object.create(null),this.hls=d,this.registerListeners()}var S=C.prototype;return S.registerListeners=function(){var o=this.hls;o.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(B.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(B.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(B.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},S.unregisterListeners=function(){var o=this.hls;o.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(B.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(B.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(B.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},S.createInternalLoader=function(o){var l=this.hls.config,h=l.pLoader,w=l.loader,p=h||w,f=new p(l);return o.loader=f,this.loaders[o.type]=f,f},S.getInternalLoader=function(o){return this.loaders[o.type]},S.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},S.destroyInternalLoaders=function(){for(var o in this.loaders){var l=this.loaders[o];l&&l.destroy(),this.resetInternalLoader(o)}},S.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},S.onManifestLoading=function(o,l){var h=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:k.PlaylistContextType.MANIFEST,url:h,deliveryDirectives:null})},S.onLevelLoading=function(o,l){var h=l.id,w=l.level,p=l.url,f=l.deliveryDirectives;this.load({id:h,groupId:null,level:w,responseType:"text",type:k.PlaylistContextType.LEVEL,url:p,deliveryDirectives:f})},S.onAudioTrackLoading=function(o,l){var h=l.id,w=l.groupId,p=l.url,f=l.deliveryDirectives;this.load({id:h,groupId:w,level:null,responseType:"text",type:k.PlaylistContextType.AUDIO_TRACK,url:p,deliveryDirectives:f})},S.onSubtitleTrackLoading=function(o,l){var h=l.id,w=l.groupId,p=l.url,f=l.deliveryDirectives;this.load({id:h,groupId:w,level:null,responseType:"text",type:k.PlaylistContextType.SUBTITLE_TRACK,url:p,deliveryDirectives:f})},S.load=function(o){var l,h=this.hls.config,w=this.getInternalLoader(o);if(w){var p=w.context;if(p&&p.url===o.url){G.logger.trace("[playlist-loader]: playlist request ongoing");return}G.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),w.abort()}var f,L,g,m;switch(o.type){case k.PlaylistContextType.MANIFEST:f=h.manifestLoadingMaxRetry,L=h.manifestLoadingTimeOut,g=h.manifestLoadingRetryDelay,m=h.manifestLoadingMaxRetryTimeout;break;case k.PlaylistContextType.LEVEL:case k.PlaylistContextType.AUDIO_TRACK:case k.PlaylistContextType.SUBTITLE_TRACK:f=0,L=h.levelLoadingTimeOut;break;default:f=h.levelLoadingMaxRetry,L=h.levelLoadingTimeOut,g=h.levelLoadingRetryDelay,m=h.levelLoadingMaxRetryTimeout;break}if(w=this.createInternalLoader(o),(l=o.deliveryDirectives)!==null&&l!==void 0&&l.part){var c;if(o.type===k.PlaylistContextType.LEVEL&&o.level!==null?c=this.hls.levels[o.level].details:o.type===k.PlaylistContextType.AUDIO_TRACK&&o.id!==null?c=this.hls.audioTracks[o.id].details:o.type===k.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(c=this.hls.subtitleTracks[o.id].details),c){var u=c.partTarget,a=c.targetduration;u&&a&&(L=Math.min(Math.max(u*3,a*.8)*1e3,L))}}var x={timeout:L,maxRetry:f,retryDelay:g,maxRetryDelay:m,highWaterMark:0},b={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};w.load(o,x,b)},S.loadsuccess=function(o,l,h,w){if(w===void 0&&(w=null),h.isSidxRequest){this.handleSidxRequest(o,h),this.handlePlaylistLoaded(o,l,h,w);return}this.resetInternalLoader(h.type);var p=o.data;if(p.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,h,"no EXTM3U delimiter",w);return}l.parsing.start=performance.now(),p.indexOf("#EXTINF:")>0||p.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,l,h,w):this.handleMasterPlaylist(o,l,h,w)},S.loaderror=function(o,l,h){h===void 0&&(h=null),this.handleNetworkError(l,h,!1,o)},S.loadtimeout=function(o,l,h){h===void 0&&(h=null),this.handleNetworkError(l,h,!0)},S.handleMasterPlaylist=function(o,l,h,w){var p=this.hls,f=o.data,L=O(o,h),g=I.default.parseMasterPlaylist(f,L),m=g.levels,c=g.sessionData;if(!m.length){this.handleManifestParsingError(o,h,"no level found in manifest",w);return}var u=m.map(function(U){return{id:U.attrs.AUDIO,audioCodec:U.audioCodec}}),a=m.map(function(U){return{id:U.attrs.SUBTITLES,textCodec:U.textCodec}}),x=I.default.parseMasterPlaylistMedia(f,L,"AUDIO",u),b=I.default.parseMasterPlaylistMedia(f,L,"SUBTITLES",a),E=I.default.parseMasterPlaylistMedia(f,L,"CLOSED-CAPTIONS");if(x.length){var N=x.some(function(U){return!U.url});!N&&m[0].audioCodec&&!m[0].attrs.AUDIO&&(G.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),x.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new y.AttrList({}),bitrate:0,url:""}))}p.trigger(B.Events.MANIFEST_LOADED,{levels:m,audioTracks:x,subtitles:b,captions:E,url:L,stats:l,networkDetails:w,sessionData:c})},S.handleTrackOrLevelPlaylist=function(o,l,h,w){var p=this.hls,f=h.id,L=h.level,g=h.type,m=O(o,h),c=Object(Z.isFiniteNumber)(f)?f:0,u=Object(Z.isFiniteNumber)(L)?L:c,a=A(h),x=I.default.parseLevelPlaylist(o.data,m,u,a,c);if(!x.fragments.length){p.trigger(B.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:m,reason:"no fragments found in level",level:typeof h.level=="number"?h.level:void 0});return}if(g===k.PlaylistContextType.MANIFEST){var b={attrs:new y.AttrList({}),bitrate:0,details:x,name:"",url:m};p.trigger(B.Events.MANIFEST_LOADED,{levels:[b],audioTracks:[],url:m,stats:l,networkDetails:w,sessionData:null})}if(l.parsing.end=performance.now(),x.needSidxRanges){var E,N=(E=x.fragments[0].initSegment)===null||E===void 0?void 0:E.url;this.load({url:N,isSidxRequest:!0,type:g,level:L,levelDetails:x,id:f,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}h.levelDetails=x,this.handlePlaylistLoaded(o,l,h,w)},S.handleSidxRequest=function(o,l){var h=Object(j.parseSegmentIndex)(new Uint8Array(o.data));if(!h)return;var w=h.references,p=l.levelDetails;w.forEach(function(f,L){var g=f.info,m=p.fragments[L];m.byteRange.length===0&&m.setByteRange(String(1+g.end-g.start)+"@"+String(g.start)),m.initSegment&&m.initSegment.setByteRange(String(h.moovEndOffset)+"@0")})},S.handleManifestParsingError=function(o,l,h,w){this.hls.trigger(B.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===k.PlaylistContextType.MANIFEST,url:o.url,reason:h,response:o,context:l,networkDetails:w})},S.handleNetworkError=function(o,l,h,w){h===void 0&&(h=!1),G.logger.warn("[playlist-loader]: A network "+(h?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var p=P.ErrorDetails.UNKNOWN,f=!1,L=this.getInternalLoader(o);switch(o.type){case k.PlaylistContextType.MANIFEST:p=h?P.ErrorDetails.MANIFEST_LOAD_TIMEOUT:P.ErrorDetails.MANIFEST_LOAD_ERROR,f=!0;break;case k.PlaylistContextType.LEVEL:p=h?P.ErrorDetails.LEVEL_LOAD_TIMEOUT:P.ErrorDetails.LEVEL_LOAD_ERROR,f=!1;break;case k.PlaylistContextType.AUDIO_TRACK:p=h?P.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,f=!1;break;case k.PlaylistContextType.SUBTITLE_TRACK:p=h?P.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:P.ErrorDetails.SUBTITLE_LOAD_ERROR,f=!1;break}L&&this.resetInternalLoader(o.type);var g={type:P.ErrorTypes.NETWORK_ERROR,details:p,fatal:f,url:o.url,loader:L,context:o,networkDetails:l};w&&(g.response=w),this.hls.trigger(B.Events.ERROR,g)},S.handlePlaylistLoaded=function(o,l,h,w){var p=h.type,f=h.level,L=h.id,g=h.groupId,m=h.loader,c=h.levelDetails,u=h.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(o,h,"invalid target duration",w);return}if(!m)return;c.live&&(m.getCacheAge&&(c.ageHeader=m.getCacheAge()||0),(!m.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(p){case k.PlaylistContextType.MANIFEST:case k.PlaylistContextType.LEVEL:this.hls.trigger(B.Events.LEVEL_LOADED,{details:c,level:f||0,id:L||0,stats:l,networkDetails:w,deliveryDirectives:u});break;case k.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(B.Events.AUDIO_TRACK_LOADED,{details:c,id:L||0,groupId:g||"",stats:l,networkDetails:w,deliveryDirectives:u});break;case k.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(B.Events.SUBTITLE_TRACK_LOADED,{details:c,id:L||0,groupId:g||"",stats:l,networkDetails:w,deliveryDirectives:u});break}},C}();Q.default=_},"./src/polyfills/number.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"isFiniteNumber",function(){return Z}),D.d(Q,"MAX_SAFE_INTEGER",function(){return B});var Z=Number.isFinite||function(P){return typeof P=="number"&&isFinite(P)},B=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(le,Q,D){"use strict";D.r(Q);var Z=function(){function B(){}return B.getSilentFrame=function(G,j){switch(G){case"mp4a.40.2":if(j===1)return new Uint8Array([0,200,0,128,35,128]);if(j===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(j===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(j===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(j===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(j===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(j===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(j===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(j===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},B}();Q.default=Z},"./src/remux/mp4-generator.ts":function(le,Q,D){"use strict";D.r(Q);var Z=Math.pow(2,32)-1,B=function(){function P(){}return P.init=function(){P.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 j;for(j in P.types)P.types.hasOwnProperty(j)&&(P.types[j]=[j.charCodeAt(0),j.charCodeAt(1),j.charCodeAt(2),j.charCodeAt(3)]);var I=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),k=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);P.HDLR_TYPES={video:I,audio:k};var y=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),A=new Uint8Array([0,0,0,0,0,0,0,0]);P.STTS=P.STSC=P.STCO=A,P.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),P.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),P.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),P.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var O=new Uint8Array([105,115,111,109]),_=new Uint8Array([97,118,99,49]),C=new Uint8Array([0,0,0,1]);P.FTYP=P.box(P.types.ftyp,O,C,O,_),P.DINF=P.box(P.types.dinf,P.box(P.types.dref,y))},P.box=function(j){for(var I=8,k=arguments.length,y=new Array(k>1?k-1:0),A=1;A<k;A++)y[A-1]=arguments[A];for(var O=y.length,_=O;O--;)I+=y[O].byteLength;var C=new Uint8Array(I);for(C[0]=I>>24&255,C[1]=I>>16&255,C[2]=I>>8&255,C[3]=I&255,C.set(j,4),O=0,I=8;O<_;O++)C.set(y[O],I),I+=y[O].byteLength;return C},P.hdlr=function(j){return P.box(P.types.hdlr,P.HDLR_TYPES[j])},P.mdat=function(j){return P.box(P.types.mdat,j)},P.mdhd=function(j,I){I*=j;var k=Math.floor(I/(Z+1)),y=Math.floor(I%(Z+1));return P.box(P.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,j>>24&255,j>>16&255,j>>8&255,j&255,k>>24,k>>16&255,k>>8&255,k&255,y>>24,y>>16&255,y>>8&255,y&255,85,196,0,0]))},P.mdia=function(j){return P.box(P.types.mdia,P.mdhd(j.timescale,j.duration),P.hdlr(j.type),P.minf(j))},P.mfhd=function(j){return P.box(P.types.mfhd,new Uint8Array([0,0,0,0,j>>24,j>>16&255,j>>8&255,j&255]))},P.minf=function(j){return j.type==="audio"?P.box(P.types.minf,P.box(P.types.smhd,P.SMHD),P.DINF,P.stbl(j)):P.box(P.types.minf,P.box(P.types.vmhd,P.VMHD),P.DINF,P.stbl(j))},P.moof=function(j,I,k){return P.box(P.types.moof,P.mfhd(j),P.traf(k,I))},P.moov=function(j){for(var I=j.length,k=[];I--;)k[I]=P.trak(j[I]);return P.box.apply(null,[P.types.moov,P.mvhd(j[0].timescale,j[0].duration)].concat(k).concat(P.mvex(j)))},P.mvex=function(j){for(var I=j.length,k=[];I--;)k[I]=P.trex(j[I]);return P.box.apply(null,[P.types.mvex].concat(k))},P.mvhd=function(j,I){I*=j;var k=Math.floor(I/(Z+1)),y=Math.floor(I%(Z+1)),A=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,j>>24&255,j>>16&255,j>>8&255,j&255,k>>24,k>>16&255,k>>8&255,k&255,y>>24,y>>16&255,y>>8&255,y&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 P.box(P.types.mvhd,A)},P.sdtp=function(j){var I=j.samples||[],k=new Uint8Array(4+I.length),y,A;for(y=0;y<I.length;y++)A=I[y].flags,k[y+4]=A.dependsOn<<4|A.isDependedOn<<2|A.hasRedundancy;return P.box(P.types.sdtp,k)},P.stbl=function(j){return P.box(P.types.stbl,P.stsd(j),P.box(P.types.stts,P.STTS),P.box(P.types.stsc,P.STSC),P.box(P.types.stsz,P.STSZ),P.box(P.types.stco,P.STCO))},P.avc1=function(j){var I=[],k=[],y,A,O;for(y=0;y<j.sps.length;y++)A=j.sps[y],O=A.byteLength,I.push(O>>>8&255),I.push(O&255),I=I.concat(Array.prototype.slice.call(A));for(y=0;y<j.pps.length;y++)A=j.pps[y],O=A.byteLength,k.push(O>>>8&255),k.push(O&255),k=k.concat(Array.prototype.slice.call(A));var _=P.box(P.types.avcC,new Uint8Array([1,I[3],I[4],I[5],252|3,224|j.sps.length].concat(I).concat([j.pps.length]).concat(k))),C=j.width,S=j.height,d=j.pixelRatio[0],o=j.pixelRatio[1];return P.box(P.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,C>>8&255,C&255,S>>8&255,S&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),_,P.box(P.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),P.box(P.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,o>>24,o>>16&255,o>>8&255,o&255])))},P.esds=function(j){var I=j.config.length;return new Uint8Array([0,0,0,0,3,23+I,0,1,0,4,15+I,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([I]).concat(j.config).concat([6,1,2]))},P.mp4a=function(j){var I=j.samplerate;return P.box(P.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,j.channelCount,0,16,0,0,0,0,I>>8&255,I&255,0,0]),P.box(P.types.esds,P.esds(j)))},P.mp3=function(j){var I=j.samplerate;return P.box(P.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,j.channelCount,0,16,0,0,0,0,I>>8&255,I&255,0,0]))},P.stsd=function(j){return j.type==="audio"?!j.isAAC&&j.codec==="mp3"?P.box(P.types.stsd,P.STSD,P.mp3(j)):P.box(P.types.stsd,P.STSD,P.mp4a(j)):P.box(P.types.stsd,P.STSD,P.avc1(j))},P.tkhd=function(j){var I=j.id,k=j.duration*j.timescale,y=j.width,A=j.height,O=Math.floor(k/(Z+1)),_=Math.floor(k%(Z+1));return P.box(P.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,I>>24&255,I>>16&255,I>>8&255,I&255,0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255,_>>24,_>>16&255,_>>8&255,_&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,y>>8&255,y&255,0,0,A>>8&255,A&255,0,0]))},P.traf=function(j,I){var k=P.sdtp(j),y=j.id,A=Math.floor(I/(Z+1)),O=Math.floor(I%(Z+1));return P.box(P.types.traf,P.box(P.types.tfhd,new Uint8Array([0,0,0,0,y>>24,y>>16&255,y>>8&255,y&255])),P.box(P.types.tfdt,new Uint8Array([1,0,0,0,A>>24,A>>16&255,A>>8&255,A&255,O>>24,O>>16&255,O>>8&255,O&255])),P.trun(j,k.length+16+20+8+16+8+8),k)},P.trak=function(j){return j.duration=j.duration||4294967295,P.box(P.types.trak,P.tkhd(j),P.mdia(j))},P.trex=function(j){var I=j.id;return P.box(P.types.trex,new Uint8Array([0,0,0,0,I>>24,I>>16&255,I>>8&255,I&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},P.trun=function(j,I){var k=j.samples||[],y=k.length,A=12+16*y,O=new Uint8Array(A),_,C,S,d,o,l;for(I+=8+A,O.set([0,0,15,1,y>>>24&255,y>>>16&255,y>>>8&255,y&255,I>>>24&255,I>>>16&255,I>>>8&255,I&255],0),_=0;_<y;_++)C=k[_],S=C.duration,d=C.size,o=C.flags,l=C.cts,O.set([S>>>24&255,S>>>16&255,S>>>8&255,S&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*_);return P.box(P.types.trun,O)},P.initSegment=function(j){P.types||P.init();var I=P.moov(j),k=new Uint8Array(P.FTYP.byteLength+I.byteLength);return k.set(P.FTYP),k.set(I,P.FTYP.byteLength),k},P}();B.types=void 0,B.HDLR_TYPES=void 0,B.STTS=void 0,B.STSC=void 0,B.STCO=void 0,B.STSZ=void 0,B.VMHD=void 0,B.SMHD=void 0,B.STSD=void 0,B.FTYP=void 0,B.DINF=void 0,Q.default=B},"./src/remux/mp4-remuxer.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return l}),D.d(Q,"normalizePts",function(){return h});var Z=D("./src/polyfills/number.ts"),B=D("./src/remux/aac-helper.ts"),P=D("./src/remux/mp4-generator.ts"),G=D("./src/events.ts"),j=D("./src/errors.ts"),I=D("./src/utils/logger.ts"),k=D("./src/types/loader.ts"),y=D("./src/utils/timescale-conversion.ts");function A(){return A=Object.assign||function(L){for(var g=1;g<arguments.length;g++){var m=arguments[g];for(var c in m)Object.prototype.hasOwnProperty.call(m,c)&&(L[c]=m[c])}return L},A.apply(this,arguments)}var O=10*1e3,_=1024,C=1152,S=null,d=null,o=!1,l=function(){function L(m,c,u,a){if(a===void 0&&(a=""),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=m,this.config=c,this.typeSupported=u,this.ISGenerated=!1,S===null){var x=navigator.userAgent||"",b=x.match(/Chrome\/(\d+)/i);S=b?parseInt(b[1]):0}if(d===null){var E=navigator.userAgent.match(/Safari\/(\d+)/i);d=E?parseInt(E[1]):0}o=!!S&&S<75||!!d&&d<600}var g=L.prototype;return g.destroy=function(){},g.resetTimeStamp=function(c){I.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},g.resetNextTimestamp=function(){I.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},g.resetInitSegment=function(){I.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},g.getVideoStartPts=function(c){var u=!1,a=c.reduce(function(x,b){var E=b.pts-x;return E<-4294967296?(u=!0,h(x,b.pts)):E>0?x:b.pts},c[0].pts);return u&&I.logger.debug("PTS rollover detected"),a},g.remux=function(c,u,a,x,b,E,N,U){var K,V,R,M,$,ee,oe=b,fe=b,ke=c.pid>-1,Ee=u.pid>-1,Te=u.samples.length,we=c.samples.length>0,Ce=Te>1,me=(!ke||we)&&(!Ee||Ce)||this.ISGenerated||N;if(me){this.ISGenerated||(R=this.generateIS(c,u,b));var ue=this.isVideoContiguous,te=-1;if(Ce&&(te=w(u.samples),!ue&&this.config.forceKeyFrameOnDiscontinuity))if(ee=!0,te>0){I.logger.warn("[mp4-remuxer]: Dropped "+te+" out of "+Te+" video samples due to a missing keyframe");var de=this.getVideoStartPts(u.samples);u.samples=u.samples.slice(te),u.dropped+=te,fe+=(u.samples[0].pts-de)/(u.timescale||9e4)}else te===-1&&(I.logger.warn("[mp4-remuxer]: No keyframe found out of "+Te+" video samples"),ee=!1);if(this.ISGenerated){if(we&&Ce){var ae=this.getVideoStartPts(u.samples),_e=h(c.samples[0].pts,ae)-ae,Re=_e/u.inputTimeScale;oe+=Math.max(0,Re),fe+=Math.max(0,-Re)}if(we){if(c.samplerate||(I.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),R=this.generateIS(c,u,b)),V=this.remuxAudio(c,oe,this.isAudioContiguous,E,Ee||Ce||U===k.PlaylistLevelType.AUDIO?fe:void 0),Ce){var ye=V?V.endPTS-V.startPTS:0;u.inputTimeScale||(I.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),R=this.generateIS(c,u,b)),K=this.remuxVideo(u,fe,ue,ye)}}else Ce&&(K=this.remuxVideo(u,fe,ue,0));K&&(K.firstKeyFrame=te,K.independent=te!==-1)}}return this.ISGenerated&&(a.samples.length&&($=this.remuxID3(a,b)),x.samples.length&&(M=this.remuxText(x,b))),{audio:V,video:K,initSegment:R,independent:ee,text:M,id3:$}},g.generateIS=function(c,u,a){var x=c.samples,b=u.samples,E=this.typeSupported,N={},U=!Object(Z.isFiniteNumber)(this._initPTS),K="audio/mp4",V,R,M;if(U&&(V=R=Infinity),c.config&&x.length&&(c.timescale=c.samplerate,c.isAAC||(E.mpeg?(K="audio/mpeg",c.codec=""):E.mp3&&(c.codec="mp3")),N.audio={id:"audio",container:K,codec:c.codec,initSegment:!c.isAAC&&E.mpeg?new Uint8Array(0):P.default.initSegment([c]),metadata:{channelCount:c.channelCount}},U&&(M=c.inputTimeScale,V=R=x[0].pts-Math.round(M*a))),u.sps&&u.pps&&b.length&&(u.timescale=u.inputTimeScale,N.video={id:"main",container:"video/mp4",codec:u.codec,initSegment:P.default.initSegment([u]),metadata:{width:u.width,height:u.height}},U)){M=u.inputTimeScale;var $=this.getVideoStartPts(b),ee=Math.round(M*a);R=Math.min(R,h(b[0].dts,$)-ee),V=Math.min(V,$-ee)}if(Object.keys(N).length)return this.ISGenerated=!0,U&&(this._initPTS=V,this._initDTS=R),{tracks:N,initPTS:V,timescale:M}},g.remuxVideo=function(c,u,a,x){var b=c.inputTimeScale,E=c.samples,N=[],U=E.length,K=this._initPTS,V=this.nextAvcDts,R=8,M,$,ee,oe=Number.POSITIVE_INFINITY,fe=Number.NEGATIVE_INFINITY,ke=0,Ee=!1;if(!a||V===null){var Te=u*b,we=E[0].pts-h(E[0].dts,E[0].pts);V=Te-we}for(var Ce=0;Ce<U;Ce++){var me=E[Ce];if(me.pts=h(me.pts-K,V),me.dts=h(me.dts-K,V),me.dts>me.pts){var ue=9e4*.2;ke=Math.max(Math.min(ke,me.pts-me.dts),-1*ue)}me.dts<E[Ce>0?Ce-1:Ce].dts&&(Ee=!0)}Ee&&E.sort(function(wt,St){var dt=wt.dts-St.dts,zt=wt.pts-St.pts;return dt||zt}),$=E[0].dts,ee=E[E.length-1].dts;var te=Math.round((ee-$)/(U-1));if(ke<0){if(ke<te*-2){I.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(y.toMsFromMpegTsClock)(-te,!0)+" ms");for(var de=ke,ae=0;ae<U;ae++)E[ae].dts=de=Math.max(de,E[ae].pts-te),E[ae].pts=Math.max(de,E[ae].pts)}else{I.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(y.toMsFromMpegTsClock)(ke,!0)+" ms to overcome this issue");for(var _e=0;_e<U;_e++)E[_e].dts=E[_e].dts+ke}$=E[0].dts}if(a){var Re=$-V,ye=Re>te,Oe=Re<-1;if(ye||Oe){ye?I.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(Re,!0)+" ms ("+Re+"dts) hole between fragments detected, filling it"):I.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(-Re,!0)+" ms ("+Re+"dts) overlapping between fragments detected"),$=V;var Pe=E[0].pts-Re;E[0].dts=$,E[0].pts=Pe,I.logger.log("Video: First PTS/DTS adjusted: "+Object(y.toMsFromMpegTsClock)(Pe,!0)+"/"+Object(y.toMsFromMpegTsClock)($,!0)+", delta: "+Object(y.toMsFromMpegTsClock)(Re,!0)+" ms")}}o&&($=Math.max(0,$));for(var Ie=0,je=0,Be=0;Be<U;Be++){for(var Ne=E[Be],et=Ne.units,Ze=et.length,$e=0,Xe=0;Xe<Ze;Xe++)$e+=et[Xe].data.length;je+=$e,Ie+=Ze,Ne.length=$e,Ne.dts=Math.max(Ne.dts,$),Ne.pts=Math.max(Ne.pts,Ne.dts,0),oe=Math.min(Ne.pts,oe),fe=Math.max(Ne.pts,fe)}ee=E[U-1].dts;var st=je+4*Ie+8,qe;try{qe=new Uint8Array(st)}catch(wt){this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:j.ErrorTypes.MUX_ERROR,details:j.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:st,reason:"fail allocating video mdat "+st});return}var nt=new DataView(qe.buffer);nt.setUint32(0,st),qe.set(P.default.types.mdat,4);for(var Me=0;Me<U;Me++){for(var ct=E[Me],at=ct.units,Ue=0,Ke=0,xe=at.length;Ke<xe;Ke++){var ge=at[Ke],be=ge.data,re=ge.data.byteLength;nt.setUint32(R,re),R+=4,qe.set(be,R),R+=re,Ue+=4+re}if(Me<U-1)M=E[Me+1].dts-ct.dts;else{var ne=this.config,se=ct.dts-E[Me>0?Me-1:Me].dts;if(ne.stretchShortVideoTrack&&this.nextAudioPts!==null){var he=Math.floor(ne.maxBufferHole*b),Le=(x?oe+x*b:this.nextAudioPts)-ct.pts;Le>he?(M=Le-se,M<0&&(M=se),I.logger.log("[mp4-remuxer]: It is approximately "+Le/90+" ms to the next segment; using duration "+M/90+" ms for the last video frame.")):M=se}else M=se}var Se=Math.round(ct.pts-ct.dts);N.push(new p(ct.key,M,Ue,Se))}if(N.length&&S&&S<70){var We=N[0].flags;We.dependsOn=2,We.isNonSync=0}console.assert(M!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=V=ee+M,this.isVideoContiguous=!0;var it=P.default.moof(c.sequenceNumber++,$,A({},c,{samples:N})),ft="video",lt={data1:it,data2:qe,startPTS:oe/b,endPTS:(fe+M)/b,startDTS:$/b,endDTS:V/b,type:ft,hasAudio:!1,hasVideo:!0,nb:N.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(qe.length,"MDAT length must not be zero"),lt},g.remuxAudio=function(c,u,a,x,b){var E=c.inputTimeScale,N=c.samplerate?c.samplerate:E,U=E/N,K=c.isAAC?_:C,V=K*U,R=this._initPTS,M=!c.isAAC&&this.typeSupported.mpeg,$=[],ee=c.samples,oe=M?0:8,fe=this.nextAudioPts||-1,ke=u*E;if(this.isAudioContiguous=a=a||ee.length&&fe>0&&(x&&Math.abs(ke-fe)<9e3||Math.abs(h(ee[0].pts-R,ke)-fe)<20*V),ee.forEach(function(be){be.pts=h(be.pts-R,ke)}),!a||fe<0){if(ee=ee.filter(function(be){return be.pts>=0}),!ee.length)return;b===0?fe=0:x?fe=Math.max(0,ke):fe=ee[0].pts}if(c.isAAC)for(var Ee=b!==void 0,Te=this.config.maxAudioFramesDrift,we=0,Ce=fe;we<ee.length;we++){var me=ee[we],ue=me.pts,te=ue-Ce,de=Math.abs(1e3*te/E);if(te<=-Te*V&&Ee)we===0&&(I.logger.warn("Audio frame @ "+(ue/E).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*te/E)+" ms."),this.nextAudioPts=fe=Ce=ue);else if(te>=Te*V&&de<O&&Ee){var ae=Math.round(te/V);Ce=ue-ae*V,Ce<0&&(ae--,Ce+=V),we===0&&(this.nextAudioPts=fe=Ce),I.logger.warn("[mp4-remuxer]: Injecting "+ae+" audio frame @ "+(Ce/E).toFixed(3)+"s due to "+Math.round(1e3*te/E)+" ms gap.");for(var _e=0;_e<ae;_e++){var Re=Math.max(Ce,0),ye=B.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);ye||(I.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ye=me.unit.subarray()),ee.splice(we,0,{unit:ye,pts:Re}),Ce+=V,we++}}me.pts=Ce,Ce+=V}for(var Oe=null,Pe=null,Ie,je=0,Be=ee.length;Be--;)je+=ee[Be].unit.byteLength;for(var Ne=0,et=ee.length;Ne<et;Ne++){var Ze=ee[Ne],$e=Ze.unit,Xe=Ze.pts;if(Pe!==null){var st=$[Ne-1];st.duration=Math.round((Xe-Pe)/U)}else if(a&&c.isAAC&&(Xe=fe),Oe=Xe,je>0){je+=oe;try{Ie=new Uint8Array(je)}catch(be){this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:j.ErrorTypes.MUX_ERROR,details:j.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:je,reason:"fail allocating audio mdat "+je});return}if(!M){var qe=new DataView(Ie.buffer);qe.setUint32(0,je),Ie.set(P.default.types.mdat,4)}}else return;Ie.set($e,oe);var nt=$e.byteLength;oe+=nt,$.push(new p(!0,K,nt,0)),Pe=Xe}var Me=$.length;if(!Me)return;var ct=$[$.length-1];this.nextAudioPts=fe=Pe+U*ct.duration;var at=M?new Uint8Array(0):P.default.moof(c.sequenceNumber++,Oe/U,A({},c,{samples:$}));c.samples=[];var Ue=Oe/E,Ke=fe/E,xe="audio",ge={data1:at,data2:Ie,startPTS:Ue,endPTS:Ke,startDTS:Ue,endDTS:Ke,type:xe,hasAudio:!0,hasVideo:!1,nb:Me};return this.isAudioContiguous=!0,console.assert(Ie.length,"MDAT length must not be zero"),ge},g.remuxEmptyAudio=function(c,u,a,x){var b=c.inputTimeScale,E=c.samplerate?c.samplerate:b,N=b/E,U=this.nextAudioPts,K=(U!==null?U:x.startDTS*b)+this._initDTS,V=x.endDTS*b+this._initDTS,R=N*_,M=Math.ceil((V-K)/R),$=B.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(I.logger.warn("[mp4-remuxer]: remux empty Audio"),!$){I.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ee=[],oe=0;oe<M;oe++){var fe=K+oe*R;ee.push({unit:$,pts:fe,dts:fe})}return c.samples=ee,this.remuxAudio(c,u,a,!1)},g.remuxID3=function(c,u){var a=c.samples.length;if(!a)return;for(var x=c.inputTimeScale,b=this._initPTS,E=this._initDTS,N=0;N<a;N++){var U=c.samples[N];U.pts=h(U.pts-b,u*x)/x,U.dts=h(U.dts-E,u*x)/x}var K=c.samples;return c.samples=[],{samples:K}},g.remuxText=function(c,u){var a=c.samples.length;if(!a)return;for(var x=c.inputTimeScale,b=this._initPTS,E=0;E<a;E++){var N=c.samples[E];N.pts=h(N.pts-b,u*x)/x}c.samples.sort(function(K,V){return K.pts-V.pts});var U=c.samples;return c.samples=[],{samples:U}},L}();function h(L,g){var m;if(g===null)return L;for(g<L?m=-8589934592:m=8589934592;Math.abs(L-g)>4294967296;)L+=m;return L}function w(L){for(var g=0;g<L.length;g++)if(L[g].key)return g;return-1}var p=function(g,m,c,u){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=m,this.size=c,this.cts=u,this.flags=new f(g)},f=function(g){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=g?2:1,this.isNonSync=g?0:1}},"./src/remux/passthrough-remuxer.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/polyfills/number.ts"),B=D("./src/utils/mp4-tools.ts"),P=D("./src/loader/fragment.ts"),G=D("./src/utils/logger.ts"),j=function(){function y(){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 A=y.prototype;return A.destroy=function(){},A.resetTimeStamp=function(_){this.initPTS=_,this.lastEndDTS=null},A.resetNextTimestamp=function(){this.lastEndDTS=null},A.resetInitSegment=function(_,C,S){this.audioCodec=C,this.videoCodec=S,this.generateInitSegment(_),this.emitInitSegment=!0},A.generateInitSegment=function(_){var C=this.audioCodec,S=this.videoCodec;if(!_||!_.byteLength){this.initTracks=void 0,this.initData=void 0;return}var d=this.initData=Object(B.parseInitSegment)(_);C||(C=k(d.audio,P.ElementaryStreamTypes.AUDIO)),S||(S=k(d.video,P.ElementaryStreamTypes.VIDEO));var o={};d.audio&&d.video?o.audiovideo={container:"video/mp4",codec:C+","+S,initSegment:_,id:"main"}:d.audio?o.audio={container:"audio/mp4",codec:C,initSegment:_,id:"audio"}:d.video?o.video={container:"video/mp4",codec:S,initSegment:_,id:"main"}:G.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},A.remux=function(_,C,S,d,o){var l=this.initPTS,h=this.lastEndDTS,w={audio:void 0,video:void 0,text:d,id3:S,initSegment:void 0};Object(Z.isFiniteNumber)(h)||(h=this.lastEndDTS=o||0);var p=C.samples;if(!p||!p.length)return w;var f={initPTS:void 0,timescale:1},L=this.initData;if((!L||!L.length)&&(this.generateInitSegment(p),L=this.initData),!L||!L.length)return G.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),w;this.emitInitSegment&&(f.tracks=this.initTracks,this.emitInitSegment=!1),Object(Z.isFiniteNumber)(l)||(this.initPTS=f.initPTS=l=I(L,p,h));var g=Object(B.getDuration)(p,L),m=h,c=g+m;Object(B.offsetStartDTS)(L,p,l),g>0?this.lastEndDTS=c:(G.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var u=!!L.audio,a=!!L.video,x="";u&&(x+="audio"),a&&(x+="video");var b={data1:p,startPTS:m,startDTS:m,endPTS:c,endDTS:c,type:x,hasAudio:u,hasVideo:a,nb:1,dropped:0};return w.audio=b.type==="audio"?b:void 0,w.video=b.type!=="audio"?b:void 0,w.text=d,w.id3=S,w.initSegment=f,w},y}(),I=function(A,O,_){return Object(B.getStartDTS)(A,O)-_};function k(y,A){var O=y==null?void 0:y.codec;return O&&O.length>4?O:O==="hvc1"?"hvc1.1.c.L120.90":O==="av01"?"av01.0.04M.08":O==="avc1"||A===P.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}Q.default=j},"./src/task-loop.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return Z});var Z=function(){function B(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var P=B.prototype;return P.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},P.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},P.onHandlerDestroyed=function(){},P.hasInterval=function(){return!!this._tickInterval},P.hasNextTick=function(){return!!this._tickTimer},P.setInterval=function(j){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,j),!0)},P.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},P.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},P.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},P.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},P.doTick=function(){},B}()},"./src/types/cmcd.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"CMCDVersion",function(){return Z}),D.d(Q,"CMCDObjectType",function(){return B}),D.d(Q,"CMCDStreamingFormat",function(){return P}),D.d(Q,"CMCDStreamType",function(){return G});var Z=1,B;(function(j){j.MANIFEST="m",j.AUDIO="a",j.VIDEO="v",j.MUXED="av",j.INIT="i",j.CAPTION="c",j.TIMED_TEXT="tt",j.KEY="k",j.OTHER="o"})(B||(B={}));var P;(function(j){j.DASH="d",j.HLS="h",j.SMOOTH="s",j.OTHER="o"})(P||(P={}));var G;(function(j){j.VOD="v",j.LIVE="l"})(G||(G={}))},"./src/types/level.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"HlsSkip",function(){return P}),D.d(Q,"getSkipValue",function(){return G}),D.d(Q,"HlsUrlParameters",function(){return j}),D.d(Q,"Level",function(){return I});function Z(k,y){for(var A=0;A<y.length;A++){var O=y[A];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(k,O.key,O)}}function B(k,y,A){return y&&Z(k.prototype,y),A&&Z(k,A),k}var P;(function(k){k.No="",k.Yes="YES",k.v2="v2"})(P||(P={}));function G(k,y){var A=k.canSkipUntil,O=k.canSkipDateRanges,_=k.endSN,C=y!==void 0?y-_:0;return A&&C<A?O?P.v2:P.Yes:P.No}var j=function(){function k(A,O,_){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=A,this.part=O,this.skip=_}var y=k.prototype;return y.addDirectives=function(O){var _=new self.URL(O);return this.msn!==void 0&&_.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&_.searchParams.set("_HLS_part",this.part.toString()),this.skip&&_.searchParams.set("_HLS_skip",this.skip),_.toString()},k}(),I=function(){function k(y){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=[y.url],this.attrs=y.attrs,this.bitrate=y.bitrate,y.details&&(this.details=y.details),this.id=y.id||0,this.name=y.name,this.width=y.width||0,this.height=y.height||0,this.audioCodec=y.audioCodec,this.videoCodec=y.videoCodec,this.unknownCodecs=y.unknownCodecs,this.codecSet=[y.videoCodec,y.audioCodec].filter(function(A){return A}).join(",").replace(/\.[^.,]+/g,"")}return B(k,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(A){var O=A%this.url.length;this._urlId!==O&&(this.details=void 0,this._urlId=O)}}]),k}()},"./src/types/loader.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"PlaylistContextType",function(){return Z}),D.d(Q,"PlaylistLevelType",function(){return B});var Z;(function(P){P.MANIFEST="manifest",P.LEVEL="level",P.AUDIO_TRACK="audioTrack",P.SUBTITLE_TRACK="subtitleTrack"})(Z||(Z={}));var B;(function(P){P.MAIN="main",P.AUDIO="audio",P.SUBTITLE="subtitle"})(B||(B={}))},"./src/types/transmuxer.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"ChunkMetadata",function(){return Z});var Z=function(G,j,I,k,y,A){k===void 0&&(k=0),y===void 0&&(y=-1),A===void 0&&(A=!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=B(),this.buffering={audio:B(),video:B(),audiovideo:B()},this.level=G,this.sn=j,this.id=I,this.size=k,this.part=y,this.partial=A};function B(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"AttrList",function(){return P});var Z=/^(\d+)x(\d+)$/,B=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,P=function(){function G(I){typeof I=="string"&&(I=G.parseAttrList(I));for(var k in I)I.hasOwnProperty(k)&&(this[k]=I[k])}var j=G.prototype;return j.decimalInteger=function(k){var y=parseInt(this[k],10);return y>Number.MAX_SAFE_INTEGER?Infinity:y},j.hexadecimalInteger=function(k){if(this[k]){var y=(this[k]||"0x").slice(2);y=(y.length&1?"0":"")+y;for(var A=new Uint8Array(y.length/2),O=0;O<y.length/2;O++)A[O]=parseInt(y.slice(O*2,O*2+2),16);return A}else return null},j.hexadecimalIntegerAsNumber=function(k){var y=parseInt(this[k],16);return y>Number.MAX_SAFE_INTEGER?Infinity:y},j.decimalFloatingPoint=function(k){return parseFloat(this[k])},j.optionalFloat=function(k,y){var A=this[k];return A?parseFloat(A):y},j.enumeratedString=function(k){return this[k]},j.bool=function(k){return this[k]==="YES"},j.decimalResolution=function(k){var y=Z.exec(this[k]);return y===null?void 0:{width:parseInt(y[1],10),height:parseInt(y[2],10)}},G.parseAttrList=function(k){var y,A={},O='"';for(B.lastIndex=0;(y=B.exec(k))!==null;){var _=y[2];_.indexOf(O)===0&&_.lastIndexOf(O)===_.length-1&&(_=_.slice(1,-1)),A[y[1]]=_}return A},G}()},"./src/utils/binary-search.ts":function(le,Q,D){"use strict";D.r(Q);var Z={search:function(P,G){for(var j=0,I=P.length-1,k=null,y=null;j<=I;){k=(j+I)/2|0,y=P[k];var A=G(y);if(A>0)j=k+1;else if(A<0)I=k-1;else return y}return null}};Q.default=Z},"./src/utils/buffer-helper.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"BufferHelper",function(){return P});var Z=D("./src/utils/logger.ts"),B={length:0,start:function(){return 0},end:function(){return 0}},P=function(){function G(){}return G.isBuffered=function(I,k){try{if(I){for(var y=G.getBuffered(I),A=0;A<y.length;A++)if(k>=y.start(A)&&k<=y.end(A))return!0}}catch(O){}return!1},G.bufferInfo=function(I,k,y){try{if(I){var A=G.getBuffered(I),O=[],_;for(_=0;_<A.length;_++)O.push({start:A.start(_),end:A.end(_)});return this.bufferedInfo(O,k,y)}}catch(C){}return{len:0,start:k,end:k,nextStart:void 0}},G.bufferedInfo=function(I,k,y){k=Math.max(0,k),I.sort(function(f,L){var g=f.start-L.start;return g||L.end-f.end});var A=[];if(y)for(var O=0;O<I.length;O++){var _=A.length;if(_){var C=A[_-1].end;I[O].start-C<y?I[O].end>C&&(A[_-1].end=I[O].end):A.push(I[O])}else A.push(I[O])}else A=I;for(var S=0,d,o=k,l=k,h=0;h<A.length;h++){var w=A[h].start,p=A[h].end;if(k+y>=w&&k<p)o=w,l=p,S=l-k;else if(k+y<w){d=w;break}}return{len:S,start:o||0,end:l||0,nextStart:d}},G.getBuffered=function(I){try{return I.buffered}catch(k){return Z.logger.log("failed to get media.buffered",k),B}},G}()},"./src/utils/cea-608-parser.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"Row",function(){return l}),D.d(Q,"CaptionScreen",function(){return h});var Z=D("./src/utils/logger.ts"),B={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},P=function(c){var u=c;return B.hasOwnProperty(c)&&(u=B[c]),String.fromCharCode(u)},G=15,j=100,I={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},k={17:2,18:4,21:6,22:8,23:10,19:13,20:15},y={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},A={25:2,26:4,29:6,30:8,31:10,27:13,28:15},O=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],_;(function(m){m[m.ERROR=0]="ERROR",m[m.TEXT=1]="TEXT",m[m.WARNING=2]="WARNING",m[m.INFO=2]="INFO",m[m.DEBUG=3]="DEBUG",m[m.DATA=3]="DATA"})(_||(_={}));var C=function(){function m(){this.time=null,this.verboseLevel=_.ERROR}var c=m.prototype;return c.log=function(a,x){this.verboseLevel>=a&&Z.logger.log(this.time+" ["+a+"] "+x)},m}(),S=function(c){for(var u=[],a=0;a<c.length;a++)u.push(c[a].toString(16));return u},d=function(){function m(u,a,x,b,E){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=u||"white",this.underline=a||!1,this.italics=x||!1,this.background=b||"black",this.flash=E||!1}var c=m.prototype;return c.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},c.setStyles=function(a){for(var x=["foreground","underline","italics","background","flash"],b=0;b<x.length;b++){var E=x[b];a.hasOwnProperty(E)&&(this[E]=a[E])}},c.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},c.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},c.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},c.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},m}(),o=function(){function m(u,a,x,b,E,N){this.uchar=void 0,this.penState=void 0,this.uchar=u||" ",this.penState=new d(a,x,b,E,N)}var c=m.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(a,x){this.uchar=a,this.penState.copy(x)},c.setPenState=function(a){this.penState.copy(a)},c.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},c.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},c.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},m}(),l=function(){function m(u){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<j;a++)this.chars.push(new o);this.logger=u,this.pos=0,this.currPenState=new d}var c=m.prototype;return c.equals=function(a){for(var x=!0,b=0;b<j;b++)if(!this.chars[b].equals(a.chars[b])){x=!1;break}return x},c.copy=function(a){for(var x=0;x<j;x++)this.chars[x].copy(a.chars[x])},c.isEmpty=function(){for(var a=!0,x=0;x<j;x++)if(!this.chars[x].isEmpty()){a=!1;break}return a},c.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(_.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>j&&(this.logger.log(_.DEBUG,"Too large cursor position "+this.pos),this.pos=j)},c.moveCursor=function(a){var x=this.pos+a;if(a>1)for(var b=this.pos+1;b<x+1;b++)this.chars[b].setPenState(this.currPenState);this.setCursor(x)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(a){a>=144&&this.backSpace();var x=P(a);if(this.pos>=j){this.logger.log(_.ERROR,"Cannot insert "+a.toString(16)+" ("+x+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(x,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(a){var x;for(x=a;x<j;x++)this.chars[x].reset()},c.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},c.clearToEndOfRow=function(){this.clearFromPos(this.pos)},c.getTextString=function(){for(var a=[],x=!0,b=0;b<j;b++){var E=this.chars[b].uchar;E!==" "&&(x=!1),a.push(E)}return x?"":a.join("")},c.setPenStyles=function(a){this.currPenState.setStyles(a);var x=this.chars[this.pos];x.setPenState(this.currPenState)},m}(),h=function(){function m(u){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<G;a++)this.rows.push(new l(u));this.logger=u,this.currRow=G-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=m.prototype;return c.reset=function(){for(var a=0;a<G;a++)this.rows[a].clear();this.currRow=G-1},c.equals=function(a){for(var x=!0,b=0;b<G;b++)if(!this.rows[b].equals(a.rows[b])){x=!1;break}return x},c.copy=function(a){for(var x=0;x<G;x++)this.rows[x].copy(a.rows[x])},c.isEmpty=function(){for(var a=!0,x=0;x<G;x++)if(!this.rows[x].isEmpty()){a=!1;break}return a},c.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},c.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},c.insertChar=function(a){var x=this.rows[this.currRow];x.insertChar(a)},c.setPen=function(a){var x=this.rows[this.currRow];x.setPenStyles(a)},c.moveCursor=function(a){var x=this.rows[this.currRow];x.moveCursor(a)},c.setCursor=function(a){this.logger.log(_.INFO,"setCursor: "+a);var x=this.rows[this.currRow];x.setCursor(a)},c.setPAC=function(a){this.logger.log(_.INFO,"pacData = "+JSON.stringify(a));var x=a.row-1;if(this.nrRollUpRows&&x<this.nrRollUpRows-1&&(x=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==x){for(var b=0;b<G;b++)this.rows[b].clear();var E=this.currRow+1-this.nrRollUpRows,N=this.lastOutputScreen;if(N){var U=N.rows[E].cueStartTime,K=this.logger.time;if(U&&K!==null&&U<K)for(var V=0;V<this.nrRollUpRows;V++)this.rows[x-this.nrRollUpRows+V+1].copy(N.rows[E+V])}}this.currRow=x;var R=this.rows[this.currRow];if(a.indent!==null){var M=a.indent,$=Math.max(M-1,0);R.setCursor(a.indent),a.color=R.chars[$].penState.foreground}var ee={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(ee)},c.setBkgData=function(a){this.logger.log(_.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},c.setRollUpRows=function(a){this.nrRollUpRows=a},c.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(_.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(_.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,x=this.rows.splice(a,1)[0];x.clear(),this.rows.splice(this.currRow,0,x),this.logger.log(_.INFO,"Rolling up")},c.getDisplayText=function(a){a=a||!1;for(var x=[],b="",E=-1,N=0;N<G;N++){var U=this.rows[N].getTextString();U&&(E=N+1,a?x.push("Row "+E+": '"+U+"'"):x.push(U.trim()))}return x.length>0&&(a?b="["+x.join(" | ")+"]":b=x.join(`
`)),b},c.getTextAndFormat=function(){return this.rows},m}(),w=function(){function m(u,a,x){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=u,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new h(x),this.nonDisplayedMemory=new h(x),this.lastOutputScreen=new h(x),this.currRollUpRow=this.displayedMemory.rows[G-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=x}var c=m.prototype;return c.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[G-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},c.getHandler=function(){return this.outputFilter},c.setHandler=function(a){this.outputFilter=a},c.setPAC=function(a){this.writeScreen.setPAC(a)},c.setBkgData=function(a){this.writeScreen.setBkgData(a)},c.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(_.INFO,"MODE="+a),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=a},c.insertChars=function(a){for(var x=0;x<a.length;x++)this.writeScreen.insertChar(a[x]);var b=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(_.INFO,b+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(_.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},c.ccRCL=function(){this.logger.log(_.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},c.ccBS=function(){if(this.logger.log(_.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},c.ccAOF=function(){},c.ccAON=function(){},c.ccDER=function(){this.logger.log(_.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},c.ccRU=function(a){this.logger.log(_.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},c.ccFON=function(){this.logger.log(_.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},c.ccRDC=function(){this.logger.log(_.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},c.ccTR=function(){this.logger.log(_.INFO,"TR"),this.setMode("MODE_TEXT")},c.ccRTD=function(){this.logger.log(_.INFO,"RTD"),this.setMode("MODE_TEXT")},c.ccEDM=function(){this.logger.log(_.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},c.ccCR=function(){this.logger.log(_.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},c.ccENM=function(){this.logger.log(_.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},c.ccEOC=function(){if(this.logger.log(_.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(_.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},c.ccTO=function(a){this.logger.log(_.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},c.ccMIDROW=function(a){var x={flash:!1};if(x.underline=a%2===1,x.italics=a>=46,x.italics)x.foreground="white";else{var b=Math.floor(a/2)-16,E=["white","green","blue","cyan","red","yellow","magenta"];x.foreground=E[b]}this.logger.log(_.INFO,"MIDROW: "+JSON.stringify(x)),this.writeScreen.setPen(x)},c.outputDataUpdate=function(a){a===void 0&&(a=!1);var x=this.logger.time;if(x===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=x:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,x,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:x),this.lastOutputScreen.copy(this.displayedMemory))},c.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},m}(),p=function(){function m(u,a,x){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var b=new C;this.channels=[null,new w(u,a,b),new w(u+1,x,b)],this.cmdHistory=g(),this.logger=b}var c=m.prototype;return c.getHandler=function(a){return this.channels[a].getHandler()},c.setHandler=function(a,x){this.channels[a].setHandler(x)},c.addData=function(a,x){var b,E,N,U=!1;this.logger.time=a;for(var K=0;K<x.length;K+=2){if(E=x[K]&127,N=x[K+1]&127,E===0&&N===0)continue;if(this.logger.log(_.DATA,"["+S([x[K],x[K+1]])+"] -> ("+S([E,N])+")"),b=this.parseCmd(E,N),b||(b=this.parseMidrow(E,N)),b||(b=this.parsePAC(E,N)),b||(b=this.parseBackgroundAttributes(E,N)),!b&&(U=this.parseChars(E,N),U)){var V=this.currentChannel;if(V&&V>0){var R=this.channels[V];R.insertChars(U)}else this.logger.log(_.WARNING,"No channel found yet. TEXT-MODE?")}!b&&!U&&this.logger.log(_.WARNING,"Couldn't parse cleaned data "+S([E,N])+" orig: "+S([x[K],x[K+1]]))}},c.parseCmd=function(a,x){var b=this.cmdHistory,E=(a===20||a===28||a===21||a===29)&&x>=32&&x<=47,N=(a===23||a===31)&&x>=33&&x<=35;if(!(E||N))return!1;if(L(a,x,b))return f(null,null,b),this.logger.log(_.DEBUG,"Repeated command ("+S([a,x])+") is dropped"),!0;var U=a===20||a===21||a===23?1:2,K=this.channels[U];return a===20||a===21||a===28||a===29?x===32?K.ccRCL():x===33?K.ccBS():x===34?K.ccAOF():x===35?K.ccAON():x===36?K.ccDER():x===37?K.ccRU(2):x===38?K.ccRU(3):x===39?K.ccRU(4):x===40?K.ccFON():x===41?K.ccRDC():x===42?K.ccTR():x===43?K.ccRTD():x===44?K.ccEDM():x===45?K.ccCR():x===46?K.ccENM():x===47&&K.ccEOC():K.ccTO(x-32),f(a,x,b),this.currentChannel=U,!0},c.parseMidrow=function(a,x){var b=0;if((a===17||a===25)&&x>=32&&x<=47){if(a===17?b=1:b=2,b!==this.currentChannel)return this.logger.log(_.ERROR,"Mismatch channel in midrow parsing"),!1;var E=this.channels[b];return E?(E.ccMIDROW(x),this.logger.log(_.DEBUG,"MIDROW ("+S([a,x])+")"),!0):!1}return!1},c.parsePAC=function(a,x){var b,E=this.cmdHistory,N=(a>=17&&a<=23||a>=25&&a<=31)&&x>=64&&x<=127,U=(a===16||a===24)&&x>=64&&x<=95;if(!(N||U))return!1;if(L(a,x,E))return f(null,null,E),!0;var K=a<=23?1:2;x>=64&&x<=95?b=K===1?I[a]:y[a]:b=K===1?k[a]:A[a];var V=this.channels[K];return V?(V.setPAC(this.interpretPAC(b,x)),f(a,x,E),this.currentChannel=K,!0):!1},c.interpretPAC=function(a,x){var b,E={color:null,italics:!1,indent:null,underline:!1,row:a};return x>95?b=x-96:b=x-64,E.underline=(b&1)===1,b<=13?E.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(b/2)]:b<=15?(E.italics=!0,E.color="white"):E.indent=Math.floor((b-16)/2)*4,E},c.parseChars=function(a,x){var b,E=null,N=null;if(a>=25?(b=2,N=a-8):(b=1,N=a),N>=17&&N<=19){var U;N===17?U=x+80:N===18?U=x+112:U=x+144,this.logger.log(_.INFO,"Special char '"+P(U)+"' in channel "+b),E=[U]}else a>=32&&a<=127&&(E=x===0?[a]:[a,x]);if(E){var K=S(E);this.logger.log(_.DEBUG,"Char codes = "+K.join(",")),f(a,x,this.cmdHistory)}return E},c.parseBackgroundAttributes=function(a,x){var b=(a===16||a===24)&&x>=32&&x<=47,E=(a===23||a===31)&&x>=45&&x<=47;if(!(b||E))return!1;var N,U={};a===16||a===24?(N=Math.floor((x-32)/2),U.background=O[N],x%2===1&&(U.background=U.background+"_semi")):x===45?U.background="transparent":(U.foreground="black",x===47&&(U.underline=!0));var K=a<=23?1:2,V=this.channels[K];return V.setBkgData(U),f(a,x,this.cmdHistory),!0},c.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var x=this.channels[a];x&&x.reset()}this.cmdHistory=g()},c.cueSplitAtTime=function(a){for(var x=0;x<this.channels.length;x++){var b=this.channels[x];b&&b.cueSplitAtTime(a)}},m}();function f(m,c,u){u.a=m,u.b=c}function L(m,c,u){return u.a===m&&u.b===c}function g(){return{a:null,b:null}}Q.default=p},"./src/utils/codecs.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"isCodecType",function(){return B}),D.d(Q,"isCodecSupportedInMp4",function(){return P});var Z={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 B(G,j){var I=Z[j];return!!I&&I[G.slice(0,4)]===!0}function P(G,j){return MediaSource.isTypeSupported((j||"video")+'/mp4;codecs="'+G+'"')}},"./src/utils/cues.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/utils/vttparser.ts"),B=D("./src/utils/webvtt-parser.ts"),P=D("./src/utils/texttrack-utils.ts"),G=/\s/,j={newCue:function(k,y,A,O){for(var _=[],C,S,d,o,l,h=self.VTTCue||self.TextTrackCue,w=0;w<O.rows.length;w++)if(C=O.rows[w],d=!0,o=0,l="",!C.isEmpty()){for(var p=0;p<C.chars.length;p++)G.test(C.chars[p].uchar)&&d?o++:(l+=C.chars[p].uchar,d=!1);C.cueStartTime=y,y===A&&(A+=1e-4),o>=16?o--:o++;var f=Object(Z.fixLineBreaks)(l.trim()),L=Object(B.generateCueId)(y,A,f);(!k||!k.cues||!k.cues.getCueById(L))&&(S=new h(y,A,f),S.id=L,S.line=w+1,S.align="left",S.position=10+Math.min(80,Math.floor(o*8/32)*10),_.push(S))}return k&&_.length&&(_.sort(function(g,m){return g.line==="auto"||m.line==="auto"?0:g.line>8&&m.line>8?m.line-g.line:g.line-m.line}),_.forEach(function(g){return Object(P.addCueToTrack)(k,g)})),_}};Q.default=j},"./src/utils/discontinuities.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"findFirstFragWithCC",function(){return G}),D.d(Q,"shouldAlignOnDiscontinuities",function(){return j}),D.d(Q,"findDiscontinuousReferenceFrag",function(){return I}),D.d(Q,"adjustSlidingStart",function(){return y}),D.d(Q,"alignStream",function(){return A}),D.d(Q,"alignPDT",function(){return _}),D.d(Q,"alignFragmentByPDTDelta",function(){return C}),D.d(Q,"alignMediaPlaylistByPDT",function(){return S});var Z=D("./src/polyfills/number.ts"),B=D("./src/utils/logger.ts"),P=D("./src/controller/level-helper.ts");function G(d,o){for(var l=null,h=0,w=d.length;h<w;h++){var p=d[h];if(p&&p.cc===o){l=p;break}}return l}function j(d,o,l){return!!(o.details&&(l.endCC>l.startCC||d&&d.cc<l.startCC))}function I(d,o){var l=d.fragments,h=o.fragments;if(!h.length||!l.length){B.logger.log("No fragments to align");return}var w=G(l,h[0].cc);if(!w||w&&!w.startPTS){B.logger.log("No frag in previous level to align on");return}return w}function k(d,o){if(d){var l=d.start+o;d.start=d.startPTS=l,d.endPTS=l+d.duration}}function y(d,o){for(var l=o.fragments,h=0,w=l.length;h<w;h++)k(l[h],d);o.fragmentHint&&k(o.fragmentHint,d),o.alignedSliding=!0}function A(d,o,l){if(!o)return;O(d,l,o),!l.alignedSliding&&o.details&&_(l,o.details),!l.alignedSliding&&o.details&&!l.skippedSegments&&Object(P.adjustSliding)(o.details,l)}function O(d,o,l){if(j(d,l,o)){var h=I(l.details,o);h&&Object(Z.isFiniteNumber)(h.start)&&(B.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),y(h.start,o))}}function _(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,h=d.fragments[0].programDateTime,w=(h-l)/1e3+o.fragments[0].start;w&&Object(Z.isFiniteNumber)(w)&&(B.logger.log("Adjusting PTS using programDateTime delta "+(h-l)+"ms, sliding:"+w.toFixed(3)+" "+d.url+" "),y(w,d))}function C(d,o){var l=d.programDateTime;if(!l)return;var h=(l-o)/1e3;d.start=d.startPTS=h,d.endPTS=h+d.duration}function S(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,h=o.fragments[0].start,w=l-h*1e3;d.fragments.forEach(function(p){C(p,w)}),d.fragmentHint&&C(d.fragmentHint,w),d.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/utils/ewma.ts"),B=function(){function P(j,I,k){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=k,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Z.default(j),this.fast_=new Z.default(I)}var G=P.prototype;return G.update=function(I,k){var y=this.slow_,A=this.fast_;this.slow_.halfLife!==I&&(this.slow_=new Z.default(I,y.getEstimate(),y.getTotalWeight())),this.fast_.halfLife!==k&&(this.fast_=new Z.default(k,A.getEstimate(),A.getTotalWeight()))},G.sample=function(I,k){I=Math.max(I,this.minDelayMs_);var y=8*k,A=I/1e3,O=y/A;this.fast_.sample(A,O),this.slow_.sample(A,O)},G.canEstimate=function(){var I=this.fast_;return I&&I.getTotalWeight()>=this.minWeight_},G.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},G.destroy=function(){},P}();Q.default=B},"./src/utils/ewma.ts":function(le,Q,D){"use strict";D.r(Q);var Z=function(){function B(G,j,I){j===void 0&&(j=0),I===void 0&&(I=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=G,this.alpha_=G?Math.exp(Math.log(.5)/G):0,this.estimate_=j,this.totalWeight_=I}var P=B.prototype;return P.sample=function(j,I){var k=Math.pow(this.alpha_,j);this.estimate_=I*(1-k)+k*this.estimate_,this.totalWeight_+=j},P.getTotalWeight=function(){return this.totalWeight_},P.getEstimate=function(){if(this.alpha_){var j=1-Math.pow(this.alpha_,this.totalWeight_);if(j)return this.estimate_/j}return this.estimate_},B}();Q.default=Z},"./src/utils/fetch-loader.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"fetchSupported",function(){return C});var Z=D("./src/polyfills/number.ts"),B=D("./src/loader/load-stats.ts"),P=D("./src/demux/chunk-cache.ts");function G(h,w){h.prototype=Object.create(w.prototype),h.prototype.constructor=h,A(h,w)}function j(h){var w=typeof Map=="function"?new Map:void 0;return j=function(f){if(f===null||!y(f))return f;if(typeof f!="function")throw new TypeError("Super expression must either be null or a function");if(typeof w!="undefined"){if(w.has(f))return w.get(f);w.set(f,L)}function L(){return I(f,arguments,O(this).constructor)}return L.prototype=Object.create(f.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),A(L,f)},j(h)}function I(h,w,p){return k()?I=Reflect.construct:I=function(L,g,m){var c=[null];c.push.apply(c,g);var u=Function.bind.apply(L,c),a=new u;return m&&A(a,m.prototype),a},I.apply(null,arguments)}function k(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(h){return!1}}function y(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function A(h,w){return A=Object.setPrototypeOf||function(f,L){return f.__proto__=L,f},A(h,w)}function O(h){return O=Object.setPrototypeOf?Object.getPrototypeOf:function(p){return p.__proto__||Object.getPrototypeOf(p)},O(h)}function _(){return _=Object.assign||function(h){for(var w=1;w<arguments.length;w++){var p=arguments[w];for(var f in p)Object.prototype.hasOwnProperty.call(p,f)&&(h[f]=p[f])}return h},_.apply(this,arguments)}function C(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(h){}return!1}var S=function(){function h(p){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=p.fetchSetup||o,this.controller=new self.AbortController,this.stats=new B.LoadStats}var w=h.prototype;return w.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},w.abortInternal=function(){var f=this.response;(!f||!f.ok)&&(this.stats.aborted=!0,this.controller.abort())},w.abort=function(){var f;this.abortInternal(),(f=this.callbacks)!==null&&f!==void 0&&f.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},w.load=function(f,L,g){var m=this,c=this.stats;if(c.loading.start)throw new Error("Loader can only be used once.");c.loading.start=self.performance.now();var u=d(f,this.controller.signal),a=g.onProgress,x=f.responseType==="arraybuffer",b=x?"byteLength":"length";this.context=f,this.config=L,this.callbacks=g,this.request=this.fetchSetup(f,u),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){m.abortInternal(),g.onTimeout(c,f,m.response)},L.timeout),self.fetch(this.request).then(function(E){if(m.response=m.loader=E,!E.ok){var N=E.status,U=E.statusText;throw new l(U||"fetch, bad network response",N,E)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(E.headers.get("Content-Length")||"0"),a&&Object(Z.isFiniteNumber)(L.highWaterMark)?m.loadProgressively(E,c,f,L.highWaterMark,a):x?E.arrayBuffer():E.text()}).then(function(E){var N=m.response;self.clearTimeout(m.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=E[b];var U={url:N.url,data:E};a&&!Object(Z.isFiniteNumber)(L.highWaterMark)&&a(c,f,E,N),g.onSuccess(U,c,f,N)}).catch(function(E){if(self.clearTimeout(m.requestTimeout),c.aborted)return;var N=E.code||0;g.onError({code:N,text:E.message},f,E.details)})},w.getCacheAge=function(){var f=null;if(this.response){var L=this.response.headers.get("age");f=L?parseFloat(L):null}return f},w.loadProgressively=function(f,L,g,m,c){m===void 0&&(m=0);var u=new P.default,a=f.body.getReader(),x=function b(){return a.read().then(function(E){if(E.done)return u.dataLength&&c(L,g,u.flush(),f),Promise.resolve(new ArrayBuffer(0));var N=E.value,U=N.length;return L.loaded+=U,U<m||u.dataLength?(u.push(N),u.dataLength>=m&&c(L,g,u.flush(),f)):c(L,g,N,f),b()}).catch(function(){return Promise.reject()})};return x()},h}();function d(h,w){var p={method:"GET",mode:"cors",credentials:"same-origin",signal:w,headers:new self.Headers(_({},h.headers))};return h.rangeEnd&&p.headers.set("Range","bytes="+h.rangeStart+"-"+String(h.rangeEnd-1)),p}function o(h,w){return new self.Request(h.url,w)}var l=function(h){G(w,h);function w(p,f,L){var g;return g=h.call(this,p)||this,g.code=void 0,g.details=void 0,g.code=f,g.details=L,g}return w}(j(Error));Q.default=S},"./src/utils/imsc1-ttml-parser.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"IMSC1_CODEC",function(){return y}),D.d(Q,"parseIMSC1",function(){return C});var Z=D("./src/utils/mp4-tools.ts"),B=D("./src/utils/vttparser.ts"),P=D("./src/utils/vttcue.ts"),G=D("./src/demux/id3.ts"),j=D("./src/utils/timescale-conversion.ts"),I=D("./src/utils/webvtt-parser.ts");function k(){return k=Object.assign||function(m){for(var c=1;c<arguments.length;c++){var u=arguments[c];for(var a in u)Object.prototype.hasOwnProperty.call(u,a)&&(m[a]=u[a])}return m},k.apply(this,arguments)}var y="stpp.ttml.im1t",A=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,O=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,_={left:"start",center:"center",right:"end",start:"start",end:"end"};function C(m,c,u,a,x){var b=Object(Z.findBox)(new Uint8Array(m),["mdat"]);if(b.length===0){x(new Error("Could not parse IMSC1 mdat"));return}var E=b[0],N=Object(G.utf8ArrayToStr)(new Uint8Array(m,E.start,E.end-E.start)),U=Object(j.toTimescaleFromScale)(c,1,u);try{a(S(N,U))}catch(K){x(K)}}function S(m,c){var u=new DOMParser,a=u.parseFromString(m,"text/xml"),x=a.getElementsByTagName("tt")[0];if(!x)throw new Error("Invalid ttml");var b={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},E=Object.keys(b).reduce(function(R,M){return R[M]=x.getAttribute("ttp:"+M)||b[M],R},{}),N=x.getAttribute("xml:space")!=="preserve",U=o(d(x,"styling","style")),K=o(d(x,"layout","region")),V=d(x,"body","[begin]");return[].map.call(V,function(R){var M=l(R,N);if(!M||!R.hasAttribute("begin"))return null;var $=f(R.getAttribute("begin"),E),ee=f(R.getAttribute("dur"),E),oe=f(R.getAttribute("end"),E);if($===null)throw p(R);if(oe===null){if(ee===null)throw p(R);oe=$+ee}var fe=new P.default($-c,oe-c,M);fe.id=Object(I.generateCueId)(fe.startTime,fe.endTime,fe.text);var ke=K[R.getAttribute("region")],Ee=U[R.getAttribute("style")];fe.position=10,fe.size=80;var Te=h(ke,Ee),we=Te.textAlign;if(we){var Ce=_[we];Ce&&(fe.lineAlign=Ce),fe.align=we}return k(fe,Te),fe}).filter(function(R){return R!==null})}function d(m,c,u){var a=m.getElementsByTagName(c)[0];return a?[].slice.call(a.querySelectorAll(u)):[]}function o(m){return m.reduce(function(c,u){var a=u.getAttribute("xml:id");return a&&(c[a]=u),c},{})}function l(m,c){return[].slice.call(m.childNodes).reduce(function(u,a,x){var b;return a.nodeName==="br"&&x?u+`
`:(b=a.childNodes)!==null&&b!==void 0&&b.length?l(a,c):c?u+a.textContent.trim().replace(/\s+/g," "):u+a.textContent},"")}function h(m,c){var u="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(x,b){var E=w(c,u,b)||w(m,u,b);return E&&(x[b]=E),x},{})}function w(m,c,u){return m.hasAttributeNS(c,u)?m.getAttributeNS(c,u):null}function p(m){return new Error("Could not parse ttml timestamp "+m)}function f(m,c){if(!m)return null;var u=Object(B.parseTimeStamp)(m);return u===null&&(A.test(m)?u=L(m,c):O.test(m)&&(u=g(m,c))),u}function L(m,c){var u=A.exec(m),a=(u[4]|0)+(u[5]|0)/c.subFrameRate;return(u[1]|0)*3600+(u[2]|0)*60+(u[3]|0)+a/c.frameRate}function g(m,c){var u=O.exec(m),a=Number(u[1]),x=u[2];switch(x){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/c.frameRate;case"t":return a/c.tickRate}return a}},"./src/utils/logger.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"enableLogs",function(){return I}),D.d(Q,"logger",function(){return k});var Z=function(){},B={trace:Z,debug:Z,log:Z,warn:Z,info:Z,error:Z},P=B;function G(y){var A=self.console[y];return A?A.bind(self.console,"["+y+"] >"):Z}function j(y){for(var A=arguments.length,O=new Array(A>1?A-1:0),_=1;_<A;_++)O[_-1]=arguments[_];O.forEach(function(C){P[C]=y[C]?y[C].bind(y):G(C)})}function I(y){if(self.console&&y===!0||typeof y=="object"){j(y,"debug","log","info","warn","error");try{P.log()}catch(A){P=B}}else P=B}var k=P},"./src/utils/mediakeys-helper.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"KeySystems",function(){return Z}),D.d(Q,"requestMediaKeySystemAccess",function(){return B});var Z;(function(P){P.WIDEVINE="com.widevine.alpha",P.PLAYREADY="com.microsoft.playready"})(Z||(Z={}));var B=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"getMediaSource",function(){return Z});function Z(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"bin2str",function(){return j}),D.d(Q,"readUint16",function(){return I}),D.d(Q,"readUint32",function(){return k}),D.d(Q,"writeUint32",function(){return y}),D.d(Q,"findBox",function(){return A}),D.d(Q,"parseSegmentIndex",function(){return O}),D.d(Q,"parseInitSegment",function(){return _}),D.d(Q,"getStartDTS",function(){return C}),D.d(Q,"getDuration",function(){return S}),D.d(Q,"computeRawDurationFromSamples",function(){return d}),D.d(Q,"offsetStartDTS",function(){return o}),D.d(Q,"segmentValidRange",function(){return l}),D.d(Q,"appendUint8Array",function(){return h});var Z=D("./src/utils/typed-array.ts"),B=D("./src/loader/fragment.ts"),P=Math.pow(2,32)-1,G=[].push;function j(w){return String.fromCharCode.apply(null,w)}function I(w,p){"data"in w&&(p+=w.start,w=w.data);var f=w[p]<<8|w[p+1];return f<0?65536+f:f}function k(w,p){"data"in w&&(p+=w.start,w=w.data);var f=w[p]<<24|w[p+1]<<16|w[p+2]<<8|w[p+3];return f<0?4294967296+f:f}function y(w,p,f){"data"in w&&(p+=w.start,w=w.data),w[p]=f>>24,w[p+1]=f>>16&255,w[p+2]=f>>8&255,w[p+3]=f&255}function A(w,p){var f=[];if(!p.length)return f;var L,g,m;"data"in w?(L=w.data,g=w.start,m=w.end):(L=w,g=0,m=L.byteLength);for(var c=g;c<m;){var u=k(L,c),a=j(L.subarray(c+4,c+8)),x=u>1?c+u:m;if(a===p[0])if(p.length===1)f.push({data:L,start:c+8,end:x});else{var b=A({data:L,start:c+8,end:x},p.slice(1));b.length&&G.apply(f,b)}c=x}return f}function O(w){var p=A(w,["moov"]),f=p[0],L=f?f.end:null,g=A(w,["sidx"]);if(!g||!g[0])return null;var m=[],c=g[0],u=c.data[0],a=u===0?8:16,x=k(c,a);a+=4;var b=0,E=0;u===0?a+=8:a+=16,a+=2;var N=c.end+E,U=I(c,a);a+=2;for(var K=0;K<U;K++){var V=a,R=k(c,V);V+=4;var M=R&2147483647,$=(R&2147483648)>>>31;if($===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ee=k(c,V);V+=4,m.push({referenceSize:M,subsegmentDuration:ee,info:{duration:ee/x,start:N,end:N+M-1}}),N+=M,V+=4,a=V}return{earliestPresentationTime:b,timescale:x,version:u,referencesCount:U,references:m,moovEndOffset:L}}function _(w){for(var p=[],f=A(w,["moov","trak"]),L=0;L<f.length;L++){var g=f[L],m=A(g,["tkhd"])[0];if(m){var c=m.data[m.start],u=c===0?12:20,a=k(m,u),x=A(g,["mdia","mdhd"])[0];if(x){c=x.data[x.start],u=c===0?12:20;var b=k(x,u),E=A(g,["mdia","hdlr"])[0];if(E){var N=j(E.data.subarray(E.start+8,E.start+12)),U={soun:B.ElementaryStreamTypes.AUDIO,vide:B.ElementaryStreamTypes.VIDEO}[N];if(U){var K=A(g,["mdia","minf","stbl","stsd"])[0],V=void 0;K&&(V=j(K.data.subarray(K.start+12,K.start+16))),p[a]={timescale:b,type:U},p[U]={timescale:b,id:a,codec:V}}}}}}var R=A(w,["moov","mvex","trex"]);return R.forEach(function(M){var $=k(M,4),ee=p[$];ee&&(ee.default={duration:k(M,12),flags:k(M,20)})}),p}function C(w,p){return A(p,["moof","traf"]).reduce(function(f,L){var g=A(L,["tfdt"])[0],m=g.data[g.start],c=A(L,["tfhd"]).reduce(function(u,a){var x=k(a,4),b=w[x];if(b){var E=k(g,4);m===1&&(E*=Math.pow(2,32),E+=k(g,8));var N=b.timescale||9e4,U=E/N;if(isFinite(U)&&(u===null||U<u))return U}return u},null);return c!==null&&isFinite(c)&&(f===null||c<f)?c:f},null)||0}function S(w,p){for(var f=0,L=0,g=0,m=A(w,["moof","traf"]),c=0;c<m.length;c++){var u=m[c],a=A(u,["tfhd"])[0],x=k(a,4),b=p[x];if(!b)continue;var E=b.default,N=k(a,0)|(E==null?void 0:E.flags),U=E==null?void 0:E.duration;N&8&&(N&2?U=k(a,12):U=k(a,8));for(var K=b.timescale||9e4,V=A(u,["trun"]),R=0;R<V.length;R++){if(U){var M=k(V[R],4);f=U*M}else f=d(V[R]);b.type===B.ElementaryStreamTypes.VIDEO?L+=f/K:b.type===B.ElementaryStreamTypes.AUDIO&&(g+=f/K)}}if(L===0&&g===0){var $=O(w);if($!=null&&$.references)return $.references.reduce(function(ee,oe){return ee+oe.info.duration||0},0)}return L||g}function d(w){var p=k(w,0),f=8;p&1&&(f+=4),p&4&&(f+=4);for(var L=0,g=k(w,4),m=0;m<g;m++){if(p&256){var c=k(w,f);L+=c,f+=4}p&512&&(f+=4),p&1024&&(f+=4),p&2048&&(f+=4)}return L}function o(w,p,f){A(p,["moof","traf"]).forEach(function(L){A(L,["tfhd"]).forEach(function(g){var m=k(g,4),c=w[m];if(!c)return;var u=c.timescale||9e4;A(L,["tfdt"]).forEach(function(a){var x=a.data[a.start],b=k(a,4);if(x===0)y(a,4,b-f*u);else{b*=Math.pow(2,32),b+=k(a,8),b-=f*u,b=Math.max(b,0);var E=Math.floor(b/(P+1)),N=Math.floor(b%(P+1));y(a,4,E),y(a,8,N)}})})})}function l(w){var p={valid:null,remainder:null},f=A(w,["moof"]);if(f){if(f.length<2)return p.remainder=w,p}else return p;var L=f[f.length-1];return p.valid=Object(Z.sliceUint8)(w,0,L.start-8),p.remainder=Object(Z.sliceUint8)(w,L.start-8),p}function h(w,p){var f=new Uint8Array(w.length+p.length);return f.set(w),f.set(p,w.length),f}},"./src/utils/output-filter.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return Z});var Z=function(){function B(G,j){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=G,this.trackName=j}var P=B.prototype;return P.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},P.newCue=function(j,I,k){(this.startTime===null||this.startTime>j)&&(this.startTime=j),this.endTime=I,this.screen=k,this.timelineController.createCaptionsTrack(this.trackName)},P.reset=function(){this.cueRanges=[]},B}()},"./src/utils/texttrack-utils.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"sendAddTrackEvent",function(){return B}),D.d(Q,"addCueToTrack",function(){return P}),D.d(Q,"clearCurrentCues",function(){return G}),D.d(Q,"removeCuesInRange",function(){return j}),D.d(Q,"getCuesInRange",function(){return k});var Z=D("./src/utils/logger.ts");function B(y,A){var O;try{O=new Event("addtrack")}catch(_){O=document.createEvent("Event"),O.initEvent("addtrack",!1,!1)}O.track=y,A.dispatchEvent(O)}function P(y,A){var O=y.mode;if(O==="disabled"&&(y.mode="hidden"),y.cues&&!y.cues.getCueById(A.id))try{if(y.addCue(A),!y.cues.getCueById(A.id))throw new Error("addCue is failed for: "+A)}catch(C){Z.logger.debug("[texttrack-utils]: "+C);var _=new self.TextTrackCue(A.startTime,A.endTime,A.text);_.id=A.id,y.addCue(_)}O==="disabled"&&(y.mode=O)}function G(y){var A=y.mode;if(A==="disabled"&&(y.mode="hidden"),y.cues)for(var O=y.cues.length;O--;)y.removeCue(y.cues[O]);A==="disabled"&&(y.mode=A)}function j(y,A,O){var _=y.mode;if(_==="disabled"&&(y.mode="hidden"),y.cues&&y.cues.length>0)for(var C=k(y.cues,A,O),S=0;S<C.length;S++)y.removeCue(C[S]);_==="disabled"&&(y.mode=_)}function I(y,A){if(A<y[0].startTime)return 0;var O=y.length-1;if(A>y[O].endTime)return-1;for(var _=0,C=O;_<=C;){var S=Math.floor((C+_)/2);if(A<y[S].startTime)C=S-1;else if(A>y[S].startTime&&_<O)_=S+1;else return S}return y[_].startTime-A<A-y[C].startTime?_:C}function k(y,A,O){var _=[],C=I(y,A);if(C>-1)for(var S=C,d=y.length;S<d;S++){var o=y[S];if(o.startTime>=A&&o.endTime<=O)_.push(o);else if(o.startTime>O)return _}return _}},"./src/utils/time-ranges.ts":function(le,Q,D){"use strict";D.r(Q);var Z={toString:function(P){for(var G="",j=P.length,I=0;I<j;I++)G+="["+P.start(I).toFixed(3)+","+P.end(I).toFixed(3)+"]";return G}};Q.default=Z},"./src/utils/timescale-conversion.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"toTimescaleFromBase",function(){return B}),D.d(Q,"toTimescaleFromScale",function(){return P}),D.d(Q,"toMsFromMpegTsClock",function(){return G}),D.d(Q,"toMpegTsClockFromTimescale",function(){return j});var Z=9e4;function B(I,k,y,A){y===void 0&&(y=1),A===void 0&&(A=!1);var O=I*k*y;return A?Math.round(O):O}function P(I,k,y,A){return y===void 0&&(y=1),A===void 0&&(A=!1),B(I,k,1/y,A)}function G(I,k){return k===void 0&&(k=!1),B(I,1e3,1/Z,k)}function j(I,k){return k===void 0&&(k=1),B(I,Z,1/k)}},"./src/utils/typed-array.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"sliceUint8",function(){return Z});function Z(B,P,G){return Uint8Array.prototype.slice?B.slice(P,G):new Uint8Array(Array.prototype.slice.call(B,P,G))}},"./src/utils/vttcue.ts":function(le,Q,D){"use strict";D.r(Q),Q.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var Z=["","lr","rl"],B=["start","middle","end","left","right"];function P(y,A){if(typeof A!="string")return!1;if(!Array.isArray(y))return!1;var O=A.toLowerCase();return~y.indexOf(O)?O:!1}function G(y){return P(Z,y)}function j(y){return P(B,y)}function I(y){for(var A=arguments.length,O=new Array(A>1?A-1:0),_=1;_<A;_++)O[_-1]=arguments[_];for(var C=1;C<arguments.length;C++){var S=arguments[C];for(var d in S)y[d]=S[d]}return y}function k(y,A,O){var _=this,C={enumerable:!0};_.hasBeenReset=!1;var S="",d=!1,o=y,l=A,h=O,w=null,p="",f=!0,L="auto",g="start",m=50,c="middle",u=50,a="middle";Object.defineProperty(_,"id",I({},C,{get:function(){return S},set:function(b){S=""+b}})),Object.defineProperty(_,"pauseOnExit",I({},C,{get:function(){return d},set:function(b){d=!!b}})),Object.defineProperty(_,"startTime",I({},C,{get:function(){return o},set:function(b){if(typeof b!="number")throw new TypeError("Start time must be set to a number.");o=b,this.hasBeenReset=!0}})),Object.defineProperty(_,"endTime",I({},C,{get:function(){return l},set:function(b){if(typeof b!="number")throw new TypeError("End time must be set to a number.");l=b,this.hasBeenReset=!0}})),Object.defineProperty(_,"text",I({},C,{get:function(){return h},set:function(b){h=""+b,this.hasBeenReset=!0}})),Object.defineProperty(_,"region",I({},C,{get:function(){return w},set:function(b){w=b,this.hasBeenReset=!0}})),Object.defineProperty(_,"vertical",I({},C,{get:function(){return p},set:function(b){var E=G(b);if(E===!1)throw new SyntaxError("An invalid or illegal string was specified.");p=E,this.hasBeenReset=!0}})),Object.defineProperty(_,"snapToLines",I({},C,{get:function(){return f},set:function(b){f=!!b,this.hasBeenReset=!0}})),Object.defineProperty(_,"line",I({},C,{get:function(){return L},set:function(b){if(typeof b!="number"&&b!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");L=b,this.hasBeenReset=!0}})),Object.defineProperty(_,"lineAlign",I({},C,{get:function(){return g},set:function(b){var E=j(b);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");g=E,this.hasBeenReset=!0}})),Object.defineProperty(_,"position",I({},C,{get:function(){return m},set:function(b){if(b<0||b>100)throw new Error("Position must be between 0 and 100.");m=b,this.hasBeenReset=!0}})),Object.defineProperty(_,"positionAlign",I({},C,{get:function(){return c},set:function(b){var E=j(b);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");c=E,this.hasBeenReset=!0}})),Object.defineProperty(_,"size",I({},C,{get:function(){return u},set:function(b){if(b<0||b>100)throw new Error("Size must be between 0 and 100.");u=b,this.hasBeenReset=!0}})),Object.defineProperty(_,"align",I({},C,{get:function(){return a},set:function(b){var E=j(b);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");a=E,this.hasBeenReset=!0}})),_.displayState=void 0}return k.prototype.getCueAsHTML=function(){var y=self.WebVTT;return y.convertCueToDOMTree(self,this.text)},k}()},"./src/utils/vttparser.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"parseTimeStamp",function(){return P}),D.d(Q,"fixLineBreaks",function(){return A}),D.d(Q,"VTTParser",function(){return O});var Z=D("./src/utils/vttcue.ts"),B=function(){function _(){}var C=_.prototype;return C.decode=function(d,o){if(!d)return"";if(typeof d!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(d))},_}();function P(_){function C(d,o,l,h){return(d|0)*3600+(o|0)*60+(l|0)+parseFloat(h||0)}var S=_.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return S?parseFloat(S[2])>59?C(S[2],S[3],0,S[4]):C(S[1],S[2],S[3],S[4]):null}var G=function(){function _(){this.values=Object.create(null)}var C=_.prototype;return C.set=function(d,o){!this.get(d)&&o!==""&&(this.values[d]=o)},C.get=function(d,o,l){return l?this.has(d)?this.values[d]:o[l]:this.has(d)?this.values[d]:o},C.has=function(d){return d in this.values},C.alt=function(d,o,l){for(var h=0;h<l.length;++h)if(o===l[h]){this.set(d,o);break}},C.integer=function(d,o){/^-?\d+$/.test(o)&&this.set(d,parseInt(o,10))},C.percent=function(d,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var l=parseFloat(o);if(l>=0&&l<=100)return this.set(d,l),!0}return!1},_}();function j(_,C,S,d){var o=d?_.split(d):[_];for(var l in o){if(typeof o[l]!="string")continue;var h=o[l].split(S);if(h.length!==2)continue;var w=h[0],p=h[1];C(w,p)}}var I=new Z.default(0,0,""),k=I.align==="middle"?"middle":"center";function y(_,C,S){var d=_;function o(){var w=P(_);if(w===null)throw new Error("Malformed timestamp: "+d);return _=_.replace(/^[^\sa-zA-Z-]+/,""),w}function l(w,p){var f=new G;j(w,function(m,c){var u;switch(m){case"region":for(var a=S.length-1;a>=0;a--)if(S[a].id===c){f.set(m,S[a].region);break}break;case"vertical":f.alt(m,c,["rl","lr"]);break;case"line":u=c.split(","),f.integer(m,u[0]),f.percent(m,u[0])&&f.set("snapToLines",!1),f.alt(m,u[0],["auto"]),u.length===2&&f.alt("lineAlign",u[1],["start",k,"end"]);break;case"position":u=c.split(","),f.percent(m,u[0]),u.length===2&&f.alt("positionAlign",u[1],["start",k,"end","line-left","line-right","auto"]);break;case"size":f.percent(m,c);break;case"align":f.alt(m,c,["start",k,"end","left","right"]);break}},/:/,/\s/),p.region=f.get("region",null),p.vertical=f.get("vertical","");var L=f.get("line","auto");L==="auto"&&I.line===-1&&(L=-1),p.line=L,p.lineAlign=f.get("lineAlign","start"),p.snapToLines=f.get("snapToLines",!0),p.size=f.get("size",100),p.align=f.get("align",k);var g=f.get("position","auto");g==="auto"&&I.position===50&&(g=p.align==="start"||p.align==="left"?0:p.align==="end"||p.align==="right"?100:50),p.position=g}function h(){_=_.replace(/^\s+/,"")}if(h(),C.startTime=o(),h(),_.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);_=_.substr(3),h(),C.endTime=o(),h(),l(_,C)}function A(_){return _.replace(/<br(?: \/)?>/gi,`
`)}var O=function(){function _(){this.state="INITIAL",this.buffer="",this.decoder=new B,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var C=_.prototype;return C.parse=function(d){var o=this;d&&(o.buffer+=o.decoder.decode(d,{stream:!0}));function l(){var g=o.buffer,m=0;for(g=A(g);m<g.length&&g[m]!=="\r"&&g[m]!==`
`;)++m;var c=g.substr(0,m);return g[m]==="\r"&&++m,g[m]===`
`&&++m,o.buffer=g.substr(m),c}function h(g){j(g,function(m,c){},/:/)}try{var w="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;w=l();var p=w.match(/^()?WEBVTT([ \t].*)?$/);if(!p||!p[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var f=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;f?f=!1:w=l();switch(o.state){case"HEADER":/:/.test(w)?h(w):w||(o.state="ID");continue;case"NOTE":w||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(w)){o.state="NOTE";break}if(!w)continue;if(o.cue=new Z.default(0,0,""),o.state="CUE",w.indexOf("-->")===-1){o.cue.id=w;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{y(w,o.cue,o.regionList)}catch(g){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var L=w.indexOf("-->")!==-1;if(!w||L&&(f=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
`),o.cue.text+=w}continue;case"BADCUE":w||(o.state="ID")}}}catch(g){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},C.flush=function(){var d=this;try{if((d.cue||d.state==="HEADER")&&(d.buffer+=`
`,d.parse()),d.state==="INITIAL"||d.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){d.onparsingerror&&d.onparsingerror(o)}return d.onflush&&d.onflush(),this},_}()},"./src/utils/webvtt-parser.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"generateCueId",function(){return O}),D.d(Q,"parseWebVTT",function(){return C});var Z=D("./src/polyfills/number.ts"),B=D("./src/utils/vttparser.ts"),P=D("./src/demux/id3.ts"),G=D("./src/utils/timescale-conversion.ts"),j=D("./src/remux/mp4-remuxer.ts"),I=/\r\n|\n\r|\n|\r/g,k=function(d,o,l){return l===void 0&&(l=0),d.substr(l,o.length)===o},y=function(d){var o=parseInt(d.substr(-3)),l=parseInt(d.substr(-6,2)),h=parseInt(d.substr(-9,2)),w=d.length>9?parseInt(d.substr(0,d.indexOf(":"))):0;if(!Object(Z.isFiniteNumber)(o)||!Object(Z.isFiniteNumber)(l)||!Object(Z.isFiniteNumber)(h)||!Object(Z.isFiniteNumber)(w))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return o+=1e3*l,o+=60*1e3*h,o+=60*60*1e3*w,o},A=function(d){for(var o=5381,l=d.length;l;)o=o*33^d.charCodeAt(--l);return(o>>>0).toString()};function O(S,d,o){return A(S.toString())+A(d.toString())+A(o)}var _=function(d,o,l){var h=d[o],w=d[h.prevCC];if(!w||!w.new&&h.new){d.ccOffset=d.presentationOffset=h.start,h.new=!1;return}for(;(p=w)!==null&&p!==void 0&&p.new;){var p;d.ccOffset+=h.start-w.start,h.new=!1,h=w,w=d[h.prevCC]}d.presentationOffset=l};function C(S,d,o,l,h,w,p,f){var L=new B.VTTParser,g=Object(P.utf8ArrayToStr)(new Uint8Array(S)).trim().replace(I,`
`).split(`
`),m=[],c=Object(G.toMpegTsClockFromTimescale)(d,o),u="00:00.000",a=0,x=0,b,E=!0,N=!1;L.oncue=function(U){var K=l[h],V=l.ccOffset,R=(a-c)/9e4;if(K!=null&&K.new&&(x!==void 0?V=l.ccOffset=K.start:_(l,h,R)),R&&(V=R-l.presentationOffset),N){var M=U.endTime-U.startTime,$=Object(j.normalizePts)((U.startTime+V-x)*9e4,w*9e4)/9e4;U.startTime=$,U.endTime=$+M}var ee=U.text.trim();U.text=decodeURIComponent(encodeURIComponent(ee)),U.id||(U.id=O(U.startTime,U.endTime,ee)),U.endTime>0&&m.push(U)},L.onparsingerror=function(U){b=U},L.onflush=function(){if(b){f(b);return}p(m)},g.forEach(function(U){if(E)if(k(U,"X-TIMESTAMP-MAP=")){E=!1,N=!0,U.substr(16).split(",").forEach(function(K){k(K,"LOCAL:")?u=K.substr(6):k(K,"MPEGTS:")&&(a=parseInt(K.substr(7)))});try{x=y(u)/1e3}catch(K){N=!1,b=K}return}else U===""&&(E=!1);L.parse(U+`
`)}),L.flush()}},"./src/utils/xhr-loader.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/utils/logger.ts"),B=D("./src/loader/load-stats.ts"),P=/^age:\s*[\d.]+\s*$/m,G=function(){function j(k){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=k?k.xhrSetup:null,this.stats=new B.LoadStats,this.retryDelay=0}var I=j.prototype;return I.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},I.abortInternal=function(){var y=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),y&&(y.onreadystatechange=null,y.onprogress=null,y.readyState!==4&&(this.stats.aborted=!0,y.abort()))},I.abort=function(){var y;this.abortInternal(),(y=this.callbacks)!==null&&y!==void 0&&y.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},I.load=function(y,A,O){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=y,this.config=A,this.callbacks=O,this.retryDelay=A.retryDelay,this.loadInternal()},I.loadInternal=function(){var y=this.config,A=this.context;if(!y)return;var O=this.loader=new self.XMLHttpRequest,_=this.stats;_.loading.first=0,_.loaded=0;var C=this.xhrSetup;try{if(C)try{C(O,A.url)}catch(o){O.open("GET",A.url,!0),C(O,A.url)}O.readyState||O.open("GET",A.url,!0);var S=this.context.headers;if(S)for(var d in S)O.setRequestHeader(d,S[d])}catch(o){this.callbacks.onError({code:O.status,text:o.message},A,O);return}A.rangeEnd&&O.setRequestHeader("Range","bytes="+A.rangeStart+"-"+(A.rangeEnd-1)),O.onreadystatechange=this.readystatechange.bind(this),O.onprogress=this.loadprogress.bind(this),O.responseType=A.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),y.timeout),O.send()},I.readystatechange=function(){var y=this.context,A=this.loader,O=this.stats;if(!y||!A)return;var _=A.readyState,C=this.config;if(O.aborted)return;if(_>=2)if(self.clearTimeout(this.requestTimeout),O.loading.first===0&&(O.loading.first=Math.max(self.performance.now(),O.loading.start)),_===4){A.onreadystatechange=null,A.onprogress=null;var S=A.status;if(S>=200&&S<300){O.loading.end=Math.max(self.performance.now(),O.loading.first);var d,o;if(y.responseType==="arraybuffer"?(d=A.response,o=d.byteLength):(d=A.responseText,o=d.length),O.loaded=O.total=o,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(O,y,d,A),!this.callbacks)return;var h={url:A.responseURL,data:d};this.callbacks.onSuccess(h,O,y,A)}else O.retry>=C.maxRetry||S>=400&&S<499?(Z.logger.error(S+" while loading "+y.url),this.callbacks.onError({code:S,text:A.statusText},y,A)):(Z.logger.warn(S+" while loading "+y.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,C.maxRetryDelay),O.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),C.timeout)},I.loadtimeout=function(){Z.logger.warn("timeout while loading "+this.context.url);var y=this.callbacks;y&&(this.abortInternal(),y.onTimeout(this.stats,this.context,this.loader))},I.loadprogress=function(y){var A=this.stats;A.loaded=y.loaded,y.lengthComputable&&(A.total=y.total)},I.getCacheAge=function(){var y=null;if(this.loader&&P.test(this.loader.getAllResponseHeaders())){var A=this.loader.getResponseHeader("age");y=A?parseFloat(A):null}return y},j}();Q.default=G}}).default})},vHTk:function(bt,Qe,ie){bt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wzkS:function(bt,Qe,ie){"use strict";ie.d(Qe,"c",function(){return B}),ie.d(Qe,"b",function(){return P}),ie.d(Qe,"d",function(){return G}),ie.d(Qe,"a",function(){return I}),ie.d(Qe,"e",function(){return k});var le=ie("9og8"),Q=ie("WmNS"),D=ie.n(Q),Z=ie("ErOA");function B(y){return Object(Z.c)("libraries/".concat(y,".json"))}function P(){return Object(Z.c)("library_tags.json")}function G(y){return j.apply(this,arguments)}function j(){return j=Object(le.a)(D.a.mark(function y(A){var O;return D.a.wrap(function(C){for(;;)switch(C.prev=C.next){case 0:return C.next=2,Object(Z.b)("attachments/".concat(A,".json"));case 2:return O=C.sent,C.abrupt("return",O.status===0);case 4:case"end":return C.stop()}},y)})),j.apply(this,arguments)}function I(y){return Object(Z.f)("libraries.json",y)}function k(y,A){return Object(Z.g)("libraries/".concat(y,".json"),A)}},y5JW:function(bt,Qe,ie){"use strict";ie.d(Qe,"c",function(){return S}),ie.d(Qe,"a",function(){return d});var le=ie("DZo9"),Q=ie("8z0m"),D=ie("+L6B"),Z=ie("2/Rp"),B=ie("9og8"),P=ie("k1fw"),G=ie("oBTY"),j=ie("miYZ"),I=ie("tsqr"),k=ie("WmNS"),y=ie.n(k),A=ie("q1tI"),O=ie.n(A),_=ie("m3rI"),C=ie("wzkS"),S="\u3000\u3000";function d(o){var l=["Bytes","KB","MB","GB","TB"];if(o==0)return"0 Byte";var h=parseInt(""+Math.floor(Math.log(o)/Math.log(1024)),10);return(o/Math.pow(1024,h)).toFixed(1)+" "+l[h]}Qe.b=function(o){var l=o.value,h=l===void 0?[]:l,w=o.action,p=o.onChange,f=o.className,L=o.maxSize,g=L===void 0?150:L,m=o.title,c=m===void 0?"\u6587\u4EF6\u4E0A\u4F20":m,u=o.accept,a=u===void 0?null:u,x={multiple:!1,fileList:h,accept:a,withCredentials:!0,beforeUpload:function(N){var U=N.size/1024/1024;return U<g?!0:(I.b.error("\u8BE5\u6587\u4EF6\u65E0\u6CD5\u4E0A\u4F20\u3002\u8D85\u8FC7\u6587\u4EF6\u5927\u5C0F\u9650\u5236(".concat(g,"MB),\u5EFA\u8BAE\u4E0A\u4F20\u5230\u767E\u5EA6\u4E91\u7B49\u5176\u5B83\u5171\u4EAB\u5DE5\u5177\u91CC\uFF0C\u7136\u540E\u518Dtxt\u6587\u6863\u91CC\u7ED9\u51FA\u94FE\u63A5\u4EE5\u53CA\u5171\u4EAB\u5BC6\u7801\u5E76\u4E0A\u4F20")),Promise.reject())},action:"".concat(_.a.API_SERVER,"/api/attachments.json"),onChange:function(N){var U=Object(G.a)(N.fileList);U=U.map(function(K){return K.name.indexOf(S)===-1&&(K.name="".concat(K.name).concat(S).concat(d(K.size))),Object(P.a)({},K)}),p(U)},onRemove:function(){var E=Object(B.a)(y.a.mark(function U(K){var V,R,M;return y.a.wrap(function(ee){for(;;)switch(ee.prev=ee.next){case 0:if(V=K.size/1024/1024,!(K.status==="uploading")){ee.next=3;break}return ee.abrupt("return",!0);case 3:if(V<g){ee.next=7;break}return ee.abrupt("return",!0);case 7:if(R=K.response?K.response.id:K.uid,!R){ee.next=15;break}return ee.next=11,Object(C.d)(K.response?K.response.id:K.id);case 11:return M=ee.sent,ee.abrupt("return",M);case 15:return ee.abrupt("return",!0);case 16:case"end":return ee.stop()}},U)}));function N(U){return E.apply(this,arguments)}return N}()};function b(E){E.preventDefault(),E.stopPropagation()}return O.a.createElement("div",{className:"single-upload ".concat(f||"")},O.a.createElement(Q.a,x,O.a.createElement(Z.a,{type:"primary",title:h.length>0?"\u6BCF\u6B21\u53EA\u80FD\u4E0A\u4F20\u4E00\u4E2A\u8D44\u6E90\uFF0C \u5220\u9664\u4E0B\u9762\u8D44\u6E90\u53EF\u91CD\u65B0\u4E0A\u4F20 ":"",disabled:h.length>0,ghost:!0},c),O.a.createElement("span",{onClick:b,style:{marginLeft:10}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",g,"M) ")))}}}]);