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__Forums__New.9b155fa6.asy...

372 lines
972 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[146,5,6,7,17],{"+NIl":function(lt,$e,ie){(function(ne){ne(ie("VrN/"))})(function(ne){"use strict";ne.defineMode("stex",function($,k){"use strict";function X(A,S){A.cmdState.push(S)}function U(A){return A.cmdState.length>0?A.cmdState[A.cmdState.length-1]:null}function O(A){var S=A.cmdState.pop();S&&S.closeBracket()}function W(A){for(var S=A.cmdState,T=S.length-1;T>=0;T--){var d=S[T];if(d.name=="DEFAULT")continue;return d}return{styleIdentifier:function(){return null}}}function F(A,S,T){return function(){this.name=A,this.bracketNo=0,this.style=S,this.styles=T,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var P={};P.importmodule=F("importmodule","tag",["string","builtin"]),P.documentclass=F("documentclass","tag",["","atom"]),P.usepackage=F("usepackage","tag",["atom"]),P.begin=F("begin","tag",["atom"]),P.end=F("end","tag",["atom"]),P.label=F("label","tag",["atom"]),P.ref=F("ref","tag",["atom"]),P.eqref=F("eqref","tag",["atom"]),P.cite=F("cite","tag",["atom"]),P.bibitem=F("bibitem","tag",["atom"]),P.Bibitem=F("Bibitem","tag",["atom"]),P.RBibitem=F("RBibitem","tag",["atom"]),P.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function w(A,S){A.f=S}function f(A,S){var T;if(A.match(/^\\[a-zA-Z@]+/)){var d=A.current().slice(1);return T=P.hasOwnProperty(d)?P[d]:P.DEFAULT,T=new T,X(S,T),w(S,M),T.style}if(A.match(/^\\[$&%#{}_]/))return"tag";if(A.match(/^\\[,;!\/\\]/))return"tag";if(A.match("\\["))return w(S,function(s,u){return b(s,u,"\\]")}),"keyword";if(A.match("\\("))return w(S,function(s,u){return b(s,u,"\\)")}),"keyword";if(A.match("$$"))return w(S,function(s,u){return b(s,u,"$$")}),"keyword";if(A.match("$"))return w(S,function(s,u){return b(s,u,"$")}),"keyword";var a=A.next();if(a=="%")return A.skipToEnd(),"comment";if(a=="}"||a=="]"){if(T=U(S),T)T.closeBracket(a),w(S,M);else return"error";return"bracket"}else return a=="{"||a=="["?(T=P.DEFAULT,T=new T,X(S,T),"bracket"):/\d/.test(a)?(A.eatWhile(/[\w.%]/),"atom"):(A.eatWhile(/[\w\-_]/),T=W(S),T.name=="begin"&&(T.argument=A.current()),T.styleIdentifier())}function b(A,S,T){if(A.eatSpace())return null;if(T&&A.match(T))return w(S,f),"keyword";if(A.match(/^\\[a-zA-Z@]+/))return"tag";if(A.match(/^[a-zA-Z]+/))return"variable-2";if(A.match(/^\\[$&%#{}_]/))return"tag";if(A.match(/^\\[,;!\/]/))return"tag";if(A.match(/^[\^_&]/))return"tag";if(A.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(A.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var d=A.next();return d=="{"||d=="}"||d=="["||d=="]"||d=="("||d==")"?"bracket":d=="%"?(A.skipToEnd(),"comment"):"error"}function M(A,S){var T=A.peek(),d;return T=="{"||T=="["?(d=U(S),d.openBracket(T),A.eat(T),w(S,f),"bracket"):/[ \t\r]/.test(T)?(A.eat(T),null):(w(S,f),O(S),f(A,S))}return{startState:function(){var A=k.inMathMode?function(S,T){return b(S,T)}:f;return{cmdState:[],f:A}},copyState:function(A){return{cmdState:A.cmdState.slice(),f:A.f}},token:function(A,S){return S.f(A,S)},blankLine:function(A){A.f=f,A.cmdState.length=0},lineComment:"%"}}),ne.defineMIME("text/x-stex","stex"),ne.defineMIME("text/x-latex","stex")})},"19Vz":function(lt,$e,ie){(function(ne){ne(ie("VrN/"))})(function(ne){ne.defineOption("placeholder","",function(F,P,w){var f=w&&w!=ne.Init;if(P&&!f)F.on("blur",U),F.on("change",O),F.on("swapDoc",O),ne.on(F.getInputField(),"compositionupdate",F.state.placeholderCompose=function(){X(F)}),O(F);else if(!P&&f){F.off("blur",U),F.off("change",O),F.off("swapDoc",O),ne.off(F.getInputField(),"compositionupdate",F.state.placeholderCompose),$(F);var b=F.getWrapperElement();b.className=b.className.replace(" CodeMirror-empty","")}P&&!F.hasFocus()&&U(F)});function $(F){F.state.placeholder&&(F.state.placeholder.parentNode.removeChild(F.state.placeholder),F.state.placeholder=null)}function k(F){$(F);var P=F.state.placeholder=document.createElement("pre");P.style.cssText="height: 0; overflow: visible",P.style.direction=F.getOption("direction"),P.className="CodeMirror-placeholder CodeMirror-line-like";var w=F.getOption("placeholder");typeof w=="string"&&(w=document.createTextNode(w)),P.appendChild(w),F.display.lineSpace.insertBefore(P,F.display.lineSpace.firstChild)}function X(F){setTimeout(function(){var P=!1,w=F.getInputField();w.nodeName=="TEXTAREA"?P=!w.value:F.lineCount()==1&&(P=!/[^\u200b]/.test(w.querySelector(".CodeMirror-line").textContent)),P?k(F):$(F)},20)}function U(F){W(F)&&k(F)}function O(F){var P=F.getWrapperElement(),w=W(F);P.className=P.className.replace(" CodeMirror-empty","")+(w?" CodeMirror-empty":""),w?k(F):$(F)}function W(F){return F.lineCount()===1&&F.getLine(0)===""}})},"1eCo":function(lt,$e,ie){(function(ne){ne(ie("VrN/"))})(function(ne){"use strict";var $={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},k={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ne.defineMode("xml",function(X,U){var O=X.indentUnit,W={},F=U.htmlMode?$:k;for(var P in F)W[P]=F[P];for(var P in U)W[P]=U[P];var w,f;function b(o,C){function x(B){return C.tokenize=B,B(o,C)}var v=o.next();if(v=="<")return o.eat("!")?o.eat("[")?o.match("CDATA[")?x(S("atom","]]>")):null:o.match("--")?x(S("comment","-->")):o.match("DOCTYPE",!0,!0)?(o.eatWhile(/[\w\._\-]/),x(T(1))):null:o.eat("?")?(o.eatWhile(/[\w\._\-]/),C.tokenize=S("meta","?>"),"meta"):(w=o.eat("/")?"closeTag":"openTag",C.tokenize=M,"tag bracket");if(v=="&"){var R;return o.eat("#")?o.eat("x")?R=o.eatWhile(/[a-fA-F\d]/)&&o.eat(";"):R=o.eatWhile(/[\d]/)&&o.eat(";"):R=o.eatWhile(/[\w\.\-:]/)&&o.eat(";"),R?"atom":"error"}else return o.eatWhile(/[^&<]/),null}b.isInText=!0;function M(o,C){var x=o.next();if(x==">"||x=="/"&&o.eat(">"))return C.tokenize=b,w=x==">"?"endTag":"selfcloseTag","tag bracket";if(x=="=")return w="equals",null;if(x=="<"){C.tokenize=b,C.state=u,C.tagName=C.tagStart=null;var v=C.tokenize(o,C);return v?v+" tag error":"tag error"}else return/[\'\"]/.test(x)?(C.tokenize=A(x),C.stringStartCol=o.column(),C.tokenize(o,C)):(o.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function A(o){var C=function(x,v){for(;!x.eol();)if(x.next()==o){v.tokenize=M;break}return"string"};return C.isInAttribute=!0,C}function S(o,C){return function(x,v){for(;!x.eol();){if(x.match(C)){v.tokenize=b;break}x.next()}return o}}function T(o){return function(C,x){for(var v;(v=C.next())!=null;){if(v=="<")return x.tokenize=T(o+1),x.tokenize(C,x);if(v==">")if(o==1){x.tokenize=b;break}else return x.tokenize=T(o-1),x.tokenize(C,x)}return"meta"}}function d(o,C,x){this.prev=o.context,this.tagName=C,this.indent=o.indented,this.startOfLine=x,(W.doNotIndent.hasOwnProperty(C)||o.context&&o.context.noIndent)&&(this.noIndent=!0)}function a(o){o.context&&(o.context=o.context.prev)}function s(o,C){for(var x;;){if(!o.context)return;if(x=o.context.tagName,!W.contextGrabbers.hasOwnProperty(x)||!W.contextGrabbers[x].hasOwnProperty(C))return;a(o)}}function u(o,C,x){return o=="openTag"?(x.tagStart=C.column(),_):o=="closeTag"?m:u}function _(o,C,x){return o=="word"?(x.tagName=C.current(),f="tag",E):W.allowMissingTagName&&o=="endTag"?(f="tag bracket",E(o,C,x)):(f="error",_)}function m(o,C,x){if(o=="word"){var v=C.current();return x.context&&x.context.tagName!=v&&W.implicitlyClosed.hasOwnProperty(x.context.tagName)&&a(x),x.context&&x.context.tagName==v||W.matchClosing===!1?(f="tag",p):(f="tag error",D)}else return W.allowMissingTagName&&o=="endTag"?(f="tag bracket",p(o,C,x)):(f="error",D)}function p(o,C,x){return o!="endTag"?(f="error",p):(a(x),u)}function D(o,C,x){return f="error",p(o,C,x)}function E(o,C,x){if(o=="word")return f="attribute",g;if(o=="endTag"||o=="selfcloseTag"){var v=x.tagName,R=x.tagStart;return x.tagName=x.tagStart=null,o=="selfcloseTag"||W.autoSelfClosers.hasOwnProperty(v)?s(x,v):(s(x,v),x.context=new d(x,v,R==x.indented)),u}return f="error",E}function g(o,C,x){return o=="equals"?c:(W.allowMissing||(f="error"),E(o,C,x))}function c(o,C,x){return o=="string"?h:o=="word"&&W.allowUnquoted?(f="string",E):(f="error",E(o,C,x))}function h(o,C,x){return o=="string"?h:E(o,C,x)}return{startState:function(o){var C={tokenize:b,state:u,indented:o||0,tagName:null,tagStart:null,context:null};return o!=null&&(C.baseIndent=o),C},token:function(o,C){if(!C.tagName&&o.sol()&&(C.indented=o.indentation()),o.eatSpace())return null;w=null;var x=C.tokenize(o,C);return(x||w)&&x!="comment"&&(f=null,C.state=C.state(w||x,o,C),f&&(x=f=="error"?x+" error":f)),x},indent:function(o,C,x){var v=o.context;if(o.tokenize.isInAttribute)return o.tagStart==o.indented?o.stringStartCol+1:o.indented+O;if(v&&v.noIndent)return ne.Pass;if(o.tokenize!=M&&o.tokenize!=b)return x?x.match(/^(\s*)/)[0].length:0;if(o.tagName)return W.multilineTagIndentPastTag!==!1?o.tagStart+o.tagName.length+2:o.tagStart+O*(W.multilineTagIndentFactor||1);if(W.alignCDATA&&/<!\[CDATA\[/.test(C))return 0;var R=C&&/^<(\/)?([\w_:\.-]*)/.exec(C);if(R&&R[1])for(;v;)if(v.tagName==R[2]){v=v.prev;break}else if(W.implicitlyClosed.hasOwnProperty(v.tagName))v=v.prev;else break;else if(R)for(;v;){var B=W.contextGrabbers[v.tagName];if(B&&B.hasOwnProperty(R[2]))v=v.prev;else break}for(;v&&v.prev&&!v.startOfLine;)v=v.prev;return v?v.indent+O:o.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:W.htmlMode?"html":"xml",helperType:W.htmlMode?"html":"xml",skipAttribute:function(o){o.state==c&&(o.state=E)},xmlCurrentTag:function(o){return o.tagName?{name:o.tagName,close:o.type=="closeTag"}:null},xmlCurrentContext:function(o){for(var C=[],x=o.context;x;x=x.prev)x.tagName&&C.push(x.tagName);return C.reverse()}}}),ne.defineMIME("text/xml","xml"),ne.defineMIME("application/xml","xml"),ne.mimeModes.hasOwnProperty("text/html")||ne.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"500L":function(lt,$e,ie){"use strict";ie.d($e,"a",function(){return m});var ne=ie("+L6B"),$=ie("2/Rp"),k=ie("2qtc"),X=ie("kLXV"),U=ie("9og8"),O=ie("k1fw"),W=ie("miYZ"),F=ie("tsqr"),P=ie("oBTY"),w=ie("tJVT"),f=ie("DZo9"),b=ie("8z0m"),M=ie("WmNS"),A=ie.n(M),S=ie("q1tI"),T=ie.n(S),d=ie("m3rI"),a=ie("wzkS"),s=ie("y5JW"),u=ie("LtfV"),_=b.a.Dragger;function m(p){var D=[];return p&&p.length>0&&(D=p.map(function(E){return{uid:E.id,id:E.id,name:E.title+s.c+E.filesize,url:E.url,filesize:E.filesize,status:"done",response:{id:E.id}}})),D}$e.b=function(p){var D=p.value,E=p.onChange,g=p.action,c=p.className,h=p.maxSize,o=h===void 0?150:h,C=p.title,x=C===void 0?"\u4E0A\u4F20\u9644\u4EF6":C,v=p.showRemoveModal,R=v===void 0?!1:v,B=p.accept,j=B===void 0?"":B,K=p.additionalText,I=p.isDragger,N=p.number,Y=N===void 0?1e3:N,q=p.aloneClear,ae=q===void 0?!1:q,he=p.restrict,_e=he===void 0?!0:he,be=Object(S.useState)(!1),Ce=Object(w.a)(be,2),Te=Ce[0],Ee=Ce[1],me=Object(S.useState)(D||[]),ue=Object(w.a)(me,2),te=ue[0],ce=ue[1];Object(S.useEffect)(function(){D&&(ce(Object(P.a)(D)),Y===(D==null?void 0:D.length)&&Ee(!0))},[D]);var se=function(){setTimeout(function(){te.pop(),ce(Object(P.a)(te))},500)},we={multiple:!0,disabled:Te,accept:j,withCredentials:!0,fileList:te,beforeUpload:function(Pe,Ne){var Be=Pe.size/1024/1024;return te.concat(Ne).length>Y?(te.pop(),ce(Object(P.a)(te)),F.b.error("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20".concat(Y,"\u4E2A\u6587\u4EF6")),ae?Promise.reject():(se(),!1)):Be<o?!0:(F.b.error("\u8BE5\u6587\u4EF6\u65E0\u6CD5\u4E0A\u4F20\u3002\u8D85\u8FC7\u6587\u4EF6\u5927\u5C0F\u9650\u5236(".concat(o,"MB).")),ae?Promise.reject():(se(),!1))},action:g||"".concat(d.a.API_SERVER,"/api/attachments.json"),onChange:function(Pe){var Ne=Object(P.a)(Pe.fileList);Ne.length>=Y?Ee(!0):Ee(!1),ce(Object(P.a)(Ne)),Ne=Ne.map(function(Be){var We;if(Be!=null&&(We=Be.response)!==null&&We!==void 0&&We.id){var Ue;Be.url="/api/attachments/".concat(Be==null||((Ue=Be.response)===null||Ue===void 0)?void 0:Ue.id)}return Be.name.indexOf(s.c)===-1&&(Be.name="".concat(Be.name).concat(s.c).concat(Object(s.a)(Be.size))),Object(O.a)({},Be)}),console.log("info:",Pe),E(Ne)},onRemove:function(){var xe=Object(U.a)(A.a.mark(function Ne(Be){var We;return A.a.wrap(function(Fe){for(;;)switch(Fe.prev=Fe.next){case 0:if(We=function(){var at=Object(U.a)(A.a.mark(function it(){var et,Ze;return A.a.wrap(function(Je){for(;;)switch(Je.prev=Je.next){case 0:if(et=Be.response?Be.response.id:Be.id,!et){Je.next=8;break}return Je.next=4,Object(a.d)(Be.response?Be.response.id:Be.uid);case 4:return Ze=Je.sent,Je.abrupt("return",Ze);case 8:return Je.abrupt("return",!0);case 9:case"end":return Je.stop()}},it)}));return function(){return at.apply(this,arguments)}}(),!R){Fe.next=5;break}return Fe.abrupt("return",new Promise(function(at,it){X.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:T.a.createElement("div",{className:"tc font16"},"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),onOk:function(){var et=Object(U.a)(A.a.mark(function ut(){var Je;return A.a.wrap(function(Re){for(;;)switch(Re.prev=Re.next){case 0:return Re.next=2,We();case 2:Je=Re.sent,F.b.success("\u5220\u9664\u6210\u529F"),at(!0);case 5:case"end":return Re.stop()}},ut)}));function Ze(){return et.apply(this,arguments)}return Ze}(),onCancel:function(){return at(!1)}})}));case 5:return Fe.next=7,We();case 7:return Fe.abrupt("return",Fe.sent);case 8:case"end":return Fe.stop()}},Ne)}));function Pe(Ne){return xe.apply(this,arguments)}return Pe}()};function Le(xe){xe.preventDefault(),xe.stopPropagation()}return T.a.createElement("div",{className:"multi-upload ".concat(c||"")},I&&T.a.createElement(_,we,T.a.createElement("p",{className:"ant-upload-drag-icon"},T.a.createElement(u.a,null)),T.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",T.a.createElement("br",null),T.a.createElement("span",{style:{display:_e?"block":"none"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927\u9650\u5236\u4E3A",o,"MB) ")),K),!I&&T.a.createElement(b.a,we,T.a.createElement($.a,{disabled:Te},x),T.a.createElement("span",{onClick:Le,style:{marginLeft:10,color:"#FA6400",display:_e?"block":"none"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",o,"MB) ")))}},"55Ip":function(lt,$e,ie){"use strict";ie.d($e,"a",function(){return s}),ie.d($e,"b",function(){return E});var ne=ie("Ty5D"),$=ie("dI71"),k=ie("q1tI"),X=ie.n(k),U=ie("YS25"),O=ie("17x9"),W=ie.n(O),F=ie("wx14"),P=ie("zLVn"),w=ie("9R94"),f=function(c){Object($.a)(h,c);function h(){for(var C,x=arguments.length,v=new Array(x),R=0;R<x;R++)v[R]=arguments[R];return C=c.call.apply(c,[this].concat(v))||this,C.history=Object(U.a)(C.props),C}var o=h.prototype;return o.render=function(){return X.a.createElement(ne.c,{history:this.history,children:this.props.children})},h}(X.a.Component),b=function(c){Object($.a)(h,c);function h(){for(var C,x=arguments.length,v=new Array(x),R=0;R<x;R++)v[R]=arguments[R];return C=c.call.apply(c,[this].concat(v))||this,C.history=Object(U.b)(C.props),C}var o=h.prototype;return o.render=function(){return X.a.createElement(ne.c,{history:this.history,children:this.props.children})},h}(X.a.Component),M=function(h,o){return typeof h=="function"?h(o):h},A=function(h,o){return typeof h=="string"?Object(U.c)(h,null,null,o):h},S=function(h){return h},T=X.a.forwardRef;typeof T=="undefined"&&(T=S);function d(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var a=T(function(c,h){var o=c.innerRef,C=c.navigate,x=c.onClick,v=Object(P.a)(c,["innerRef","navigate","onClick"]),R=v.target,B=Object(F.a)({},v,{onClick:function(K){try{x&&x(K)}catch(I){throw K.preventDefault(),I}!K.defaultPrevented&&K.button===0&&(!R||R==="_self")&&!d(K)&&(K.preventDefault(),C())}});return S!==T?B.ref=h||o:B.ref=o,X.a.createElement("a",B)}),s=T(function(c,h){var o=c.component,C=o===void 0?a:o,x=c.replace,v=c.to,R=c.innerRef,B=Object(P.a)(c,["component","replace","to","innerRef"]);return X.a.createElement(ne.e.Consumer,null,function(j){j||Object(w.a)(!1);var K=j.history,I=A(M(v,j.location),j.location),N=I?K.createHref(I):"",Y=Object(F.a)({},B,{href:N,navigate:function(){var ae=M(v,j.location),he=x?K.replace:K.push;he(ae)}});return S!==T?Y.ref=h||R:Y.innerRef=R,X.a.createElement(C,Y)})});if(!1)var u,_;var m=function(h){return h},p=X.a.forwardRef;typeof p=="undefined"&&(p=m);function D(){for(var c=arguments.length,h=new Array(c),o=0;o<c;o++)h[o]=arguments[o];return h.filter(function(C){return C}).join(" ")}var E=p(function(c,h){var o=c["aria-current"],C=o===void 0?"page":o,x=c.activeClassName,v=x===void 0?"active":x,R=c.activeStyle,B=c.className,j=c.exact,K=c.isActive,I=c.location,N=c.sensitive,Y=c.strict,q=c.style,ae=c.to,he=c.innerRef,_e=Object(P.a)(c,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return X.a.createElement(ne.e.Consumer,null,function(be){be||Object(w.a)(!1);var Ce=I||be.location,Te=A(M(ae,Ce),Ce),Ee=Te.pathname,me=Ee&&Ee.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),ue=me?Object(ne.f)(Ce.pathname,{path:me,exact:j,sensitive:N,strict:Y}):null,te=!!(K?K(ue,Ce):ue),ce=te?D(B,v):B,se=te?Object(F.a)({},q,{},R):q,we=Object(F.a)({"aria-current":te&&C||null,className:ce,style:se,to:Te},_e);return m!==p?we.ref=h||he:we.innerRef=he,X.a.createElement(s,we)})});if(!1)var g},"7/Dv":function(lt,$e,ie){lt.exports={bg:"bg___2rJyo",flexRow:"flexRow___2xuIa",flexJustifyCenter:"flexJustifyCenter___Z3bJt",flexAlignEnd:"flexAlignEnd___v7Ww-",flexAlignCenter:"flexAlignCenter___223DA",flexColumn:"flexColumn___3CNqR",formWrap:"formWrap___2b6uL",titleWrap:"titleWrap___1CMQA",fieldWrap:"fieldWrap___2BRrD",mdWrap:"mdWrap___3UYzt",backgroundFa:"backgroundFa___32wpj",button:"button___MHDAn"}},"7Cbv":function(lt,$e,ie){"use strict";var ne=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),$=new Uint8Array(16);function k(){if(!ne)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ne($)}var X=/^(?:[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 U(M){return typeof M=="string"&&X.test(M)}for(var O=U,W=[],F=0;F<256;++F)W.push((F+256).toString(16).substr(1));function P(M){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,S=(W[M[A+0]]+W[M[A+1]]+W[M[A+2]]+W[M[A+3]]+"-"+W[M[A+4]]+W[M[A+5]]+"-"+W[M[A+6]]+W[M[A+7]]+"-"+W[M[A+8]]+W[M[A+9]]+"-"+W[M[A+10]]+W[M[A+11]]+W[M[A+12]]+W[M[A+13]]+W[M[A+14]]+W[M[A+15]]).toLowerCase();if(!O(S))throw TypeError("Stringified UUID is invalid");return S}var w=P;function f(M,A,S){M=M||{};var T=M.random||(M.rng||k)();if(T[6]=T[6]&15|64,T[8]=T[8]&63|128,A){S=S||0;for(var d=0;d<16;++d)A[S+d]=T[d];return A}return w(T)}var b=$e.a=f},"7ahc":function(lt,$e,ie){"use strict";ie.d($e,"a",function(){return _});var ne=ie("k1fw"),$=ie("0Owb"),k=ie("+L6B"),X=ie("2/Rp"),U=ie("y8nQ"),O=ie("Vl3Y"),W=ie("tJVT"),F=ie("OaEy"),P=ie("2fM7"),w=ie("q1tI"),f=ie.n(w),b=ie("VrN/"),M=ie.n(b),A=ie("p77/"),S=ie.n(A),T=ie("c5Ni"),d=ie.n(T),a=P.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},u={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"]};$e.b=function(m){var p=m.callback,D=m.onCancel,E=Object(w.useState)("python"),g=Object(W.a)(E,2),c=g[0],h=g[1];function o(x){h(u[x][1])}function C(x){p(x)}return f.a.createElement(O.a,Object($.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:C}),f.a.createElement(O.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},f.a.createElement(P.a,{onChange:o},Object.keys(u).map(function(x){return f.a.createElement(a,{key:x,value:x},u[x][0])}))),f.a.createElement(O.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},f.a.createElement(_,{mode:c})),f.a.createElement("div",{className:"flex-container flex-end"},f.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),f.a.createElement(X.a,{type:"ghost",onClick:D},"\u53D6\u6D88")))};function _(m){var p=m.value,D=m.onChange,E=m.mode,g=m.options,c=g===void 0?{}:g,h=Object(w.useRef)(),o=Object(w.useState)(),C=Object(W.a)(o,2),x=C[0],v=C[1];return Object(w.useEffect)(function(){if(x){function R(B){var j=B.getValue();D&&D(j)}return x.on("change",R),function(){x.off("change",R)}}},[x,D]),Object(w.useEffect)(function(){x&&x.setOption("mode",E)},[x,E]),Object(w.useEffect)(function(){x&&((p!==x.getValue()||p==="")&&setTimeout(function(){x.setValue(p||" ")},300))},[x,p]),Object(w.useEffect)(function(){if(h.current&&!x){var R=M.a.fromTextArea(h.current,Object(ne.a)({mode:E,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));v(R)}},[h.current,x]),f.a.createElement("div",{className:"my-codemirror-container"},f.a.createElement("textarea",{ref:h}))}},"8EBN":function(lt,$e,ie){(function(ne){ne(ie("VrN/"))})(function(ne){"use strict";ne.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var $=0;$<ne.modeInfo.length;$++){var k=ne.modeInfo[$];k.mimes&&(k.mime=k.mimes[0])}ne.findModeByMIME=function(X){X=X.toLowerCase();for(var U=0;U<ne.modeInfo.length;U++){var O=ne.modeInfo[U];if(O.mime==X)return O;if(O.mimes){for(var W=0;W<O.mimes.length;W++)if(O.mimes[W]==X)return O}}if(/\+xml$/.test(X))return ne.findModeByMIME("application/xml");if(/\+json$/.test(X))return ne.findModeByMIME("application/json")},ne.findModeByExtension=function(X){X=X.toLowerCase();for(var U=0;U<ne.modeInfo.length;U++){var O=ne.modeInfo[U];if(O.ext){for(var W=0;W<O.ext.length;W++)if(O.ext[W]==X)return O}}},ne.findModeByFileName=function(X){for(var U=0;U<ne.modeInfo.length;U++){var O=ne.modeInfo[U];if(O.file&&O.file.test(X))return O}var W=X.lastIndexOf("."),F=W>-1&&X.substring(W+1,X.length);if(F)return ne.findModeByExtension(F)},ne.findModeByName=function(X){X=X.toLowerCase();for(var U=0;U<ne.modeInfo.length;U++){var O=ne.modeInfo[U];if(O.name.toLowerCase()==X)return O;if(O.alias){for(var W=0;W<O.alias.length;W++)if(O.alias[W].toLowerCase()==X)return O}}}})},"8hTe":function(lt,$e,ie){lt.exports={button:"button___1wy9m"}},"9Bee":function(lt,$e,ie){"use strict";var ne=ie("DYRE"),$=ie("zeV3"),k=ie("+L6B"),X=ie("2/Rp"),U=ie("k1fw"),O=ie("9og8"),W=ie("tJVT"),F=ie("WmNS"),P=ie.n(F),w=ie("q1tI"),f=ie.n(w),b=ie("vg9a"),M=ie("DlQD"),A=ie.n(M),S=ie("rUJ1");function T(V,l){var y=V.match(/^(\s+)(?:```)/);if(y===null)return l;var z=y[1];return l.split(`
`).map(function(Z){var G=Z.match(/^\s+/);if(G===null)return Z;var ve=Object(W.a)(G,1),ze=ve[0];return ze.length>=z.length?Z.slice(z.length):Z}).join(`
`)}var d=[],a=["<ul>"],s=new A.a.Renderer,u=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function _(){d.length=0,a=["<ul>"]}var m={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function p(V,l,y,z){if(l>=V.length||V[l].level<=y)return l;var Z=V[l];z.push("<li><a href='#"+Z.anchor+"'>"+Z.text+"</a>"),l++;var G=[];return l=p(V,l,Z.level,G),G.length>0&&(z.push("<ul>"),G.forEach(function(ve){z.push(ve)}),z.push("</ul>")),z.push("</li>"),l=p(V,l,y,z),l}function D(){return p(d,0,0,a),a.push("</ul>"),a.join("")}var E={heading:function(l){var y=u.exec(l);if(y)return{type:"heading",raw:y[0],depth:y[1].length,text:y[2]}},fences:function(l){var y=this.rules.block.fences.exec(l);if(y){var z=y[0],Z=T(z,y[3]||""),G=y[2]?y[2].trim():y[2];if(["latex","katex","math"].indexOf(G)>=0){var ve=h(),ze=Z;Z=ve,o[ve]={type:"block",expression:ze}}return{type:"code",raw:z,lang:G,text:Z}}}},g=/(?:\${2})([^\n`]+?)(?:\${2})/gi,c=0,h=function(){return"__special_katext_id_".concat(c++,"__")},o={};function C(){return o}function x(){c=0,o={}}function v(V){return V=V.replace(g,function(l,y){var z=h();return o[z]={type:"inline",expression:y},z}),V}var R=s.listitem;s.listitem=function(V){return R(v(V))};var B=s.paragraph;s.paragraph=function(V){return B(v(V))};var j=s.tablecell;s.tablecell=function(V,l){return j(v(V),l)},s.code=function(V,l,y){var z=(l||"").match(/\S*/)[0];return z?["latex","katex","math"].indexOf(z)>=0?"<p class='editormd-tex'>".concat(V,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(l,'">').concat(y?V:Object(S.escape)(V,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(y?V:Object(S.escape)(V,!0))+"</code></pre>"},s.heading=function(V,l,y){var z=this.options.headerPrefix+y.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return d.push({anchor:z,level:l,text:V}),"<h"+l+' id="'+z+'">'+V+"</h"+l+">"},A.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),A.a.use({tokenizer:E,renderer:s});var K=A.a,I=ie("SJMd"),N=ie("ulZh"),Y=ie.n(N),q=ie("m3rI"),ae=ie("Oy/b"),he=ie("p5ED"),_e=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 be=function(V,l){return(be=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,z){y.__proto__=z}||function(y,z){for(var Z in z)Object.prototype.hasOwnProperty.call(z,Z)&&(y[Z]=z[Z])})(V,l)};function Ce(V,l){function y(){this.constructor=V}be(V,l),V.prototype=l===null?Object.create(l):(y.prototype=l.prototype,new y)}function Te(V,l,y,z){return new(y||(y=Promise))(function(Z,G){function ve(ct){try{Oe(z.next(ct))}catch(Ge){G(Ge)}}function ze(ct){try{Oe(z.throw(ct))}catch(Ge){G(Ge)}}function Oe(ct){var Ge;ct.done?Z(ct.value):(Ge=ct.value,Ge instanceof y?Ge:new y(function(Ct){Ct(Ge)})).then(ve,ze)}Oe((z=z.apply(V,l||[])).next())})}function Ee(V,l){var y,z,Z,G,ve={label:0,sent:function(){if(1&Z[0])throw Z[1];return Z[1]},trys:[],ops:[]};return G={next:ze(0),throw:ze(1),return:ze(2)},typeof Symbol=="function"&&(G[Symbol.iterator]=function(){return this}),G;function ze(Oe){return function(ct){return function(Ge){if(y)throw new TypeError("Generator is already executing.");for(;ve;)try{if(y=1,z&&(Z=2&Ge[0]?z.return:Ge[0]?z.throw||((Z=z.return)&&Z.call(z),0):z.next)&&!(Z=Z.call(z,Ge[1])).done)return Z;switch(z=0,Z&&(Ge=[2&Ge[0],Z.value]),Ge[0]){case 0:case 1:Z=Ge;break;case 4:return ve.label++,{value:Ge[1],done:!1};case 5:ve.label++,z=Ge[1],Ge=[0];continue;case 7:Ge=ve.ops.pop(),ve.trys.pop();continue;default:if(!(Z=ve.trys,(Z=Z.length>0&&Z[Z.length-1])||Ge[0]!==6&&Ge[0]!==2)){ve=0;continue}if(Ge[0]===3&&(!Z||Ge[1]>Z[0]&&Ge[1]<Z[3])){ve.label=Ge[1];break}if(Ge[0]===6&&ve.label<Z[1]){ve.label=Z[1],Z=Ge;break}if(Z&&ve.label<Z[2]){ve.label=Z[2],ve.ops.push(Ge);break}Z[2]&&ve.ops.pop(),ve.trys.pop();continue}Ge=l.call(V,ve)}catch(Ct){Ge=[6,Ct],z=0}finally{y=Z=0}if(5&Ge[0])throw Ge[1];return{value:Ge[0]?Ge[1]:void 0,done:!0}}([Oe,ct])}}}function me(){for(var V=0,l=0,y=arguments.length;l<y;l++)V+=arguments[l].length;var z=Array(V),Z=0;for(l=0;l<y;l++)for(var G=arguments[l],ve=0,ze=G.length;ve<ze;ve++,Z++)z[Z]=G[ve];return z}var ue=function(){function V(){}return V.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},V.setAttributes=function(l,y){for(var z=0,Z=y;z<Z.length;z++){var G=Z[z],ve=G[0],ze=G[1];l.setAttribute(ve,ze)}},V.createRect=function(l,y,z){var Z=document.createElementNS("http://www.w3.org/2000/svg","rect");return Z.setAttribute("width",l.toString()),Z.setAttribute("height",y.toString()),z&&V.setAttributes(Z,z),Z},V.createLine=function(l,y,z,Z,G){var ve=document.createElementNS("http://www.w3.org/2000/svg","line");return ve.setAttribute("x1",l.toString()),ve.setAttribute("y1",y.toString()),ve.setAttribute("x2",z.toString()),ve.setAttribute("y2",Z.toString()),G&&V.setAttributes(ve,G),ve},V.createPolygon=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg","polygon");return z.setAttribute("points",l),y&&V.setAttributes(z,y),z},V.createCircle=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg","circle");return z.setAttribute("cx",(l/2).toString()),z.setAttribute("cy",(l/2).toString()),z.setAttribute("r",l.toString()),y&&V.setAttributes(z,y),z},V.createEllipse=function(l,y,z){var Z=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Z.setAttribute("cx",(l/2).toString()),Z.setAttribute("cy",(y/2).toString()),Z.setAttribute("rx",(l/2).toString()),Z.setAttribute("ry",(y/2).toString()),z&&V.setAttributes(Z,z),Z},V.createGroup=function(l){var y=document.createElementNS("http://www.w3.org/2000/svg","g");return l&&V.setAttributes(y,l),y},V.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},V.createMarker=function(l,y,z,Z,G,ve,ze){var Oe=document.createElementNS("http://www.w3.org/2000/svg","marker");return V.setAttributes(Oe,[["id",l],["orient",y],["markerWidth",z.toString()],["markerHeight",Z.toString()],["refX",G.toString()],["refY",ve.toString()]]),Oe.appendChild(ze),Oe},V.createText=function(l){var y=document.createElementNS("http://www.w3.org/2000/svg","text");return y.setAttribute("x","0"),y.setAttribute("y","0"),l&&V.setAttributes(y,l),y},V.createTSpan=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg","tspan");return z.textContent=l,y&&V.setAttributes(z,y),z},V.createImage=function(l){var y=document.createElementNS("http://www.w3.org/2000/svg","image");return l&&V.setAttributes(y,l),y},V.createPoint=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return z.x=l,z.y=y,z},V.createPath=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg","path");return z.setAttribute("d",l),y&&V.setAttributes(z,y),z},V}(),te=function(){function V(){}return V.addKey=function(l){V.key=l},Object.defineProperty(V,"isLicensed",{get:function(){return!!V.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(V.key)},enumerable:!1,configurable:!0}),V}(),ce=function(){function V(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return V.prototype.rasterize=function(l,y,z){var Z=this;return new Promise(function(G){var ve=z!==void 0?z:document.createElement("canvas");l===null&&(Z.markersOnly=!0,Z.naturalSize=!1);var ze=document.createElementNS("http://www.w3.org/2000/svg","svg");ze.setAttribute("xmlns","http://www.w3.org/2000/svg"),ze.setAttribute("width",y.width.baseVal.valueAsString),ze.setAttribute("height",y.height.baseVal.valueAsString),ze.setAttribute("viewBox","0 0 "+y.viewBox.baseVal.width.toString()+" "+y.viewBox.baseVal.height.toString()),ze.innerHTML=y.innerHTML,Z.naturalSize===!0?(ze.width.baseVal.value=l.naturalWidth,ze.height.baseVal.value=l.naturalHeight):Z.width!==void 0&&Z.height!==void 0&&(ze.width.baseVal.value=Z.width,ze.height.baseVal.value=Z.height),ve.width=ze.width.baseVal.value,ve.height=ze.height.baseVal.value;var Oe=ze.outerHTML,ct=ve.getContext("2d");Z.markersOnly!==!0&&ct.drawImage(l,0,0,ve.width,ve.height);var Ge=window.URL,Ct=new Image(ve.width,ve.height);Ct.setAttribute("crossOrigin","anonymous");var Mt=new Blob([Oe],{type:"image/svg+xml"}),Wt=Ge.createObjectURL(Mt);Ct.onload=function(){ct.drawImage(Ct,0,0),Ge.revokeObjectURL(Wt);var Fr=ve.toDataURL(Z.imageType,Z.imageQuality);G(Fr)},Ct.src=Wt})},V}(),se=function(){},we=function(){function V(l){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+l+"_"}return Object.defineProperty(V.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(V.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(V.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),V.prototype.addClass=function(l){return this.styleSheet===void 0&&this.addStyleSheet(),l.name=""+this.classNamePrefix+l.localName,this.classes.push(l),this.styleSheet.sheet.insertRule("."+l.name+" {"+l.style+"}",this.styleSheet.sheet.cssRules.length),l},V.prototype.addRule=function(l){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(l),this.styleSheet.sheet.insertRule(l.selector+" {"+l.style+"}",this.styleSheet.sheet.cssRules.length)},V.prototype.addStyleSheet=function(){var l;this.styleSheet=document.createElement("style"),((l=this.styleSheetRoot)!==null&&l!==void 0?l:document.head).appendChild(this.styleSheet),this.addRule(new Le("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Le("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new Le("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new xe("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new xe("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},V.prototype.removeStyleSheet=function(){var l;this.styleSheet&&(((l=this.styleSheetRoot)!==null&&l!==void 0?l:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},V}(),Le=function(V,l){this.selector=V,this.style=l},xe=function(V,l){this.localName=V,this.style=l},Pe=function(){function V(l,y,z,Z,G){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=l,this.displayMode=y,this.markerItems=z,this.uiStyleSettings=Z,this.styles=G,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return V.prototype.show=function(l){var y=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=l,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var z=document.createElement("div");z.className=this.toolbarBlockStyleClass.name,z.style.whiteSpace="nowrap",this.uiContainer.appendChild(z),this.addActionButton(z,'<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(z,'<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(z,'<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(z,'<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(z,'<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(z,'<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(z,'<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(z,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(G){var ve=document.createElement("div");ve.className=""+y.toolbarButtonStyleClass.name,ve.setAttribute("data-type-name",G.typeName),ve.innerHTML=G.icon,ve.addEventListener("click",function(){y.markerToolbarButtonClicked(ve,G)}),y.buttons.push(ve),y.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 Z=document.createElement("div");Z.className=this.toolbarBlockStyleClass.name,Z.style.whiteSpace="nowrap",Z.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(Z),this.addActionButton(Z,'<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(Z,'<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()},V.prototype.addButtonClickListener=function(l){this.buttonClickListeners.push(l)},V.prototype.removeButtonClickListener=function(l){this.buttonClickListeners.indexOf(l)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(l),1)},V.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},V.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var l=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var y=0;y<this.markerButtons.length;y++)y<l||y===l&&this.markerButtons.length-1===l?this.markerButtonBlock.appendChild(this.markerButtons[y]):(y===l&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[y]))}},V.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")},V.prototype.resetButtonStyles=function(){var l=this;this.buttons.forEach(function(y){y.className=y.className.replace(l.uiStyleSettings.toolbarButtonStyleColorsClassName?l.uiStyleSettings.toolbarButtonStyleColorsClassName:l.toolbarButtonStyleColorsClass.name,"").trim(),y.className=y.className.replace(l.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?l.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:l.toolbarActiveButtonStyleColorsClass.name,"").trim(),y.className+=" "+(l.uiStyleSettings.toolbarButtonStyleColorsClassName?l.uiStyleSettings.toolbarButtonStyleColorsClassName:l.toolbarButtonStyleColorsClass.name)})},V.prototype.addActionButton=function(l,y,z){var Z=this,G=document.createElement("div");switch(G.className=""+this.toolbarButtonStyleClass.name,G.innerHTML=y,G.setAttribute("data-action",z),G.addEventListener("click",function(){Z.actionToolbarButtonClicked(G,z)}),z){case"select":G.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":G.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":G.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":G.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":G.style.fill=this.uiStyleSettings.closeButtonColor}l.appendChild(G),this.buttons.push(G)},V.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new xe("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 xe("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new xe("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new xe("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 xe("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var l=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new xe("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*l)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*l)+`px;
padding: `+l+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new xe("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new xe("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Le("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new Le("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},V.prototype.markerToolbarButtonClicked=function(l,y){this.setActiveButton(l),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(z){return z("marker",y)}),this.markerButtonOverflowBlock.style.display="none"},V.prototype.actionToolbarButtonClicked=function(l,y){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(z){return z("action",y)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},V.prototype.setActiveButton=function(l){this.resetButtonStyles(),l.className=l.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),l.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},V.prototype.setActiveMarkerButton=function(l){var y=this.markerButtons.find(function(z){return z.getAttribute("data-type-name")===l});y&&this.setActiveButton(y)},V.prototype.setCurrentMarker=function(l){var y=this;this.currentMarker=l,this.buttons.filter(function(z){return/delete|notes/.test(z.getAttribute("data-action"))}).forEach(function(z){y.currentMarker===void 0?(z.style.fillOpacity="0.4",z.style.pointerEvents="none"):(z.style.fillOpacity="1",z.style.pointerEvents="all")})},V}(),Ne=function(){function V(l,y,z,Z){this.panels=[],this.panelButtons=[],this.markerjsContainer=l,this.displayMode=y,this.uiStyleSettings=z,this.styles=Z,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return V.prototype.addStyles=function(){var l;this.toolboxStyleClass=this.styles.addClass(new xe("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 xe("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var y=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new xe("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new xe("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new xe("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 xe("toolbox-panel-row_colors",`
background-color: `+((l=this.uiStyleSettings.toolboxBackgroundColor)!==null&&l!==void 0?l:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new xe("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*y)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*y)+`px;
padding: `+y+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new xe("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new xe("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new Le("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Le("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},V.prototype.show=function(l){var y;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=l,this.uiContainer.className=this.toolboxStyleClass.name+" "+((y=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&y!==void 0?y:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},V.prototype.setPanelButtons=function(l){var y,z,Z=this;this.panels=l,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((y=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&y!==void 0?y:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((z=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&z!==void 0?z:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(G){var ve;G.uiStyleSettings=Z.uiStyleSettings;var ze=document.createElement("div");ze.className=Z.toolboxButtonStyleClass.name+" "+((ve=Z.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ve!==void 0?ve:Z.toolboxButtonStyleColorsClass.name),ze.innerHTML=G.icon,ze.title=G.title,ze.addEventListener("click",function(){Z.panelButtonClick(G)}),Z.panelButtons.push(ze),Z.buttonRow.appendChild(ze)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},V.prototype.panelButtonClick=function(l){var y=this,z=-1;if(l!==this.activePanel){z=this.panels.indexOf(l),this.panelRow.innerHTML="";var Z=l.getUi();Z.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(Z),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=l}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){y.displayMode==="inline"?y.panelRow.style.display="none":y.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(G,ve){var ze,Oe;G.className=y.toolboxButtonStyleClass.name+" "+(ve===z?""+((ze=y.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&ze!==void 0?ze:y.toolboxActiveButtonStyleColorsClass.name):""+((Oe=y.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Oe!==void 0?Oe:y.toolboxButtonStyleColorsClass.name))})},V}(),Be=function(V,l){this.title=V,this.icon=l},We=function(V){function l(y,z,Z,G){var ve=V.call(this,y,G||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return ve.colors=[],ve.addTransparent=!1,ve.colorBoxes=[],ve.colors=z,ve.currentColor=Z,ve.setCurrentColor=ve.setCurrentColor.bind(ve),ve.getColorBox=ve.getColorBox.bind(ve),ve}return Ce(l,V),l.prototype.getUi=function(){var y=this,z=document.createElement("div");return z.style.overflow="hidden",z.style.whiteSpace="nowrap",this.colors.forEach(function(Z){var G=y.getColorBox(Z);z.appendChild(G),y.colorBoxes.push(G)}),z},l.prototype.getColorBox=function(y){var z=this,Z=this.uiStyleSettings.toolbarHeight/4,G=this.uiStyleSettings.toolbarHeight-Z,ve=document.createElement("div");ve.style.display="inline-block",ve.style.boxSizing="content-box",ve.style.width=G-2+"px",ve.style.height=G-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=(G+2)/2+"px",ve.style.borderColor=y===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ve.addEventListener("click",function(){z.setCurrentColor(y,ve)});var ze=document.createElement("div");return ze.style.display="inline-block",ze.style.width=G-2+"px",ze.style.height=G-2+"px",ze.style.backgroundColor=y,ze.style.borderRadius=G/2+"px",y==="transparent"&&(ze.style.fill=this.uiStyleSettings.toolboxAccentColor,ze.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(ze),ve},l.prototype.setCurrentColor=function(y,z){var Z=this;this.currentColor=y,this.colorBoxes.forEach(function(G){G.style.borderColor=G===z?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(y)},l}(Be),Ue=function(){function V(l,y,z){this._state="new",this._isSelected=!1,this._container=l,this._overlayContainer=y,this.globalSettings=z,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(V.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),V.prototype.ownsTarget=function(l){return!1},Object.defineProperty(V.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),V.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},V.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},V.prototype.pointerDown=function(l,y){},V.prototype.dblClick=function(l,y){},V.prototype.manipulate=function(l){},V.prototype.pointerUp=function(l){this.stateChanged()},V.prototype.dispose=function(){},V.prototype.addMarkerVisualToContainer=function(l){this.container.childNodes.length>0?this.container.insertBefore(l,this.container.childNodes[0]):this.container.appendChild(l)},V.prototype.getState=function(){return{typeName:V.typeName,state:this.state,notes:this.notes}},V.prototype.restoreState=function(l){this._state=l.state,this.notes=l.notes},V.prototype.scale=function(l,y){},V.prototype.colorChanged=function(l){this.onColorChanged&&this.onColorChanged(l),this.stateChanged()},V.prototype.fillColorChanged=function(l){this.onFillColorChanged&&this.onFillColorChanged(l),this.stateChanged()},V.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var l=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),l.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(l)&&this.onStateChanged(this)}},V.typeName="MarkerBase",V}(),Fe=function(){function V(){this.findGripByVisual=this.findGripByVisual.bind(this)}return V.prototype.findGripByVisual=function(l){return this.topLeft.ownsTarget(l)?this.topLeft:this.topCenter.ownsTarget(l)?this.topCenter:this.topRight.ownsTarget(l)?this.topRight:this.centerLeft.ownsTarget(l)?this.centerLeft:this.centerRight.ownsTarget(l)?this.centerRight:this.bottomLeft.ownsTarget(l)?this.bottomLeft:this.bottomCenter.ownsTarget(l)?this.bottomCenter:this.bottomRight.ownsTarget(l)?this.bottomRight:void 0},V}(),at=function(){function V(){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 V.prototype.ownsTarget=function(l){return l===this.visual||l===this.visual.childNodes[0]||l===this.visual.childNodes[1]},V}(),it=function(){function V(){}return V.toITransformMatrix=function(l){return{a:l.a,b:l.b,c:l.c,d:l.d,e:l.e,f:l.f}},V.toSVGMatrix=function(l,y){return l.a=y.a,l.b=y.b,l.c=y.c,l.d=y.d,l.e=y.e,l.f=y.f,l},V}(),et=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.left=0,G.top=0,G.width=0,G.height=0,G.defaultSize={x:50,y:20},G.offsetX=0,G.offsetY=0,G.rotationAngle=0,G.CB_DISTANCE=10,G._suppressMarkerCreateEvent=!1,G.container.transform.baseVal.appendItem(ue.createTransform()),G.setupControlBox(),G}return Ce(l,V),Object.defineProperty(l.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"visual",{get:function(){return this._visual},set:function(y){this._visual=y;var z=ue.createTransform();this._visual.transform.baseVal.appendItem(z)},enumerable:!1,configurable:!0}),l.prototype.ownsTarget=function(y){return!!V.prototype.ownsTarget.call(this,y)||!!(this.controlGrips.findGripByVisual(y)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(y))},l.prototype.pointerDown=function(y,z){V.prototype.pointerDown.call(this,y,z),this.state==="new"&&(this.left=y.x,this.top=y.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var Z=this.unrotatePoint(y);if(this.manipulationStartX=Z.x,this.manipulationStartY=Z.y,this.offsetX=Z.x-this.left,this.offsetY=Z.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(z),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(z)){this.activeGrip=this.rotatorGrip;var G=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=G.x-this.width/2,this.top=G.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var 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"},l.prototype.pointerUp=function(y){var z=this.state;V.prototype.pointerUp.call(this,y),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(y),this._state="select",z==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},l.prototype.moveVisual=function(y){this.visual.style.transform="translate("+y.x+"px, "+y.y+"px)"},l.prototype.manipulate=function(y){var z=this.unrotatePoint(y);this.state==="creating"?this.resize(y):this.state==="move"?(this.left=this.manipulationStartLeft+(z.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(z.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(z):this.state==="rotate"&&this.rotate(y)},l.prototype.resize=function(y){var z=this.manipulationStartLeft,Z=this.manipulationStartWidth,G=this.manipulationStartTop,ve=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:z=this.manipulationStartLeft+y.x-this.manipulationStartX,Z=this.manipulationStartWidth+this.manipulationStartLeft-z;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:Z=this.manipulationStartWidth+y.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:G=this.manipulationStartTop+y.y-this.manipulationStartY,ve=this.manipulationStartHeight+this.manipulationStartTop-G;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ve=this.manipulationStartHeight+y.y-this.manipulationStartY}Z>=0?(this.left=z,this.width=Z):(this.left=z+Z,this.width=-Z),ve>=0?(this.top=G,this.height=ve):(this.top=G+ve,this.height=-ve),this.setSize()},l.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},l.prototype.rotate=function(y){if(Math.abs(y.x-this.centerX)>.1){var z=Math.sign(y.x-this.centerX);this.rotationAngle=180*Math.atan((y.y-this.centerY)/(y.x-this.centerX))/Math.PI+90*z,this.applyRotation()}},l.prototype.applyRotation=function(){var y=this.container.transform.baseVal.getItem(0);y.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(y,0)},l.prototype.rotatePoint=function(y){if(this.rotationAngle===0)return y;var z=this.container.getCTM(),Z=ue.createPoint(y.x,y.y);return{x:(Z=Z.matrixTransform(z)).x,y:Z.y}},l.prototype.unrotatePoint=function(y){if(this.rotationAngle===0)return y;var z=this.container.getCTM();z=z.inverse();var Z=ue.createPoint(y.x,y.y);return{x:(Z=Z.matrixTransform(z)).x,y:Z.y}},l.prototype.select=function(){V.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},l.prototype.deselect=function(){V.prototype.deselect.call(this),this.controlBox.style.display="none"},l.prototype.setupControlBox=function(){this.controlBox=ue.createGroup();var y=ue.createTransform();y.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(y),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 Fe,this.addControlGrips(),this.controlBox.style.display="none"},l.prototype.adjustControlBox=function(){var y=this.controlBox.transform.baseVal.getItem(0);y.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(y,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()},l.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()},l.prototype.createGrip=function(){var y=new at;return y.visual.transform.baseVal.appendItem(ue.createTransform()),this.controlBox.appendChild(y.visual),y},l.prototype.positionGrips=function(){var y=this.controlGrips.topLeft.GRIP_SIZE,z=-y/2,Z=z,G=(this.width+this.CB_DISTANCE)/2-y/2,ve=(this.height+this.CB_DISTANCE)/2-y/2,ze=this.height+this.CB_DISTANCE-y/2,Oe=this.width+this.CB_DISTANCE-y/2;this.positionGrip(this.controlGrips.topLeft.visual,z,Z),this.positionGrip(this.controlGrips.topCenter.visual,G,Z),this.positionGrip(this.controlGrips.topRight.visual,Oe,Z),this.positionGrip(this.controlGrips.centerLeft.visual,z,ve),this.positionGrip(this.controlGrips.centerRight.visual,Oe,ve),this.positionGrip(this.controlGrips.bottomLeft.visual,z,ze),this.positionGrip(this.controlGrips.bottomCenter.visual,G,ze),this.positionGrip(this.controlGrips.bottomRight.visual,Oe,ze),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,G,Z-3*this.CB_DISTANCE)},l.prototype.positionGrip=function(y,z,Z){var G=y.transform.baseVal.getItem(0);G.setTranslate(z,Z),y.transform.baseVal.replaceItem(G,0)},l.prototype.hideControlBox=function(){this.controlBox.style.display="none"},l.prototype.showControlBox=function(){this.controlBox.style.display=""},l.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:it.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:it.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},V.prototype.getState.call(this))},l.prototype.restoreState=function(y){V.prototype.restoreState.call(this,y);var z=y;this.left=z.left,this.top=z.top,this.width=z.width,this.height=z.height,this.rotationAngle=z.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(it.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,z.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(it.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,z.containerTransformMatrix))},l.prototype.scale=function(y,z){V.prototype.scale.call(this,y,z);var Z=this.rotatePoint({x:this.left,y:this.top}),G=this.unrotatePoint({x:Z.x*y,y:Z.y*z});this.left=G.x,this.top=G.y,this.width=this.width*y,this.height=this.height*z,this.adjustControlBox()},l}(Ue),Ze=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.fillColor="transparent",G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.opacity=1,G.setStrokeColor=G.setStrokeColor.bind(G),G.setFillColor=G.setFillColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.createVisual=G.createVisual.bind(G),G}return Ce(l,V),l.prototype.ownsTarget=function(y){return!(!V.prototype.ownsTarget.call(this,y)&&y!==this.visual)},l.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)},l.prototype.pointerDown=function(y,z){V.prototype.pointerDown.call(this,y,z),this.state==="new"&&(this.createVisual(),this.moveVisual(y),this._state="creating")},l.prototype.manipulate=function(y){V.prototype.manipulate.call(this,y)},l.prototype.resize=function(y){V.prototype.resize.call(this,y),this.setSize()},l.prototype.setSize=function(){V.prototype.setSize.call(this),ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},l.prototype.pointerUp=function(y){V.prototype.pointerUp.call(this,y),this.setSize()},l.prototype.setStrokeColor=function(y){this.strokeColor=y,this.visual&&ue.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(y),this.stateChanged()},l.prototype.setFillColor=function(y){this.fillColor=y,this.visual&&ue.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},l.prototype.setStrokeWidth=function(y){this.strokeWidth=y,this.visual&&ue.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},l.prototype.setStrokeDasharray=function(y){this.strokeDasharray=y,this.visual&&ue.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},l.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},V.prototype.getState.call(this))},l.prototype.restoreState=function(y){var z=y;this.fillColor=z.fillColor,this.strokeColor=z.strokeColor,this.strokeWidth=z.strokeWidth,this.strokeDasharray=z.strokeDasharray,this.opacity=z.opacity,this.createVisual(),V.prototype.restoreState.call(this,y),this.setSize()},l.prototype.scale=function(y,z){V.prototype.scale.call(this,y,z),this.setSize()},l.title="Rectangle marker",l}(et),ut=function(V){function l(y,z,Z,G){var ve=V.call(this,y,G||'<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=z,ve.currentWidth=Z,ve.setCurrentWidth=ve.setCurrentWidth.bind(ve),ve}return Ce(l,V),l.prototype.getUi=function(){var y=this,z=document.createElement("div");return z.style.display="flex",z.style.overflow="hidden",z.style.flexGrow="2",this.widths.forEach(function(Z){var G=document.createElement("div");G.style.display="flex",G.style.flexGrow="2",G.style.alignItems="center",G.style.justifyContent="space-between",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.borderColor=Z===y.currentWidth?y.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){y.setCurrentWidth(Z,G)}),z.appendChild(G);var ve=document.createElement("div");ve.innerText=Z.toString(),ve.style.marginRight="5px",G.appendChild(ve);var ze=document.createElement("div");ze.style.minHeight="20px",ze.style.flexGrow="2",ze.style.display="flex",ze.style.alignItems="center";var Oe=document.createElement("hr");Oe.style.minWidth="20px",Oe.style.border="0px",Oe.style.borderTop=Z+"px solid "+y.uiStyleSettings.toolboxColor,Oe.style.flexGrow="2",ze.appendChild(Oe),G.appendChild(ze),y.widthBoxes.push(G)}),z},l.prototype.setCurrentWidth=function(y,z){var Z=this;this.currentWidth=y,this.widthBoxes.forEach(function(G){G.style.borderColor=G===z?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},l}(Be),Je=function(V){function l(y,z,Z,G){var ve=V.call(this,y,G||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return ve.styles=[],ve.styleBoxes=[],ve.styles=z,ve.currentStyle=Z,ve.setCurrentStyle=ve.setCurrentStyle.bind(ve),ve}return Ce(l,V),l.prototype.getUi=function(){var y=this,z=document.createElement("div");return z.style.display="flex",z.style.overflow="hidden",z.style.flexGrow="2",this.styles.forEach(function(Z){var G=document.createElement("div");G.style.display="flex",G.style.alignItems="center",G.style.justifyContent="space-between",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.overflow="hidden",G.style.maxWidth=100/y.styles.length-5+"%",G.style.borderColor=Z===y.currentStyle?y.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){y.setCurrentStyle(Z,G)}),z.appendChild(G);var ve=document.createElement("div");ve.style.minHeight="20px",ve.style.flexGrow="2",ve.style.overflow="hidden";var ze=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+y.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(Z!==""?'stroke-dasharray="'+Z+'"':"")+` />
</svg>`;ve.innerHTML=ze,G.appendChild(ve),y.styleBoxes.push(G)}),z},l.prototype.setCurrentStyle=function(y,z){var Z=this;this.currentStyle=y,this.styleBoxes.forEach(function(G){G.style.borderColor=G===z?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},l}(Be),st=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.strokeColor=Z.defaultColor,G.strokeWidth=Z.defaultStrokeWidth,G.strokeDasharray=Z.defaultStrokeDasharray,G.strokePanel=new We("Line color",Z.defaultColorSet,Z.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.strokeWidthPanel=new ut("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new Je("Line style",Z.defaultStrokeDasharrays,Z.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G}return Ce(l,V),Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=V.prototype.getState.call(this);return y.typeName=l.typeName,y},l.typeName="FrameMarker",l.title="Frame marker",l.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',l}(Ze),Re=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},nt=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.x1=0,G.y1=0,G.x2=0,G.y2=0,G.defaultLength=50,G.manipulationStartX=0,G.manipulationStartY=0,G.manipulationStartX1=0,G.manipulationStartY1=0,G.manipulationStartX2=0,G.manipulationStartY2=0,G.setupControlBox(),G}return Ce(l,V),l.prototype.ownsTarget=function(y){return!!V.prototype.ownsTarget.call(this,y)||!(!this.grip1.ownsTarget(y)&&!this.grip2.ownsTarget(y))},l.prototype.pointerDown=function(y,z){V.prototype.pointerDown.call(this,y,z),this.manipulationStartX=y.x,this.manipulationStartY=y.y,this.state==="new"&&(this.x1=y.x,this.y1=y.y,this.x2=y.x,this.y2=y.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(z)?this.activeGrip=this.grip1:this.grip2.ownsTarget(z)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},l.prototype.pointerUp=function(y){var z=this.state;V.prototype.pointerUp.call(this,y),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(y),this._state="select",z==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},l.prototype.adjustVisual=function(){},l.prototype.manipulate=function(y){this.state==="creating"?this.resize(y):this.state==="move"?(this.x1=this.manipulationStartX1+y.x-this.manipulationStartX,this.y1=this.manipulationStartY1+y.y-this.manipulationStartY,this.x2=this.manipulationStartX2+y.x-this.manipulationStartX,this.y2=this.manipulationStartY2+y.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(y)},l.prototype.resize=function(y){switch(this.activeGrip){case this.grip1:this.x1=y.x,this.y1=y.y;break;case this.grip2:case void 0:this.x2=y.x,this.y2=y.y}this.adjustVisual(),this.adjustControlBox()},l.prototype.select=function(){V.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},l.prototype.deselect=function(){V.prototype.deselect.call(this),this.controlBox.style.display="none"},l.prototype.setupControlBox=function(){this.controlBox=ue.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},l.prototype.adjustControlBox=function(){this.positionGrips()},l.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},l.prototype.createGrip=function(){var y=new at;return y.visual.transform.baseVal.appendItem(ue.createTransform()),this.controlBox.appendChild(y.visual),y},l.prototype.positionGrips=function(){var y=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-y/2,this.y1-y/2),this.positionGrip(this.grip2.visual,this.x2-y/2,this.y2-y/2)},l.prototype.positionGrip=function(y,z,Z){var G=y.transform.baseVal.getItem(0);G.setTranslate(z,Z),y.transform.baseVal.replaceItem(G,0)},l.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},V.prototype.getState.call(this))},l.prototype.restoreState=function(y){V.prototype.restoreState.call(this,y);var z=y;this.x1=z.x1,this.y1=z.y1,this.x2=z.x2,this.y2=z.y2},l.prototype.scale=function(y,z){V.prototype.scale.call(this,y,z),this.x1=this.x1*y,this.y1=this.y1*z,this.x2=this.x2*y,this.y2=this.y2*z,this.adjustVisual(),this.adjustControlBox()},l}(Ue),qe=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.setStrokeColor=G.setStrokeColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.strokeColor=Z.defaultColor,G.strokeWidth=Z.defaultStrokeWidth,G.strokeDasharray=Z.defaultStrokeDasharray,G.strokePanel=new We("Line color",Z.defaultColorSet,Z.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.strokeWidthPanel=new ut("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new Je("Line style",Z.defaultStrokeDasharrays,Z.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G}return Ce(l,V),l.prototype.ownsTarget=function(y){return!(!V.prototype.ownsTarget.call(this,y)&&y!==this.visual&&y!==this.selectorLine&&y!==this.visibleLine)},l.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)},l.prototype.pointerDown=function(y,z){V.prototype.pointerDown.call(this,y,z),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},l.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()]]))},l.prototype.setStrokeColor=function(y){this.strokeColor=y,this.adjustVisual(),this.colorChanged(y)},l.prototype.setStrokeWidth=function(y){this.strokeWidth=y,this.adjustVisual()},l.prototype.setStrokeDasharray=function(y){this.strokeDasharray=y,this.adjustVisual(),this.stateChanged()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},V.prototype.getState.call(this));return y.typeName=l.typeName,y},l.prototype.restoreState=function(y){V.prototype.restoreState.call(this,y);var z=y;this.strokeColor=z.strokeColor,this.strokeWidth=z.strokeWidth,this.strokeDasharray=z.strokeDasharray,this.createVisual(),this.adjustVisual()},l.typeName="LineMarker",l.title="Line marker",l.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',l}(nt),Ie=function(V){function l(y,z,Z,G){var ve=V.call(this,y,G||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return ve.fonts=[],ve.fontBoxes=[],ve.fonts=z,ve.currentFont=Z,ve.setCurrentFont=ve.setCurrentFont.bind(ve),ve}return Ce(l,V),l.prototype.getUi=function(){var y=this,z=document.createElement("div");return z.style.overflow="hidden",z.style.flexGrow="2",this.fonts.forEach(function(Z){var G=document.createElement("div");G.style.display="inline-block",G.style.alignItems="center",G.style.justifyContent="space-between",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.overflow="hidden",G.style.maxWidth=100/y.fonts.length-5+"%",G.style.borderColor=Z===y.currentFont?y.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){y.setCurrentFont(Z,G)}),z.appendChild(G);var ve=document.createElement("div");ve.style.display="flex",ve.style.minHeight="20px",ve.style.flexGrow="2",ve.style.fontFamily=Z,ve.style.overflow="hidden";var ze=document.createElement("div");ze.style.whiteSpace="nowrap",ze.style.overflow="hidden",ze.style.textOverflow="ellipsis",ze.innerHTML="The quick brown fox jumps over the lazy dog",ve.appendChild(ze),G.appendChild(ve),y.fontBoxes.push(G)}),z},l.prototype.setCurrentFont=function(y,z){var Z=this;this.currentFont=y,this.fontBoxes.forEach(function(G){G.style.borderColor=G===z?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},l}(Be),He=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.color="transparent",G.padding=5,G.DEFAULT_TEXT="your text here",G.text=G.DEFAULT_TEXT,G.isMoved=!1,G.color=Z.defaultColor,G.fontFamily=Z.defaultFontFamily,G.defaultSize={x:100,y:30},G.setColor=G.setColor.bind(G),G.setFont=G.setFont.bind(G),G.renderText=G.renderText.bind(G),G.sizeText=G.sizeText.bind(G),G.textEditDivClicked=G.textEditDivClicked.bind(G),G.showTextEditor=G.showTextEditor.bind(G),G.setSize=G.setSize.bind(G),G.positionTextEditor=G.positionTextEditor.bind(G),G.colorPanel=new We("Color",Z.defaultColorSet,Z.defaultColor),G.colorPanel.onColorChanged=G.setColor,G.fontFamilyPanel=new Ie("Font",Z.defaultFontFamilies,Z.defaultFontFamily),G.fontFamilyPanel.onFontChanged=G.setFont,G}return Ce(l,V),l.prototype.ownsTarget=function(y){if(V.prototype.ownsTarget.call(this,y)||y===this.visual||y===this.textElement||y===this.bgRectangle)return!0;var z=!1;return this.textElement.childNodes.forEach(function(Z){Z===y&&(z=!0)}),z},l.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()},l.prototype.pointerDown=function(y,z){V.prototype.pointerDown.call(this,y,z),this.isMoved=!1,this.pointerDownPoint=y,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(y),this._state="creating")},l.prototype.renderText=function(){var y=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(z){y.textElement.appendChild(ue.createTSpan(z.trim()===""?" ":z.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},l.prototype.getTextScale=function(){var y=this.textElement.getBBox(),z=1;if(y.width>0&&y.height>0){var Z=(1*this.width-this.width*this.padding*2/100)/y.width,G=(1*this.height-this.height*this.padding*2/100)/y.height;z=Math.min(Z,G)}return z},l.prototype.getTextPosition=function(y){var z=this.textElement.getBBox(),Z=0,G=0;return z.width>0&&z.height>0&&(Z=(this.width-z.width*y)/2,G=this.height/2-z.height*y/2),{x:Z,y:G}},l.prototype.sizeText=function(){var y=this.textElement.getBBox(),z=this.getTextScale(),Z=this.getTextPosition(z);Z.y-=y.y*z,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+Z.x+"px, "+Z.y+"px) scale("+z+", "+z+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(Z.x,Z.y),this.textElement.transform.baseVal.getItem(1).setScale(z,z))},l.prototype.manipulate=function(y){V.prototype.manipulate.call(this,y),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(y.x-this.pointerDownPoint.x)>5||Math.abs(y.y-this.pointerDownPoint.y)>5)},l.prototype.resize=function(y){V.prototype.resize.call(this,y),this.isMoved=!0,this.setSize(),this.sizeText()},l.prototype.setSize=function(){V.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()]]))},l.prototype.pointerUp=function(y){var z=this.state;z==="creating"&&(this._suppressMarkerCreateEvent=!0),V.prototype.pointerUp.call(this,y),this.setSize(),(z==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},l.prototype.showTextEditor=function(){var y=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(z){z.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var z=Number.parseFloat(y.textEditor.style.fontSize);y.textEditor.clientWidth>=Number.parseInt(y.textEditor.style.maxWidth)&&z>.9;)z-=.1,y.textEditor.style.fontSize=Math.max(z,.9)+"em"}),this.textEditor.addEventListener("keyup",function(z){z.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(z){if(z.clipboardData){var Z=z.clipboardData.getData("text"),G=window.getSelection();if(!G.rangeCount)return!1;G.deleteFromDocument(),G.getRangeAt(0).insertNode(document.createTextNode(Z)),z.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){y.textEditDivClicked(y.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},l.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var y=this.getTextScale(),z=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),Z=this.textElement.getBBox(),G={x:Z.width*y,y:Z.height*y};z.x-=G.x/2,z.y-=G.y/2,this.textEditor.style.top=z.y+"px",this.textEditor.style.left=z.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-z.x+"px",this.textEditor.style.fontSize=Math.max(16*y,12)+"px",this.textElement.style.display="none"}},l.prototype.textEditDivClicked=function(y){this.text=y.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},l.prototype.select=function(){V.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},l.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),V.prototype.deselect.call(this)},l.prototype.dblClick=function(y,z){V.prototype.dblClick.call(this,y,z),this.showTextEditor()},l.prototype.setColor=function(y){this.textElement&&ue.setAttributes(this.textElement,[["fill",y]]),this.color=y,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(y)},l.prototype.setFont=function(y){this.textElement&&ue.setAttributes(this.textElement,[["font-family",y]]),this.fontFamily=y,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},l.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},l.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},V.prototype.getState.call(this));return y.typeName=l.typeName,y},l.prototype.restoreState=function(y){var z=y;this.color=z.color,this.fontFamily=z.fontFamily,this.padding=z.padding,this.text=z.text,this.createVisual(),V.prototype.restoreState.call(this,y),this.setSize()},l.prototype.scale=function(y,z){V.prototype.scale.call(this,y,z),this.setSize(),this.sizeText(),this.positionTextEditor()},l.typeName="TextMarker",l.title="Text marker",l.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>',l}(et),Se=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.color="transparent",G.lineWidth=3,G.drawing=!1,G.pixelRatio=1,G.color=Z.defaultColor,G.lineWidth=Z.defaultStrokeWidth,G.pixelRatio=Z.freehandPixelRatio,G.setColor=G.setColor.bind(G),G.addCanvas=G.addCanvas.bind(G),G.finishCreation=G.finishCreation.bind(G),G.setLineWidth=G.setLineWidth.bind(G),G.colorPanel=new We("Color",Z.defaultColorSet,Z.defaultColor),G.colorPanel.onColorChanged=G.setColor,G.lineWidthPanel=new ut("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),G.lineWidthPanel.onWidthChanged=G.setLineWidth,G}return Ce(l,V),l.prototype.ownsTarget=function(y){return!(!V.prototype.ownsTarget.call(this,y)&&y!==this.visual&&y!==this.drawingImage)},l.prototype.createVisual=function(){this.visual=ue.createGroup(),this.drawingImage=ue.createImage(),this.visual.appendChild(this.drawingImage);var y=ue.createTransform();this.visual.transform.baseVal.appendItem(y),this.addMarkerVisualToContainer(this.visual)},l.prototype.pointerDown=function(y,z){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(y.x,y.y),this.drawing=!0):V.prototype.pointerDown.call(this,y,z)},l.prototype.manipulate=function(y){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(y.x,y.y),this.canvasContext.stroke()):V.prototype.manipulate.call(this,y)},l.prototype.resize=function(y){V.prototype.resize.call(this,y),ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),ue.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},l.prototype.pointerUp=function(y){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):V.prototype.pointerUp.call(this,y)},l.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)},l.prototype.select=function(){this.state==="creating"&&this.finishCreation(),V.prototype.select.call(this)},l.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),V.prototype.deselect.call(this)},l.prototype.finishCreation=function(){for(var y=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),z=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],Z=z[0],G=z[1],ve=z[2],ze=z[3],Oe=!1,ct=0;ct<this.canvasElement.height;ct++)for(var Ge=0;Ge<this.canvasElement.width;Ge++)y.data[ct*this.canvasElement.width*4+4*Ge+3]>0&&(Oe=!0,ct<G&&(G=ct),Ge<Z&&(Z=Ge),ct>ze&&(ze=ct),Ge>ve&&(ve=Ge));if(Oe){this.left=Z/this.pixelRatio,this.top=G/this.pixelRatio,this.width=(ve-Z)/this.pixelRatio,this.height=(ze-G)/this.pixelRatio;var Ct=document.createElement("canvas");Ct.width=ve-Z,Ct.height=ze-G,Ct.getContext("2d").putImageData(this.canvasContext.getImageData(Z,G,ve-Z,ze-G),0,0),this.drawingImgUrl=Ct.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},l.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})},l.prototype.setColor=function(y){this.color=y,this.colorChanged(y)},l.prototype.setLineWidth=function(y){this.lineWidth=y},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=Object.assign({drawingImgUrl:this.drawingImgUrl},V.prototype.getState.call(this));return y.typeName=l.typeName,y},l.prototype.restoreState=function(y){this.createVisual(),V.prototype.restoreState.call(this,y),this.drawingImgUrl=y.drawingImgUrl,this.setDrawingImage()},l.prototype.scale=function(y,z){V.prototype.scale.call(this,y,z),this.setDrawingImage()},l.typeName="FreehandMarker",l.title="Freehand marker",l.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>',l}(et),pe=function(V){function l(y,z,Z){var G=V.call(this,y,Z||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return G.typeBoxes=[],G.currentType=z,G.setCurrentType=G.setCurrentType.bind(G),G}return Ce(l,V),l.prototype.getUi=function(){var y=this,z=document.createElement("div");z.style.display="flex",z.style.overflow="hidden",z.style.flexGrow="2";for(var Z=function(ze){var Oe="both";switch(ze){case 0:Oe="both";break;case 1:Oe="start";break;case 2:Oe="end";break;case 3:Oe="none"}var ct=document.createElement("div");if(ct.style.display="flex",ct.style.flexGrow="2",ct.style.alignItems="center",ct.style.justifyContent="space-between",ct.style.padding="5px",ct.style.borderWidth="2px",ct.style.borderStyle="solid",ct.style.borderColor=Oe===G.currentType?G.uiStyleSettings.toolboxAccentColor:"transparent",ct.addEventListener("click",function(){y.setCurrentType(Oe,ct)}),z.appendChild(ct),Oe==="both"||Oe==="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="`+(G.uiStyleSettings!==void 0?G.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Ge.style.marginLeft="5px",ct.appendChild(Ge)}var Ct=document.createElement("div");Ct.style.display="flex",Ct.style.alignItems="center",Ct.style.minHeight="20px",Ct.style.flexGrow="2";var Mt=document.createElement("hr");if(Mt.style.minWidth="20px",Mt.style.border="0px",Mt.style.borderTop="3px solid "+(G.uiStyleSettings!==void 0?G.uiStyleSettings.toolboxColor:"#eeeeee"),Mt.style.flexGrow="2",Ct.appendChild(Mt),ct.appendChild(Ct),Oe==="both"||Oe==="end"){var Wt=document.createElement("div");Wt.style.display="flex",Wt.style.alignItems="center",Wt.style.minHeight="20px",Wt.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,0 10,5 0,10" fill="`+(G.uiStyleSettings!==void 0?G.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Wt.style.marginRight="5px",ct.appendChild(Wt)}G.typeBoxes.push(ct)},G=this,ve=0;ve<4;ve++)Z(ve);return z},l.prototype.setCurrentType=function(y,z){var Z=this;this.currentType=y,this.typeBoxes.forEach(function(G){G.style.borderColor=G===z?Z.uiStyleSettings!==void 0?Z.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},l}(Be),ye=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.arrowType="end",G.arrowBaseHeight=10,G.arrowBaseWidth=10,G.getArrowPoints=G.getArrowPoints.bind(G),G.setArrowType=G.setArrowType.bind(G),G.arrowTypePanel=new pe("Arrow type","end"),G.arrowTypePanel.onArrowTypeChanged=G.setArrowType,G}return Ce(l,V),l.prototype.ownsTarget=function(y){return!(!V.prototype.ownsTarget.call(this,y)&&y!==this.arrow1&&y!==this.arrow2)},l.prototype.getArrowPoints=function(y,z){var Z=this.arrowBaseWidth+2*this.strokeWidth,G=this.arrowBaseHeight+2*this.strokeWidth;return y-Z/2+","+(z+G/2)+" "+y+","+(z-G/2)+" "+(y+Z/2)+","+(z+G/2)},l.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)},l.prototype.pointerDown=function(y,z){V.prototype.pointerDown.call(this,y,z),this.state==="creating"&&this.createTips()},l.prototype.adjustVisual=function(){if(V.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 y=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),z=this.arrow1.transform.baseVal.getItem(0);z.setRotate(y,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(z,0);var Z=this.arrow2.transform.baseVal.getItem(0);Z.setRotate(y+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(Z,0)}},l.prototype.setArrowType=function(y){this.arrowType=y,this.adjustVisual(),this.stateChanged()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=Object.assign({arrowType:this.arrowType},V.prototype.getState.call(this));return y.typeName=l.typeName,y},l.prototype.restoreState=function(y){V.prototype.restoreState.call(this,y);var z=y;this.arrowType=z.arrowType,this.createTips(),this.adjustVisual()},l.typeName="ArrowMarker",l.title="Arrow marker",l.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',l}(qe),re=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.fillColor=Z.defaultFillColor,G.strokeWidth=0,G.fillPanel=new We("Color",Z.defaultColorSet,Z.defaultFillColor),G.fillPanel.onColorChanged=G.setFillColor,G}return Ce(l,V),Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=V.prototype.getState.call(this);return y.typeName=l.typeName,y},l.typeName="CoverMarker",l.title="Cover marker",l.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',l}(Ze),oe=function(V){function l(y,z,Z,G){var ve=V.call(this,y,G||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return ve.opacities=[],ve.opacityBoxes=[],ve.opacities=z,ve.currentOpacity=Z,ve.setCurrentOpacity=ve.setCurrentOpacity.bind(ve),ve}return Ce(l,V),l.prototype.getUi=function(){var y=this,z=document.createElement("div");return z.style.display="flex",z.style.overflow="hidden",z.style.flexGrow="2",z.style.justifyContent="space-between",this.opacities.forEach(function(Z){var G=document.createElement("div");G.style.display="flex",G.style.alignItems="center",G.style.justifyContent="center",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.borderColor=Z===y.currentOpacity?y.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){y.setCurrentOpacity(Z,G)}),z.appendChild(G);var ve=document.createElement("div");ve.innerText=100*Z+"%",G.appendChild(ve),y.opacityBoxes.push(G)}),z},l.prototype.setCurrentOpacity=function(y,z){var Z=this;this.currentOpacity=y,this.opacityBoxes.forEach(function(G){G.style.borderColor=G===z?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},l}(Be),le=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.setOpacity=G.setOpacity.bind(G),G.fillColor=Z.defaultHighlightColor,G.strokeWidth=0,G.opacity=Z.defaultHighlightOpacity,G.fillPanel=new We("Color",Z.defaultColorSet,G.fillColor),G.fillPanel.onColorChanged=G.setFillColor,G.opacityPanel=new oe("Opacity",Z.defaultOpacitySteps,G.opacity),G.opacityPanel.onOpacityChanged=G.setOpacity,G}return Ce(l,V),l.prototype.setOpacity=function(y){this.opacity=y,this.visual&&ue.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=V.prototype.getState.call(this);return y.typeName=l.typeName,y},l.typeName="HighlightMarker",l.title="Highlight marker",l.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>',l}(re),de='<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>',De=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.bgColor="transparent",G.tipPosition={x:0,y:0},G.tipBase1Position={x:0,y:0},G.tipBase2Position={x:0,y:0},G.tipMoving=!1,G.color=Z.defaultStrokeColor,G.bgColor=Z.defaultFillColor,G.fontFamily=Z.defaultFontFamily,G.defaultSize={x:100,y:30},G.setBgColor=G.setBgColor.bind(G),G.getTipPoints=G.getTipPoints.bind(G),G.positionTip=G.positionTip.bind(G),G.setTipPoints=G.setTipPoints.bind(G),G.colorPanel=new We("Text color",Z.defaultColorSet,G.color,'<svg viewBox="0 0 24 24"><path d="M9.62 12L12 5.67 14.37 12M11 3L5.5 17h2.25l1.12-3h6.25l1.13 3h2.25L13 3h-2z"/></svg>'),G.colorPanel.onColorChanged=G.setColor,G.bgColorPanel=new We("Fill color",Z.defaultColorSet,G.bgColor,de),G.bgColorPanel.onColorChanged=G.setBgColor,G.fontFamilyPanel=new Ie("Font",Z.defaultFontFamilies,Z.defaultFontFamily),G.fontFamilyPanel.onFontChanged=G.setFont,G.tipGrip=new at,G.tipGrip.visual.transform.baseVal.appendItem(ue.createTransform()),G.controlBox.appendChild(G.tipGrip.visual),G}return Ce(l,V),l.prototype.ownsTarget=function(y){return V.prototype.ownsTarget.call(this,y)||this.tipGrip.ownsTarget(y)||this.tip===y},l.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)},l.prototype.pointerDown=function(y,z){this.state==="new"&&V.prototype.pointerDown.call(this,y,z),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(z)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):V.prototype.pointerDown.call(this,y,z)},l.prototype.pointerUp=function(y){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,V.prototype.pointerUp.call(this,y);else{var z=this.state==="creating";V.prototype.pointerUp.call(this,y),this.setTipPoints(z),this.positionTip()}},l.prototype.manipulate=function(y){if(this.tipMoving){var z=this.unrotatePoint(y);this.tipPosition={x:z.x-this.manipulationStartLeft,y:z.y-this.manipulationStartTop},this.positionTip()}else V.prototype.manipulate.call(this,y)},l.prototype.setBgColor=function(y){this.bgRectangle&&this.tip&&(ue.setAttributes(this.bgRectangle,[["fill",y]]),ue.setAttributes(this.tip,[["fill",y]])),this.bgColor=y,this.fillColorChanged(y)},l.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},l.prototype.setTipPoints=function(y){y===void 0&&(y=!1);var z=Math.min(this.height/2,15),Z=this.height/5;y&&(this.tipPosition={x:z+Z/2,y:this.height+20});var G=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?G<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(Z=this.width/5,z=Math.min(this.width/2,15),this.tipBase1Position={x:z,y:0},this.tipBase2Position={x:z+Z,y:0}):(this.tipBase1Position={x:0,y:z},this.tipBase2Position={x:0,y:z+Z}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?G<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(Z=this.width/5,z=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-z-Z,y:0},this.tipBase2Position={x:this.width-z,y:0}):(this.tipBase1Position={x:this.width,y:z},this.tipBase2Position={x:this.width,y:z+Z}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?G<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(Z=this.width/5,z=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-z-Z,y:this.height},this.tipBase2Position={x:this.width-z,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-z-Z},this.tipBase2Position={x:this.width,y:this.height-z}):G<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(Z=this.width/5,z=Math.min(this.width/2,15),this.tipBase1Position={x:z,y:this.height},this.tipBase2Position={x:z+Z,y:this.height}):(this.tipBase1Position={x:0,y:this.height-z},this.tipBase2Position={x:0,y:this.height-z-Z})},l.prototype.resize=function(y){V.prototype.resize.call(this,y),this.positionTip()},l.prototype.positionTip=function(){ue.setAttributes(this.tip,[["points",this.getTipPoints()]]);var y=this.tipGrip.visual.transform.baseVal.getItem(0);y.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(y,0)},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),l.prototype.select=function(){this.positionTip(),V.prototype.select.call(this)},l.prototype.getState=function(){var y=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},V.prototype.getState.call(this));return y.typeName=l.typeName,y},l.prototype.restoreState=function(y){var z=y;this.bgColor=z.bgColor,this.tipPosition=z.tipPosition,V.prototype.restoreState.call(this,y),this.createTip(),this.setTipPoints()},l.prototype.scale=function(y,z){V.prototype.scale.call(this,y,z),this.tipPosition={x:this.tipPosition.x*y,y:this.tipPosition.y*z},this.positionTip()},l.typeName="CalloutMarker",l.title="Callout marker",l.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>',l}(He),Me=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.fillColor="transparent",G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.opacity=1,G.strokeColor=Z.defaultColor,G.strokeWidth=Z.defaultStrokeWidth,G.strokeDasharray=Z.defaultStrokeDasharray,G.fillColor=Z.defaultFillColor,G.setStrokeColor=G.setStrokeColor.bind(G),G.setFillColor=G.setFillColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.setOpacity=G.setOpacity.bind(G),G.createVisual=G.createVisual.bind(G),G.strokePanel=new We("Line color",me(Z.defaultColorSet,["transparent"]),Z.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.fillPanel=new We("Fill color",me(Z.defaultColorSet,["transparent"]),G.fillColor,de),G.fillPanel.onColorChanged=G.setFillColor,G.strokeWidthPanel=new ut("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new Je("Line style",Z.defaultStrokeDasharrays,Z.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G.opacityPanel=new oe("Opacity",Z.defaultOpacitySteps,G.opacity),G.opacityPanel.onOpacityChanged=G.setOpacity,G}return Ce(l,V),l.prototype.ownsTarget=function(y){return!(!V.prototype.ownsTarget.call(this,y)&&y!==this.visual)},l.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)},l.prototype.pointerDown=function(y,z){V.prototype.pointerDown.call(this,y,z),this.state==="new"&&(this.createVisual(),this.moveVisual(y),this._state="creating")},l.prototype.manipulate=function(y){V.prototype.manipulate.call(this,y)},l.prototype.resize=function(y){V.prototype.resize.call(this,y),this.setSize()},l.prototype.setSize=function(){V.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()]])},l.prototype.pointerUp=function(y){V.prototype.pointerUp.call(this,y),this.setSize()},l.prototype.setStrokeColor=function(y){this.strokeColor=y,this.visual&&ue.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(y),this.stateChanged()},l.prototype.setFillColor=function(y){this.fillColor=y,this.visual&&ue.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(y),this.stateChanged()},l.prototype.setStrokeWidth=function(y){this.strokeWidth=y,this.visual&&ue.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},l.prototype.setStrokeDasharray=function(y){this.strokeDasharray=y,this.visual&&ue.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},l.prototype.setOpacity=function(y){this.opacity=y,this.visual&&ue.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},V.prototype.getState.call(this));return y.typeName=l.typeName,y},l.prototype.restoreState=function(y){var z=y;this.fillColor=z.fillColor,this.strokeColor=z.strokeColor,this.strokeWidth=z.strokeWidth,this.strokeDasharray=z.strokeDasharray,this.opacity=z.opacity,this.createVisual(),V.prototype.restoreState.call(this,y),this.setSize()},l.prototype.scale=function(y,z){V.prototype.scale.call(this,y,z),this.setSize()},l.typeName="EllipseMarker",l.title="Ellipse marker",l.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>',l}(et),Ye=function(V){function l(y,z,Z){return V.call(this,y,z,Z)||this}return Ce(l,V),Object.defineProperty(l.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),l.prototype.ownsTarget=function(y){return!(!V.prototype.ownsTarget.call(this,y)&&y!==this.tip1&&y!==this.tip2)},l.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)},l.prototype.pointerDown=function(y,z){V.prototype.pointerDown.call(this,y,z),this.state==="creating"&&this.createTips()},l.prototype.adjustVisual=function(){if(V.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 y=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),z=this.tip1.transform.baseVal.getItem(0);z.setRotate(y,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(z,0);var Z=this.tip2.transform.baseVal.getItem(0);Z.setRotate(y+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(Z,0)}},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=V.prototype.getState.call(this);return y.typeName=l.typeName,y},l.prototype.restoreState=function(y){V.prototype.restoreState.call(this,y),this.createTips(),this.adjustVisual()},l.typeName="MeasurementMarker",l.title="Measurement marker",l.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>',l}(qe),yt=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.strokePanel.colors=Z.defaultColorSet,G.fillColor="transparent",G}return Ce(l,V),Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=V.prototype.getState.call(this);return y.typeName=l.typeName,y},l.typeName="EllipseFrameMarker",l.title="Ellipse frame marker",l.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>',l}(Me),At=function(){function V(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(V.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),V.prototype.addUndoStep=function(l){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(l)||(this.undoStack.push(l),JSON.stringify(this.lastRedoStep)!==JSON.stringify(l)&&this.redoStack.splice(0,this.redoStack.length))},V.prototype.replaceLastUndoStep=function(l){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=l)},V.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},V.prototype.undo=function(){if(this.undoStack.length>1){var l=this.undoStack.pop();return l!==void 0&&this.redoStack.push(l),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},V.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},V}(),Ke=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.curveX=0,G.curveY=0,G.manipulationStartCurveX=0,G.manipulationStartCurveY=0,G.setStrokeColor=G.setStrokeColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.positionGrips=G.positionGrips.bind(G),G.addControlGrips=G.addControlGrips.bind(G),G.adjustVisual=G.adjustVisual.bind(G),G.setupControlBox=G.setupControlBox.bind(G),G.resize=G.resize.bind(G),G.strokeColor=Z.defaultColor,G.strokeWidth=Z.defaultStrokeWidth,G.strokeDasharray=Z.defaultStrokeDasharray,G.strokePanel=new We("Line color",Z.defaultColorSet,Z.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.strokeWidthPanel=new ut("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new Je("Line style",Z.defaultStrokeDasharrays,Z.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G}return Ce(l,V),l.prototype.ownsTarget=function(y){return!(!V.prototype.ownsTarget.call(this,y)&&y!==this.visual&&y!==this.selectorCurve&&y!==this.visibleCurve&&!this.curveGrip.ownsTarget(y))},l.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},l.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)},l.prototype.pointerDown=function(y,z){V.prototype.pointerDown.call(this,y,z),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=y.x,this.curveY=y.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(z)&&(this.activeGrip=this.curveGrip,this._state="resize")},l.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()]]))},l.prototype.setupControlBox=function(){V.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)},l.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,V.prototype.addControlGrips.call(this)},l.prototype.positionGrips=function(){V.prototype.positionGrips.call(this);var y=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-y/2,this.curveY-y/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()))},l.prototype.manipulate=function(y){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+y.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+y.y-this.manipulationStartY),V.prototype.manipulate.call(this,y)},l.prototype.resize=function(y){this.activeGrip===this.curveGrip&&(this.curveX=y.x,this.curveY=y.y),V.prototype.resize.call(this,y),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},l.prototype.setStrokeColor=function(y){this.strokeColor=y,this.adjustVisual(),this.colorChanged(y)},l.prototype.setStrokeWidth=function(y){this.strokeWidth=y,this.adjustVisual()},l.prototype.setStrokeDasharray=function(y){this.strokeDasharray=y,this.adjustVisual()},l.prototype.scale=function(y,z){this.curveX=this.curveX*y,this.curveY=this.curveY*z,V.prototype.scale.call(this,y,z)},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},V.prototype.getState.call(this));return y.typeName=l.typeName,y},l.prototype.restoreState=function(y){V.prototype.restoreState.call(this,y);var z=y;this.strokeColor=z.strokeColor,this.strokeWidth=z.strokeWidth,this.strokeDasharray=z.strokeDasharray,this.curveX=z.curveX,this.curveY=z.curveY,this.createVisual(),this.adjustVisual()},l.typeName="CurveMarker",l.title="Curve marker",l.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>',l}(nt),xt=function(){function V(l,y){y===void 0&&(y=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=l,this.cancelable=y}return Object.defineProperty(V.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),V.prototype.preventDefault=function(){this._defaultPrevented=!0},V}(),mt=function(V){function l(y,z,Z){var G=V.call(this,y,!1)||this;return G.dataUrl=z,G.state=Z,G}return Ce(l,V),l}(xt),ot=function(V){function l(y,z,Z){Z===void 0&&(Z=!1);var G=V.call(this,y,Z)||this;return G.marker=z,G}return Ce(l,V),l}(xt),Rt=function(){function V(){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 V.prototype.addEventListener=function(l,y){this[l].push(y)},V.prototype.removeEventListener=function(l,y){var z=this[l].indexOf(y);z>-1&&this[l].splice(z,1)},V}(),Lt=function(){function V(l){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Re,this._isOpen=!1,this.undoRedoManager=new At,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 Rt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=V.instanceCounter++,this.styles=new we(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=l,this.targetRoot=document.body,this.width=l.clientWidth,this.height=l.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(V.prototype,"ALL_MARKER_TYPES",{get:function(){return[st,Se,ye,He,yt,Me,le,De,Ye,re,qe,Ke]},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[st,Se,ye,He,Me,le,De]},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"BASIC_MARKER_TYPES",{get:function(){return[st,Se,ye,He,le]},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(l){var y=this;this._availableMarkerTypes.splice(0),l.forEach(function(z){if(typeof z=="string"){var Z=y.ALL_MARKER_TYPES.find(function(G){return G.typeName===z});Z!==void 0&&y._availableMarkerTypes.push(Z)}else y._availableMarkerTypes.push(z)})},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(l){this._zoomLevel=l,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(V.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),V.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},V.prototype.show=function(){var l=this;this.styles.styleSheetRoot===void 0&&se.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=se.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(y){return y(new xt(l))})},V.prototype.render=function(){return Te(this,void 0,void 0,function(){var l;return Ee(this,function(y){switch(y.label){case 0:return this.setCurrentMarker(),(l=new ce).naturalSize=this.renderAtNaturalSize,l.imageType=this.renderImageType,l.imageQuality=this.renderImageQuality,l.markersOnly=this.renderMarkersOnly,l.width=this.renderWidth,l.height=this.renderHeight,[4,l.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return y.sent(),[4,l.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,y.sent()]}})})},V.prototype.close=function(l){var y=this;if(l===void 0&&(l=!1),this.isOpen){var z=!1;l||this.eventListeners.beforeclose.forEach(function(Z){var G=new xt(y,!0);Z(G),G.defaultPrevented&&(z=!0)}),z||(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(Z){return Z(new xt(y))}),this.detachEvents(),this._isOpen=!1)}},V.prototype.addMarkersToToolbar=function(){for(var l,y=[],z=0;z<arguments.length;z++)y[z]=arguments[z];(l=this._availableMarkerTypes).push.apply(l,y)},V.prototype.addRenderEventListener=function(l){this.addEventListener("render",function(y){l(y.dataUrl,y.state)})},V.prototype.removeRenderEventListener=function(l){},V.prototype.addCloseEventListener=function(l){this.addEventListener("close",function(){l()})},V.prototype.removeCloseEventListener=function(l){},V.prototype.setupResizeObserver=function(){var l=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){l.resize(l.target.clientWidth,l.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return l.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},V.prototype.onPopupTargetResize=function(){var l=1*this.target.clientWidth/this.target.clientHeight,y=this.editorCanvas.clientWidth/l>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*l:this.editorCanvas.clientWidth,z=y<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/l;this.resize(y,z)},V.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},V.prototype.resize=function(l,y){this._isResizing=!0;var z=l/this.imageWidth,Z=y/this.imageHeight;this.imageWidth=Math.round(l),this.imageHeight=Math.round(y),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(z,Z),this._isResizing=!1},V.prototype.scaleMarkers=function(l,y){var z,Z=this;this._currentMarker&&this._currentMarker instanceof He?this._currentMarker.scale(l,y):(z=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(G){G!==Z._currentMarker&&G.scale(l,y)}),z!==void 0&&this.setCurrentMarker(z)},V.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"},V.prototype.setTopLeft=function(){var l=this.editingTarget.getBoundingClientRect(),y=this.editorCanvas.getBoundingClientRect();this.left=l.left-y.left,this.top=l.top-y.top},V.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)},V.prototype.addDefs=function(){for(var l,y=[],z=0;z<arguments.length;z++)y[z]=arguments[z];this.defs=ue.createDefs(),this.addDefsToImage(),(l=this.defs).append.apply(l,y)},V.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},V.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)},V.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},V.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},V.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)},V.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},V.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)},V.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 l=document.createElement("a");l.href="https://markerjs.com/",l.target="_blank",l.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>',l.title="Powered by marker.js",l.style.display="grid",l.style.alignItems="center",l.style.justifyItems="center",l.style.padding="3px",l.style.width="20px",l.style.height="20px",this.logoUI.appendChild(l),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},V.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")},V.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"},V.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},V.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 l=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=l+"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 Pe(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 Ne(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},V.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},V.prototype.removeMarker=function(l){this.markerImage.removeChild(l.container),this.markers.indexOf(l)>-1&&this.markers.splice(this.markers.indexOf(l),1),l.dispose()},V.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())},V.prototype.toolbarButtonClicked=function(l,y){if(l==="marker"&&y!==void 0)this.createNewMarker(y);else if(l==="action")switch(y){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()}},V.prototype.deleteSelectedMarker=function(){var l=this;if(this._currentMarker!==void 0){var y=!1;if(this.eventListeners.markerbeforedelete.forEach(function(Z){var G=new ot(l,l._currentMarker,!0);Z(G),G.defaultPrevented&&(y=!0)}),!y){var z=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(Z){return Z(new ot(l,z))})}}},V.prototype.clear=function(){var l=this,y=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ve){var ze=new ot(l,void 0,!0);ve(ze),ze.defaultPrevented&&(y=!0)}),!y)){this.setCurrentMarker();for(var z=function(ve){var ze=Z.markers[ve];Z.setCurrentMarker(Z.markers[ve]),Z._currentMarker.dispose(),Z.markerImage.removeChild(Z._currentMarker.container),Z.markers.splice(Z.markers.indexOf(Z._currentMarker),1),Z.eventListeners.markerdelete.forEach(function(Oe){return Oe(new ot(l,ze))})},Z=this,G=this.markers.length-1;G>=0;G--)z(G);this.addUndoStep()}},Object.defineProperty(V.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),V.prototype.showNotesEditor=function(){var l;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=(l=this._currentMarker.notes)!==null&&l!==void 0?l:"",this.overlayContainer.appendChild(this.notesArea))},V.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)},V.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},V.prototype.addUndoStep=function(){var l=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var y=this.getState(),z=this.undoRedoManager.getLastUndoStep();if(!z||z.width===y.width&&z.height===y.height){var Z=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(y),Z<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(G){return G(new xt(l))})}else this.undoRedoManager.replaceLastUndoStep(y),this.eventListeners.statechange.forEach(function(G){return G(new xt(l))})}},V.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},V.prototype.undoStep=function(){var l=this,y=this.undoRedoManager.undo();y!==void 0&&(this.restoreState(y),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(z){return z(new xt(l))}))},V.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},V.prototype.redoStep=function(){var l=this,y=this.undoRedoManager.redo();y!==void 0&&(this.restoreState(y),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(z){return z(new xt(l))}))},V.prototype.stepZoom=function(){var l=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=l<this.zoomSteps.length-1?this.zoomSteps[l+1]:this.zoomSteps[0]},V.prototype.panTo=function(l){this.contentDiv.scrollBy({left:this.prevPanPoint.x-l.x,top:this.prevPanPoint.y-l.y}),this.prevPanPoint=l},V.prototype.startRenderAndClose=function(){return Te(this,void 0,void 0,function(){var l,y,z=this;return Ee(this,function(Z){switch(Z.label){case 0:return[4,this.render()];case 1:return l=Z.sent(),y=this.getState(),this.eventListeners.render.forEach(function(G){return G(new mt(z,l,y))}),this.close(!0),[2]}})})},V.prototype.getState=function(l){l===!0&&this.setCurrentMarker();var y={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(z){return y.markers.push(z.getState())}),y},V.prototype.restoreState=function(l){var y=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);l.markers.forEach(function(z){var Z=y._availableMarkerTypes.find(function(ve){return ve.typeName===z.typeName});if(Z!==void 0){var G=y.addNewMarker(Z);G.restoreState(z),y.markers.push(G)}}),l.width&&l.height&&(l.width!==this.imageWidth||l.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/l.width,this.imageHeight/l.height),this.eventListeners.restorestate.forEach(function(z){return z(new xt(y))})},V.prototype.addNewMarker=function(l){var y=ue.createGroup();return this.markerImage.appendChild(y),new l(y,this.overlayContainer,this.settings)},V.prototype.createNewMarker=function(l){var y,z=this;(y=typeof l=="string"?this._availableMarkerTypes.find(function(Z){return Z.typeName===l}):l)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(y),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(y.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(Z){return Z(new ot(z,z._currentMarker))}))},V.prototype.markerCreated=function(l){var y=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(l),this.setCurrentMarker(l),l instanceof Se&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(Se):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(z){return z(new ot(y,y._currentMarker))})},V.prototype.colorChanged=function(l){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=l,this.settings.defaultStrokeColor=l)},V.prototype.fillColorChanged=function(l){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=l)},V.prototype.markerStateChanged=function(l){var y=this;this.eventListeners.markerchange.forEach(function(z){return z(new ot(y,l))})},V.prototype.setCurrentMarker=function(l){var y=this;this._currentMarker!==l&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(z){return z(new ot(y,y._currentMarker))})),this._currentMarker=l,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(z){return z(new ot(y,y._currentMarker))}))},V.prototype.onPointerDown=function(l){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||l.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var y=this.markers.find(function(z){return z.ownsTarget(l.target)});y!==void 0?(this.setCurrentMarker(y),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(l.clientX,l.clientY),l.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:l.clientX,y:l.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(l.clientX,l.clientY))},V.prototype.onDblClick=function(l){if(this._isFocused||this.focus(),this.mode==="select"){var y=this.markers.find(function(z){return z.ownsTarget(l.target)});y!==void 0&&y!==this._currentMarker&&this.setCurrentMarker(y),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(l.clientX,l.clientY),l.target):this.setCurrentMarker()}},V.prototype.onPointerMove=function(l){this.touchPoints!==1&&l.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||l.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(l.clientX,l.clientY)):this.zoomLevel>1&&this.panTo({x:l.clientX,y:l.clientY}))},V.prototype.onPointerUp=function(l){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(l.clientX,l.clientY)),this.isDragging=!1,this.addUndoStep()},V.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},V.prototype.onKeyUp=function(l){this._currentMarker===void 0||this.notesArea!==void 0||l.key!=="Delete"&&l.key!=="Backspace"||this.deleteSelectedMarker()},V.prototype.clientToLocalCoordinates=function(l,y){var z=this.markerImage.getBoundingClientRect();return{x:(l-z.left)/this.zoomLevel,y:(y-z.top)/this.zoomLevel}},V.prototype.onWindowResize=function(){this.positionUI()},V.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var l=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=l+"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()},V.prototype.addLicenseKey=function(l){te.addKey(l)},V.prototype.addEventListener=function(l,y){this.eventListeners.addEventListener(l,y)},V.prototype.removeEventListener=function(l,y){this.eventListeners.removeEventListener(l,y)},V.prototype.renderState=function(l){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(l),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(V.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),V.prototype.focus=function(){var l=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(y){return y(new xt(l))}))},V.prototype.blur=function(){var l=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(y){return y(new xt(l))}))},V.instanceCounter=0,V}();/* **********************************
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(V,l){return(Kt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,z){y.__proto__=z}||function(y,z){for(var Z in z)Object.prototype.hasOwnProperty.call(z,Z)&&(y[Z]=z[Z])})(V,l)};function Bt(V,l){if(typeof l!="function"&&l!==null)throw new TypeError("Class extends value "+String(l)+" is not a constructor or null");function y(){this.constructor=V}Kt(V,l),V.prototype=l===null?Object.create(l):(y.prototype=l.prototype,new y)}function wt(V,l,y,z){return new(y||(y=Promise))(function(Z,G){function ve(ct){try{Oe(z.next(ct))}catch(Ge){G(Ge)}}function ze(ct){try{Oe(z.throw(ct))}catch(Ge){G(Ge)}}function Oe(ct){var Ge;ct.done?Z(ct.value):(Ge=ct.value,Ge instanceof y?Ge:new y(function(Ct){Ct(Ge)})).then(ve,ze)}Oe((z=z.apply(V,l||[])).next())})}function yr(V,l){var y,z,Z,G,ve={label:0,sent:function(){if(1&Z[0])throw Z[1];return Z[1]},trys:[],ops:[]};return G={next:ze(0),throw:ze(1),return:ze(2)},typeof Symbol=="function"&&(G[Symbol.iterator]=function(){return this}),G;function ze(Oe){return function(ct){return function(Ge){if(y)throw new TypeError("Generator is already executing.");for(;ve;)try{if(y=1,z&&(Z=2&Ge[0]?z.return:Ge[0]?z.throw||((Z=z.return)&&Z.call(z),0):z.next)&&!(Z=Z.call(z,Ge[1])).done)return Z;switch(z=0,Z&&(Ge=[2&Ge[0],Z.value]),Ge[0]){case 0:case 1:Z=Ge;break;case 4:return ve.label++,{value:Ge[1],done:!1};case 5:ve.label++,z=Ge[1],Ge=[0];continue;case 7:Ge=ve.ops.pop(),ve.trys.pop();continue;default:if(!(Z=ve.trys,(Z=Z.length>0&&Z[Z.length-1])||Ge[0]!==6&&Ge[0]!==2)){ve=0;continue}if(Ge[0]===3&&(!Z||Ge[1]>Z[0]&&Ge[1]<Z[3])){ve.label=Ge[1];break}if(Ge[0]===6&&ve.label<Z[1]){ve.label=Z[1],Z=Ge;break}if(Z&&ve.label<Z[2]){ve.label=Z[2],ve.ops.push(Ge);break}Z[2]&&ve.ops.pop(),ve.trys.pop();continue}Ge=l.call(V,ve)}catch(Ct){Ge=[6,Ct],z=0}finally{y=Z=0}if(5&Ge[0])throw Ge[1];return{value:Ge[0]?Ge[1]:void 0,done:!0}}([Oe,ct])}}}var ir=function(){function V(){}return V.addKey=function(l){V.key=l},Object.defineProperty(V,"isLicensed",{get:function(){return!!V.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(V.key)},enumerable:!1,configurable:!0}),V}(),gt=function(){function V(){}return V.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},V.setAttributes=function(l,y){for(var z=0,Z=y;z<Z.length;z++){var G=Z[z],ve=G[0],ze=G[1];l.setAttribute(ve,ze)}},V.createRect=function(l,y,z){var Z=document.createElementNS("http://www.w3.org/2000/svg","rect");return Z.setAttribute("width",l.toString()),Z.setAttribute("height",y.toString()),z&&V.setAttributes(Z,z),Z},V.createLine=function(l,y,z,Z,G){var ve=document.createElementNS("http://www.w3.org/2000/svg","line");return ve.setAttribute("x1",l.toString()),ve.setAttribute("y1",y.toString()),ve.setAttribute("x2",z.toString()),ve.setAttribute("y2",Z.toString()),G&&V.setAttributes(ve,G),ve},V.createPolygon=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg","polygon");return z.setAttribute("points",l),y&&V.setAttributes(z,y),z},V.createCircle=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg","circle");return z.setAttribute("cx",(l/2).toString()),z.setAttribute("cy",(l/2).toString()),z.setAttribute("r",l.toString()),y&&V.setAttributes(z,y),z},V.createEllipse=function(l,y,z){var Z=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Z.setAttribute("cx",(l/2).toString()),Z.setAttribute("cy",(y/2).toString()),Z.setAttribute("rx",(l/2).toString()),Z.setAttribute("ry",(y/2).toString()),z&&V.setAttributes(Z,z),Z},V.createGroup=function(l){var y=document.createElementNS("http://www.w3.org/2000/svg","g");return l&&V.setAttributes(y,l),y},V.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},V.createMarker=function(l,y,z,Z,G,ve,ze){var Oe=document.createElementNS("http://www.w3.org/2000/svg","marker");return V.setAttributes(Oe,[["id",l],["orient",y],["markerWidth",z.toString()],["markerHeight",Z.toString()],["refX",G.toString()],["refY",ve.toString()]]),Oe.appendChild(ze),Oe},V.createText=function(l){var y=document.createElementNS("http://www.w3.org/2000/svg","text");return y.setAttribute("x","0"),y.setAttribute("y","0"),l&&V.setAttributes(y,l),y},V.createTSpan=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg","tspan");return z.textContent=l,y&&V.setAttributes(z,y),z},V.createImage=function(l){var y=document.createElementNS("http://www.w3.org/2000/svg","image");return l&&V.setAttributes(y,l),y},V.createPoint=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return z.x=l,z.y=y,z},V.createPath=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg","path");return z.setAttribute("d",l),y&&V.setAttributes(z,y),z},V.createElement=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg",l);return y&&V.setAttributes(z,y),z},V.getHollowRectanglePath=function(l,y,z,Z,G,ve,ze,Oe){return"M"+l+","+y+"V"+(y+Z)+"H"+(l+z)+"V"+y+"H"+G+"V"+ve+"H"+(G+ze)+"V"+(ve+Oe)+"H"+G+"V"+y+"Z"},V}(),Gr=function(){function V(l){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+l+"_"}return Object.defineProperty(V.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(V.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(V.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),V.prototype.addClass=function(l){return this.styleSheet===void 0&&this.addStyleSheet(),l.name=""+this.classNamePrefix+l.localName,this.classes.push(l),this.styleSheet.sheet.insertRule("."+l.name+" {"+l.style+"}",this.styleSheet.sheet.cssRules.length),l},V.prototype.addRule=function(l){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(l),this.styleSheet.sheet.insertRule(l.selector+" {"+l.style+"}",this.styleSheet.sheet.cssRules.length)},V.prototype.addStyleSheet=function(){var l;this.styleSheet=document.createElement("style"),((l=this.styleSheetRoot)!==null&&l!==void 0?l:document.head).appendChild(this.styleSheet),this.addRule(new br("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new br("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new br("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new fr("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new fr("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},V.prototype.removeStyleSheet=function(){var l;this.styleSheet&&(((l=this.styleSheetRoot)!==null&&l!==void 0?l:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},V}(),br=function(V,l){this.selector=V,this.style=l},fr=function(V,l){this.localName=V,this.style=l},Tr=function(){function V(){this.blocks=[],this.display=""}return V.prototype.addButtonBlock=function(l){l.className=this.blockClassName,l.buttonClassName=this.buttonClassName,l.buttonColorsClassName=this.buttonColorsClassName,l.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(l)},V.prototype.addElementBlock=function(l){l.className===void 0&&(l.className=this.blockClassName),this.blocks.push(l)},V.prototype.getUI=function(){var l=document.createElement("div");return l.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,l.style.display=this.display,this.blocks.forEach(function(y){return l.appendChild(y.getUI())}),l},V}(),si=function(){function V(){}return V.prototype.getUI=function(){var l=document.createElement("div");if(l.className=this.className,this.minWidth!==void 0&&(l.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":l.style.justifyContent="flex-start";break;case"center":l.style.justifyContent="center";break;case"end":l.style.justifyContent="flex-end"}return l.style.whiteSpace="nowrap",l},V}(),Kr=function(V){function l(){var y=V!==null&&V.apply(this,arguments)||this;return y.buttons=[],y}return Bt(l,V),l.prototype.addButton=function(y){y.className=this.buttonClassName,y.colorsClassName=this.buttonColorsClassName,y.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(y)},l.prototype.getUI=function(){var y=V.prototype.getUI.call(this);return this.buttons.forEach(function(z){return y.appendChild(z.getUI())}),y},l}(si),It=function(){function V(l,y){this._isActive=!1,this._isHidden=!1,this._icon=l,this.title=y,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(V.prototype,"icon",{get:function(){return this._icon},set:function(l){this._icon=l,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isActive",{get:function(){return this._isActive},set:function(l){this._isActive=l,this.adjustClassName()},enumerable:!1,configurable:!0}),V.prototype.getUI=function(){var l=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 l.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},V.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,"")))},V.prototype.hide=function(){this._isHidden=!0},V}(),ft=function(V){function l(){var y=V!==null&&V.apply(this,arguments)||this;return y.elements=[],y}return Bt(l,V),l.prototype.addElement=function(y){this.elements.push(y)},l.prototype.getUI=function(){var y=V.prototype.getUI.call(this);return this.elements.forEach(function(z){return y.appendChild(z)}),y},l}(si),Ur=function(){function V(l,y){this.horizontal=l,this.vertical=y}return Object.defineProperty(V.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),V.prototype.getVerticalLength=function(l){return l/this.ratio},V.prototype.getHorizontalLength=function(l){return l*this.ratio},V}(),li=function(){function V(){}return V.getIcon=function(l,y){if(l>0&&y>0){var z=new Ur(l,y),Z=z.ratio>=1?20:z.getHorizontalLength(20),G=z.ratio<1?20:z.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 ze=gt.createDefs();ve.appendChild(ze);var Oe=gt.createElement("clipPath",[["id","text-bg-clip"]]);ze.appendChild(Oe);var ct=gt.createPath(gt.getHollowRectanglePath((24-Z)/2,(24-G)/2,Z,G,(24-Z)/2+2,(24-G)/2+2,Z-4,G-4));ve.appendChild(ct);var Ge=gt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ge.appendChild(gt.createTSpan(l+":"+y)),ve.appendChild(Ge);var Ct=Ge.getBBox();gt.setAttributes(Ge,[["x",((24-Ct.width)/2).toString()],["y",((24-Ct.height)/2-Ct.y).toString()]]);var Mt=gt.createPath(gt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Ct.width))/2,(24-Math.ceil(Ct.height))/2,Math.ceil(Ct.width),Math.ceil(Ct.height)));return Oe.appendChild(Mt),gt.setAttributes(ct,[["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>'},V}(),wr=function(V){function l(y,z,Z){var G=V.call(this,y,z)||this;return G.isDropdownOpen=!1,G.onClick=G.dropdownButtonClicked,G.dropdownButtons=Z,G}return Bt(l,V),l.prototype.setupDropdown=function(){var y=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(z){z.className=y.className,z.colorsClassName=y.colorsClassName,y.dropdownBlock.appendChild(z.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},l.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},l.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},l.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},l.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},l.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},l}(It),Ot=function(){function V(l,y){this.GRIP_SIZE=10,this.color=l,this.fillColor=y,this.visual=gt.createGroup(),this.visual.appendChild(gt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(gt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return V.prototype.ownsTarget=function(l){return l===this.visual||l===this.visual.childNodes[0]||l===this.visual.childNodes[1]},V.prototype.setCenter=function(l,y){this.visual.childNodes.forEach(function(z){return gt.setAttributes(z,[["cx",l.toString()],["cy",y.toString()]])})},V}(),Vr=function(){function V(l,y,z,Z){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=l,this.canvasHeight=y,this.margin=z,this.container=Z,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(V.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(l){this._aspectRatio=l,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(l){this._isGridVisible=l,this.gridContainer&&gt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(l){this._zoomFactor=l,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),V.prototype.open=function(){var l=this;this.cropShadeElement=gt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=gt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var y=0;y<this.numberOfGridLines;y++)this.horizontalGridLines.push(gt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(gt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(z){return l.gridContainer.appendChild(z)}),this.verticalGridLines.forEach(function(z){return l.gridContainer.appendChild(z)}),this.cropRectElement=gt.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},V.prototype.setCropRectangle=function(l){this.cropRect=l;var y=Object.assign({},this.cropRect);this.zoomFactor!==1&&(y.width=this.cropRect.width*this.zoomFactor,y.height=this.cropRect.height*this.zoomFactor,y.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-y.width/2,y.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-y.height/2),gt.setAttributes(this.cropRectElement,[["x",y.x.toString()],["y",y.y.toString()],["width",y.width.toString()],["height",y.height.toString()]]);var z=y.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(G,ve){var ze=y.y+z*(ve+1);gt.setAttributes(G,[["x1",""+y.x],["y1",""+ze],["x2",""+(y.x+y.width)],["y2",""+ze]])});var Z=y.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(G,ve){var ze=y.x+Z*(ve+1);gt.setAttributes(G,[["x1",""+ze],["y1",""+y.y],["x2",""+ze],["y2",""+(y.y+y.height)]])}),gt.setAttributes(this.cropShadeElement,[["d",gt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,y.x,y.y,y.width,y.height)]]),this.topLeftGrip.setCenter(y.x,y.y),this.topRightGrip.setCenter(y.x+y.width,y.y),this.bottomLeftGrip.setCenter(y.x,y.y+y.height),this.bottomRightGrip.setCenter(y.x+y.width,y.y+y.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},V.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)},V.prototype.clientToLocalCoordinates=function(l,y){var z=this.container.getBoundingClientRect();return{x:l-z.left+this.margin,y:y-z.top+this.margin}},V.prototype.onPointerDown=function(l){this.container.setPointerCapture(l.pointerId),this.previousPoint=this.clientToLocalCoordinates(l.clientX,l.clientY),this.cropRectElement===l.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(l.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(l.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(l.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(l.target)&&(this.activeGrip=this.bottomRightGrip)},V.prototype.onPointerMove=function(l){if(this.isMoving)this.move(this.clientToLocalCoordinates(l.clientX,l.clientY));else if(this.activeGrip){var y=this.clientToLocalCoordinates(l.clientX,l.clientY);this.resize(y)}l.preventDefault()},V.prototype.onPointerUp=function(l){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(l.pointerId)},V.prototype.move=function(l){var y=l.x-this.previousPoint.x,z=l.y-this.previousPoint.y;this.zoomFactor!==1&&(y=-y/this.zoomFactor,z=-z/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+y),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+z),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=l},V.prototype.resize=function(l){var y=Object.assign({},this.cropRect),z=l.x-this.previousPoint.x,Z=l.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:y.x+z<this.margin&&(z=this.margin-y.x),y.x+=z,y.width=this.cropRect.x+this.cropRect.width-y.x;break;case this.bottomRightGrip:case this.topRightGrip:y.width+z>this.canvasWidth*this.zoomFactor&&(z=this.canvasWidth*this.zoomFactor-y.width),y.width+=z}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(y.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(z),y.height=this.aspectRatio.getVerticalLength(y.width)):(y.y+=Z,y.height=this.cropRect.y+this.cropRect.height-y.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?y.height=this.aspectRatio.getVerticalLength(y.width):y.height+=Z}y.width<10&&(y.x=this.cropRect.x,y.width=10),y.height<10&&(y.y=this.cropRect.y,y.height=10),this.previousPoint=l,y.x>=this.margin&&y.y>=this.margin&&y.x-this.margin+y.width<=this.canvasWidth&&y.y-this.margin+y.height<=this.canvasHeight&&(this.cropRect=y,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},V.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var l=this.cropRect.x+this.cropRect.width/2,y=this.cropRect.y+this.cropRect.height/2,z=this.aspectRatio.getHorizontalLength(this.cropRect.height),Z=this.aspectRatio.getVerticalLength(this.cropRect.width);z/this.canvasWidth<Z/this.canvasHeight?this.cropRect.width=z:this.cropRect.height=Z,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=l-this.cropRect.width/2,this.cropRect.y=y-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)}},V.prototype.getRescaledRect=function(l,y,z,Z,G,ve){var ze=z/l,Oe=Z/y;return{x:(G.x-ve)*ze+ve,y:(G.y-ve)*Oe+ve,width:G.width*ze,height:G.height*Oe}},V.prototype.scaleCanvas=function(l,y){var z=this.getRescaledRect(this.canvasWidth,this.canvasHeight,l,y,this.cropRect,this.margin);this.canvasWidth=l,this.canvasHeight=y,this.onCropChange&&this.onCropChange(z),this.setCropRectangle(z)},V}(),ui=function(){function V(l){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=l,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(V.prototype,"angle",{get:function(){return this._angle},set:function(l){this._angle=l,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),V.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},V.prototype.onPointerDown=function(l){this.controlContainer.setPointerCapture(l.pointerId),this.isDragging=!0,this.previousPoint={x:l.clientX,y:l.clientY}},V.prototype.onPointerMove=function(l){this.isDragging&&(this.onAngleChange&&this.onAngleChange((l.clientX-this.previousPoint.x)/5),this.previousPoint.x=l.clientX)},V.prototype.onPointerUp=function(l){this.isDragging&&this.onAngleChange&&this.onAngleChange((l.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(l.pointerId)},V.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var l=this.angleLabelText.getBBox();gt.setAttributes(this.angleLabelElement,[["x",((this.width-l.width)/2).toString()],["y",(this.height/2).toString()]])}},V.prototype.positionScaleShape=function(){if(this.scaleShape){var l=this.scaleShape.transform.baseVal.getItem(0);l.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(l,0)}},V.prototype.getVisual=function(){var l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.setAttribute("xmlns","http://www.w3.org/2000/svg"),l.setAttribute("width",this.width+"px"),l.setAttribute("height",this.height+"px"),l.setAttribute("viewBox","0 0 "+this.width+" "+this.height),l.style.flexShrink="0",document.body.appendChild(l);for(var y="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,z=1;z<=this.width/5+10;z++){var Z=z%5==0?this.height/3:this.height/6;y+="h4v"+-Z+"h1v"+Z}y+="v1H0Z",this.scaleShape=gt.createPath(y);var G=gt.createTransform();this.scaleShape.transform.baseVal.appendItem(G),l.appendChild(this.scaleShape),this.angleLabelElement=gt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=gt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ve=gt.createTSpan("");return ve.innerHTML="&deg;",this.angleLabelElement.appendChild(ve),l.appendChild(this.angleLabelElement),document.body.removeChild(l),l},V}(),gi=function(){function V(){this.naturalSize=!1,this.imageType="image/png"}return V.prototype.rasterize=function(l,y,z,Z,G,ve,ze){var Oe=this;return new Promise(function(ct){var Ge=document.createElement("canvas");Ge.width=l.width.baseVal.value-2*Z,Ge.height=l.height.baseVal.value-2*Z;var Ct=1,Mt=1;Oe.naturalSize===!0?(Ct=y.naturalWidth/(l.width.baseVal.value-2*Z)/ve,Mt=y.naturalHeight/(l.height.baseVal.value-2*Z)/ze,Ge.width=y.naturalWidth/ve,Ge.height=y.naturalHeight/ze):Oe.width!==void 0&&Oe.height!==void 0&&(Ct=Oe.width/z.width,Mt=Oe.height/z.height,Ge.width*=Ct,Ge.height*=Mt);var Wt=Ge.getContext("2d");Wt.translate(Ge.width/2,Ge.height/2),Wt.rotate(G*Math.PI/180),Wt.scale(ve,ze),Wt.translate(-Ge.width/2,-Ge.height/2),Wt.drawImage(y,0,0,Ge.width,Ge.height);var Fr=document.createElement("canvas");Fr.width=z.width*Ct,Fr.height=z.height*Mt,Fr.getContext("2d").putImageData(Wt.getImageData((z.x-Z)*Ct,(z.y-Z)*Mt,z.width*Ct,z.height*Mt),0,0),ct(Fr.toDataURL(Oe.imageType,Oe.imageQuality))})},V}(),Xe=function(){function V(l){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=V.instanceCounter++,this.styles=new Gr(this.instanceNo),this.target=l,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(V.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(l){this._zoomToCropEnabled=l,l?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(l){this._isGridVisible=l,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"gridLines",{get:function(){return this._gridLines},set:function(l){this._gridLines=l,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(l){this._rotationAngle=l,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"aspectRatio",{get:function(){var l;return(l=this._aspectRatio)!==null&&l!==void 0?l:this.aspectRatios[0]},set:function(l){this._aspectRatio=l},enumerable:!1,configurable:!0}),V.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},V.prototype.show=function(){this.showUI(),this.open()},V.prototype.close=function(l){l===void 0&&(l=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),l||this.closeEventListeners.forEach(function(y){return y()}),this._isOpen=!1)},V.prototype.addRenderEventListener=function(l){this.renderEventListeners.push(l)},V.prototype.removeRenderEventListener=function(l){this.renderEventListeners.indexOf(l)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(l),1)},V.prototype.addCloseEventListener=function(l){this.closeEventListeners.push(l)},V.prototype.removeCloseEventListener=function(l){this.closeEventListeners.indexOf(l)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(l),1)},V.prototype.setupResizeObserver=function(){var l=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){l.resize(l.target.clientWidth,l.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))},V.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var l=1*this.target.clientWidth/this.target.clientHeight,y=this.contentDiv.clientWidth/l>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*l:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,z=y+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/l;this.resize(y,z)}},V.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},V.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",gt.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},V.prototype.resize=function(l,y){this.imageWidth=Math.round(l),this.imageHeight=Math.round(y),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()},V.prototype.setEditingTarget=function(){var l=document.createElement("canvas");l.width=this.target.naturalWidth,l.height=this.target.naturalHeight,l.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var y=l.toDataURL();gt.setAttributes(this.editingTarget,[["href",y]]),this.setEditingTargetSize()},V.prototype.setTopLeft=function(){var l=this.target.getBoundingClientRect(),y=this.editorCanvas.getBoundingClientRect();this.left=l.left-y.left-this.CANVAS_MARGIN,this.top=l.top-y.top-this.CANVAS_MARGIN},V.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=gt.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=gt.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=gt.createGroup(),this.editingTargetRotationScaleContainer=gt.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var l=gt.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(l);var y=gt.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(y),this.editingTargetContainer=gt.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)},V.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},V.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=gt.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Vr(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()},V.prototype.zoomToCrop=function(){if(this.cropRect){var l=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,y=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=l+"px "+y+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-l+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-y+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},V.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)},V.prototype.cropRectChanged=function(l){this.cropRect=l,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},V.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},V.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"},V.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},V.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 l=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,y=this.target.offsetTop>l+this.CANVAS_MARGIN?this.target.offsetTop-(l+this.CANVAS_MARGIN):0;this.coverDiv.style.top=y+"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},V.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},V.prototype.addTopToolbar=function(){var l=this;this.topToolbar=new Tr,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 y=new Kr;y.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(y);var z=[];this.aspectRatios.forEach(function(Mt){var Wt=new It(li.getIcon(Mt.horizontal,Mt.vertical),Mt.horizontal===0&&Mt.vertical===0?"FREE":Mt.horizontal+":"+Mt.vertical);Wt.onClick=function(){return l.ratioButtonClicked(Mt)},z.push(Wt)}),this.aspectRatioButton=new wr(li.getIcon(0,0),"Aspect ratio",z),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,y.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var Z=new It('<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");Z.isActive=this.isGridVisible,Z.onClick=function(){l.isGridVisible=!l.isGridVisible,Z.isActive=l.isGridVisible},y.addButton(Z);var G=new It('<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"Zoom to selection");if(G.isActive=this.zoomToCropEnabled,G.onClick=function(){l.zoomToCropEnabled=!l.zoomToCropEnabled,G.isActive=l.zoomToCropEnabled},y.addButton(G),!ir.isLicensed){var ve=new ft;this.topToolbar.addElementBlock(ve);var ze=document.createElement("div");ze.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var Oe=document.createElement("a");Oe.style.color="currentColor",Oe.href="https://markerjs.com/products/cropro",Oe.target="_blank",Oe.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>',ze.appendChild(Oe),ve.addElement(ze)}var ct=new Kr;ct.minWidth=3*this.toolbarHeight+"px",ct.contentAlign="end",this.topToolbar.addButtonBlock(ct);var Ge=new It('<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,ct.addButton(Ge),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ge.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Ct=new It('<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");Ct.onClick=this.close,ct.addButton(Ct),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Ct.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},V.prototype.addBottomToolbar=function(){var l=this;this.bottomToolbar=new Tr,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 y=new Kr;y.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(y);var z=new It('<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");z.onClick=this.rotateLeftButtonClicked,y.addButton(z);var Z=new It('<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");Z.onClick=this.rotateRightButtonClicked,y.addButton(Z);var G=new ft;G.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(G),this.straightener=new ui("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(ct){l.rotateBy(ct),l.straightener.angle=l.rotationAngle},G.addElement(this.straightener.getUI());var ve=new Kr;ve.minWidth=2*this.toolbarHeight+"px",ve.contentAlign="end",this.bottomToolbar.addButtonBlock(ve);var ze=new It('<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");ze.onClick=this.flipHorizontallyButtonClicked,ve.addButton(ze);var Oe=new It('<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");Oe.onClick=this.flipVerticallyButtonClicked,ve.addButton(Oe)},V.prototype.ratioButtonClicked=function(l){this.aspectRatio=l,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},V.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=li.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},V.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Ur(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},V.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},V.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},V.prototype.restoreState=function(l){if(l){var y=this.cropLayer.getRescaledRect(l.width,l.height,this.imageWidth,this.imageHeight,l.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(y),this.cropRectChanged(y),this.flippedHorizontally=l.flippedHorizontally,this.flippedVertically=l.flippedVertically,this.applyFlip(),this.rotationAngle=l.rotationAngle,this.applyRotation()}},V.prototype.clientToLocalCoordinates=function(l,y){var z=this.cropImage.getBoundingClientRect();return{x:l-z.left,y:y-z.top}},V.prototype.onWindowResize=function(){this.positionUI()},V.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var l=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=l+"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()},V.prototype.rotateLeftButtonClicked=function(){var l=this.rotationAngle-90;this.rotationAngle%90!=0&&(l+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(l)},V.prototype.rotateRightButtonClicked=function(){var l=this.rotationAngle+90;this.rotationAngle%90!=0&&(l-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(l)},V.prototype.rotateTo=function(l){l=(l=l>180?l-360:l)<=-180?l+360:l,this.rotationAngle=l,this.applyRotation()},V.prototype.rotateBy=function(l){this.rotateTo((this.rotationAngle+l)%360)},V.prototype.applyRotation=function(){var l=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var y=this.editingTargetRotationContainer.transform.baseVal.getItem(0);y.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(y,0);var z=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/z.width,this.imageHeight/z.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=l},V.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},V.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},V.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},V.prototype.startRenderAndClose=function(){return wt(this,void 0,void 0,function(){var l,y;return yr(this,function(z){switch(z.label){case 0:return[4,this.render()];case 1:return l=z.sent(),y=this.getState(),this.renderEventListeners.forEach(function(Z){return Z(l,y)}),this.close(!0),[2]}})})},V.prototype.render=function(){return wt(this,void 0,void 0,function(){var l;return yr(this,function(y){switch(y.label){case 0:return(l=new gi).naturalSize=this.renderAtNaturalSize,l.imageType=this.renderImageType,l.imageQuality=this.renderImageQuality,l.width=this.renderWidth,l.height=this.renderHeight,this.unzoomFromCrop(),gt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,l.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 y.sent(),[4,l.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,y.sent()]}})})},V.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new fr("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 fr("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new fr("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var l=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new fr("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*l)+`px;
height: `+(this.toolbarHeight-2*l)+`px;
padding: `+l+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new fr("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new fr("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new br("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new br("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new fr("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 fr("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new fr("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 fr("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*l)+`px;
padding: `+l+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new fr("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},V.instanceCounter=0,V}(),St=ie("8hTe"),ei=ie.n(St),hi=/<pre[^>]*>/g;function di(V){var l=document.createElement("div");return l.innerHTML=V,l.childNodes.length===0?"":l.childNodes[0].nodeValue}var ki=$e.a=function(V){var l=V.value,y=l===void 0?"":l,z=V.edit,Z=z===void 0?!1:z,G=V.className,ve=V.showTextOnly,ze=V.showLines,Oe=V.replaces,ct=V.zoomImg,Ge=V.hasMask,Ct=V.style,Mt=Ct===void 0?{}:Ct,Wt=V.stylesPrev,Fr=Wt===void 0?{}:Wt,jr=String(y),sr=Object(w.useRef)(),Xr=Object(w.useRef)(),Ki=Object(w.useState)(""),Ar=Object(W.a)(Ki,2),_r=Ar[0],ti=Ar[1],vi=Object(w.useState)("office"),$r=Object(W.a)(vi,2),ri=$r[0],Wr=$r[1],fn=function(){var Ut=new Xe(Xr.current);Ut.displayMode="popup",Ut.addRenderEventListener(function(){var pr=Object(O.a)(P.a.mark(function Ft(mr){var Xt;return P.a.wrap(function(nr){for(;;)switch(nr.prev=nr.next){case 0:return sr.current.style.display="none",nr.next=3,Object(_e.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:mr}});case 3:Xt=nr.sent,Xt!=null&&Xt.id&&Oe(Xr.current.getAttribute("src").replace(q.a.API_SERVER,""),"/api/attachments/".concat(Xt==null?void 0:Xt.id,"?type=").concat(Xt.content_type));case 5:case"end":return nr.stop()}},Ft)}));return function(Ft){return pr.apply(this,arguments)}}()),Ut.show()},Vi=function(){var Ut=new Lt(Xr.current);Ut.settings.displayMode="popup",Ut.addEventListener("render",function(){var pr=Object(O.a)(P.a.mark(function Ft(mr){var Xt;return P.a.wrap(function(nr){for(;;)switch(nr.prev=nr.next){case 0:if(sr.current.style.display="none",!Xr.current){nr.next=6;break}return nr.next=4,Object(_e.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:mr.dataUrl}});case 4:Xt=nr.sent,Xt!=null&&Xt.id&&Oe(Xr.current.getAttribute("src").replace(q.a.API_SERVER,""),"/api/attachments/".concat(Xt==null?void 0:Xt.id,"?type=").concat(Xt.content_type));case 6:case"end":return nr.stop()}},Ft)}));return function(Ft){return pr.apply(this,arguments)}}()),Ut.show(),window.markerArea=Ut},Pr=Object(w.useMemo)(function(){try{var qt=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Ut=/\"\/api\/attachments\/|\"\/attachments\/download\//g,pr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;jr=jr.replace(qt,"("+q.a.API_SERVER+"/api/attachments/").replace(Ut,'"'+q.a.API_SERVER+"/api/attachments/").replace(pr,'"'+q.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,`
`),jr=jr.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
`)}catch(yi){}var Ft=K(jr),mr=C();if(jr.match(/\[TOC\]/)&&(Ft=Ft.replace("<p>[TOC]</p>",D()),_()),Ft=Ft.replace(/(__special_katext_id_\d+__)/g,function(yi,nr){var ar=mr[nr],ii=ar.type,bi=ar.expression;return Object(ae.renderToString)(di(bi)||"",{displayMode:ii==="block",throwOnError:!1,output:"html"})}),Ft=Ft.replace(/▁/g,"\u2581\u2581\u2581"),x(),ve){var Xt=document.createElement("div");return Xt.innerHTML=Ft,Xt.innerText}return setTimeout(function(){return Oi()},500),Ft},[jr]),Mr=Object(w.useRef)();m.WebkitLineClamp=ze,ze&&(Mt=Object(U.a)(Object(U.a)({},Mt),m));function Ri(qt){var Ut=qt.target;if(Ut.tagName.toUpperCase()==="IMG"){if(ct){var pr=Ut.getAttribute("src");ti(pr),Wr("image")}}else if(Ut.tagName.toUpperCase()==="A"){var Ft=Ut.getAttribute("href");if(Ft.indexOf("office")>-1)qt.preventDefault(),ti(Ft),Wr("office");else if(Ft.indexOf("application/pdf")>-1)qt.preventDefault(),ti(Ft),Wr("pdf");else if(Ft.indexOf("type=text")>-1)qt.preventDefault(),ti(Ft),Wr("html");else if(Ft.startsWith("#")){qt.preventDefault();var mr=document.getElementById(Ft.replace("#",""));mr&&mr.scrollIntoView(!0)}}}var Oi=function(){var Ut,pr=(Ut=Mr.current)===null||Ut===void 0?void 0:Ut.querySelectorAll("video");pr==null||pr.forEach(function(Ft){if(Ft.oncontextmenu=function(){return!1},Ft.src.indexOf(".m3u8")>-1&&!Ft.canPlayType("application/vnd.apple.mpegurl")){if(Y.a.isSupported()){var mr=new Y.a;mr.loadSource(Ft.src),mr.attachMedia(Ft)}}})};Object(w.useEffect)(function(){if(Mr.current&&Pr&&(Pr.match(hi)&&window.PR.prettyPrint()),Mr.current)return Mr.current.addEventListener("click",Ri),function(){Mr.current.removeEventListener("click",Ri),x(),_()}},[Pr,Mr.current,Ri]);var Pi=function(Ut){if(!Z)return;Ut.target.nodeName==="IMG"?(sr.current.style.display="flex",sr.current.style.width=Ut.target.clientWidth+"px",sr.current.style.height=Ut.target.clientHeight+"px",sr.current.style.top=Ut.target.offsetTop+"px",sr.current.style.left=Ut.target.offsetLeft+"px",Xr.current.src=Ut.target.getAttribute("src")):sr.current.style.display="none"};return f.a.createElement("div",{style:{position:"relative"}},f.a.createElement("div",{ref:Mr,style:Object(U.a)({},Mt),className:"".concat(G||""," markdown-body ").concat(ei.a.mdBody),onMouseOver:Pi,dangerouslySetInnerHTML:{__html:Pr}}),f.a.createElement("div",{ref:sr,className:ei.a.button},f.a.createElement($.a,null,f.a.createElement(X.a,{onClick:function(){return fn()}},"\u88C1\u526A"),f.a.createElement(X.a,{onClick:function(){return Vi()}},"\u7F16\u8F91"))),f.a.createElement("img",{ref:Xr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),f.a.createElement(he.a,{close:!0,data:_r,hasMask:Ge,type:_r!=null&&_r.length?ri:"",style:Object(U.a)({},Fr),onClose:function(){return ti("")}}))}},"9VGf":function(lt,$e,ie){"use strict";ie.d($e,"a",function(){return k});var ne=ie("q1tI"),$=ie.n(ne);function k(X,U){var O=Object(ne.useRef)();Object(ne.useEffect)(function(){O.current=X}),Object(ne.useEffect)(function(){function W(){O.current()}if(U!==null){var F=setInterval(W,U);return function(){return clearInterval(F)}}},[U])}},BU3w:function(lt,$e,ie){"use strict";ie.d($e,"a",function(){return O});var ne=ie("MNnm"),$="rc-util-key";function k(W){if(W.attachTo)return W.attachTo;var F=document.querySelector("head");return F||document.body}function X(W){var F,P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ne.a)())return null;var w=document.createElement("style");if((F=P.csp)===null||F===void 0?void 0:F.nonce){var f;w.nonce=(f=P.csp)===null||f===void 0?void 0:f.nonce}w.innerHTML=W;var b=k(P),M=b.firstChild;return P.prepend&&b.prepend?b.prepend(w):P.prepend&&M?b.insertBefore(w,M):b.appendChild(w),w}var U=new Map;function O(W,F){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},w=k(P);if(!U.has(w)){var f=X("",P),b=f.parentNode;U.set(w,b),b.removeChild(f)}var M=Array.from(U.get(w).children).find(function(a){return a.tagName==="STYLE"&&a[$]===F});if(M){var A,S;if(((A=P.csp)===null||A===void 0?void 0:A.nonce)&&M.nonce!==((S=P.csp)===null||S===void 0?void 0:S.nonce)){var T;M.nonce=(T=P.csp)===null||T===void 0?void 0:T.nonce}return M.innerHTML!==W&&(M.innerHTML=W),M}var d=X(W,P);return d[$]=F,d}},Bd2K:function(lt,$e,ie){(function(ne){ne(ie("VrN/"),ie("osHv"))})(function(ne){ne.defineOption("autoCloseTags",!1,function(P,w,f){if(f!=ne.Init&&f&&P.removeKeyMap("autoCloseTags"),!w)return;var b={name:"autoCloseTags"};(typeof w!="object"||w.whenClosing!==!1)&&(b["'/'"]=function(M){return O(M)}),(typeof w!="object"||w.whenOpening!==!1)&&(b["'>'"]=function(M){return X(M)}),P.addKeyMap(b)});var $=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],k=["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 X(P){if(P.getOption("disableInput"))return ne.Pass;for(var w=P.listSelections(),f=[],b=P.getOption("autoCloseTags"),M=0;M<w.length;M++){if(!w[M].empty())return ne.Pass;var A=w[M].head,S=P.getTokenAt(A),T=ne.innerMode(P.getMode(),S.state),d=T.state,a=T.mode.xmlCurrentTag&&T.mode.xmlCurrentTag(d),s=a&&a.name;if(!s)return ne.Pass;var u=T.mode.configuration=="html",_=typeof b=="object"&&b.dontCloseTags||u&&$,m=typeof b=="object"&&b.indentTags||u&&k;S.end>A.ch&&(s=s.slice(0,s.length-S.end+A.ch));var p=s.toLowerCase();if(!s||S.type=="string"&&(S.end!=A.ch||!/[\"\']/.test(S.string.charAt(S.string.length-1))||S.string.length==1)||S.type=="tag"&&a.close||S.string.indexOf("/")==A.ch-S.start-1||_&&W(_,p)>-1||F(P,T.mode.xmlCurrentContext&&T.mode.xmlCurrentContext(d)||[],s,A,!0))return ne.Pass;var D=typeof b=="object"&&b.emptyTags;if(D&&W(D,s)>-1){f[M]={text:"/>",newPos:ne.Pos(A.line,A.ch+2)};continue}var E=m&&W(m,p)>-1;f[M]={indent:E,text:">"+(E?`
`:"")+"</"+s+">",newPos:E?ne.Pos(A.line+1,0):ne.Pos(A.line,A.ch+1)}}for(var g=typeof b=="object"&&b.dontIndentOnAutoClose,M=w.length-1;M>=0;M--){var c=f[M];P.replaceRange(c.text,w[M].head,w[M].anchor,"+insert");var h=P.listSelections().slice(0);h[M]={head:c.newPos,anchor:c.newPos},P.setSelections(h),!g&&c.indent&&(P.indentLine(c.newPos.line,null,!0),P.indentLine(c.newPos.line+1,null,!0))}}function U(P,w){for(var f=P.listSelections(),b=[],M=w?"/":"</",A=P.getOption("autoCloseTags"),S=typeof A=="object"&&A.dontIndentOnSlash,T=0;T<f.length;T++){if(!f[T].empty())return ne.Pass;var d=f[T].head,a=P.getTokenAt(d),s=ne.innerMode(P.getMode(),a.state),u=s.state;if(w&&(a.type=="string"||a.string.charAt(0)!="<"||a.start!=d.ch-1))return ne.Pass;var _,m=s.mode.name!="xml"&&P.getMode().name=="htmlmixed";if(m&&s.mode.name=="javascript")_=M+"script";else if(m&&s.mode.name=="css")_=M+"style";else{var p=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(u);if(!p||p.length&&F(P,p,p[p.length-1],d))return ne.Pass;_=M+p[p.length-1]}P.getLine(d.line).charAt(a.end)!=">"&&(_+=">"),b[T]=_}if(P.replaceSelections(b),f=P.listSelections(),!S)for(var T=0;T<f.length;T++)(T==f.length-1||f[T].head.line<f[T+1].head.line)&&P.indentLine(f[T].head.line)}function O(P){return P.getOption("disableInput")?ne.Pass:U(P,!0)}ne.commands.closeTag=function(P){return U(P)};function W(P,w){if(P.indexOf)return P.indexOf(w);for(var f=0,b=P.length;f<b;++f)if(P[f]==w)return f;return-1}function F(P,w,f,b,M){if(!ne.scanForClosingTag)return!1;var A=Math.min(P.lastLine()+1,b.line+500),S=ne.scanForClosingTag(P,b,null,A);if(!S||S.tag!=f)return!1;for(var T=M?1:0,d=w.length-1;d>=0&&w[d]==f;d--)++T;b=S.to;for(var d=1;d<T;d++){var a=ne.scanForClosingTag(P,b,null,A);if(!a||a.tag!=f)return!1;b=a.to}return!0}})},BjJ7:function(lt,$e,ie){"use strict";ie.d($e,"d",function(){return $}),ie.d($e,"c",function(){return k}),ie.d($e,"e",function(){return X}),ie.d($e,"b",function(){return U}),ie.d($e,"a",function(){return W});var ne=ie("m3rI");function $(F){var P=!0;if(F.length>0){for(var w=0;w<F.length;w++)if(F[w].compile_success==0||!F[w].compile_success){P=!1;break}}else P=!1;return P}function k(F){for(var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",w=[],f=0;f<F.length;f++){var b=F[f],M=P?"".concat(P,"/").concat(b.name):"".concat(b.name);w.push({title:b.name,isLeaf:!(b.type==="tree"),key:M})}return w}function X(F,P,w){for(var f=0;f<F.length;f++){var b=F[f];if(b.key===P){b.children=w;break}b.children&&X(b.children,P,w)}return F}function U(F,P,w){var f;return function(){var b=this,M=arguments,A=function(){f=null,w||F.apply(b,M)},S=w&&!f;clearTimeout(f),f=setTimeout(A,P),S&&F.apply(b,M)}}var O=!0,W=ne.a.API_SERVER},"C+DQ":function(lt,$e,ie){},CKgm:function(lt,$e,ie){"use strict";ie.r($e);var ne=ie("+L6B"),$=ie("2/Rp"),k=ie("5NDa"),X=ie("5rEg"),U=ie("sPJy"),O=ie("bE4q"),W=ie("miYZ"),F=ie("tsqr"),P=ie("9og8"),w=ie("k1fw"),f=ie("y8nQ"),b=ie("Vl3Y"),M=ie("tJVT"),A=ie("PpiC"),S=ie("OaEy"),T=ie("2fM7"),d=ie("WmNS"),a=ie.n(d),s=ie("q1tI"),u=ie.n(s),_=ie("Ty5D"),m=ie("9kvl"),p=ie("55Ip"),D=ie("Ot1p"),E=ie("500L"),g=ie("h+Ho"),c=ie("7/Dv"),h=ie.n(c),o=T.a.Option,C=function(v){var R,B,j,K=v.forumsDetail,I=v.globalSetting,N=v.loading,Y=v.dispatch,q=Object(A.a)(v,["forumsDetail","globalSetting","loading","dispatch"]),ae=Object(_.i)(),he=b.a.useForm(),_e=Object(M.a)(he,1),be=_e[0],Ce=Object(s.useState)({}),Te=Object(M.a)(Ce,2),Ee=Te[0],me=Te[1],ue=Object(s.useState)(0),te=Object(M.a)(ue,2),ce=te[0],se=te[1],we=Object(s.useState)(!1),Le=Object(M.a)(we,2),xe=Le[0],Pe=Le[1],Ne=Object(s.useState)({}),Be=Object(M.a)(Ne,2),We=Be[0],Ue=Be[1],Fe=Object(s.useState)(1),at=Object(M.a)(Fe,2),it=at[0],et=at[1];Object(s.useEffect)(function(){if(Ze(),ae.memoId)Pe(!0),ut();else{Pe(!1);var Re={forum_id:5};me(Object(w.a)({},Re)),be.setFieldsValue(Object(w.a)({},Re))}},[ae.memoId]);var Ze=function(){var Re=Object(P.a)(a.a.mark(function nt(){var qe;return a.a.wrap(function(He){for(;;)switch(He.prev=He.next){case 0:return He.next=2,Object(g.f)({});case 2:qe=He.sent,Ue(qe||{});case 4:case"end":return He.stop()}},nt)}));return function(){return Re.apply(this,arguments)}}(),ut=function(){var Re=Object(P.a)(a.a.mark(function nt(){var qe,Ie,He;return a.a.wrap(function(pe){for(;;)switch(pe.prev=pe.next){case 0:return pe.next=2,Object(g.e)({id:ae.memoId});case 2:if(pe.t0=pe.sent,pe.t0){pe.next=5;break}pe.t0={};case 5:Ie=pe.t0,He={subject:Ie.subject,content:Ie.content,attachments:Object(E.a)(Ie.attachments),forum_id:Ie.forum_id,memo_tags:(qe=Ie.memo_tags)===null||qe===void 0?void 0:qe.map(function(ye){return ye.id})},me(Object(w.a)({},He)),be.setFieldsValue(Object(w.a)({},He));case 9:case"end":return pe.stop()}},nt)}));return function(){return Re.apply(this,arguments)}}(),Je=function(){var Re=Object(P.a)(a.a.mark(function nt(qe){var Ie,He,Se,pe;return a.a.wrap(function(re){for(;;)switch(re.prev=re.next){case 0:if(Se=Object(w.a)(Object(w.a)({id:xe?ae.memoId:null},Ee),{},{attachment_ids:(Ie=Ee.attachments)===null||Ie===void 0||((He=Ie.filter(function(oe){var le;return(le=oe.response)===null||le===void 0?void 0:le.id}))===null||He===void 0)?void 0:He.map(function(oe){var le;return(le=oe.response)===null||le===void 0?void 0:le.id}),tags:Ee.memo_tags}),!xe){re.next=7;break}return re.next=4,Object(g.n)(Se);case 4:re.t0=re.sent,re.next=10;break;case 7:return re.next=9,Object(g.j)(Se);case 9:re.t0=re.sent;case 10:pe=re.t0,se(0),(pe==null?void 0:pe.status)===0&&(F.b.success(pe==null?void 0:pe.message),it===1?m.d.push("/forums/".concat(xe?ae==null?void 0:ae.memoId:pe==null?void 0:pe.memo_id)):m.d.push("/forums/".concat(xe?ae==null?void 0:ae.memoId:pe==null?void 0:pe.memo_id,"/edit")));case 13:case"end":return re.stop()}},nt)}));return function(qe){return Re.apply(this,arguments)}}(),st=function(){document.body.scrollIntoView(),window.location.href.includes("new")?m.d.goBack():m.d.push("/forums/".concat(ae.memoId))};return u.a.createElement("section",{className:h.a.bg},u.a.createElement("section",{className:"animated fadeIn mb10"},u.a.createElement("aside",{className:"mt10"},u.a.createElement(O.a,{separator:"/"},u.a.createElement(O.a.Item,null,u.a.createElement(p.a,{to:"/forums"},"\u4EA4\u6D41\u95EE\u7B54")),u.a.createElement(O.a.Item,null,"\u8BE6\u60C5")))),u.a.createElement("aside",{className:"bg-white font16 pt20 pb20 pl20"},xe?"\u7F16\u8F91\u8BDD\u9898":"\u53D1\u5E03\u8BDD\u9898"),u.a.createElement(b.a,{form:be,className:h.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(nt,qe){console.log(qe,"values"),me(Object(w.a)(Object(w.a)({},Ee),nt))},onFinish:Je,onFinishFailed:function(){se(0)}},u.a.createElement("div",{className:h.a.fieldWrap},u.a.createElement(b.a.Item,{name:"subject",label:u.a.createElement("span",{className:"font16"},"\u8BDD\u9898\u540D\u79F0: "),rules:[{required:!0,message:"\u8BF7\u5148\u8F93\u5165\u8BDD\u9898\u540D\u79F0"}]},u.a.createElement(X.a,{maxLength:50,suffix:"".concat(((R=Ee.subject)===null||R===void 0?void 0:R.length)||0,"/50")}))),u.a.createElement("div",{className:h.a.mdWrap},u.a.createElement(b.a.Item,{name:"content",label:u.a.createElement("span",{className:"font16"},"\u5185\u5BB9: "),rules:[{required:!0,message:"\u8BF7\u5148\u8F93\u5165\u8BDD\u9898\u5185\u5BB9"}]},u.a.createElement(D.a,{height:600,id:"forums-new-content",watch:!0,defaultValue:Ee.content})),u.a.createElement("div",null,u.a.createElement(b.a.Item,{name:"attachments",style:{width:350}},u.a.createElement(E.b,{showRemoveModal:!0})))),u.a.createElement("div",{className:h.a.mdWrap},u.a.createElement(b.a.Item,{name:"forum_id",label:u.a.createElement("span",{className:"font16"},"\u8BDD\u9898\u7C7B\u578B: "),rules:[{required:!0,message:"\u8BF7\u5148\u9009\u62E9\u8BDD\u9898\u7C7B\u578B"}]},u.a.createElement(T.a,{style:{width:300}},We==null||((B=We.forums)===null||B===void 0)?void 0:B.map(function(Re){return u.a.createElement(o,{key:Re.id,value:Re.id},Re.name)})))),Ee.forum_id===5&&u.a.createElement("div",{className:h.a.mdWrap},u.a.createElement(b.a.Item,{name:"memo_tags",label:u.a.createElement("span",{className:"font16"},"\u6280\u672F\u6807\u7B7E: "),rules:[{required:!0,message:"\u8BF7\u5148\u9009\u62E9\u6280\u672F\u6807\u7B7E"}]},u.a.createElement(T.a,{style:{width:300},placeholder:"\u8BF7\u9009\u62E9\u6280\u672F\u6807\u7B7E",mode:"multiple",tokenSeparators:[";"],filterOption:function(nt,qe){return qe.props.children.toLocaleLowerCase().indexOf(nt.toLocaleLowerCase())!=-1}},We==null||((j=We.tag_list)===null||j===void 0)?void 0:j.map(function(Re){return u.a.createElement(o,{key:Re.id,value:Re.id},Re.name)})))),u.a.createElement("div",{className:h.a.backgroundFa},u.a.createElement("div",{className:"pt40 mb30"},u.a.createElement(b.a.Item,null,u.a.createElement($.a,{size:"large",type:"primary",className:"".concat(h.a.button," mr20"),htmlType:"submit",loading:ce===1,onClick:function(){et(1),se(1)}},"\u63D0\u4EA4"),u.a.createElement($.a,{size:"large",type:"primary",className:"".concat(h.a.button," mr20"),htmlType:"submit",loading:ce===2,onClick:function(){et(2),se(2)}},"\u4FDD\u5B58"),u.a.createElement($.a,{size:"large",type:"primary",ghost:!0,className:"".concat(h.a.button," mr20"),onClick:st},"\u53D6\u6D88"))))))};$e.default=Object(m.a)(function(x){var v=x.forumsDetail,R=x.loading,B=x.globalSetting;return{forumsDetail:v,globalSetting:B,loading:R.models.forumsDetail}})(C)},D1Df:function(lt,$e,ie){"use strict";function ne(v){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ne=function(B){return typeof B}:ne=function(B){return B&&typeof Symbol=="function"&&B.constructor===Symbol&&B!==Symbol.prototype?"symbol":typeof B},ne(v)}function $(){return $=Object.assign||function(v){for(var R=1;R<arguments.length;R++){var B=arguments[R];for(var j in B)Object.prototype.hasOwnProperty.call(B,j)&&(v[j]=B[j])}return v},$.apply(this,arguments)}function k(v,R){var B=Object.keys(v);if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(v);R&&(j=j.filter(function(K){return Object.getOwnPropertyDescriptor(v,K).enumerable})),B.push.apply(B,j)}return B}function X(v){for(var R=1;R<arguments.length;R++){var B=arguments[R]!=null?arguments[R]:{};R%2?k(B,!0).forEach(function(j){S(v,j,B[j])}):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(B)):k(B).forEach(function(j){Object.defineProperty(v,j,Object.getOwnPropertyDescriptor(B,j))})}return v}function U(v,R){if(v==null)return{};var B=O(v,R),j,K;if(Object.getOwnPropertySymbols){var I=Object.getOwnPropertySymbols(v);for(K=0;K<I.length;K++){if(j=I[K],R.indexOf(j)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(v,j))continue;B[j]=v[j]}}return B}function O(v,R){if(v==null)return{};var B={},j=Object.keys(v),K,I;for(I=0;I<j.length;I++){if(K=j[I],R.indexOf(K)>=0)continue;B[K]=v[K]}return B}function W(v,R){if(!(v instanceof R))throw new TypeError("Cannot call a class as a function")}function F(v,R){for(var B=0;B<R.length;B++){var j=R[B];j.enumerable=j.enumerable||!1,j.configurable=!0,"value"in j&&(j.writable=!0),Object.defineProperty(v,j.key,j)}}function P(v,R,B){return R&&F(v.prototype,R),B&&F(v,B),v}function w(v,R){return R&&(ne(R)==="object"||typeof R=="function")?R:b(v)}function f(v){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(B){return B.__proto__||Object.getPrototypeOf(B)},f(v)}function b(v){if(v===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v}function M(v,R){if(typeof R!="function"&&R!==null)throw new TypeError("Super expression must either be null or a function");v.prototype=Object.create(R&&R.prototype,{constructor:{value:v,writable:!0,configurable:!0}}),R&&A(v,R)}function A(v,R){return A=Object.setPrototypeOf||function(j,K){return j.__proto__=K,j},A(v,R)}function S(v,R,B){return R in v?Object.defineProperty(v,R,{value:B,enumerable:!0,configurable:!0,writable:!0}):v[R]=B,v}var T=ie("q1tI"),d=ie("17x9"),a=ie("H38U"),s=ie("aRTE");function u(v){for(var R="",B=0;B<v.length;B++){var j=v.charCodeAt(B);j<128?R+=String.fromCharCode(j):j<2048?(R+=String.fromCharCode(192|j>>6),R+=String.fromCharCode(128|j&63)):j<55296||j>=57344?(R+=String.fromCharCode(224|j>>12),R+=String.fromCharCode(128|j>>6&63),R+=String.fromCharCode(128|j&63)):(B++,j=65536+((j&1023)<<10|v.charCodeAt(B)&1023),R+=String.fromCharCode(240|j>>18),R+=String.fromCharCode(128|j>>12&63),R+=String.fromCharCode(128|j>>6&63),R+=String.fromCharCode(128|j&63))}return R}var _={size:128,level:"L",bgColor:"#FFFFFF",fgColor:"#000000",includeMargin:!1},m={},p=4,D=.1;function E(v){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,B=[];return v.forEach(function(j,K){var I=null;j.forEach(function(N,Y){if(!N&&I!==null){B.push("M".concat(I+R," ").concat(K+R,"h").concat(Y-I,"v1H").concat(I+R,"z")),I=null;return}if(Y===j.length-1){if(!N)return;I===null?B.push("M".concat(Y+R,",").concat(K+R," h1v1H").concat(Y+R,"z")):B.push("M".concat(I+R,",").concat(K+R," h").concat(Y+1-I,"v1H").concat(I+R,"z"));return}N&&I===null&&(I=Y)})}),B.join("")}function g(v,R){return v.slice().map(function(B,j){return j<R.y||j>=R.y+R.h?B:B.map(function(K,I){return I<R.x||I>=R.x+R.w?K:!1})})}function c(v,R){var B=v.imageSettings,j=v.size,K=v.includeMargin;if(B==null)return null;var I=K?p:0,N=R.length+I*2,Y=Math.floor(j*D),q=N/j,ae=(B.width||Y)*q,he=(B.height||Y)*q,_e=B.x==null?R.length/2-ae/2:B.x*q,be=B.y==null?R.length/2-he/2:B.y*q,Ce=null;if(B.excavate){var Te=Math.floor(_e),Ee=Math.floor(be),me=Math.ceil(ae+_e-Te),ue=Math.ceil(he+be-Ee);Ce={x:Te,y:Ee,w:me,h:ue}}return{x:_e,y:be,h:he,w:ae,excavation:Ce}}var h=function(){try{new Path2D().addPath(new Path2D)}catch(v){return!1}return!0}(),o=function(v){M(R,v);function R(){var B,j;W(this,R);for(var K=arguments.length,I=new Array(K),N=0;N<K;N++)I[N]=arguments[N];return j=w(this,(B=f(R)).call.apply(B,[this].concat(I))),S(b(j),"_canvas",void 0),S(b(j),"_image",void 0),S(b(j),"state",{imgLoaded:!1}),S(b(j),"handleImageLoad",function(){j.setState({imgLoaded:!0})}),j}return P(R,[{key:"componentDidMount",value:function(){this.update()}},{key:"componentDidUpdate",value:function(){this.update()}},{key:"update",value:function(){var j=this.props,K=j.value,I=j.size,N=j.level,Y=j.bgColor,q=j.fgColor,ae=j.includeMargin,he=j.imageSettings,_e=new a(-1,s[N]);if(_e.addData(u(K)),_e.make(),this._canvas!=null){var be=this._canvas,Ce=be.getContext("2d");if(!Ce)return;var Te=_e.modules;if(Te===null)return;var Ee=ae?p:0,me=Te.length+Ee*2,ue=c(this.props,Te);he!=null&&ue!=null&&(ue.excavation!=null&&(Te=g(Te,ue.excavation)));var te=window.devicePixelRatio||1;be.height=be.width=I*te;var ce=I/me*te;Ce.scale(ce,ce),Ce.fillStyle=Y,Ce.fillRect(0,0,me,me),Ce.fillStyle=q,h?Ce.fill(new Path2D(E(Te,Ee))):Te.forEach(function(se,we){se.forEach(function(Le,xe){Le&&Ce.fillRect(xe+Ee,we+Ee,1,1)})}),this.state.imgLoaded&&this._image&&ue!=null&&Ce.drawImage(this._image,ue.x+Ee,ue.y+Ee,ue.w,ue.h)}}},{key:"render",value:function(){var j=this,K=this.props,I=K.value,N=K.size,Y=K.level,q=K.bgColor,ae=K.fgColor,he=K.style,_e=K.includeMargin,be=K.imageSettings,Ce=U(K,["value","size","level","bgColor","fgColor","style","includeMargin","imageSettings"]),Te=X({height:N,width:N},he),Ee=null,me=be&&be.src;return be!=null&&me!=null&&(Ee=T.createElement("img",{src:me,style:{display:"none"},onLoad:this.handleImageLoad,ref:function(te){return j._image=te}})),T.createElement(T.Fragment,null,T.createElement("canvas",$({style:Te,height:N,width:N,ref:function(te){return j._canvas=te}},Ce)),Ee)}}]),R}(T.PureComponent);S(o,"defaultProps",_);var C=function(v){M(R,v);function R(){return W(this,R),w(this,f(R).apply(this,arguments))}return P(R,[{key:"render",value:function(){var j=this.props,K=j.value,I=j.size,N=j.level,Y=j.bgColor,q=j.fgColor,ae=j.includeMargin,he=j.imageSettings,_e=U(j,["value","size","level","bgColor","fgColor","includeMargin","imageSettings"]),be=new a(-1,s[N]);be.addData(u(K)),be.make();var Ce=be.modules;if(Ce===null)return null;var Te=ae?p:0,Ee=Ce.length+Te*2,me=c(this.props,Ce),ue=null;he!=null&&me!=null&&(me.excavation!=null&&(Ce=g(Ce,me.excavation)),ue=T.createElement("image",{xlinkHref:he.src,height:me.h,width:me.w,x:me.x+Te,y:me.y+Te,preserveAspectRatio:"none"}));var te=E(Ce,Te);return T.createElement("svg",$({shapeRendering:"crispEdges",height:I,width:I,viewBox:"0 0 ".concat(Ee," ").concat(Ee)},_e),T.createElement("path",{fill:Y,d:"M0,0 h".concat(Ee,"v").concat(Ee,"H0z")}),T.createElement("path",{fill:q,d:te}),ue)}}]),R}(T.PureComponent);S(C,"defaultProps",_);var x=function(R){var B=R.renderAs,j=U(R,["renderAs"]),K=B==="svg"?C:o;return T.createElement(K,j)};x.defaultProps=X({renderAs:"canvas"},_),lt.exports=x},DlQD:function(lt,$e,ie){(function(ne,$){lt.exports=$()})(this,function(){"use strict";function ne(Se,pe){for(var ye=0;ye<pe.length;ye++){var re=pe[ye];re.enumerable=re.enumerable||!1,re.configurable=!0,"value"in re&&(re.writable=!0),Object.defineProperty(Se,re.key,re)}}function $(Se,pe,ye){return pe&&ne(Se.prototype,pe),ye&&ne(Se,ye),Se}function k(Se,pe){if(!Se)return;if(typeof Se=="string")return X(Se,pe);var ye=Object.prototype.toString.call(Se).slice(8,-1);if(ye==="Object"&&Se.constructor&&(ye=Se.constructor.name),ye==="Map"||ye==="Set")return Array.from(Se);if(ye==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ye))return X(Se,pe)}function X(Se,pe){(pe==null||pe>Se.length)&&(pe=Se.length);for(var ye=0,re=new Array(pe);ye<pe;ye++)re[ye]=Se[ye];return re}function U(Se,pe){var ye;if(typeof Symbol=="undefined"||Se[Symbol.iterator]==null){if(Array.isArray(Se)||(ye=k(Se))||pe&&Se&&typeof Se.length=="number"){ye&&(Se=ye);var re=0;return function(){return re>=Se.length?{done:!0}:{done:!1,value:Se[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 ye=Se[Symbol.iterator](),ye.next.bind(ye)}function O(Se,pe){return pe={exports:{}},Se(pe,pe.exports),pe.exports}var W=O(function(Se){function pe(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function ye(re){Se.exports.defaults=re}Se.exports={defaults:pe(),getDefaults:pe,changeDefaults:ye}}),F=W.defaults,P=W.getDefaults,w=W.changeDefaults,f=/[&<>"']/,b=/[&<>"']/g,M=/[<>"']|&(?!#?\w+;)/,A=/[<>"']|&(?!#?\w+;)/g,S={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},T=function(pe){return S[pe]};function d(Se,pe){if(pe){if(f.test(Se))return Se.replace(b,T)}else if(M.test(Se))return Se.replace(A,T);return Se}var a=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(Se){return Se.replace(a,function(pe,ye){return ye=ye.toLowerCase(),ye==="colon"?":":ye.charAt(0)==="#"?ye.charAt(1)==="x"?String.fromCharCode(parseInt(ye.substring(2),16)):String.fromCharCode(+ye.substring(1)):""})}var u=/(^|[^\[])\^/g;function _(Se,pe){Se=Se.source||Se,pe=pe||"";var ye={replace:function(oe,le){return le=le.source||le,le=le.replace(u,"$1"),Se=Se.replace(oe,le),ye},getRegex:function(){return new RegExp(Se,pe)}};return ye}var m=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function D(Se,pe,ye){if(Se){var re;try{re=decodeURIComponent(s(ye)).replace(m,"").toLowerCase()}catch(oe){return null}if(re.indexOf("javascript:")===0||re.indexOf("vbscript:")===0||re.indexOf("data:")===0)return null}pe&&!p.test(ye)&&(ye=o(pe,ye));try{ye=encodeURI(ye).replace(/%25/g,"%")}catch(oe){return null}return ye}var E={},g=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,h=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(Se,pe){E[" "+Se]||(g.test(Se)?E[" "+Se]=Se+"/":E[" "+Se]=R(Se,"/",!0)),Se=E[" "+Se];var ye=Se.indexOf(":")===-1;return pe.substring(0,2)==="//"?ye?pe:Se.replace(c,"$1")+pe:pe.charAt(0)==="/"?ye?pe:Se.replace(h,"$1")+pe:Se+pe}var C={exec:function(){}};function x(Se){for(var pe=1,ye,re;pe<arguments.length;pe++){ye=arguments[pe];for(re in ye)Object.prototype.hasOwnProperty.call(ye,re)&&(Se[re]=ye[re])}return Se}function v(Se,pe){var ye=Se.replace(/\|/g,function(le,de,De){for(var Me=!1,Ye=de;--Ye>=0&&De[Ye]==="\\";)Me=!Me;return Me?"|":" |"}),re=ye.split(/ \|/),oe=0;if(re.length>pe)re.splice(pe);else for(;re.length<pe;)re.push("");for(;oe<re.length;oe++)re[oe]=re[oe].trim().replace(/\\\|/g,"|");return re}function R(Se,pe,ye){var re=Se.length;if(re===0)return"";for(var oe=0;oe<re;){var le=Se.charAt(re-oe-1);if(le===pe&&!ye)oe++;else if(le!==pe&&ye)oe++;else break}return Se.substr(0,re-oe)}function B(Se,pe){if(Se.indexOf(pe[1])===-1)return-1;for(var ye=Se.length,re=0,oe=0;oe<ye;oe++)if(Se[oe]==="\\")oe++;else if(Se[oe]===pe[0])re++;else if(Se[oe]===pe[1]&&(re--,re<0))return oe;return-1}function j(Se){Se&&Se.sanitize&&!Se.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 K={escape:d,unescape:s,edit:_,cleanUrl:D,resolveUrl:o,noopTest:C,merge:x,splitCells:v,rtrim:R,findClosingBracket:B,checkSanitizeDeprecation:j},I=W.defaults,N=K.rtrim,Y=K.splitCells,q=K.escape,ae=K.findClosingBracket;function he(Se,pe,ye){var re=pe.href,oe=pe.title?q(pe.title):null,le=Se[1].replace(/\\([\[\]])/g,"$1");return Se[0].charAt(0)!=="!"?{type:"link",raw:ye,href:re,title:oe,text:le}:{type:"image",raw:ye,href:re,title:oe,text:q(le)}}function _e(Se,pe){var ye=Se.match(/^(\s+)(?:```)/);if(ye===null)return pe;var re=ye[1];return pe.split(`
`).map(function(oe){var le=oe.match(/^\s+/);if(le===null)return oe;var de=le[0];return de.length>=re.length?oe.slice(re.length):oe}).join(`
`)}var be=function(){function Se(ye){this.options=ye||I}var pe=Se.prototype;return pe.space=function(re){var oe=this.rules.block.newline.exec(re);if(oe)return oe[0].length>1?{type:"space",raw:oe[0]}:{raw:`
`}},pe.code=function(re,oe){var le=this.rules.block.code.exec(re);if(le){var de=oe[oe.length-1];if(de&&de.type==="paragraph")return{raw:le[0],text:le[0].trimRight()};var De=le[0].replace(/^ {4}/gm,"");return{type:"code",raw:le[0],codeBlockStyle:"indented",text:this.options.pedantic?De:N(De,`
`)}}},pe.fences=function(re){var oe=this.rules.block.fences.exec(re);if(oe){var le=oe[0],de=_e(le,oe[3]||"");return{type:"code",raw:le,lang:oe[2]?oe[2].trim():oe[2],text:de}}},pe.heading=function(re){var oe=this.rules.block.heading.exec(re);if(oe)return{type:"heading",raw:oe[0],depth:oe[1].length,text:oe[2]}},pe.nptable=function(re){var oe=this.rules.block.nptable.exec(re);if(oe){var le={type:"table",header:Y(oe[1].replace(/^ *| *\| *$/g,"")),align:oe[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:oe[3]?oe[3].replace(/\n$/,"").split(`
`):[],raw:oe[0]};if(le.header.length===le.align.length){var de=le.align.length,De;for(De=0;De<de;De++)/^ *-+: *$/.test(le.align[De])?le.align[De]="right":/^ *:-+: *$/.test(le.align[De])?le.align[De]="center":/^ *:-+ *$/.test(le.align[De])?le.align[De]="left":le.align[De]=null;for(de=le.cells.length,De=0;De<de;De++)le.cells[De]=Y(le.cells[De],le.header.length);return le}}},pe.hr=function(re){var oe=this.rules.block.hr.exec(re);if(oe)return{type:"hr",raw:oe[0]}},pe.blockquote=function(re){var oe=this.rules.block.blockquote.exec(re);if(oe){var le=oe[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:oe[0],text:le}}},pe.list=function(re){var oe=this.rules.block.list.exec(re);if(oe){for(var le=oe[0],de=oe[2],De=de.length>1,Me=de[de.length-1]===")",Ye={type:"list",raw:le,ordered:De,start:De?+de.slice(0,-1):"",loose:!1,items:[]},yt=oe[0].match(this.rules.block.item),At=!1,Ke,xt,mt,ot,Rt,Lt,Kt,Bt=yt.length,wt=0;wt<Bt;wt++)Ke=yt[wt],le=Ke,xt=Ke.length,Ke=Ke.replace(/^ *([*+-]|\d+[.)]) */,""),~Ke.indexOf(`
`)&&(xt-=Ke.length,Ke=this.options.pedantic?Ke.replace(/^ {1,4}/gm,""):Ke.replace(new RegExp("^ {1,"+xt+"}","gm"),"")),wt!==Bt-1&&(mt=this.rules.block.bullet.exec(yt[wt+1])[0],(De?mt.length===1||!Me&&mt[mt.length-1]===")":mt.length>1||this.options.smartLists&&mt!==de)&&(ot=yt.slice(wt+1).join(`
`),Ye.raw=Ye.raw.substring(0,Ye.raw.length-ot.length),wt=Bt-1)),Rt=At||/\n\n(?!\s*$)/.test(Ke),wt!==Bt-1&&(At=Ke.charAt(Ke.length-1)===`
`,Rt||(Rt=At)),Rt&&(Ye.loose=!0),Lt=/^\[[ xX]\] /.test(Ke),Kt=void 0,Lt&&(Kt=Ke[1]!==" ",Ke=Ke.replace(/^\[[ xX]\] +/,"")),Ye.items.push({type:"list_item",raw:le,task:Lt,checked:Kt,loose:Rt,text:Ke});return Ye}},pe.html=function(re){var oe=this.rules.block.html.exec(re);if(oe)return{type:this.options.sanitize?"paragraph":"html",raw:oe[0],pre:!this.options.sanitizer&&(oe[1]==="pre"||oe[1]==="script"||oe[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(oe[0]):q(oe[0]):oe[0]}},pe.def=function(re){var oe=this.rules.block.def.exec(re);if(oe){oe[3]&&(oe[3]=oe[3].substring(1,oe[3].length-1));var le=oe[1].toLowerCase().replace(/\s+/g," ");return{tag:le,raw:oe[0],href:oe[2],title:oe[3]}}},pe.table=function(re){var oe=this.rules.block.table.exec(re);if(oe){var le={type:"table",header:Y(oe[1].replace(/^ *| *\| *$/g,"")),align:oe[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:oe[3]?oe[3].replace(/\n$/,"").split(`
`):[]};if(le.header.length===le.align.length){le.raw=oe[0];var de=le.align.length,De;for(De=0;De<de;De++)/^ *-+: *$/.test(le.align[De])?le.align[De]="right":/^ *:-+: *$/.test(le.align[De])?le.align[De]="center":/^ *:-+ *$/.test(le.align[De])?le.align[De]="left":le.align[De]=null;for(de=le.cells.length,De=0;De<de;De++)le.cells[De]=Y(le.cells[De].replace(/^ *\| *| *\| *$/g,""),le.header.length);return le}}},pe.lheading=function(re){var oe=this.rules.block.lheading.exec(re);if(oe)return{type:"heading",raw:oe[0],depth:oe[2].charAt(0)==="="?1:2,text:oe[1]}},pe.paragraph=function(re){var oe=this.rules.block.paragraph.exec(re);if(oe)return{type:"paragraph",raw:oe[0],text:oe[1].charAt(oe[1].length-1)===`
`?oe[1].slice(0,-1):oe[1]}},pe.text=function(re,oe){var le=this.rules.block.text.exec(re);if(le){var de=oe[oe.length-1];return de&&de.type==="text"?{raw:le[0],text:le[0]}:{type:"text",raw:le[0],text:le[0]}}},pe.escape=function(re){var oe=this.rules.inline.escape.exec(re);if(oe)return{type:"escape",raw:oe[0],text:q(oe[1])}},pe.tag=function(re,oe,le){var de=this.rules.inline.tag.exec(re);if(de)return!oe&&/^<a /i.test(de[0])?oe=!0:oe&&/^<\/a>/i.test(de[0])&&(oe=!1),!le&&/^<(pre|code|kbd|script)(\s|>)/i.test(de[0])?le=!0:le&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(de[0])&&(le=!1),{type:this.options.sanitize?"text":"html",raw:de[0],inLink:oe,inRawBlock:le,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(de[0]):q(de[0]):de[0]}},pe.link=function(re){var oe=this.rules.inline.link.exec(re);if(oe){var le=ae(oe[2],"()");if(le>-1){var de=oe[0].indexOf("!")===0?5:4,De=de+oe[1].length+le;oe[2]=oe[2].substring(0,le),oe[0]=oe[0].substring(0,De).trim(),oe[3]=""}var Me=oe[2],Ye="";if(this.options.pedantic){var yt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Me);yt?(Me=yt[1],Ye=yt[3]):Ye=""}else Ye=oe[3]?oe[3].slice(1,-1):"";Me=Me.trim().replace(/^<([\s\S]*)>$/,"$1");var At=he(oe,{href:Me&&Me.replace(this.rules.inline._escapes,"$1"),title:Ye&&Ye.replace(this.rules.inline._escapes,"$1")},oe[0]);return At}},pe.reflink=function(re,oe){var le;if((le=this.rules.inline.reflink.exec(re))||(le=this.rules.inline.nolink.exec(re))){var de=(le[2]||le[1]).replace(/\s+/g," ");if(de=oe[de.toLowerCase()],!de||!de.href){var De=le[0].charAt(0);return{type:"text",raw:De,text:De}}var Me=he(le,de,le[0]);return Me}},pe.strong=function(re,oe,le){le===void 0&&(le="");var de=this.rules.inline.strong.start.exec(re);if(de&&(!de[1]||de[1]&&(le===""||this.rules.inline.punctuation.exec(le)))){oe=oe.slice(-1*re.length);var De=de[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;De.lastIndex=0;for(var Me;(de=De.exec(oe))!=null;)if(Me=this.rules.inline.strong.middle.exec(oe.slice(0,de.index+3)),Me)return{type:"strong",raw:re.slice(0,Me[0].length),text:re.slice(2,Me[0].length-2)}}},pe.em=function(re,oe,le){le===void 0&&(le="");var de=this.rules.inline.em.start.exec(re);if(de&&(!de[1]||de[1]&&(le===""||this.rules.inline.punctuation.exec(le)))){oe=oe.slice(-1*re.length);var De=de[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;De.lastIndex=0;for(var Me;(de=De.exec(oe))!=null;)if(Me=this.rules.inline.em.middle.exec(oe.slice(0,de.index+2)),Me)return{type:"em",raw:re.slice(0,Me[0].length),text:re.slice(1,Me[0].length-1)}}},pe.codespan=function(re){var oe=this.rules.inline.code.exec(re);if(oe){var le=oe[2].replace(/\n/g," "),de=/[^ ]/.test(le),De=le.startsWith(" ")&&le.endsWith(" ");return de&&De&&(le=le.substring(1,le.length-1)),le=q(le,!0),{type:"codespan",raw:oe[0],text:le}}},pe.br=function(re){var oe=this.rules.inline.br.exec(re);if(oe)return{type:"br",raw:oe[0]}},pe.del=function(re){var oe=this.rules.inline.del.exec(re);if(oe)return{type:"del",raw:oe[0],text:oe[1]}},pe.autolink=function(re,oe){var le=this.rules.inline.autolink.exec(re);if(le){var de,De;return le[2]==="@"?(de=q(this.options.mangle?oe(le[1]):le[1]),De="mailto:"+de):(de=q(le[1]),De=de),{type:"link",raw:le[0],text:de,href:De,tokens:[{type:"text",raw:de,text:de}]}}},pe.url=function(re,oe){var le;if(le=this.rules.inline.url.exec(re)){var de,De;if(le[2]==="@")de=q(this.options.mangle?oe(le[0]):le[0]),De="mailto:"+de;else{var Me;do Me=le[0],le[0]=this.rules.inline._backpedal.exec(le[0])[0];while(Me!==le[0]);de=q(le[0]),le[1]==="www."?De="http://"+de:De=de}return{type:"link",raw:le[0],text:de,href:De,tokens:[{type:"text",raw:de,text:de}]}}},pe.inlineText=function(re,oe,le){var de=this.rules.inline.text.exec(re);if(de){var De;return oe?De=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(de[0]):q(de[0]):de[0]:De=q(this.options.smartypants?le(de[0]):de[0]),{type:"text",raw:de[0],text:De}}},Se}(),Ce=K.noopTest,Te=K.edit,Ee=K.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:Ce,table:Ce,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=Te(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=Te(me.item,"gm").replace(/bull/g,me.bullet).getRegex(),me.list=Te(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=Te(me.html,"i").replace("comment",me._comment).replace("tag",me._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),me.paragraph=Te(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=Te(me.blockquote).replace("paragraph",me.paragraph).getRegex(),me.normal=Ee({},me),me.gfm=Ee({},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=Te(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=Te(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=Ee({},me.normal,{html:Te(`^ *(?: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:Ce,paragraph:Te(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:Ce,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:Ce,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};ue._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",ue.punctuation=Te(ue.punctuation).replace(/punctuation/g,ue._punctuation).getRegex(),ue._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",ue._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",ue.em.start=Te(ue.em.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.middle=Te(ue.em.middle).replace(/punctuation/g,ue._punctuation).replace(/overlapSkip/g,ue._overlapSkip).getRegex(),ue.em.endAst=Te(ue.em.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.endUnd=Te(ue.em.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.start=Te(ue.strong.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.middle=Te(ue.strong.middle).replace(/punctuation/g,ue._punctuation).replace(/blockSkip/g,ue._blockSkip).getRegex(),ue.strong.endAst=Te(ue.strong.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.endUnd=Te(ue.strong.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.blockSkip=Te(ue._blockSkip,"g").getRegex(),ue.overlapSkip=Te(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=Te(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=Te(ue.tag).replace("comment",me._comment).replace("attribute",ue._attribute).getRegex(),ue._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ue._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,ue._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,ue.link=Te(ue.link).replace("label",ue._label).replace("href",ue._href).replace("title",ue._title).getRegex(),ue.reflink=Te(ue.reflink).replace("label",ue._label).getRegex(),ue.reflinkSearch=Te(ue.reflinkSearch,"g").replace("reflink",ue.reflink).replace("nolink",ue.nolink).getRegex(),ue.normal=Ee({},ue),ue.pedantic=Ee({},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:Te(/^!?\[(label)\]\((.*?)\)/).replace("label",ue._label).getRegex(),reflink:Te(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ue._label).getRegex()}),ue.gfm=Ee({},ue.normal,{escape:Te(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=Te(ue.gfm.url,"i").replace("email",ue.gfm._extended_email).getRegex(),ue.breaks=Ee({},ue.gfm,{br:Te(ue.br).replace("{2,}","*").getRegex(),text:Te(ue.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var te={block:me,inline:ue},ce=W.defaults,se=te.block,we=te.inline;function Le(Se){return Se.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 xe(Se){var pe="",ye,re,oe=Se.length;for(ye=0;ye<oe;ye++)re=Se.charCodeAt(ye),Math.random()>.5&&(re="x"+re.toString(16)),pe+="&#"+re+";";return pe}var Pe=function(){function Se(ye){this.tokens=[],this.tokens.links=Object.create(null),this.options=ye||ce,this.options.tokenizer=this.options.tokenizer||new be,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var re={block:se.normal,inline:we.normal};this.options.pedantic?(re.block=se.pedantic,re.inline=we.pedantic):this.options.gfm&&(re.block=se.gfm,this.options.breaks?re.inline=we.breaks:re.inline=we.gfm),this.tokenizer.rules=re}Se.lex=function(re,oe){var le=new Se(oe);return le.lex(re)};var pe=Se.prototype;return pe.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},pe.blockTokens=function(re,oe,le){oe===void 0&&(oe=[]),le===void 0&&(le=!0),re=re.replace(/^ +$/gm,"");for(var de,De,Me,Ye;re;){if(de=this.tokenizer.space(re)){re=re.substring(de.raw.length),de.type&&oe.push(de);continue}if(de=this.tokenizer.code(re,oe)){re=re.substring(de.raw.length),de.type?oe.push(de):(Ye=oe[oe.length-1],Ye.raw+=`
`+de.raw,Ye.text+=`
`+de.text);continue}if(de=this.tokenizer.fences(re)){re=re.substring(de.raw.length),oe.push(de);continue}if(de=this.tokenizer.heading(re)){re=re.substring(de.raw.length),oe.push(de);continue}if(de=this.tokenizer.nptable(re)){re=re.substring(de.raw.length),oe.push(de);continue}if(de=this.tokenizer.hr(re)){re=re.substring(de.raw.length),oe.push(de);continue}if(de=this.tokenizer.blockquote(re)){re=re.substring(de.raw.length),de.tokens=this.blockTokens(de.text,[],le),oe.push(de);continue}if(de=this.tokenizer.list(re)){for(re=re.substring(de.raw.length),Me=de.items.length,De=0;De<Me;De++)de.items[De].tokens=this.blockTokens(de.items[De].text,[],!1);oe.push(de);continue}if(de=this.tokenizer.html(re)){re=re.substring(de.raw.length),oe.push(de);continue}if(le&&(de=this.tokenizer.def(re))){re=re.substring(de.raw.length),this.tokens.links[de.tag]||(this.tokens.links[de.tag]={href:de.href,title:de.title});continue}if(de=this.tokenizer.table(re)){re=re.substring(de.raw.length),oe.push(de);continue}if(de=this.tokenizer.lheading(re)){re=re.substring(de.raw.length),oe.push(de);continue}if(le&&(de=this.tokenizer.paragraph(re))){re=re.substring(de.raw.length),oe.push(de);continue}if(de=this.tokenizer.text(re,oe)){re=re.substring(de.raw.length),de.type?oe.push(de):(Ye=oe[oe.length-1],Ye.raw+=`
`+de.raw,Ye.text+=`
`+de.text);continue}if(re){var yt="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(yt);break}else throw new Error(yt)}}return oe},pe.inline=function(re){var oe,le,de,De,Me,Ye,yt=re.length;for(oe=0;oe<yt;oe++){Ye=re[oe];switch(Ye.type){case"paragraph":case"text":case"heading":{Ye.tokens=[],this.inlineTokens(Ye.text,Ye.tokens);break}case"table":{for(Ye.tokens={header:[],cells:[]},De=Ye.header.length,le=0;le<De;le++)Ye.tokens.header[le]=[],this.inlineTokens(Ye.header[le],Ye.tokens.header[le]);for(De=Ye.cells.length,le=0;le<De;le++)for(Me=Ye.cells[le],Ye.tokens.cells[le]=[],de=0;de<Me.length;de++)Ye.tokens.cells[le][de]=[],this.inlineTokens(Me[de],Ye.tokens.cells[le][de]);break}case"blockquote":{this.inline(Ye.tokens);break}case"list":{for(De=Ye.items.length,le=0;le<De;le++)this.inline(Ye.items[le].tokens);break}}}return re},pe.inlineTokens=function(re,oe,le,de,De){oe===void 0&&(oe=[]),le===void 0&&(le=!1),de===void 0&&(de=!1),De===void 0&&(De="");var Me,Ye=re,yt;if(this.tokens.links){var At=Object.keys(this.tokens.links);if(At.length>0)for(;(yt=this.tokenizer.rules.inline.reflinkSearch.exec(Ye))!=null;)At.includes(yt[0].slice(yt[0].lastIndexOf("[")+1,-1))&&(Ye=Ye.slice(0,yt.index)+"["+"a".repeat(yt[0].length-2)+"]"+Ye.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(yt=this.tokenizer.rules.inline.blockSkip.exec(Ye))!=null;)Ye=Ye.slice(0,yt.index)+"["+"a".repeat(yt[0].length-2)+"]"+Ye.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;re;){if(Me=this.tokenizer.escape(re)){re=re.substring(Me.raw.length),oe.push(Me);continue}if(Me=this.tokenizer.tag(re,le,de)){re=re.substring(Me.raw.length),le=Me.inLink,de=Me.inRawBlock,oe.push(Me);continue}if(Me=this.tokenizer.link(re)){re=re.substring(Me.raw.length),Me.type==="link"&&(Me.tokens=this.inlineTokens(Me.text,[],!0,de)),oe.push(Me);continue}if(Me=this.tokenizer.reflink(re,this.tokens.links)){re=re.substring(Me.raw.length),Me.type==="link"&&(Me.tokens=this.inlineTokens(Me.text,[],!0,de)),oe.push(Me);continue}if(Me=this.tokenizer.strong(re,Ye,De)){re=re.substring(Me.raw.length),Me.tokens=this.inlineTokens(Me.text,[],le,de),oe.push(Me);continue}if(Me=this.tokenizer.em(re,Ye,De)){re=re.substring(Me.raw.length),Me.tokens=this.inlineTokens(Me.text,[],le,de),oe.push(Me);continue}if(Me=this.tokenizer.codespan(re)){re=re.substring(Me.raw.length),oe.push(Me);continue}if(Me=this.tokenizer.br(re)){re=re.substring(Me.raw.length),oe.push(Me);continue}if(Me=this.tokenizer.del(re)){re=re.substring(Me.raw.length),Me.tokens=this.inlineTokens(Me.text,[],le,de),oe.push(Me);continue}if(Me=this.tokenizer.autolink(re,xe)){re=re.substring(Me.raw.length),oe.push(Me);continue}if(!le&&(Me=this.tokenizer.url(re,xe))){re=re.substring(Me.raw.length),oe.push(Me);continue}if(Me=this.tokenizer.inlineText(re,de,Le)){re=re.substring(Me.raw.length),De=Me.raw.slice(-1),oe.push(Me);continue}if(re){var Ke="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(Ke);break}else throw new Error(Ke)}}return oe},$(Se,null,[{key:"rules",get:function(){return{block:se,inline:we}}}]),Se}(),Ne=W.defaults,Be=K.cleanUrl,We=K.escape,Ue=function(){function Se(ye){this.options=ye||Ne}var pe=Se.prototype;return pe.code=function(re,oe,le){var de=(oe||"").match(/\S*/)[0];if(this.options.highlight){var De=this.options.highlight(re,de);De!=null&&De!==re&&(le=!0,re=De)}return de?'<pre><code class="'+this.options.langPrefix+We(de,!0)+'">'+(le?re:We(re,!0))+`</code></pre>
`:"<pre><code>"+(le?re:We(re,!0))+`</code></pre>
`},pe.blockquote=function(re){return`<blockquote>
`+re+`</blockquote>
`},pe.html=function(re){return re},pe.heading=function(re,oe,le,de){return this.options.headerIds?"<h"+oe+' id="'+this.options.headerPrefix+de.slug(le)+'">'+re+"</h"+oe+`>
`:"<h"+oe+">"+re+"</h"+oe+`>
`},pe.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},pe.list=function(re,oe,le){var de=oe?"ol":"ul",De=oe&&le!==1?' start="'+le+'"':"";return"<"+de+De+`>
`+re+"</"+de+`>
`},pe.listitem=function(re){return"<li>"+re+`</li>
`},pe.checkbox=function(re){return"<input "+(re?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},pe.paragraph=function(re){return"<p>"+re+`</p>
`},pe.table=function(re,oe){return oe&&(oe="<tbody>"+oe+"</tbody>"),`<table>
<thead>
`+re+`</thead>
`+oe+`</table>
`},pe.tablerow=function(re){return`<tr>
`+re+`</tr>
`},pe.tablecell=function(re,oe){var le=oe.header?"th":"td",de=oe.align?"<"+le+' align="'+oe.align+'">':"<"+le+">";return de+re+"</"+le+`>
`},pe.strong=function(re){return"<strong>"+re+"</strong>"},pe.em=function(re){return"<em>"+re+"</em>"},pe.codespan=function(re){return"<code>"+re+"</code>"},pe.br=function(){return this.options.xhtml?"<br/>":"<br>"},pe.del=function(re){return"<del>"+re+"</del>"},pe.link=function(re,oe,le){if(re=Be(this.options.sanitize,this.options.baseUrl,re),re===null)return le;var de='<a href="'+We(re)+'"';return oe&&(de+=' title="'+oe+'"'),de+=">"+le+"</a>",de},pe.image=function(re,oe,le){if(re=Be(this.options.sanitize,this.options.baseUrl,re),re===null)return le;var de='<img src="'+re+'" alt="'+le+'"';return oe&&(de+=' title="'+oe+'"'),de+=this.options.xhtml?"/>":">",de},pe.text=function(re){return re},Se}(),Fe=function(){function Se(){}var pe=Se.prototype;return pe.strong=function(re){return re},pe.em=function(re){return re},pe.codespan=function(re){return re},pe.del=function(re){return re},pe.html=function(re){return re},pe.text=function(re){return re},pe.link=function(re,oe,le){return""+le},pe.image=function(re,oe,le){return""+le},pe.br=function(){return""},Se}(),at=function(){function Se(){this.seen={}}var pe=Se.prototype;return pe.slug=function(re){var oe=re.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(oe)){var le=oe;do this.seen[le]++,oe=le+"-"+this.seen[le];while(this.seen.hasOwnProperty(oe))}return this.seen[oe]=0,oe},Se}(),it=W.defaults,et=K.unescape,Ze=function(){function Se(ye){this.options=ye||it,this.options.renderer=this.options.renderer||new Ue,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Fe,this.slugger=new at}Se.parse=function(re,oe){var le=new Se(oe);return le.parse(re)};var pe=Se.prototype;return pe.parse=function(re,oe){oe===void 0&&(oe=!0);var le="",de,De,Me,Ye,yt,At,Ke,xt,mt,ot,Rt,Lt,Kt,Bt,wt,yr,ir,gt,Gr=re.length;for(de=0;de<Gr;de++){ot=re[de];switch(ot.type){case"space":continue;case"hr":{le+=this.renderer.hr();continue}case"heading":{le+=this.renderer.heading(this.parseInline(ot.tokens),ot.depth,et(this.parseInline(ot.tokens,this.textRenderer)),this.slugger);continue}case"code":{le+=this.renderer.code(ot.text,ot.lang,ot.escaped);continue}case"table":{for(xt="",Ke="",Ye=ot.header.length,De=0;De<Ye;De++)Ke+=this.renderer.tablecell(this.parseInline(ot.tokens.header[De]),{header:!0,align:ot.align[De]});for(xt+=this.renderer.tablerow(Ke),mt="",Ye=ot.cells.length,De=0;De<Ye;De++){for(At=ot.tokens.cells[De],Ke="",yt=At.length,Me=0;Me<yt;Me++)Ke+=this.renderer.tablecell(this.parseInline(At[Me]),{header:!1,align:ot.align[Me]});mt+=this.renderer.tablerow(Ke)}le+=this.renderer.table(xt,mt);continue}case"blockquote":{mt=this.parse(ot.tokens),le+=this.renderer.blockquote(mt);continue}case"list":{for(Rt=ot.ordered,Lt=ot.start,Kt=ot.loose,Ye=ot.items.length,mt="",De=0;De<Ye;De++)wt=ot.items[De],yr=wt.checked,ir=wt.task,Bt="",wt.task&&(gt=this.renderer.checkbox(yr),Kt?wt.tokens.length>0&&wt.tokens[0].type==="text"?(wt.tokens[0].text=gt+" "+wt.tokens[0].text,wt.tokens[0].tokens&&wt.tokens[0].tokens.length>0&&wt.tokens[0].tokens[0].type==="text"&&(wt.tokens[0].tokens[0].text=gt+" "+wt.tokens[0].tokens[0].text)):wt.tokens.unshift({type:"text",text:gt}):Bt+=gt),Bt+=this.parse(wt.tokens,Kt),mt+=this.renderer.listitem(Bt,ir,yr);le+=this.renderer.list(mt,Rt,Lt);continue}case"html":{le+=this.renderer.html(ot.text);continue}case"paragraph":{le+=this.renderer.paragraph(this.parseInline(ot.tokens));continue}case"text":{for(mt=ot.tokens?this.parseInline(ot.tokens):ot.text;de+1<Gr&&re[de+1].type==="text";)ot=re[++de],mt+=`
`+(ot.tokens?this.parseInline(ot.tokens):ot.text);le+=oe?this.renderer.paragraph(mt):mt;continue}default:{var br='Token with "'+ot.type+'" type was not found.';if(this.options.silent){console.error(br);return}else throw new Error(br)}}}return le},pe.parseInline=function(re,oe){oe=oe||this.renderer;var le="",de,De,Me=re.length;for(de=0;de<Me;de++){De=re[de];switch(De.type){case"escape":{le+=oe.text(De.text);break}case"html":{le+=oe.html(De.text);break}case"link":{le+=oe.link(De.href,De.title,this.parseInline(De.tokens,oe));break}case"image":{le+=oe.image(De.href,De.title,De.text);break}case"strong":{le+=oe.strong(this.parseInline(De.tokens,oe));break}case"em":{le+=oe.em(this.parseInline(De.tokens,oe));break}case"codespan":{le+=oe.codespan(De.text);break}case"br":{le+=oe.br();break}case"del":{le+=oe.del(this.parseInline(De.tokens,oe));break}case"text":{le+=oe.text(De.text);break}default:{var Ye='Token with "'+De.type+'" type was not found.';if(this.options.silent){console.error(Ye);return}else throw new Error(Ye)}}}return le},Se}(),ut=K.merge,Je=K.checkSanitizeDeprecation,st=K.escape,Re=W.getDefaults,nt=W.changeDefaults,qe=W.defaults;function Ie(Se,pe,ye){if(typeof Se=="undefined"||Se===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Se!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Se)+", string expected");if(typeof pe=="function"&&(ye=pe,pe=null),pe=ut({},Ie.defaults,pe||{}),Je(pe),ye){var re=pe.highlight,oe;try{oe=Pe.lex(Se,pe)}catch(Me){return ye(Me)}var le=function(Ye){var yt;if(!Ye)try{yt=Ze.parse(oe,pe)}catch(At){Ye=At}return pe.highlight=re,Ye?ye(Ye):ye(null,yt)};if(!re||re.length<3)return le();if(delete pe.highlight,!oe.length)return le();var de=0;Ie.walkTokens(oe,function(Me){Me.type==="code"&&(de++,setTimeout(function(){re(Me.text,Me.lang,function(Ye,yt){if(Ye)return le(Ye);yt!=null&&yt!==Me.text&&(Me.text=yt,Me.escaped=!0),de--,de===0&&le()})},0))}),de===0&&le();return}try{var De=Pe.lex(Se,pe);return pe.walkTokens&&Ie.walkTokens(De,pe.walkTokens),Ze.parse(De,pe)}catch(Me){if(Me.message+=`
Please report this to https://github.com/markedjs/marked.`,pe.silent)return"<p>An error occurred:</p><pre>"+st(Me.message+"",!0)+"</pre>";throw Me}}Ie.options=Ie.setOptions=function(Se){return ut(Ie.defaults,Se),nt(Ie.defaults),Ie},Ie.getDefaults=Re,Ie.defaults=qe,Ie.use=function(Se){var pe=ut({},Se);if(Se.renderer&&function(){var re=Ie.defaults.renderer||new Ue,oe=function(De){var Me=re[De];re[De]=function(){for(var Ye=arguments.length,yt=new Array(Ye),At=0;At<Ye;At++)yt[At]=arguments[At];var Ke=Se.renderer[De].apply(re,yt);return Ke===!1&&(Ke=Me.apply(re,yt)),Ke}};for(var le in Se.renderer)oe(le);pe.renderer=re}(),Se.tokenizer&&function(){var re=Ie.defaults.tokenizer||new be,oe=function(De){var Me=re[De];re[De]=function(){for(var Ye=arguments.length,yt=new Array(Ye),At=0;At<Ye;At++)yt[At]=arguments[At];var Ke=Se.tokenizer[De].apply(re,yt);return Ke===!1&&(Ke=Me.apply(re,yt)),Ke}};for(var le in Se.tokenizer)oe(le);pe.tokenizer=re}(),Se.walkTokens){var ye=Ie.defaults.walkTokens;pe.walkTokens=function(re){Se.walkTokens(re),ye&&ye(re)}}Ie.setOptions(pe)},Ie.walkTokens=function(Se,pe){for(var ye=U(Se),re;!(re=ye()).done;){var oe=re.value;pe(oe);switch(oe.type){case"table":{for(var le=U(oe.tokens.header),de;!(de=le()).done;){var De=de.value;Ie.walkTokens(De,pe)}for(var Me=U(oe.tokens.cells),Ye;!(Ye=Me()).done;)for(var yt=Ye.value,At=U(yt),Ke;!(Ke=At()).done;){var xt=Ke.value;Ie.walkTokens(xt,pe)}break}case"list":{Ie.walkTokens(oe.items,pe);break}default:oe.tokens&&Ie.walkTokens(oe.tokens,pe)}}},Ie.Parser=Ze,Ie.parser=Ze.parse,Ie.Renderer=Ue,Ie.TextRenderer=Fe,Ie.Lexer=Pe,Ie.lexer=Pe.lex,Ie.Tokenizer=be,Ie.Slugger=at,Ie.parse=Ie;var He=Ie;return He})},ELLl:function(lt,$e,ie){(function(ne){ne(ie("VrN/"))})(function(ne){var $={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},k=ne.Pos;ne.defineOption("autoCloseBrackets",!1,function(S,T,d){d&&d!=ne.Init&&(S.removeKeyMap(U),S.state.closeBrackets=null),T&&(O(X(T,"pairs")),S.state.closeBrackets=T,S.addKeyMap(U))});function X(S,T){return T=="pairs"&&typeof S=="string"?S:typeof S=="object"&&S[T]!=null?S[T]:$[T]}var U={Backspace:P,Enter:w};function O(S){for(var T=0;T<S.length;T++){var d=S.charAt(T),a="'"+d+"'";U[a]||(U[a]=W(d))}}O($.pairs+"`");function W(S){return function(T){return b(T,S)}}function F(S){var T=S.state.closeBrackets;if(!T||T.override)return T;var d=S.getModeAt(S.getCursor());return d.closeBrackets||T}function P(S){var T=F(S);if(!T||S.getOption("disableInput"))return ne.Pass;for(var d=X(T,"pairs"),a=S.listSelections(),s=0;s<a.length;s++){if(!a[s].empty())return ne.Pass;var u=M(S,a[s].head);if(!u||d.indexOf(u)%2!=0)return ne.Pass}for(var s=a.length-1;s>=0;s--){var _=a[s].head;S.replaceRange("",k(_.line,_.ch-1),k(_.line,_.ch+1),"+delete")}}function w(S){var T=F(S),d=T&&X(T,"explode");if(!d||S.getOption("disableInput"))return ne.Pass;for(var a=S.listSelections(),s=0;s<a.length;s++){if(!a[s].empty())return ne.Pass;var u=M(S,a[s].head);if(!u||d.indexOf(u)%2!=0)return ne.Pass}S.operation(function(){var _=S.lineSeparator()||`
`;S.replaceSelection(_+_,null),S.execCommand("goCharLeft"),a=S.listSelections();for(var m=0;m<a.length;m++){var p=a[m].head.line;S.indentLine(p,null,!0),S.indentLine(p+1,null,!0)}})}function f(S){var T=ne.cmpPos(S.anchor,S.head)>0;return{anchor:new k(S.anchor.line,S.anchor.ch+(T?-1:1)),head:new k(S.head.line,S.head.ch+(T?1:-1))}}function b(S,T){var d=F(S);if(!d||S.getOption("disableInput"))return ne.Pass;var a=X(d,"pairs"),s=a.indexOf(T);if(s==-1)return ne.Pass;for(var u=X(d,"closeBefore"),_=X(d,"triples"),m=a.charAt(s+1)==T,p=S.listSelections(),D=s%2==0,E,g=0;g<p.length;g++){var c=p[g],h=c.head,o,C=S.getRange(h,k(h.line,h.ch+1));if(D&&!c.empty())o="surround";else if((m||!D)&&C==T)m&&A(S,h)?o="both":_.indexOf(T)>=0&&S.getRange(h,k(h.line,h.ch+3))==T+T+T?o="skipThree":o="skip";else if(m&&h.ch>1&&_.indexOf(T)>=0&&S.getRange(k(h.line,h.ch-2),h)==T+T){if(h.ch>2&&/\bstring/.test(S.getTokenTypeAt(k(h.line,h.ch-2))))return ne.Pass;o="addFour"}else if(m){var x=h.ch==0?" ":S.getRange(k(h.line,h.ch-1),h);if(!ne.isWordChar(C)&&x!=T&&!ne.isWordChar(x))o="both";else return ne.Pass}else if(D&&(C.length===0||/\s/.test(C)||u.indexOf(C)>-1))o="both";else return ne.Pass;if(!E)E=o;else if(E!=o)return ne.Pass}var v=s%2?a.charAt(s-1):T,R=s%2?T:a.charAt(s+1);S.operation(function(){if(E=="skip")S.execCommand("goCharRight");else if(E=="skipThree")for(var B=0;B<3;B++)S.execCommand("goCharRight");else if(E=="surround"){for(var j=S.getSelections(),B=0;B<j.length;B++)j[B]=v+j[B]+R;S.replaceSelections(j,"around"),j=S.listSelections().slice();for(var B=0;B<j.length;B++)j[B]=f(j[B]);S.setSelections(j)}else E=="both"?(S.replaceSelection(v+R,null),S.triggerElectric(v+R),S.execCommand("goCharLeft")):E=="addFour"&&(S.replaceSelection(v+v+v+v,"before"),S.execCommand("goCharRight"))})}function M(S,T){var d=S.getRange(k(T.line,T.ch-1),k(T.line,T.ch+1));return d.length==2?d:null}function A(S,T){var d=S.getTokenAt(k(T.line,T.ch+1));return/\bstring/.test(d.type)&&d.start==T.ch&&(T.ch==0||!/\bstring/.test(S.getTokenTypeAt(T)))}})},GfqC:function(lt,$e,ie){"use strict";var ne=ie("q1tI"),$=ie.n(ne),k=ie("TSYQ"),X=ie.n(k);function U(K,I){var N="cannot "+K.method+" "+K.action+" "+I.status+"'",Y=new Error(N);return Y.status=I.status,Y.method=K.method,Y.url=K.action,Y}function O(K){var I=K.responseText||K.response;if(!I)return I;try{return JSON.parse(I)}catch(N){return I}}function W(K){var I=new XMLHttpRequest;K.onProgress&&I.upload&&(I.upload.onprogress=function(ae){ae.total>0&&(ae.percent=ae.loaded/ae.total*100),K.onProgress(ae)});var N=new FormData;K.data&&Object.keys(K.data).forEach(function(q){var ae=K.data[q];if(Array.isArray(ae)){ae.forEach(function(he){N.append(q+"[]",he)});return}N.append(q,K.data[q])}),K.file instanceof Blob?N.append(K.filename,K.file,K.file.name):N.append(K.filename,K.file),I.onerror=function(ae){K.onError(ae)},I.onload=function(){return I.status<200||I.status>=300?K.onError(U(K,I),O(I)):K.onSuccess(O(I),I)},I.open(K.method,K.action,!0),K.withCredentials&&"withCredentials"in I&&(I.withCredentials=!0);var Y=K.headers||{};return Y["X-Requested-With"]!==null&&I.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(Y).forEach(function(q){Y[q]!==null&&I.setRequestHeader(q,Y[q])}),I.send(N),{abort:function(){I.abort()}}}var F=+new Date,P=0;function w(){return"rc-upload-"+F+"-"+ ++P}function f(K,I){return K.indexOf(I,K.length-I.length)!==-1}var b=function(K,I){if(K&&I){var N=Array.isArray(I)?I:I.split(","),Y=K.name||"",q=K.type||"",ae=q.replace(/\/.*$/,"");return N.some(function(he){var _e=he.trim();return _e.charAt(0)==="."?f(Y.toLowerCase(),_e.toLowerCase()):/\/\*$/.test(_e)?ae===_e.replace(/\/.*$/,""):q===_e})}return!0};function M(K,I){var N=K.createReader(),Y=[];function q(){N.readEntries(function(ae){var he=Array.prototype.slice.apply(ae);Y=Y.concat(he);var _e=!he.length;_e?I(Y):q()})}q()}var A=function(I,N,Y){var q=function ae(he,_e){_e=_e||"",he.isFile?he.file(function(be){Y(be)&&(he.fullPath&&!be.webkitRelativePath&&(Object.defineProperties(be,{webkitRelativePath:{writable:!0}}),be.webkitRelativePath=he.fullPath.replace(/^\//,""),Object.defineProperties(be,{webkitRelativePath:{writable:!1}})),N([be]))}):he.isDirectory&&M(he,function(be){be.forEach(function(Ce){ae(Ce,""+_e+he.name+"/")})})};I.forEach(function(ae){q(ae.webkitGetAsEntry())})},S=A,T=Object.assign||function(K){for(var I=1;I<arguments.length;I++){var N=arguments[I];for(var Y in N)Object.prototype.hasOwnProperty.call(N,Y)&&(K[Y]=N[Y])}return K},d=function(){function K(I,N){var Y=[],q=!0,ae=!1,he=void 0;try{for(var _e=I[Symbol.iterator](),be;!(q=(be=_e.next()).done)&&!(Y.push(be.value),N&&Y.length===N);q=!0);}catch(Ce){ae=!0,he=Ce}finally{try{!q&&_e.return&&_e.return()}finally{if(ae)throw he}}return Y}return function(I,N){if(Array.isArray(I))return I;if(Symbol.iterator in Object(I))return K(I,N);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=function(){function K(I,N){for(var Y=0;Y<N.length;Y++){var q=N[Y];q.enumerable=q.enumerable||!1,q.configurable=!0,"value"in q&&(q.writable=!0),Object.defineProperty(I,q.key,q)}}return function(I,N,Y){return N&&K(I.prototype,N),Y&&K(I,Y),I}}();function s(K,I,N){return I in K?Object.defineProperty(K,I,{value:N,enumerable:!0,configurable:!0,writable:!0}):K[I]=N,K}function u(K,I){var N={};for(var Y in K){if(I.indexOf(Y)>=0)continue;if(!Object.prototype.hasOwnProperty.call(K,Y))continue;N[Y]=K[Y]}return N}function _(K,I){if(!(K instanceof I))throw new TypeError("Cannot call a class as a function")}function m(K,I){if(!K)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I&&(typeof I=="object"||typeof I=="function")?I:K}function p(K,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);K.prototype=Object.create(I&&I.prototype,{constructor:{value:K,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(K,I):K.__proto__=I)}var D=function(I){return Object.keys(I).reduce(function(N,Y){return(Y.substr(0,5)==="data-"||Y.substr(0,5)==="aria-"||Y==="role")&&(N[Y]=I[Y]),N},{})},E=function(K){p(I,K);function I(){var N,Y,q,ae;_(this,I);for(var he=arguments.length,_e=Array(he),be=0;be<he;be++)_e[be]=arguments[be];return ae=(Y=(q=m(this,(N=I.__proto__||Object.getPrototypeOf(I)).call.apply(N,[this].concat(_e))),q),q.state={uid:w()},q.reqs={},q.onChange=function(Ce){var Te=Ce.target.files;q.uploadFiles(Te),q.reset()},q.onClick=function(Ce){var Te=q.fileInput;if(!Te)return;var Ee=q.props,me=Ee.children,ue=Ee.onClick;me&&me.type==="button"&&(Te.parentNode.focus(),Te.parentNode.querySelector("button").blur()),Te.click(),ue&&ue(Ce)},q.onKeyDown=function(Ce){Ce.key==="Enter"&&q.onClick()},q.onFileDrop=function(Ce){var Te=q.props.multiple;if(Ce.preventDefault(),Ce.type==="dragover")return;if(q.props.directory)S(Array.prototype.slice.call(Ce.dataTransfer.items),q.uploadFiles,function(me){return b(me,q.props.accept)});else{var Ee=Array.prototype.slice.call(Ce.dataTransfer.files).filter(function(me){return b(me,q.props.accept)});Te===!1&&(Ee=Ee.slice(0,1)),q.uploadFiles(Ee)}},q.uploadFiles=function(Ce){var Te=Array.prototype.slice.call(Ce);Te.map(function(Ee){return Ee.uid=w(),Ee}).forEach(function(Ee){q.upload(Ee,Te)})},q.saveFileInput=function(Ce){q.fileInput=Ce},Y),m(q,ae)}return a(I,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(Y,q){var ae=this,he=this.props;if(!he.beforeUpload)return setTimeout(function(){return ae.post(Y)},0);var _e=he.beforeUpload(Y,q);_e&&_e.then?_e.then(function(be){var Ce=Object.prototype.toString.call(be);return Ce==="[object File]"||Ce==="[object Blob]"?ae.post(be):ae.post(Y)}).catch(function(be){console.log(be)}):_e!==!1&&setTimeout(function(){return ae.post(Y)},0);return}},{key:"post",value:function(Y){var q=this;if(!this._isMounted)return;var ae=this.props,he=ae.onStart,_e=ae.onProgress,be=ae.transformFile,Ce=be===void 0?function(Te){return Te}:be;new Promise(function(Te){var Ee=ae.action;return typeof Ee=="function"&&(Ee=Ee(Y)),Te(Ee)}).then(function(Te){var Ee=Y.uid,me=ae.customRequest||W,ue=Promise.resolve(Ce(Y)).then(function(te){var ce=ae.data;return typeof ce=="function"&&(ce=ce(te)),Promise.all([te,ce])}).catch(function(te){console.error(te)});ue.then(function(te){var ce=d(te,2),se=ce[0],we=ce[1],Le={action:Te,filename:ae.name,data:we,file:se,headers:ae.headers,withCredentials:ae.withCredentials,method:ae.method||"post",onProgress:_e?function(xe){_e(xe,Y)}:null,onSuccess:function(Pe,Ne){delete q.reqs[Ee],ae.onSuccess(Pe,Y,Ne)},onError:function(Pe,Ne){delete q.reqs[Ee],ae.onError(Pe,Ne,Y)}};he(Y),q.reqs[Ee]=me(Le)})})}},{key:"reset",value:function(){this.setState({uid:w()})}},{key:"abort",value:function(Y){var q=this.reqs;if(Y){var ae=Y;Y&&Y.uid&&(ae=Y.uid),q[ae]&&q[ae].abort&&q[ae].abort(),delete q[ae]}else Object.keys(q).forEach(function(he){q[he]&&q[he].abort&&q[he].abort(),delete q[he]})}},{key:"render",value:function(){var Y,q=this.props,ae=q.component,he=q.prefixCls,_e=q.className,be=q.disabled,Ce=q.id,Te=q.style,Ee=q.multiple,me=q.accept,ue=q.children,te=q.directory,ce=q.openFileDialogOnClick,se=q.onMouseEnter,we=q.onMouseLeave,Le=u(q,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),xe=X()((Y={},s(Y,he,!0),s(Y,he+"-disabled",be),s(Y,_e,_e),Y)),Pe=be?{}:{onClick:ce?this.onClick:function(){},onKeyDown:ce?this.onKeyDown:function(){},onMouseEnter:se,onMouseLeave:we,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return $.a.createElement(ae,T({},Pe,{className:xe,role:"button",style:Te}),$.a.createElement("input",T({},D(Le),{id:Ce,type:"file",ref:this.saveFileInput,onClick:function(Be){return Be.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:me,directory:te?"directory":null,webkitdirectory:te?"webkitdirectory":null,multiple:Ee,onChange:this.onChange})),ue)}}]),I}(ne.Component),g=E,c=Object.assign||function(K){for(var I=1;I<arguments.length;I++){var N=arguments[I];for(var Y in N)Object.prototype.hasOwnProperty.call(N,Y)&&(K[Y]=N[Y])}return K},h=function(){function K(I,N){for(var Y=0;Y<N.length;Y++){var q=N[Y];q.enumerable=q.enumerable||!1,q.configurable=!0,"value"in q&&(q.writable=!0),Object.defineProperty(I,q.key,q)}}return function(I,N,Y){return N&&K(I.prototype,N),Y&&K(I,Y),I}}();function o(K,I){if(!(K instanceof I))throw new TypeError("Cannot call a class as a function")}function C(K,I){if(!K)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I&&(typeof I=="object"||typeof I=="function")?I:K}function x(K,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);K.prototype=Object.create(I&&I.prototype,{constructor:{value:K,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(K,I):K.__proto__=I)}function v(){}var R=function(K){x(I,K);function I(){var N,Y,q,ae;o(this,I);for(var he=arguments.length,_e=Array(he),be=0;be<he;be++)_e[be]=arguments[be];return ae=(Y=(q=C(this,(N=I.__proto__||Object.getPrototypeOf(I)).call.apply(N,[this].concat(_e))),q),q.saveUploader=function(Ce){q.uploader=Ce},Y),C(q,ae)}return h(I,[{key:"abort",value:function(Y){this.uploader.abort(Y)}},{key:"render",value:function(){return $.a.createElement(g,c({},this.props,{ref:this.saveUploader}))}}]),I}(ne.Component);R.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:v,onError:v,onSuccess:v,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var B=R,j=$e.a=B},H38U:function(lt,$e,ie){var ne=ie("f4xo"),$=ie("rcnY"),k=ie("wU8J"),X=ie("Iq15"),U=ie("dWSS");function O(F,P){this.typeNumber=F,this.errorCorrectLevel=P,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var W=O.prototype;W.addData=function(F){var P=new ne(F);this.dataList.push(P),this.dataCache=null},W.isDark=function(F,P){if(F<0||this.moduleCount<=F||P<0||this.moduleCount<=P)throw new Error(F+","+P);return this.modules[F][P]},W.getModuleCount=function(){return this.moduleCount},W.make=function(){if(this.typeNumber<1){var F=1;for(F=1;F<40;F++){for(var P=$.getRSBlocks(F,this.errorCorrectLevel),w=new k,f=0,b=0;b<P.length;b++)f+=P[b].dataCount;for(var b=0;b<this.dataList.length;b++){var M=this.dataList[b];w.put(M.mode,4),w.put(M.getLength(),X.getLengthInBits(M.mode,F)),M.write(w)}if(w.getLengthInBits()<=f*8)break}this.typeNumber=F}this.makeImpl(!1,this.getBestMaskPattern())},W.makeImpl=function(F,P){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var w=0;w<this.moduleCount;w++){this.modules[w]=new Array(this.moduleCount);for(var f=0;f<this.moduleCount;f++)this.modules[w][f]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(F,P),this.typeNumber>=7&&this.setupTypeNumber(F),this.dataCache==null&&(this.dataCache=O.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,P)},W.setupPositionProbePattern=function(F,P){for(var w=-1;w<=7;w++){if(F+w<=-1||this.moduleCount<=F+w)continue;for(var f=-1;f<=7;f++){if(P+f<=-1||this.moduleCount<=P+f)continue;0<=w&&w<=6&&(f==0||f==6)||0<=f&&f<=6&&(w==0||w==6)||2<=w&&w<=4&&2<=f&&f<=4?this.modules[F+w][P+f]=!0:this.modules[F+w][P+f]=!1}}},W.getBestMaskPattern=function(){for(var F=0,P=0,w=0;w<8;w++){this.makeImpl(!0,w);var f=X.getLostPoint(this);(w==0||F>f)&&(F=f,P=w)}return P},W.createMovieClip=function(F,P,w){var f=F.createEmptyMovieClip(P,w),b=1;this.make();for(var M=0;M<this.modules.length;M++)for(var A=M*b,S=0;S<this.modules[M].length;S++){var T=S*b,d=this.modules[M][S];d&&(f.beginFill(0,100),f.moveTo(T,A),f.lineTo(T+b,A),f.lineTo(T+b,A+b),f.lineTo(T,A+b),f.endFill())}return f},W.setupTimingPattern=function(){for(var F=8;F<this.moduleCount-8;F++){if(this.modules[F][6]!=null)continue;this.modules[F][6]=F%2==0}for(var P=8;P<this.moduleCount-8;P++){if(this.modules[6][P]!=null)continue;this.modules[6][P]=P%2==0}},W.setupPositionAdjustPattern=function(){for(var F=X.getPatternPosition(this.typeNumber),P=0;P<F.length;P++)for(var w=0;w<F.length;w++){var f=F[P],b=F[w];if(this.modules[f][b]!=null)continue;for(var M=-2;M<=2;M++)for(var A=-2;A<=2;A++)M==-2||M==2||A==-2||A==2||M==0&&A==0?this.modules[f+M][b+A]=!0:this.modules[f+M][b+A]=!1}},W.setupTypeNumber=function(F){for(var P=X.getBCHTypeNumber(this.typeNumber),w=0;w<18;w++){var f=!F&&(P>>w&1)==1;this.modules[Math.floor(w/3)][w%3+this.moduleCount-8-3]=f}for(var w=0;w<18;w++){var f=!F&&(P>>w&1)==1;this.modules[w%3+this.moduleCount-8-3][Math.floor(w/3)]=f}},W.setupTypeInfo=function(F,P){for(var w=this.errorCorrectLevel<<3|P,f=X.getBCHTypeInfo(w),b=0;b<15;b++){var M=!F&&(f>>b&1)==1;b<6?this.modules[b][8]=M:b<8?this.modules[b+1][8]=M:this.modules[this.moduleCount-15+b][8]=M}for(var b=0;b<15;b++){var M=!F&&(f>>b&1)==1;b<8?this.modules[8][this.moduleCount-b-1]=M:b<9?this.modules[8][15-b-1+1]=M:this.modules[8][15-b-1]=M}this.modules[this.moduleCount-8][8]=!F},W.mapData=function(F,P){for(var w=-1,f=this.moduleCount-1,b=7,M=0,A=this.moduleCount-1;A>0;A-=2)for(A==6&&A--;;){for(var S=0;S<2;S++)if(this.modules[f][A-S]==null){var T=!1;M<F.length&&(T=(F[M]>>>b&1)==1);var d=X.getMask(P,f,A-S);d&&(T=!T),this.modules[f][A-S]=T,b--,b==-1&&(M++,b=7)}if(f+=w,f<0||this.moduleCount<=f){f-=w,w=-w;break}}},O.PAD0=236,O.PAD1=17,O.createData=function(F,P,w){for(var f=$.getRSBlocks(F,P),b=new k,M=0;M<w.length;M++){var A=w[M];b.put(A.mode,4),b.put(A.getLength(),X.getLengthInBits(A.mode,F)),A.write(b)}for(var S=0,M=0;M<f.length;M++)S+=f[M].dataCount;if(b.getLengthInBits()>S*8)throw new Error("code length overflow. ("+b.getLengthInBits()+">"+S*8+")");for(b.getLengthInBits()+4<=S*8&&b.put(0,4);b.getLengthInBits()%8!=0;)b.putBit(!1);for(;!(b.getLengthInBits()>=S*8);){if(b.put(O.PAD0,8),b.getLengthInBits()>=S*8)break;b.put(O.PAD1,8)}return O.createBytes(b,f)},O.createBytes=function(F,P){for(var w=0,f=0,b=0,M=new Array(P.length),A=new Array(P.length),S=0;S<P.length;S++){var T=P[S].dataCount,d=P[S].totalCount-T;f=Math.max(f,T),b=Math.max(b,d),M[S]=new Array(T);for(var a=0;a<M[S].length;a++)M[S][a]=255&F.buffer[a+w];w+=T;var s=X.getErrorCorrectPolynomial(d),u=new U(M[S],s.getLength()-1),_=u.mod(s);A[S]=new Array(s.getLength()-1);for(var a=0;a<A[S].length;a++){var m=a+_.getLength()-A[S].length;A[S][a]=m>=0?_.get(m):0}}for(var p=0,a=0;a<P.length;a++)p+=P[a].totalCount;for(var D=new Array(p),E=0,a=0;a<f;a++)for(var S=0;S<P.length;S++)a<M[S].length&&(D[E++]=M[S][a]);for(var a=0;a<b;a++)for(var S=0;S<P.length;S++)a<A[S].length&&(D[E++]=A[S][a]);return D},lt.exports=O},HmJG:function(lt,$e,ie){},Iq15:function(lt,$e,ie){var ne=ie("nVVt"),$=ie("dWSS"),k=ie("dQei"),X={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},U={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,G18:1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,G15_MASK:1<<14|1<<12|1<<10|1<<4|1<<1,getBCHTypeInfo:function(O){for(var W=O<<10;U.getBCHDigit(W)-U.getBCHDigit(U.G15)>=0;)W^=U.G15<<U.getBCHDigit(W)-U.getBCHDigit(U.G15);return(O<<10|W)^U.G15_MASK},getBCHTypeNumber:function(O){for(var W=O<<12;U.getBCHDigit(W)-U.getBCHDigit(U.G18)>=0;)W^=U.G18<<U.getBCHDigit(W)-U.getBCHDigit(U.G18);return O<<12|W},getBCHDigit:function(O){for(var W=0;O!=0;)W++,O>>>=1;return W},getPatternPosition:function(O){return U.PATTERN_POSITION_TABLE[O-1]},getMask:function(O,W,F){switch(O){case X.PATTERN000:return(W+F)%2==0;case X.PATTERN001:return W%2==0;case X.PATTERN010:return F%3==0;case X.PATTERN011:return(W+F)%3==0;case X.PATTERN100:return(Math.floor(W/2)+Math.floor(F/3))%2==0;case X.PATTERN101:return W*F%2+W*F%3==0;case X.PATTERN110:return(W*F%2+W*F%3)%2==0;case X.PATTERN111:return(W*F%3+(W+F)%2)%2==0;default:throw new Error("bad maskPattern:"+O)}},getErrorCorrectPolynomial:function(O){for(var W=new $([1],0),F=0;F<O;F++)W=W.multiply(new $([1,k.gexp(F)],0));return W},getLengthInBits:function(O,W){if(1<=W&&W<10)switch(O){case ne.MODE_NUMBER:return 10;case ne.MODE_ALPHA_NUM:return 9;case ne.MODE_8BIT_BYTE:return 8;case ne.MODE_KANJI:return 8;default:throw new Error("mode:"+O)}else if(W<27)switch(O){case ne.MODE_NUMBER:return 12;case ne.MODE_ALPHA_NUM:return 11;case ne.MODE_8BIT_BYTE:return 16;case ne.MODE_KANJI:return 10;default:throw new Error("mode:"+O)}else if(W<41)switch(O){case ne.MODE_NUMBER:return 14;case ne.MODE_ALPHA_NUM:return 13;case ne.MODE_8BIT_BYTE:return 16;case ne.MODE_KANJI:return 12;default:throw new Error("mode:"+O)}else throw new Error("type:"+W)},getLostPoint:function(O){for(var W=O.getModuleCount(),F=0,P=0;P<W;P++)for(var w=0;w<W;w++){for(var f=0,b=O.isDark(P,w),M=-1;M<=1;M++){if(P+M<0||W<=P+M)continue;for(var A=-1;A<=1;A++){if(w+A<0||W<=w+A)continue;if(M==0&&A==0)continue;b==O.isDark(P+M,w+A)&&f++}}f>5&&(F+=3+f-5)}for(var P=0;P<W-1;P++)for(var w=0;w<W-1;w++){var S=0;O.isDark(P,w)&&S++,O.isDark(P+1,w)&&S++,O.isDark(P,w+1)&&S++,O.isDark(P+1,w+1)&&S++,(S==0||S==4)&&(F+=3)}for(var P=0;P<W;P++)for(var w=0;w<W-6;w++)O.isDark(P,w)&&!O.isDark(P,w+1)&&O.isDark(P,w+2)&&O.isDark(P,w+3)&&O.isDark(P,w+4)&&!O.isDark(P,w+5)&&O.isDark(P,w+6)&&(F+=40);for(var w=0;w<W;w++)for(var P=0;P<W-6;P++)O.isDark(P,w)&&!O.isDark(P+1,w)&&O.isDark(P+2,w)&&O.isDark(P+3,w)&&O.isDark(P+4,w)&&!O.isDark(P+5,w)&&O.isDark(P+6,w)&&(F+=40);for(var T=0,w=0;w<W;w++)for(var P=0;P<W;P++)O.isDark(P,w)&&T++;var d=Math.abs(100*T/W/W-50)/5;return F+=d*10,F}};lt.exports=U},LdHM:function(lt,$e,ie){"use strict";ie.d($e,"b",function(){return u}),ie.d($e,"a",function(){return m});var ne=ie("1OyB"),$=ie("vuIU"),k=ie("Ji7U"),X=ie("LK+K"),U=ie("q1tI"),O=ie("rePB"),W=ie("Ff2n"),F=ie("ODXe"),P=ie("4IlW"),w=ie("bX4T"),f=ie("YrtM"),b=ie("TSYQ"),M=ie.n(b),A=ie("+nKL"),S=ie("8OUc"),T=function(Y,q){var ae=Y.prefixCls,he=Y.id,_e=Y.flattenOptions,be=Y.childrenAsData,Ce=Y.values,Te=Y.searchValue,Ee=Y.multiple,me=Y.defaultActiveFirstOption,ue=Y.height,te=Y.itemHeight,ce=Y.notFoundContent,se=Y.open,we=Y.menuItemSelectedIcon,Le=Y.virtual,xe=Y.onSelect,Pe=Y.onToggleOpen,Ne=Y.onActiveValue,Be=Y.onScroll,We=Y.onMouseEnter,Ue="".concat(ae,"-item"),Fe=Object(f.a)(function(){return _e},[se,_e],function(He,Se){return Se[0]&&He[1]!==Se[1]}),at=U.useRef(null),it=function(Se){Se.preventDefault()},et=function(Se){at.current&&at.current.scrollTo({index:Se})},Ze=function(Se){for(var pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ye=Fe.length,re=0;re<ye;re+=1){var oe=(Se+re*pe+ye)%ye,le=Fe[oe],de=le.group,De=le.data;if(!de&&!De.disabled)return oe}return-1},ut=U.useState(function(){return Ze(0)}),Je=Object(F.a)(ut,2),st=Je[0],Re=Je[1],nt=function(Se){Re(Se);var pe=Fe[Se];if(!pe){Ne(null,-1);return}Ne(pe.data.value,Se)};U.useEffect(function(){nt(me!==!1?Ze(0):-1)},[Fe.length,Te]),U.useEffect(function(){var He=setTimeout(function(){if(!Ee&&se&&Ce.size===1){var Se=Array.from(Ce)[0],pe=Fe.findIndex(function(ye){var re=ye.data;return re.value===Se});nt(pe),et(pe)}});return function(){return clearTimeout(He)}},[se]);var qe=function(Se){Se!==void 0&&xe(Se,{selected:!Ce.has(Se)}),Ee||Pe(!1)};if(U.useImperativeHandle(q,function(){return{onKeyDown:function(Se){var pe=Se.which;switch(pe){case P.a.UP:case P.a.DOWN:{var ye=0;if(pe===P.a.UP?ye=-1:pe===P.a.DOWN&&(ye=1),ye!==0){var re=Ze(st+ye,ye);et(re),nt(re)}break}case P.a.ENTER:{var oe=Fe[st];oe&&!oe.data.disabled?qe(oe.data.value):qe(void 0),se&&Se.preventDefault();break}case P.a.ESC:Pe(!1)}},onKeyUp:function(){},scrollTo:function(Se){et(Se)}}}),Fe.length===0)return U.createElement("div",{role:"listbox",id:"".concat(he,"_list"),className:"".concat(Ue,"-empty"),onMouseDown:it},ce);function Ie(He){var Se=Fe[He];if(!Se)return null;var pe=Se.data||{},ye=pe.value,re=pe.label,oe=pe.children,le=Object(w.a)(pe,!0),de=be?oe:re;return Se?U.createElement("div",Object.assign({"aria-label":typeof de=="string"?de:null},le,{key:He,role:"option",id:"".concat(he,"_list_").concat(He),"aria-selected":Ce.has(ye)}),ye):null}return U.createElement(U.Fragment,null,U.createElement("div",{role:"listbox",id:"".concat(he,"_list"),style:{height:0,width:0,overflow:"hidden"}},Ie(st-1),Ie(st),Ie(st+1)),U.createElement(A.a,{itemKey:"key",ref:at,data:Fe,height:ue,itemHeight:te,fullHeight:!1,onMouseDown:it,onScroll:Be,virtual:Le,onMouseEnter:We},function(He,Se){var pe,ye=He.group,re=He.groupOption,oe=He.data,le=oe.label,de=oe.key;if(ye)return U.createElement("div",{className:M()(Ue,"".concat(Ue,"-group"))},le!==void 0?le:de);var De=oe.disabled,Me=oe.value,Ye=oe.title,yt=oe.children,At=oe.style,Ke=oe.className,xt=Object(W.a)(oe,["disabled","value","title","children","style","className"]),mt=Ce.has(Me),ot="".concat(Ue,"-option"),Rt=M()(Ue,ot,Ke,(pe={},Object(O.a)(pe,"".concat(ot,"-grouped"),re),Object(O.a)(pe,"".concat(ot,"-active"),st===Se&&!De),Object(O.a)(pe,"".concat(ot,"-disabled"),De),Object(O.a)(pe,"".concat(ot,"-selected"),mt),pe)),Lt=be?yt:le,Kt=!we||typeof we=="function"||mt;return U.createElement("div",Object.assign({},xt,{"aria-selected":mt,className:Rt,title:Ye,onMouseMove:function(){if(st===Se||De)return;nt(Se)},onClick:function(){De||qe(Me)},style:At}),U.createElement("div",{className:"".concat(ot,"-content")},Lt||Me),U.isValidElement(we)||mt,Kt&&U.createElement(S.a,{className:"".concat(Ue,"-option-state"),customizeIcon:we,customizeIconProps:{isSelected:mt}},mt?"\u2713":null))}))},d=U.forwardRef(T);d.displayName="OptionList";var a=d,s=function(){return null};s.isSelectOption=!0;var u=s,_=function(){return null};_.isSelectOptGroup=!0;var m=_,p=ie("VTBJ"),D=ie("Zm9Q");function E(N){var Y=N.key,q=N.props,ae=q.children,he=q.value,_e=Object(W.a)(q,["children","value"]);return Object(p.a)({key:Y,value:he!==void 0?he:Y,children:ae},_e)}function g(N){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(D.a)(N).map(function(q,ae){if(!U.isValidElement(q)||!q.type)return null;var he=q.type.isSelectOptGroup,_e=q.key,be=q.props,Ce=be.children,Te=Object(W.a)(be,["children"]);return Y||!he?E(q):Object(p.a)(Object(p.a)({key:"__RC_SELECT_GRP__".concat(_e===null?ae:_e,"__"),label:_e},Te),{},{options:g(Ce)})}).filter(function(q){return q})}var c=ie("2Qr1"),h=ie("qNPg"),o=ie("U8pU"),C=ie("Kwbf"),x=ie("WKfj");function v(N){var Y=N.mode,q=N.options,ae=N.children,he=N.backfill,_e=N.allowClear,be=N.placeholder,Ce=N.getInputElement,Te=N.showSearch,Ee=N.onSearch,me=N.defaultOpen,ue=N.autoFocus,te=N.labelInValue,ce=N.value,se=N.inputValue,we=N.optionLabelProp,Le=Y==="multiple"||Y==="tags",xe=Te!==void 0?Te:Le||Y==="combobox",Pe=q||g(ae);if(Object(C.a)(Y!=="tags"||Pe.every(function(Ue){return!Ue.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),Y==="tags"||Y==="combobox"){var Ne=Pe.some(function(Ue){return Ue.options?Ue.options.some(function(Fe){return typeof("value"in Fe?Fe.value:Fe.key)=="number"}):typeof("value"in Ue?Ue.value:Ue.key)=="number"});Object(C.a)(!Ne,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(C.a)(Y!=="combobox"||!we,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(C.a)(Y==="combobox"||!he,"`backfill` only works with `combobox` mode."),Object(C.a)(Y==="combobox"||!Ce,"`getInputElement` only work with `combobox` mode."),Object(C.b)(Y!=="combobox"||!Ce||!_e||!be,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Ee&&!xe&&Y!=="combobox"&&Y!=="tags"&&Object(C.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(C.b)(!me||ue,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ce!=null){var Be=Object(x.d)(ce);Object(C.a)(!te||Be.every(function(Ue){return Object(o.a)(Ue)==="object"&&("key"in Ue||"value"in Ue)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(C.a)(!Le||Array.isArray(ce),"`value` should be array when `mode` is `multiple` or `tags`")}if(ae){var We=null;Object(D.a)(ae).some(function(Ue){if(!U.isValidElement(Ue)||!Ue.type)return!1;var Fe=Ue.type;if(Fe.isSelectOption)return!1;if(Fe.isSelectOptGroup){var at=Object(D.a)(Ue.props.children).every(function(it){return!U.isValidElement(it)||!Ue.type||it.type.isSelectOption?!0:(We=it.type,!1)});return!at}return We=Fe,!0}),We&&Object(C.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(We.displayName||We.name||We,"`.")),Object(C.a)(se===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var R=v,B=Object(h.a)({prefixCls:"rc-select",components:{optionList:a},convertChildrenToData:g,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:R,fillOptionsWithMissingValue:c.a}),j=function(N){Object(k.a)(q,N);var Y=Object(X.a)(q);function q(){var ae;return Object(ne.a)(this,q),ae=Y.apply(this,arguments),ae.selectRef=U.createRef(),ae.focus=function(){ae.selectRef.current.focus()},ae.blur=function(){ae.selectRef.current.blur()},ae}return Object($.a)(q,[{key:"render",value:function(){return U.createElement(B,Object.assign({ref:this.selectRef},this.props))}}]),q}(U.Component);j.Option=u,j.OptGroup=m;var K=j,I=$e.c=K},M8RZ:function(lt,$e,ie){"use strict";ie.d($e,"a",function(){return P});var ne=ie("fWQN"),$=ie("mtLc"),k=ie("yKVA"),X=ie("879j"),U=ie("q1tI"),O=ie.n(U),W=ie("i8i4"),F=ie.n(W),P=function(w){Object(k.a)(b,w);var f=Object(X.a)(b);function b(M){var A;Object(ne.a)(this,b),A=f.call(this,M);var S=window.document;return A.node=S.createElement("div"),S.body.appendChild(A.node),A}return Object($.a)(b,[{key:"render",value:function(){var A=this.props.children;return Object(W.createPortal)(A,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),b}(O.a.Component)},Ot1p:function(lt,$e,ie){"use strict";var ne=ie("2qtc"),$=ie("kLXV"),k=ie("rAM+"),X=ie("miYZ"),U=ie("tsqr"),O=ie("9og8"),W=ie("tJVT"),F=ie("jrin"),P=ie("WmNS"),w=ie.n(P),f=ie("q1tI"),b=ie.n(f),M=ie("VrN/"),A=ie.n(M),S=ie("bdgK"),T=ie("p77/"),d=ie("Bd2K"),a=ie("ELLl"),s=ie("19Vz"),u=ie("lZu9"),_=ie("+NIl"),m=ie("kSUc"),p=ie("9Bee"),D=function(Ke){var xt=Ke.value,mt=xt===void 0?"":xt,ot=Ke.className,Rt=Ke.showTextOnly,Lt=Ke.showLines,Kt=Ke.style,Bt=Kt===void 0?{}:Kt,wt=Object(f.useMemo)(function(){return""},[mt]);return b.a.createElement(b.a.Fragment,null,b.a.createElement("div",{dangerouslySetInnerHTML:{__html:wt}}))},E=ie("Q9mQ"),g=ie("diRs"),c=ie("0Owb"),h=ie("dejd"),o=ie("C+DQ"),C=ie("D1Df"),x=ie.n(C),v=ie("1vsH"),R=ie("m3rI"),B=[{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 j(Ke){var xt=Ke.onActionCallback,mt=Ke.title,ot=Ke.icon,Rt=Ke.actionName,Lt=Ke.className,Kt=Lt===void 0?"":Lt,Bt=Ke.children;function wt(){xt(Rt)}return b.a.createElement("a",{title:mt,className:Kt,onClick:wt},b.a.createElement("i",{className:"md-iconfont ".concat(ot)}),Bt)}var K=function(Ke){var xt=Ke.watch,mt=Ke.showNullButton,ot=Ke.onActionCallback,Rt=Ke.fullScreen,Lt=Ke.insertTemp,Kt=Ke.hidetoolBar,Bt=Ke.uuid,wt=Ke.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(v.E)("_educoder_session_login"),"&_educoder_session=").concat(Object(v.E)("_educoder_session"),"&key=").concat(Bt,"&api=").concat(encodeURIComponent(R.a.PROXY_SERVER)));var yr=[].concat(B,[{title:"".concat(xt?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(xt?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return b.a.createElement("ul",{className:"markdown-toolbar-container"},!Kt&&yr.map(function(ir,gt){return b.a.createElement("li",{key:gt},ir.actionName?b.a.createElement(j,Object(c.a)({},ir,{onActionCallback:ot})):b.a.createElement("span",{className:"v-line"}))}),mt?b.a.createElement("li",null,b.a.createElement(j,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:ot},b.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Lt&&b.a.createElement("li",null,b.a.createElement(j,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Lt),onActionCallback:ot},b.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),b.a.createElement("li",null,b.a.createElement(g.a,{title:"\u6253\u5F00\u624B\u673A\u626B\u4E00\u626B",content:b.a.createElement("div",null,b.a.createElement(x.a,{size:150,fgColor:"#000",value:"https://test2.educoder.net/upload.html?_educoder_session_login=".concat(Object(v.E)("_educoder_session_login"),"&_educoder_session=").concat(Object(v.E)("_educoder_session"),"&key=").concat(Bt,"&api=").concat(encodeURIComponent(R.a.PROXY_SERVER))}))},b.a.createElement("span",{className:"fill-tip",onMouseOver:function(){return wt(!0)}},"\u624B\u673A\u4E0A\u4F20\u6587\u4EF6"))),b.a.createElement("li",{className:"btn-full-screen"},b.a.createElement(j,{icon:"".concat(Rt?"icon-shrink":"icon-enlarge"),title:Rt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:ot})))},I=ie("M8RZ"),N=ie("+L6B"),Y=ie("2/Rp"),q=ie("y8nQ"),ae=ie("Vl3Y"),he=ie("5NDa"),_e=ie("5rEg"),be={labelCol:{span:4},wrapperCol:{span:20}},Ce=function(Ke){var xt=Ke.callback,mt=Ke.onCancel;function ot(Rt){xt(Rt)}return b.a.createElement(ae.a,Object(c.a)({},be,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:ot}),b.a.createElement(ae.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},b.a.createElement(_e.a,null)),b.a.createElement(ae.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},b.a.createElement(_e.a,null)),b.a.createElement("div",{className:"flex-container flex-end"},b.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),b.a.createElement(Y.a,{type:"ghost",onClick:mt},"\u53D6\u6D88")))},Te=ie("7ahc"),Ee=ie("k1fw"),me=ie("HmJG"),ue=ie("BjJ7"),te=ae.a.useForm,ce={width:280,marginRight:10},se={labelCol:{span:5},wrapperCol:{span:19}},we=function(Ke){var xt=Ke.callback,mt=Ke.onCancel,ot=te(),Rt=Object(W.a)(ot,1),Lt=Rt[0],Kt=Object(f.useRef)();function Bt(ir){xt(Object(Ee.a)(Object(Ee.a)({},ir),{},{name:Kt.current}))}function wt(ir,gt){Lt.setFieldsValue({src:"/api/attachments/".concat(ir.id,"?type=").concat(ir.content_type),type:gt.type})}function yr(ir){var gt=ir.target.files[0];Kt.current=gt.name,xe(gt,wt)}return b.a.createElement(ae.a,Object(c.a)({form:Lt},se,{className:"upload-image-panel",onFinish:Bt}),b.a.createElement(ae.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},b.a.createElement("div",{className:"flex-container"},b.a.createElement(ae.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},b.a.createElement(_e.a,{style:ce})),b.a.createElement(Le,{onFileChange:yr}))),b.a.createElement(ae.a.Item,{label:"\u6587\u4EF6\u63CF\u8FF0",name:"alt"},b.a.createElement(_e.a,{style:{width:264}})),b.a.createElement(ae.a.Item,{style:{textAlign:"right"}},b.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),b.a.createElement(Y.a,{type:"ghost",onClick:mt},"\u53D6\u6D88")))};function Le(Ke){var xt=Ke.onFileChange;return b.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",b.a.createElement("input",{type:"file",onChange:xt}))}function xe(Ke,xt){if(!Ke)throw new String("\u6CA1\u6709\u6587\u4EF6");var mt=new FormData;mt.append("editormd-image-file",Ke),mt.append("file_param_name","editormd-image-file"),mt.append("byxhr","true");var ot=new window.XMLHttpRequest;ot.withCredentials=!0,ot.addEventListener("load",function(Rt){xt(JSON.parse(Rt.target.responseText),Ke)},!1),ot.addEventListener("error",function(Rt){console.error(Rt)},!1),ot.open("POST","".concat(ue.a,"/api/attachments.json")),ot.send(mt)}var Pe=ie("giR+"),Ne=ie("fyUT"),Be=ie("7Kak"),We=ie("9yH6"),Ue=We.a.Group,Fe={margin:"0 8px"},at=function(Ke){var xt=Ke.callback,mt=Ke.onCancel;function ot(Rt){xt(Rt)}return b.a.createElement(ae.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:ot},b.a.createElement("div",{className:"flex-container"},b.a.createElement("span",{style:Fe},"\u5355\u5143\u683C\u6570\uFF1A"),b.a.createElement("span",{style:Fe},"\u884C\u6570"),b.a.createElement(ae.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},b.a.createElement(Ne.a,null)),b.a.createElement("span",{style:Fe},"\u5217\u6570"),b.a.createElement(ae.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},b.a.createElement(Ne.a,null))),b.a.createElement("div",{className:"flex-container",style:{marginTop:12}},b.a.createElement("span",{style:Fe},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),b.a.createElement(ae.a.Item,{name:"align"},b.a.createElement(Ue,null,b.a.createElement(We.a,{value:"default"},b.a.createElement("i",{className:"fa fa-align-justify"})),b.a.createElement(We.a,{value:"left"},b.a.createElement("i",{className:"fa fa-align-left"})),b.a.createElement(We.a,{value:"center"},b.a.createElement("i",{className:"fa fa-align-center"})),b.a.createElement(We.a,{value:"right"},b.a.createElement("i",{className:"fa fa-align-right"}))))),b.a.createElement("div",{className:"flex-container flex-end"},b.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),b.a.createElement(Y.a,{type:"ghost",onClick:mt},"\u53D6\u6D88")))},it=ie("ErOA"),et=ie("7Cbv"),Ze="link",ut="upload-image",Je="code-block",st="add-table",Re="------------",nt={default:Re,left:":".concat(Re),center:":".concat(Re,":"),right:"".concat(Re,":")},qe=ie("9VGf"),Ie,He;function Se(){}var pe=0,ye=1e4,re="\u2581",oe=`
**\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 le(Ke){return/^\d+$/.test(Ke)?"".concat(Ke,"px"):Ke}var de=navigator.platform.toUpperCase().indexOf("MAC")>=0,De=de?"Cmd":"Ctrl",Me=["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"],Ye=(Ie={},Object(F.a)(Ie,De+"-B","bold"),Object(F.a)(Ie,De+"-I","italic"),Ie),yt=(He={},Object(F.a)(He,Ze,"\u6DFB\u52A0\u94FE\u63A5"),Object(F.a)(He,Je,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(F.a)(He,ut,"\u6DFB\u52A0\u6587\u4EF6"),Object(F.a)(He,st,"\u6DFB\u52A0\u8868\u683C"),He),At=$e.a=function(Ke){var xt=Ke.defaultValue,mt=xt===void 0?"":xt,ot=Ke.onChange,Rt=Ke.width,Lt=Rt===void 0?"100%":Rt,Kt=Ke.height,Bt=Kt===void 0?400:Kt,wt=Ke.miniToolbar,yr=wt===void 0?!1:wt,ir=Ke.isFocus,gt=ir===void 0?!1:ir,Gr=Ke.watch,br=Ke.insertTemp,fr=Ke.mode,Tr=fr===void 0?"markdown":fr,si=Ke.id,Kr=si===void 0?"markdown-editor-id":si,It=Ke.showResizeBar,ft=It===void 0?!1:It,Ur=Ke.noStorage,li=Ur===void 0?!1:Ur,wr=Ke.showNullButton,Ot=wr===void 0?!1:wr,Vr=Ke.hidetoolBar,ui=Vr===void 0?!1:Vr,gi=Ke.fullScreen,Xe=gi===void 0?!1:gi,St=Ke.onBlur,ei=Ke.onCMBeforeChange,hi=Ke.onFullScreen,di=Ke.className,ki=di===void 0?"":di,V=Ke.disablePaste,l=V===void 0?!1:V,y=Ke.placeholder,z=y===void 0?"":y,Z=Ke.values,G=Z===void 0?"":Z,ve=Object(f.useState)(null),ze=Object(W.a)(ve,2),Oe=ze[0],ct=ze[1],Ge=Object(f.useState)(mt),Ct=Object(W.a)(Ge,2),Mt=Ct[0],Wt=Ct[1],Fr=Object(f.useState)(Gr),jr=Object(W.a)(Fr,2),sr=jr[0],Xr=jr[1],Ki=Object(f.useState)(Xe),Ar=Object(W.a)(Ki,2),_r=Ar[0],ti=Ar[1],vi=Object(f.useState)(""),$r=Object(W.a)(vi,2),ri=$r[0],Wr=$r[1],fn=Object(f.useState)(0),Vi=Object(W.a)(fn,2),Pr=Vi[0],Mr=Vi[1],Ri=Object(f.useState)(Bt),Oi=Object(W.a)(Ri,2),Pi=Oi[0],qt=Oi[1],Ut=Object(f.useState)(!1),pr=Object(W.a)(Ut,2),Ft=pr[0],mr=pr[1],Xt=Object(f.useRef)(Object(et.a)()),yi=Object(f.useRef)(!1),nr=Object(f.useRef)(),ar=Object(f.useRef)(),ii=Object(f.useRef)(),bi=Object(f.useRef)(),xi=Object(f.useRef)(),Fn=function(){var pt=Object(O.a)(w.a.mark(function Tt(){var bt,Dt;return w.a.wrap(function(Ht){for(;;)switch(Ht.prev=Ht.next){case 0:return Ht.next=2,Object(it.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Xt.current}});case 2:Dt=Ht.sent,Dt!=null&&(bt=Dt.attachments)!==null&&bt!==void 0&&bt.length&&(console.log("cm:",Oe,ar),Dt.attachments.map(function(Pt){Pt.content_type.indexOf("image")>-1?Oe.replaceSelection("![,](/api/attachments/".concat(Pt.id,"?type=").concat(Pt.content_type,")")):Pt.content_type.indexOf("video")>-1?Oe.replaceSelection('<video width="100%" controls src="'.concat(R.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Pt.content_type.indexOf("pdf")>-1?Oe.replaceSelection('<a href="'.concat(R.a.API_SERVER,"/api/attachments/").concat(Pt.id,"?type=").concat(Pt.content_type,'&disposition=inline" target="_blank">').concat(Pt.name,"</a>")):Oe.replaceSelection("[".concat(Pt.name,"](").concat(R.a.API_SERVER,"/api/attachments/").concat(Pt.id,"?type=").concat(Pt.content_type,")"))}));case 4:case"end":return Ht.stop()}},Tt)}));return function(){return pt.apply(this,arguments)}}();Object(f.useEffect)(function(){Wt(G),Oe==null||Oe.setValue(G)},[G]),Object(f.useEffect)(function(){hi==null||hi(_r)},[_r]),Object(f.useEffect)(function(){if(ar.current){var pt=A.a.fromTextArea(ar.current,{mode:Tr,lineNumbers:!yr,lineWrapping:!0,value:mt,autoCloseTags:!0,autoCloseBrackets:!0});gt&&pt.focus();function Tt(bt,Dt){if(l){Dt.preventDefault();return}var Nt=Dt.clipboardData;if(Nt){var Ht=Nt.types.toString(),Pt=Nt.items;if(Ht==="Files"||Nt.types.indexOf("Files")>-1){if(Dt.preventDefault(),Tr=="stex")return;try{var Qt,lr=Pt[1];((Qt=Pt[0])===null||Qt===void 0?void 0:Qt.kind)==="file"&&(lr=Pt[0]);var kt=lr.getAsFile(),Mi=kt.name.split(".").pop();xe(kt,function(zt){if(zt.id){var gr,Vt,Yr;(kt==null||((gr=kt.type)===null||gr===void 0)?void 0:gr.indexOf("image"))>-1?pt.replaceSelection("![,](/api/attachments/".concat(zt.id,"?type=").concat(zt.content_type,")")):(kt==null||((Vt=kt.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?pt.replaceSelection('<video width="100%" controls src="'.concat(R.a.API_SERVER,"/api/attachments/").concat(zt.id,'"></video>')):(kt==null||((Yr=kt.type)===null||Yr===void 0)?void 0:Yr.indexOf("pdf"))>-1?pt.replaceSelection('<a href="'.concat(R.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(kt.type,'&disposition=inline" target="_blank">').concat(kt.name,"</a>")):Me.includes(Mi)?pt.replaceSelection('<a href="'.concat(R.a.API_SERVER,"/api/attachments/").concat(zt.id,'?type=office&disposition=inline" target="_blank">').concat(kt.name,"</a>")):pt.replaceSelection("[".concat(kt.name,"](").concat(R.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(zt.content_type,")"))}else(zt==null?void 0:zt.status)===401&&(document.location.href="/user/login")})}catch(zt){U.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return pt.on("paste",Tt),pt.on("dragleave",function(bt,Dt){ii.current.classList.remove("mouse-hover-md")}),pt.on("dragover",function(bt,Dt){ii.current.classList.add("mouse-hover-md")}),pt.on("drop",function(bt,Dt){ii.current.classList.add("mouse-hover-md");var Nt;if(Nt=Dt.dataTransfer.files,Nt.length>0){Dt.preventDefault(),Dt.stopPropagation();for(var Ht=function(lr){var kt=Nt[lr],Mi=kt.name.split(".").pop();xe(kt,function(zt){if(zt.id){var gr,Vt,Yr;(kt==null||((gr=kt.type)===null||gr===void 0)?void 0:gr.indexOf("image"))>-1?pt.replaceSelection("![,](/api/attachments/".concat(zt.id,"?type=").concat(zt.content_type,")")):(kt==null||((Vt=kt.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?pt.replaceSelection('<video width="100%" controls src="'.concat(R.a.API_SERVER,"/api/attachments/").concat(zt.id,'"></video>')):(kt==null||((Yr=kt.type)===null||Yr===void 0)?void 0:Yr.indexOf("pdf"))>-1?pt.replaceSelection('<a href="'.concat(R.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(kt.type,'&disposition=inline" target="_blank">').concat(kt.name,"</a>")):Me.includes(Mi)?pt.replaceSelection('<a href="'.concat(R.a.API_SERVER,"/api/attachments/").concat(zt.id,'?type=office&disposition=inline" target="_blank">').concat(kt.name,"</a>")):pt.replaceSelection("[".concat(kt.name,"](").concat(R.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(zt.content_type,")"))}else(zt==null?void 0:zt.status)===401&&(document.location.href="/user/login")})},Pt=0;Pt<Nt.length;Pt++)Ht(Pt)}}),ct(pt),function(){pt.off("paste",Tt)}}},[]);var Qr=Object(f.useCallback)(function(){if(ii.current)try{}catch(pt){console.log(pt,"---- to set md editor body height")}},[Pi,ii,_r]);Object(f.useEffect)(function(){function pt(){var bt=new S.default(function(Dt){var Nt=Object(k.a)(Dt),Ht;try{for(Nt.s();!(Ht=Nt.n()).done;){var Pt=Ht.value;(Pt.target.offsetHeight>0||Pt.target.offsetWidth>0)&&(Qr(),Oe.setSize("100%","100%"),Oe.refresh())}}catch(Qt){Nt.e(Qt)}finally{Nt.f()}});return bt.observe(ar.current.parentElement),bt}if(Oe){var Tt=pt();return function(){Tt.unobserve(ar.current.parentElement)}}},[Oe,Qr]),Object(f.useEffect)(function(){if(Oe){for(var pt=[],Tt=function(){var Pt=Dt[bt];Nt=Object(W.a)(Pt,2);var Qt=Nt[0],lr=Nt[1],kt=Object(F.a)({},Qt,function(){Xi(lr)});pt.push(kt),Oe.addKeyMap(kt)},bt=0,Dt=Object.entries(Ye);bt<Dt.length;bt++){var Nt;Tt()}return nr.current=setInterval(function(){yi.current&&Fn()},4e3),function(){clearInterval(nr.current);var Ht=Object(k.a)(pt),Pt;try{for(Ht.s();!(Pt=Ht.n()).done;){var Qt=Pt.value;Oe.removeKeyMap(Qt)}}catch(lr){Ht.e(lr)}finally{Ht.f()}}}},[Oe]),Object(f.useEffect)(function(){Xe!==_r&&ti(Xe)},[Xe]),Object(qe.a)(function(){if(!li&&Pr>0){var pt=new Date().getTime(),Tt=window.sessionStorage.getItem(Kr);pt>=Pr+ye&&(!Tt||Tt!==Mt)&&(window.sessionStorage.setItem(Kr,Mt),mr(!0))}},ye),Object(f.useEffect)(function(){Xr(Gr)},[Oe,Gr]),Object(f.useEffect)(function(){Oe&&(gt&&Oe.focus())},[Oe,gt]),Object(f.useEffect)(function(){if(sr&&Oe){var pt=Oe.getScrollerElement();function Tt(bt){var Dt=bt.target;if(xi.current){var Nt=Dt.scrollTop/Dt.scrollHeight;xi.current.scrollTop=xi.current.scrollHeight*Nt}}return pt.addEventListener("scroll",Tt),function(){pt.removeEventListener("scroll",Tt)}}},[Oe,sr]),Object(f.useEffect)(function(){if(Oe&&ei){function pt(Tt,bt){ei(Tt,bt)}return Oe.on("beforeChange",pt),function(){Oe.off("beforeChange",pt)}}},[Oe,ei]),Object(f.useEffect)(function(){if(Oe&&St){function pt(){St(Oe.getValue())}return Oe.on("blur",pt),function(){Oe.off("blur",pt)}}},[Oe,St]),Object(f.useEffect)(function(){if(Oe){function pt(Tt){var bt=Tt.getValue();Wt(bt),Mr(new Date().getTime()),Tt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),ot&&ot(bt)}return Oe.on("change",pt),function(){Oe.off("change",pt)}}},[Oe,ot]),Object(f.useEffect)(function(){Oe&&(mt==null?(Oe.setValue(""),Wt("")):mt!==Oe.getValue()&&(Oe.setValue(mt),Wt(mt),Oe.setCursor(Oe.lineCount(),0)))},[Oe,mt]);var Xi=Object(f.useCallback)(function(pt){var Tt=Oe.getCursor(),bt=Oe.getSelection(),Dt=bt.split(`
`);switch(pt){case"bold":return Oe.replaceSelection("**"+bt+"**"),bt===""&&Oe.setCursor(Tt.line,Tt.ch+2),Oe.focus();case"italic":return Oe.replaceSelection("*"+bt+"*"),bt===""&&Oe.setCursor(Tt.line,Tt.ch+1),Oe.focus();case"code":return Oe.replaceSelection("`"+bt+"`"),bt===""&&Oe.setCursor(Tt.line,Tt.ch+1),Oe.focus();case"inline-latex":return Oe.replaceSelection("`$$"+bt+"$$`"),bt===""&&Oe.setCursor(Tt.line,Tt.ch+3),Oe.focus();case"latex":return Oe.replaceSelection("```latex\n"+bt+"\n```"),Oe.setCursor(Tt.line+1,bt.length+1),Oe.focus();case"line-break":return Oe.replaceSelection(`<br/>
`),Oe.focus();case"list-ul":return bt===""?Oe.replaceSelection("- "+bt):Oe.replaceSelection(Dt.map(function(Nt){return Nt===""?"":"- ".concat(Nt)}).join(`
`)),Oe.focus();case"list-ol":return bt===""?Oe.replaceSelection("1. "+bt):Oe.replaceSelection(Dt.map(function(Nt,Ht){return Nt===""?"":"".concat(Ht+1,". ").concat(Nt)}).join(`
`)),Oe.focus();case"add-null-ch":return bt===""&&Oe.setCursor(Tt.line,Tt.ch+1),Oe.replaceSelection(re),Oe.focus();case"inster-template-1":return bt===""&&Oe.setCursor(Tt.line,Tt.ch),Oe.replaceSelection(oe),Oe.focus();case"eraser":return Oe.setValue(""),Oe.focus();case"trigger-watch":return Xr(!sr),Oe.focus();case"trigger-full-screen":return ti(!_r),Oe.focus();case Ze:Wr(Ze);return;case Je:Wr(Je);return;case ut:Wr(ut);return;case st:Wr(st);return;default:throw new Error}},[Oe,sr,_r]),Ir=Object(f.useCallback)(function(pt){Wr("");switch(ri){case Ze:var Tt=pt.title,bt=pt.link;return Oe.replaceSelection("[".concat(Tt,"](").concat(bt,")")),Oe.focus();case Je:var Dt=pt.language,Nt=pt.content;return Oe.replaceSelection(["```"+Dt,Nt,"```"].join(`
`)),Oe.focus();case ut:var Ht=pt.src,Pt=pt.alt,Qt=pt.name;return Ht.indexOf("type=image")>-1?Oe.replaceSelection("![ ".concat(Pt||""," ]( ").concat(Ht,' "').concat(Pt||"",'" )')):Ht.indexOf("type=application/pdf")>-1?Oe.replaceSelection('<a href="'.concat(Ht,'&disposition=inline" target="_blank">').concat(Qt,"</a>")):Oe.replaceSelection('<a href="'.concat(Ht,'" target="_blank">').concat(Qt,"</a>")),Oe.focus();case st:for(var lr=pt.row,kt=pt.col,Mi=pt.align,zt=`
`,gr=0;gr<lr;gr++){for(var Vt=[],Yr=[],pn=0;pn<kt;pn++)gr===1&&Yr.push(nt[Mi]),Vt.push(" ");gr===1&&(zt+="| ".concat(Yr.join(" | "),` |
`)),zt+="| ".concat(Vt.join(kt===1?"":" | "),` |
`)}return Oe.replaceSelection(zt+`
`),Oe.focus();default:throw new Error}},[Oe,ri]),Yi=Object(f.useMemo)(function(){switch(ri){case Ze:return b.a.createElement(Ce,{callback:Ir,onCancel:ci});case Je:return b.a.createElement(Te.b,{callback:Ir,onCancel:ci});case ut:return b.a.createElement(we,{callback:Ir,onCancel:ci});case st:return b.a.createElement(at,{callback:Ir,onCancel:ci});default:return null}},[ri]);function ci(){Wr("")}Object(f.useEffect)(function(){if(bi.current){var pt=bi.current,Tt=!1,bt=0;function Dt(Pt){Tt=!0,bt=Pt.pageY}function Nt(){Tt=!1}function Ht(Pt){if(Tt){var Qt=Pt.pageY-bt;Qt<0&&(Qt=0),Qt>300&&(Qt=300);var lr=Bt+Qt+"px";qt(lr)}}return pt.addEventListener("mousedown",Dt),document.addEventListener("mousemove",Ht),document.addEventListener("mouseup",Nt),function(){pt.removeEventListener("mousedown",Dt),document.removeEventListener("mousemove",Ht),document.removeEventListener("mouseup",Nt)}}},[Oe,bi]),Object(f.useEffect)(function(){qt(Bt)},[Bt]);var Ei=le(Lt),ua=le(Pi),ha={width:Ei,height:ua},Qa=Object(f.useMemo)(function(){if(Pr){var pt=new Date(Pr),Tt=pt.getHours(),bt=pt.getMinutes(),Dt=pt.getSeconds();return Tt=Tt<10?"0"+Tt:Tt,bt=bt<10?"0"+bt:bt,Dt=Dt<10?"0"+Dt:Dt,"".concat(Tt,":").concat(bt,":").concat(Dt)}return 0},[Pr]);function Ja(){window.sessionStorage.removeItem(Kr),mr(!1),Mr(0)}function da(){mr(!1),Mr(0),Oe.setValue(window.sessionStorage.getItem(Kr))}function jn(pt,Tt){var bt=Oe.getValue();bt=bt.replace(pt,Tt),Wt(bt),Oe==null||Oe.setValue(bt)}return b.a.createElement(f.Fragment,null,b.a.createElement("div",{className:"markdown-editor-wrapper",ref:ii},b.a.createElement("div",{className:"markdown-editor-container ".concat(ki," ").concat(sr?"on-preview":""," ").concat(yr?"mini":""," ").concat(_r?"full-screen":""),style:ha},b.a.createElement(K,{insertTemp:br,watch:sr,fullScreen:_r,showNullButton:Ot,onActionCallback:Xi,hidetoolBar:ui,uuid:Xt.current,setOpenPhones:function(){yi.current=!0}}),b.a.createElement("div",{className:"markdown-editor-body"},b.a.createElement("div",{className:"codemirror-container"},b.a.createElement("textarea",{ref:ar,placeholder:z})),sr?b.a.createElement("div",{ref:xi,className:"preview-container"},Tr==="stex"&&b.a.createElement(D,{value:Mt}),Tr!=="stex"&&b.a.createElement(p.a,{edit:!0,value:Mt,replaces:jn})):null))),ft?b.a.createElement("a",{ref:bi,className:"editor-resize"}):null,b.a.createElement(I.a,null,yt[ri]?b.a.createElement($.a,{centered:!0,title:yt[ri],visible:!0,onCancel:ci,footer:null},Yi):null))}},SJMd:function(lt,$e){/**
* @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,ne,$,k=!1,X,U;window.PR_SHOULD_USE_CONTINUATION=!0;var O,W;(function(){var F=window,P=["break,continue,do,else,for,if,return,while"],w=[P,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],f=[w,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],b=[f,"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"],M=[f,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],A=[f,"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"],S="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",T=[f,"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",a=[P,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],s=[P,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],u=[P,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],_=[b,A,M,T,d,a,s,u],m=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,p="str",D="kwd",E="com",g="typ",c="lit",h="pun",o="pln",C="tag",x="dec",v="src",R="atn",B="atv",j="nocode",K="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function I(xe){for(var Pe=0,Ne=!1,Be=!1,We=0,Ue=xe.length;We<Ue;++We){var Fe=xe[We];if(Fe.ignoreCase)Be=!0;else if(/[a-z]/i.test(Fe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Ne=!0,Be=!1;break}}var at={b:8,t:9,n:10,v:11,f:12,r:13};function it(st){var Re=st.charCodeAt(0);if(Re!==92)return Re;var nt=st.charAt(1);return Re=at[nt],Re||("0"<=nt&&nt<="7"?parseInt(st.substring(1),8):nt==="u"||nt==="x"?parseInt(st.substring(2),16):st.charCodeAt(1))}function et(st){if(st<32)return(st<16?"\\x0":"\\x")+st.toString(16);var Re=String.fromCharCode(st);return Re==="\\"||Re==="-"||Re==="]"||Re==="^"?"\\"+Re:Re}function Ze(st){var Re=st.substring(1,st.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")),nt=[],qe=Re[0]==="^",Ie=["["];qe&&Ie.push("^");for(var He=qe?1:0,Se=Re.length;He<Se;++He){var pe=Re[He];if(/\\[bdsw]/i.test(pe))Ie.push(pe);else{var ye=it(pe),re;He+2<Se&&Re[He+1]==="-"?(re=it(Re[He+2]),He+=2):re=ye,nt.push([ye,re]),re<65||ye>122||(re<65||ye>90||nt.push([Math.max(65,ye)|32,Math.min(re,90)|32]),re<97||ye>122||nt.push([Math.max(97,ye)&~32,Math.min(re,122)&~32]))}}nt.sort(function(De,Me){return De[0]-Me[0]||Me[1]-De[1]});for(var oe=[],le=[],He=0;He<nt.length;++He){var de=nt[He];de[0]<=le[1]+1?le[1]=Math.max(le[1],de[1]):oe.push(le=de)}for(var He=0;He<oe.length;++He){var de=oe[He];Ie.push(et(de[0])),de[1]>de[0]&&(de[1]+1>de[0]&&Ie.push("-"),Ie.push(et(de[1])))}return Ie.push("]"),Ie.join("")}function ut(st){for(var Re=st.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")),nt=Re.length,qe=[],Ie=0,He=0;Ie<nt;++Ie){var Se=Re[Ie];if(Se==="(")++He;else if(Se.charAt(0)==="\\"){var pe=+Se.substring(1);pe&&(pe<=He?qe[pe]=-1:Re[Ie]=et(pe))}}for(var Ie=1;Ie<qe.length;++Ie)qe[Ie]===-1&&(qe[Ie]=++Pe);for(var Ie=0,He=0;Ie<nt;++Ie){var Se=Re[Ie];if(Se==="(")++He,qe[He]||(Re[Ie]="(?:");else if(Se.charAt(0)==="\\"){var pe=+Se.substring(1);pe&&pe<=He&&(Re[Ie]="\\"+qe[pe])}}for(var Ie=0;Ie<nt;++Ie)Re[Ie]==="^"&&Re[Ie+1]!=="^"&&(Re[Ie]="");if(st.ignoreCase&&Ne)for(var Ie=0;Ie<nt;++Ie){var Se=Re[Ie],ye=Se.charAt(0);Se.length>=2&&ye==="["?Re[Ie]=Ze(Se):ye!=="\\"&&(Re[Ie]=Se.replace(/[a-zA-Z]/g,function(le){var de=le.charCodeAt(0);return"["+String.fromCharCode(de&~32,de|32)+"]"}))}return Re.join("")}for(var Je=[],We=0,Ue=xe.length;We<Ue;++We){var Fe=xe[We];if(Fe.global||Fe.multiline)throw new Error(""+Fe);Je.push("(?:"+ut(Fe)+")")}return new RegExp(Je.join("|"),Be?"gi":"g")}function N(xe,Pe){var Ne=/(?:^|\s)nocode(?:\s|$)/,Be=[],We=0,Ue=[],Fe=0;function at(it){var et=it.nodeType;if(et==1){if(Ne.test(it.className))return;for(var Ze=it.firstChild;Ze;Ze=Ze.nextSibling)at(Ze);var ut=it.nodeName.toLowerCase();(ut==="br"||ut==="li")&&(Be[Fe]=`
`,Ue[Fe<<1]=We++,Ue[Fe++<<1|1]=it)}else if(et==3||et==4){var Je=it.nodeValue;Je.length&&(Pe?Je=Je.replace(/\r\n?/g,`
`):Je=Je.replace(/[ \t\r\n]+/g," "),Be[Fe]=Je,Ue[Fe<<1]=We,We+=Je.length,Ue[Fe++<<1|1]=it)}}return at(xe),{sourceCode:Be.join("").replace(/\n$/,""),spans:Ue}}function Y(xe,Pe,Ne,Be,We){if(!Ne)return;var Ue={sourceNode:xe,pre:1,langExtension:null,numberLines:null,sourceCode:Ne,spans:null,basePos:Pe,decorations:null};Be(Ue),We.push.apply(We,Ue.decorations)}var q=/\S/;function ae(xe){for(var Pe=void 0,Ne=xe.firstChild;Ne;Ne=Ne.nextSibling){var Be=Ne.nodeType;Pe=Be===1?Pe?xe:Ne:Be===3&&q.test(Ne.nodeValue)?xe:Pe}return Pe===xe?void 0:Pe}function he(xe,Pe){var Ne={},Be;(function(){for(var Fe=xe.concat(Pe),at=[],it={},et=0,Ze=Fe.length;et<Ze;++et){var ut=Fe[et],Je=ut[3];if(Je)for(var st=Je.length;--st>=0;)Ne[Je.charAt(st)]=ut;var Re=ut[1],nt=""+Re;it.hasOwnProperty(nt)||(at.push(Re),it[nt]=null)}at.push(/[\0-\uffff]/),Be=I(at)})();var We=Pe.length,Ue=function(Fe){for(var at=Fe.sourceCode,it=Fe.basePos,et=Fe.sourceNode,Ze=[it,o],ut=0,Je=at.match(Be)||[],st={},Re=0,nt=Je.length;Re<nt;++Re){var qe=Je[Re],Ie=st[qe],He=void 0,Se;if(typeof Ie=="string")Se=!1;else{var pe=Ne[qe.charAt(0)];if(pe)He=qe.match(pe[1]),Ie=pe[0];else{for(var ye=0;ye<We;++ye)if(pe=Pe[ye],He=qe.match(pe[1]),He){Ie=pe[0];break}He||(Ie=o)}Se=Ie.length>=5&&Ie.substring(0,5)==="lang-",Se&&!(He&&typeof He[1]=="string")&&(Se=!1,Ie=v),Se||(st[qe]=Ie)}var re=ut;if(ut+=qe.length,!Se)Ze.push(it+re,Ie);else{var oe=He[1],le=qe.indexOf(oe),de=le+oe.length;He[2]&&(de=qe.length-He[2].length,le=de-oe.length);var De=Ie.substring(5);Y(et,it+re,qe.substring(0,le),Ue,Ze),Y(et,it+re+le,oe,ue(De,oe),Ze),Y(et,it+re+de,qe.substring(de),Ue,Ze)}}Fe.decorations=Ze};return Ue}function _e(xe){var Pe=[],Ne=[];xe.tripleQuotedStrings?Pe.push([p,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):xe.multiLineStrings?Pe.push([p,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Pe.push([p,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),xe.verbatimStrings&&Ne.push([p,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Be=xe.hashComments;Be&&(xe.cStyleComments?(Be>1?Pe.push([E,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Pe.push([E,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Ne.push([p,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Pe.push([E,/^#[^\r\n]*/,null,"#"])),xe.cStyleComments&&(Ne.push([E,/^\/\/[^\r\n]*/,null]),Ne.push([E,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var We=xe.regexLiterals;if(We){var Ue=We>1?"":`
\r`,Fe=Ue?".":"[\\S\\s]",at="/(?=[^/*"+Ue+"])(?:[^/\\x5B\\x5C"+Ue+"]|\\x5C"+Fe+"|\\x5B(?:[^\\x5C\\x5D"+Ue+"]|\\x5C"+Fe+")*(?:\\x5D|$))+/";Ne.push(["lang-regex",RegExp("^"+K+"("+at+")")])}var it=xe.types;it&&Ne.push([g,it]);var et=(""+xe.keywords).replace(/^ | $/g,"");et.length&&Ne.push([D,new RegExp("^(?:"+et.replace(/[\s,]+/g,"|")+")\\b"),null]),Pe.push([o,/^\s+/,null,` \r
\xA0`]);var Ze="^.[^\\s\\w.$@'\"`/\\\\]*";return xe.regexLiterals&&(Ze+="(?!s*/)"),Ne.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[g,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[o,/^[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"],[o,/^\\[\s\S]?/,null],[h,new RegExp(Ze),null]),he(Pe,Ne)}var be=_e({keywords:_,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Ce(xe,Pe,Ne){for(var Be=/(?:^|\s)nocode(?:\s|$)/,We=/\r\n?|\n/,Ue=xe.ownerDocument,Fe=Ue.createElement("li");xe.firstChild;)Fe.appendChild(xe.firstChild);var at=[Fe];function it(Re){var nt=Re.nodeType;if(nt==1&&!Be.test(Re.className))if(Re.nodeName==="br")et(Re),Re.parentNode&&Re.parentNode.removeChild(Re);else for(var qe=Re.firstChild;qe;qe=qe.nextSibling)it(qe);else if((nt==3||nt==4)&&Ne){var Ie=Re.nodeValue,He=Ie.match(We);if(He){var Se=Ie.substring(0,He.index);Re.nodeValue=Se;var pe=Ie.substring(He.index+He[0].length);if(pe){var ye=Re.parentNode;ye.insertBefore(Ue.createTextNode(pe),Re.nextSibling)}et(Re),Se||Re.parentNode.removeChild(Re)}}}function et(Re){for(;!Re.nextSibling;)if(Re=Re.parentNode,!Re)return;function nt(He,Se){var pe=Se?He.cloneNode(!1):He,ye=He.parentNode;if(ye){var re=nt(ye,1),oe=He.nextSibling;re.appendChild(pe);for(var le=oe;le;le=oe)oe=le.nextSibling,re.appendChild(le)}return pe}for(var qe=nt(Re.nextSibling,0),Ie;(Ie=qe.parentNode)&&Ie.nodeType===1;)qe=Ie;at.push(qe)}for(var Ze=0;Ze<at.length;++Ze)it(at[Ze]);Pe===(Pe|0)&&at[0].setAttribute("value",Pe);var ut=Ue.createElement("ol");ut.className="linenums";for(var Je=Math.max(0,Pe-1|0)||0,Ze=0,st=at.length;Ze<st;++Ze)Fe=at[Ze],Fe.className="L"+(Ze+Je)%10,Fe.firstChild||Fe.appendChild(Ue.createTextNode("\xA0")),ut.appendChild(Fe);xe.appendChild(ut)}function Te(xe){var Pe=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Pe=Pe&&+Pe[1]<=8;var Ne=/\n/g,Be=xe.sourceCode,We=Be.length,Ue=0,Fe=xe.spans,at=Fe.length,it=0,et=xe.decorations,Ze=et.length,ut=0;et[Ze]=We;var Je,st;for(st=Je=0;st<Ze;)et[st]!==et[st+2]?(et[Je++]=et[st++],et[Je++]=et[st++]):st+=2;for(Ze=Je,st=Je=0;st<Ze;){for(var Re=et[st],nt=et[st+1],qe=st+2;qe+2<=Ze&&et[qe+1]===nt;)qe+=2;et[Je++]=Re,et[Je++]=nt,st=qe}Ze=et.length=Je;var Ie=xe.sourceNode,He="";Ie&&(He=Ie.style.display,Ie.style.display="none");try{for(var Se=null;it<at;){var pe=Fe[it],ye=Fe[it+2]||We,re=et[ut+2]||We,qe=Math.min(ye,re),oe=Fe[it+1],le;if(oe.nodeType!==1&&(le=Be.substring(Ue,qe))){Pe&&(le=le.replace(Ne,"\r")),oe.nodeValue=le;var de=oe.ownerDocument,De=de.createElement("span");De.className=et[ut+1];var Me=oe.parentNode;Me.replaceChild(De,oe),De.appendChild(oe),Ue<ye&&(Fe[it+1]=oe=de.createTextNode(Be.substring(qe,ye)),Me.insertBefore(oe,De.nextSibling))}Ue=qe,Ue>=ye&&(it+=2),Ue>=re&&(ut+=2)}}finally{Ie&&(Ie.style.display=He)}}var Ee={};function me(xe,Pe){for(var Ne=Pe.length;--Ne>=0;){var Be=Pe[Ne];Ee.hasOwnProperty(Be)?F.console&&console.warn("cannot override language handler %s",Be):Ee[Be]=xe}}function ue(xe,Pe){return xe&&Ee.hasOwnProperty(xe)||(xe=/^\s*</.test(Pe)?"default-markup":"default-code"),Ee[xe]}me(be,["default-code"]),me(he([],[[o,/^[^<?]+/],[x,/^<!\w[^>]*(?:>|$)/],[E,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[h,/^(?:<[%?]|[%?]>)/],["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(he([[o,/^[\s]+/,null,` \r
`],[B,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[C,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[R,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[h,/^[=<>\/]+/],["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(he([],[[B,/^[\s\S]+/]]),["uq.val"]),me(_e({keywords:b,hashComments:!0,cStyleComments:!0,types:m}),["c","cc","cpp","cxx","cyc","m"]),me(_e({keywords:"null,true,false"}),["json"]),me(_e({keywords:A,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:m}),["cs"]),me(_e({keywords:M,cStyleComments:!0}),["java"]),me(_e({keywords:u,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),me(_e({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),me(_e({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),me(_e({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),me(_e({keywords:T,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),me(_e({keywords:S,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),me(he([],[[p,/^[\s\S]+/]]),["regex"]);function te(xe){var Pe=xe.langExtension;try{var Ne=N(xe.sourceNode,xe.pre),Be=Ne.sourceCode;xe.sourceCode=Be,xe.spans=Ne.spans,xe.basePos=0,ue(Pe,Be)(xe),Te(xe)}catch(We){F.console&&console.log(We&&We.stack||We)}}function ce(xe,Pe,Ne){var Be=Ne||!1,We=Pe||null,Ue=document.createElement("div");Ue.innerHTML="<pre>"+xe+"</pre>",Ue=Ue.firstChild,Be&&Ce(Ue,Be,!0);var Fe={langExtension:We,numberLines:Be,sourceNode:Ue,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return te(Fe),Ue.innerHTML}function se(xe,Pe){var Ne=Pe||document.body,Be=Ne.ownerDocument||document;function We(pe){return Ne.getElementsByTagName(pe)}for(var Ue=[We("pre"),We("code"),We("xmp")],Fe=[],at=0;at<Ue.length;++at)for(var it=0,et=Ue[at].length;it<et;++it)Fe.push(Ue[at][it]);Ue=null;var Ze=Date;Ze.now||(Ze={now:function(){return+new Date}});var ut=0,Je=/\blang(?:uage)?-([\w.]+)(?!\S)/,st=/\bprettyprint\b/,Re=/\bprettyprinted\b/,nt=/pre|xmp/i,qe=/^code$/i,Ie=/^(?:pre|code|xmp)$/i,He={};function Se(){for(var pe=F.PR_SHOULD_USE_CONTINUATION?Ze.now()+250:Infinity;ut<Fe.length&&Ze.now()<pe;ut++){for(var ye=Fe[ut],re=He,oe=ye;oe=oe.previousSibling;){var le=oe.nodeType,de=(le===7||le===8)&&oe.nodeValue;if(de?!/^\??prettify\b/.test(de):le!==3||/\S/.test(oe.nodeValue))break;if(de){re={},de.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Bt,wt,yr){re[wt]=yr});break}}var De=ye.className;if((re!==He||st.test(De))&&!Re.test(De)){for(var Me=!1,Ye=ye.parentNode;Ye;Ye=Ye.parentNode){var yt=Ye.tagName;if(Ie.test(yt)&&Ye.className&&st.test(Ye.className)){Me=!0;break}}if(!Me){ye.className+=" prettyprinted";var At=re.lang;if(!At){At=De.match(Je);var Ke;!At&&(Ke=ae(ye))&&qe.test(Ke.tagName)&&(At=Ke.className.match(Je)),At&&(At=At[1])}var xt;if(nt.test(ye.tagName))xt=1;else{var mt=ye.currentStyle,ot=Be.defaultView,Rt=mt?mt.whiteSpace:ot&&ot.getComputedStyle?ot.getComputedStyle(ye,null).getPropertyValue("white-space"):0;xt=Rt&&Rt.substring(0,3)==="pre"}var Lt=re.linenums;(Lt=Lt==="true"||+Lt)||(Lt=De.match(/\blinenums\b(?::(\d+))?/),Lt=Lt?Lt[1]&&Lt[1].length?+Lt[1]:!0:!1),Lt&&Ce(ye,Lt,xt);var Kt={langExtension:At,sourceNode:ye,numberLines:Lt,pre:xt,sourceCode:null,basePos:null,spans:null,decorations:null};te(Kt)}}}ut<Fe.length?F.setTimeout(Se,250):typeof xe=="function"&&xe()}Se()}var we=F.PR={createSimpleLexer:he,registerLangHandler:me,sourceDecorator:_e,PR_ATTRIB_NAME:R,PR_ATTRIB_VALUE:B,PR_COMMENT:E,PR_DECLARATION:x,PR_KEYWORD:D,PR_LITERAL:c,PR_NOCODE:j,PR_PLAIN:o,PR_PUNCTUATION:h,PR_SOURCE:v,PR_STRING:p,PR_TAG:C,PR_TYPE:g,prettyPrintOne:k?F.prettyPrintOne=ce:O=ce,prettyPrint:W=k?F.prettyPrint=se:W=se},Le=F.define;typeof Le=="function"&&Le.amd&&Le("google-code-prettify",[],function(){return we})})()},"VrN/":function(lt,$e,ie){(function(ne,$){lt.exports=$()})(this,function(){"use strict";var ne=navigator.userAgent,$=navigator.platform,k=/gecko\/\d/i.test(ne),X=/MSIE \d/.test(ne),U=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ne),O=/Edge\/(\d+)/.exec(ne),W=X||U||O,F=W&&(X?document.documentMode||6:+(O||U)[1]),P=!O&&/WebKit\//.test(ne),w=P&&/Qt\/\d+\.\d+/.test(ne),f=!O&&/Chrome\//.test(ne),b=/Opera\//.test(ne),M=/Apple Computer/.test(navigator.vendor),A=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ne),S=/PhantomJS/.test(ne),T=!O&&/AppleWebKit/.test(ne)&&/Mobile\/\w+/.test(ne),d=/Android/.test(ne),a=T||d||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ne),s=T||/Mac/.test($),u=/\bCrOS\b/.test(ne),_=/win/i.test($),m=b&&ne.match(/Version\/(\d*\.\d*)/);m&&(m=Number(m[1])),m&&m>=15&&(b=!1,P=!0);var p=s&&(w||b&&(m==null||m<12.11)),D=k||W&&F>=9;function E(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var g=function(e,t){var i=e.className,r=E(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 h(e,t){return c(e).appendChild(t)}function o(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 L=0;L<t.length;++L)n.appendChild(t[L]);return n}function C(e,t,i,r){var n=o(e,t,i,r);return n.setAttribute("role","presentation"),n}var x;document.createRange?x=function(e,t,i,r){var n=document.createRange();return n.setEnd(r||e,i),n.setStart(e,t),n}:x=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 v(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 R(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function B(e,t){var i=e.className;E(t).test(i)||(e.className+=(i?" ":"")+t)}function j(e,t){for(var i=e.split(" "),r=0;r<i.length;r++)i[r]&&!E(i[r]).test(t)&&(t+=" "+i[r]);return t}var K=function(e){e.select()};T?K=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:W&&(K=function(e){try{e.select()}catch(t){}});function I(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function N(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 Y(e,t,i,r,n){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var L=r||0,H=n||0;;){var Q=e.indexOf(" ",L);if(Q<0||Q>=t)return H+(t-L);H+=Q-L,H+=i-H%i,L=Q+1}}var q=function(){this.id=null,this.f=null,this.time=0,this.handler=I(this.onTimeout,this)};q.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},q.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 ae(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}var he=50,_e={toString:function(){return"CodeMirror.Pass"}},be={scroll:!1},Ce={origin:"*mouse"},Te={origin:"+move"};function Ee(e,t,i){for(var r=0,n=0;;){var L=e.indexOf(" ",r);L==-1&&(L=e.length);var H=L-r;if(L==e.length||n+H>=t)return r+Math.min(H,t-n);if(n+=L-r,n+=i-n%i,r=L+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 ce(e,t){for(var i=[],r=0;r<e.length;r++)i[r]=t(e[r],r);return i}function se(e,t,i){for(var r=0,n=i(t);r<e.length&&i(e[r])<=n;)r++;e.splice(r,0,t)}function we(){}function Le(e,t){var i;return Object.create?i=Object.create(e):(we.prototype=e,i=new we),t&&N(t,i),i}var xe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Pe(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||xe.test(e))}function Ne(e,t){return t?t.source.indexOf("\\w")>-1&&Pe(e)?!0:t.test(e):Pe(e)}function Be(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var We=/[\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 Ue(e){return e.charCodeAt(0)>=768&&We.test(e)}function Fe(e,t,i){for(;(i<0?t>0:t<e.length)&&Ue(e.charAt(t));)t+=i;return t}function at(e,t,i){for(var r=t>i?-1:1;;){if(t==i)return t;var n=(t+i)/2,L=r<0?Math.ceil(n):Math.floor(n);if(L==t)return e(L)?t:i;e(L)?i=L:t=L+r}}function it(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,L=0;L<e.length;++L){var H=e[L];(H.from<i&&H.to>t||t==i&&H.to==t)&&(r(Math.max(H.from,t),Math.min(H.to,i),H.level==1?"rtl":"ltr",L),n=!0)}n||r(t,i,"ltr")}var et=null;function Ze(e,t,i){var r;et=null;for(var n=0;n<e.length;++n){var L=e[n];if(L.from<t&&L.to>t)return n;L.to==t&&(L.from!=L.to&&i=="before"?r=n:et=n),L.from==t&&(L.from!=L.to&&i!="before"?r=n:et=n)}return r!=null?r:et}var ut=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(ee){return ee<=247?e.charAt(ee):1424<=ee&&ee<=1524?"R":1536<=ee&&ee<=1785?t.charAt(ee-1536):1774<=ee&&ee<=2220?"r":8192<=ee&&ee<=8203?"w":ee==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,L=/[LRr]/,H=/[Lb1n]/,Q=/[1n]/;function J(ee,fe,ge){this.level=ee,this.from=fe,this.to=ge}return function(ee,fe){var ge=fe=="ltr"?"L":"R";if(ee.length==0||fe=="ltr"&&!r.test(ee))return!1;for(var ke=ee.length,Ae=[],je=0;je<ke;++je)Ae.push(i(ee.charCodeAt(je)));for(var Ve=0,Qe=ge;Ve<ke;++Ve){var tt=Ae[Ve];tt=="m"?Ae[Ve]=Qe:Qe=tt}for(var ht=0,rt=ge;ht<ke;++ht){var dt=Ae[ht];dt=="1"&&rt=="r"?Ae[ht]="n":L.test(dt)&&(rt=dt,dt=="r"&&(Ae[ht]="R"))}for(var Et=1,vt=Ae[0];Et<ke-1;++Et){var _t=Ae[Et];_t=="+"&&vt=="1"&&Ae[Et+1]=="1"?Ae[Et]="1":_t==","&&vt==Ae[Et+1]&&(vt=="1"||vt=="n")&&(Ae[Et]=vt),vt=_t}for(var Yt=0;Yt<ke;++Yt){var dr=Ae[Yt];if(dr==",")Ae[Yt]="N";else if(dr=="%"){var Jt=void 0;for(Jt=Yt+1;Jt<ke&&Ae[Jt]=="%";++Jt);for(var Br=Yt&&Ae[Yt-1]=="!"||Jt<ke&&Ae[Jt]=="1"?"1":"N",kr=Yt;kr<Jt;++kr)Ae[kr]=Br;Yt=Jt-1}}for(var tr=0,Rr=ge;tr<ke;++tr){var vr=Ae[tr];Rr=="L"&&vr=="1"?Ae[tr]="L":L.test(vr)&&(Rr=vr)}for(var or=0;or<ke;++or)if(n.test(Ae[or])){var rr=void 0;for(rr=or+1;rr<ke&&n.test(Ae[rr]);++rr);for(var Zt=(or?Ae[or-1]:ge)=="L",Or=(rr<ke?Ae[rr]:ge)=="L",dn=Zt==Or?Zt?"L":"R":ge,Di=or;Di<rr;++Di)Ae[Di]=dn;or=rr-1}for(var Er=[],oi,cr=0;cr<ke;)if(H.test(Ae[cr])){var Ya=cr;for(++cr;cr<ke&&H.test(Ae[cr]);++cr);Er.push(new J(0,Ya,cr))}else{var mi=cr,zi=Er.length,Gi=fe=="rtl"?1:0;for(++cr;cr<ke&&Ae[cr]!="L";++cr);for(var Cr=mi;Cr<cr;)if(Q.test(Ae[Cr])){mi<Cr&&(Er.splice(zi,0,new J(1,mi,Cr)),zi+=Gi);var cn=Cr;for(++Cr;Cr<cr&&Q.test(Ae[Cr]);++Cr);Er.splice(zi,0,new J(2,cn,Cr)),zi+=Gi,mi=Cr}else++Cr;mi<cr&&Er.splice(zi,0,new J(1,mi,cr))}return fe=="ltr"&&(Er[0].level==1&&(oi=ee.match(/^\s+/))&&(Er[0].from=oi[0].length,Er.unshift(new J(0,0,oi[0].length))),te(Er).level==1&&(oi=ee.match(/\s+$/))&&(te(Er).to-=oi[0].length,Er.push(new J(0,ke-oi[0].length,ke)))),fe=="rtl"?Er.reverse():Er}}();function Je(e,t){var i=e.order;return i==null&&(i=e.order=ut(e.text,t)),i}var st=[],Re=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]||st).concat(i)}};function nt(e,t){return e._handlers&&e._handlers[t]||st}function qe(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 L=ae(n,i);L>-1&&(r[t]=n.slice(0,L).concat(n.slice(L+1)))}}}function Ie(e,t){var i=nt(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 He(e,t,i){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Ie(e,i||t.type,e,t),le(t)||t.codemirrorIgnore}function Se(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)ae(i,t[r])==-1&&i.push(t[r])}function pe(e,t){return nt(e,t).length>0}function ye(e){e.prototype.on=function(t,i){Re(this,t,i)},e.prototype.off=function(t,i){qe(this,t,i)}}function re(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function oe(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function le(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function de(e){re(e),oe(e)}function De(e){return e.target||e.srcElement}function Me(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),s&&e.ctrlKey&&t==1&&(t=3),t}var Ye=function(){if(W&&F<9)return!1;var e=o("div");return"draggable"in e||"dragDrop"in e}(),yt;function At(e){if(yt==null){var t=o("span","\u200B");h(e,o("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(yt=t.offsetWidth<=1&&t.offsetHeight>2&&!(W&&F<8))}var i=yt?o("span","\u200B"):o("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var Ke;function xt(e){if(Ke!=null)return Ke;var t=h(e,document.createTextNode("A\u062EA")),i=x(t,0,1).getBoundingClientRect(),r=x(t,1,2).getBoundingClientRect();return c(e),!i||i.left==i.right?!1:Ke=r.right-i.right<3}var mt=`
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 L=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),H=L.indexOf("\r");H!=-1?(i.push(L.slice(0,H)),t+=H+1):(i.push(L),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},ot=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},Rt=function(){var e=o("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Lt=null;function Kt(e){if(Lt!=null)return Lt;var t=h(e,o("span","x")),i=t.getBoundingClientRect(),r=x(t,0,1).getBoundingClientRect();return Lt=Math.abs(i.left-r.left)>1}var Bt={},wt={};function yr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Bt[e]=t}function ir(e,t){wt[e]=t}function gt(e){if(typeof e=="string"&&wt.hasOwnProperty(e))e=wt[e];else if(e&&typeof e.name=="string"&&wt.hasOwnProperty(e.name)){var t=wt[e.name];typeof t=="string"&&(t={name:t}),e=Le(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return gt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return gt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Gr(e,t){t=gt(t);var i=Bt[t.name];if(!i)return Gr(e,"text/plain");var r=i(e,t);if(br.hasOwnProperty(t.name)){var n=br[t.name];for(var L in n){if(!n.hasOwnProperty(L))continue;r.hasOwnProperty(L)&&(r["_"+L]=r[L]),r[L]=n[L]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var H in t.modeProps)r[H]=t.modeProps[H];return r}var br={};function fr(e,t){var i=br.hasOwnProperty(e)?br[e]:br[e]={};N(t,i)}function Tr(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 si(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 Kr(e,t,i){return e.startState?e.startState(t,i):!0}var It=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};It.prototype.eol=function(){return this.pos>=this.string.length},It.prototype.sol=function(){return this.pos==this.lineStart},It.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},It.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},It.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},It.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},It.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},It.prototype.skipToEnd=function(){this.pos=this.string.length},It.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},It.prototype.backUp=function(e){this.pos-=e},It.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Y(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?Y(this.string,this.lineStart,this.tabSize):0)},It.prototype.indentation=function(){return Y(this.string,null,this.tabSize)-(this.lineStart?Y(this.string,this.lineStart,this.tabSize):0)},It.prototype.match=function(e,t,i){if(typeof e=="string"){var r=function(H){return i?H.toLowerCase():H},n=this.string.substr(this.pos,e.length);if(r(n)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var L=this.string.slice(this.pos).match(e);return L&&L.index>0?null:(L&&t!==!1&&(this.pos+=L[0].length),L)}},It.prototype.current=function(){return this.string.slice(this.start,this.pos)},It.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},It.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},It.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ft(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],L=n.chunkSize();if(t<L){i=n;break}t-=L}return i.lines[t]}function Ur(e,t,i){var r=[],n=t.line;return e.iter(t.line,i.line+1,function(L){var H=L.text;n==i.line&&(H=H.slice(0,i.ch)),n==t.line&&(H=H.slice(t.ch)),r.push(H),++n}),r}function li(e,t,i){var r=[];return e.iter(t,i,function(n){r.push(n.text)}),r}function wr(e,t){var i=t-e.height;if(i)for(var r=e;r;r=r.parent)r.height+=i}function Ot(e){if(e.parent==null)return null;for(var t=e.parent,i=ae(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 Vr(e,t){var i=e.first;e:do{for(var r=0;r<e.children.length;++r){var n=e.children[r],L=n.height;if(t<L){e=n;continue e}t-=L,i+=n.chunkSize()}return i}while(!e.lines);for(var H=0;H<e.lines.length;++H){var Q=e.lines[H],J=Q.height;if(t<J)break;t-=J}return i+H}function ui(e,t){return t>=e.first&&t<e.first+e.size}function gi(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Xe(e,t,i){if(i===void 0&&(i=null),!(this instanceof Xe))return new Xe(e,t,i);this.line=e,this.ch=t,this.sticky=i}function St(e,t){return e.line-t.line||e.ch-t.ch}function ei(e,t){return e.sticky==t.sticky&&St(e,t)==0}function hi(e){return Xe(e.line,e.ch)}function di(e,t){return St(e,t)<0?t:e}function ki(e,t){return St(e,t)<0?e:t}function V(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function l(e,t){if(t.line<e.first)return Xe(e.first,0);var i=e.first+e.size-1;return t.line>i?Xe(i,ft(e,i).text.length):y(t,ft(e,t.line).text.length)}function y(e,t){var i=e.ch;return i==null||i>t?Xe(e.line,t):i<0?Xe(e.line,0):e}function z(e,t){for(var i=[],r=0;r<t.length;r++)i[r]=l(e,t[r]);return i}var Z=function(e,t){this.state=e,this.lookAhead=t},G=function(e,t,i,r){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};G.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},G.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},G.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},G.fromSaved=function(e,t,i){return t instanceof Z?new G(e,Tr(e.mode,t.state),i,t.lookAhead):new G(e,Tr(e.mode,t),i)},G.prototype.save=function(e){var t=e!==!1?Tr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Z(t,this.maxLookAhead):t};function ve(e,t,i,r){var n=[e.state.modeGen],L={};jr(e,t.text,e.doc.mode,i,function(ee,fe){return n.push(ee,fe)},L,r);for(var H=i.state,Q=function(ee){i.baseTokens=n;var fe=e.state.overlays[ee],ge=1,ke=0;i.state=!0,jr(e,t.text,fe.mode,i,function(Ae,je){for(var Ve=ge;ke<Ae;){var Qe=n[ge];Qe>Ae&&n.splice(ge,1,Ae,n[ge+1],Qe),ge+=2,ke=Math.min(Ae,Qe)}if(!je)return;if(fe.opaque)n.splice(Ve,ge-Ve,Ae,"overlay "+je),ge=Ve+2;else for(;Ve<ge;Ve+=2){var tt=n[Ve+1];n[Ve+1]=(tt?tt+" ":"")+"overlay "+je}},L),i.state=H,i.baseTokens=null,i.baseTokenPos=1},J=0;J<e.state.overlays.length;++J)Q(J);return{styles:n,classes:L.bgClass||L.textClass?L:null}}function ze(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Oe(e,Ot(t)),n=t.text.length>e.options.maxHighlightLength&&Tr(e.doc.mode,r.state),L=ve(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=L.styles,L.classes?t.styleClasses=L.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 Oe(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new G(r,!0,t);var L=sr(e,t,i),H=L>r.first&&ft(r,L-1).stateAfter,Q=H?G.fromSaved(r,H,L):new G(r,Kr(r.mode),L);return r.iter(L,t,function(J){ct(e,J.text,Q);var ee=Q.line;J.stateAfter=ee==t-1||ee%5==0||ee>=n.viewFrom&&ee<n.viewTo?Q.save():null,Q.nextLine()}),i&&(r.modeFrontier=Q.line),Q}function ct(e,t,i,r){var n=e.doc.mode,L=new It(t,e.options.tabSize,i);for(L.start=L.pos=r||0,t==""&&Ge(n,i.state);!L.eol();)Ct(n,L,i.state),L.start=L.pos}function Ge(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var i=si(e,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}function Ct(e,t,i,r){for(var n=0;n<10;n++){r&&(r[0]=si(e,i).mode);var L=e.token(t,i);if(t.pos>t.start)return L}throw new Error("Mode "+e.name+" failed to advance stream.")}var Mt=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function Wt(e,t,i,r){var n=e.doc,L=n.mode,H;t=l(n,t);var Q=ft(n,t.line),J=Oe(e,t.line,i),ee=new It(Q.text,e.options.tabSize,J),fe;for(r&&(fe=[]);(r||ee.pos<t.ch)&&!ee.eol();)ee.start=ee.pos,H=Ct(L,ee,J.state),r&&fe.push(new Mt(ee,H,Tr(n.mode,J.state)));return r?fe:new Mt(ee,H,J.state)}function Fr(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 jr(e,t,i,r,n,L,H){var Q=i.flattenSpans;Q==null&&(Q=e.options.flattenSpans);var J=0,ee=null,fe=new It(t,e.options.tabSize,r),ge,ke=e.options.addModeClass&&[null];for(t==""&&Fr(Ge(i,r.state),L);!fe.eol();){if(fe.pos>e.options.maxHighlightLength?(Q=!1,H&&ct(e,t,r,fe.pos),fe.pos=t.length,ge=null):ge=Fr(Ct(i,fe,r.state,ke),L),ke){var Ae=ke[0].name;Ae&&(ge="m-"+(ge?Ae+" "+ge:Ae))}if(!Q||ee!=ge){for(;J<fe.start;)J=Math.min(fe.start,J+5e3),n(J,ee);ee=ge}fe.start=fe.pos}for(;J<fe.pos;){var je=Math.min(fe.pos,J+5e3);n(je,ee),J=je}}function sr(e,t,i){for(var r,n,L=e.doc,H=i?-1:t-(e.doc.mode.innerMode?1e3:100),Q=t;Q>H;--Q){if(Q<=L.first)return L.first;var J=ft(L,Q-1),ee=J.stateAfter;if(ee&&(!i||Q+(ee instanceof Z?ee.lookAhead:0)<=L.modeFrontier))return Q;var fe=Y(J.text,null,e.options.tabSize);(n==null||r>fe)&&(n=Q-1,r=fe)}return n}function Xr(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=ft(e,r).stateAfter;if(n&&(!(n instanceof Z)||r+n.lookAhead<t)){i=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,i)}var Ki=!1,Ar=!1;function _r(){Ki=!0}function ti(){Ar=!0}function vi(e,t,i){this.marker=e,this.from=t,this.to=i}function $r(e,t){if(e)for(var i=0;i<e.length;++i){var r=e[i];if(r.marker==t)return r}}function ri(e,t){for(var i,r=0;r<e.length;++r)e[r]!=t&&(i||(i=[])).push(e[r]);return i}function Wr(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function fn(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var L=e[n],H=L.marker,Q=L.from==null||(H.inclusiveLeft?L.from<=t:L.from<t);if(Q||L.from==t&&H.type=="bookmark"&&(!i||!L.marker.insertLeft)){var J=L.to==null||(H.inclusiveRight?L.to>=t:L.to>t);(r||(r=[])).push(new vi(H,L.from,J?null:L.to))}}return r}function Vi(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var L=e[n],H=L.marker,Q=L.to==null||(H.inclusiveRight?L.to>=t:L.to>t);if(Q||L.from==t&&H.type=="bookmark"&&(!i||L.marker.insertLeft)){var J=L.from==null||(H.inclusiveLeft?L.from<=t:L.from<t);(r||(r=[])).push(new vi(H,J?null:L.from-t,L.to==null?null:L.to-t))}}return r}function Pr(e,t){if(t.full)return null;var i=ui(e,t.from.line)&&ft(e,t.from.line).markedSpans,r=ui(e,t.to.line)&&ft(e,t.to.line).markedSpans;if(!i&&!r)return null;var n=t.from.ch,L=t.to.ch,H=St(t.from,t.to)==0,Q=fn(i,n,H),J=Vi(r,L,H),ee=t.text.length==1,fe=te(t.text).length+(ee?n:0);if(Q)for(var ge=0;ge<Q.length;++ge){var ke=Q[ge];if(ke.to==null){var Ae=$r(J,ke.marker);Ae?ee&&(ke.to=Ae.to==null?null:Ae.to+fe):ke.to=n}}if(J)for(var je=0;je<J.length;++je){var Ve=J[je];if(Ve.to!=null&&(Ve.to+=fe),Ve.from==null){var Qe=$r(Q,Ve.marker);Qe||(Ve.from=fe,ee&&(Q||(Q=[])).push(Ve))}else Ve.from+=fe,ee&&(Q||(Q=[])).push(Ve)}Q&&(Q=Mr(Q)),J&&J!=Q&&(J=Mr(J));var tt=[Q];if(!ee){var ht=t.text.length-2,rt;if(ht>0&&Q)for(var dt=0;dt<Q.length;++dt)Q[dt].to==null&&(rt||(rt=[])).push(new vi(Q[dt].marker,null,null));for(var Et=0;Et<ht;++Et)tt.push(rt);tt.push(J)}return tt}function Mr(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 Ri(e,t,i){var r=null;if(e.iter(t.line,i.line+1,function(Ae){if(Ae.markedSpans)for(var je=0;je<Ae.markedSpans.length;++je){var Ve=Ae.markedSpans[je].marker;Ve.readOnly&&(!r||ae(r,Ve)==-1)&&(r||(r=[])).push(Ve)}}),!r)return null;for(var n=[{from:t,to:i}],L=0;L<r.length;++L)for(var H=r[L],Q=H.find(0),J=0;J<n.length;++J){var ee=n[J];if(St(ee.to,Q.from)<0||St(ee.from,Q.to)>0)continue;var fe=[J,1],ge=St(ee.from,Q.from),ke=St(ee.to,Q.to);(ge<0||!H.inclusiveLeft&&!ge)&&fe.push({from:ee.from,to:Q.from}),(ke>0||!H.inclusiveRight&&!ke)&&fe.push({from:Q.to,to:ee.to}),n.splice.apply(n,fe),J+=fe.length-3}return n}function Oi(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 Pi(e,t){if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}function qt(e){return e.inclusiveLeft?-1:0}function Ut(e){return e.inclusiveRight?1:0}function pr(e,t){var i=e.lines.length-t.lines.length;if(i!=0)return i;var r=e.find(),n=t.find(),L=St(r.from,n.from)||qt(e)-qt(t);if(L)return-L;var H=St(r.to,n.to)||Ut(e)-Ut(t);return H||t.id-e.id}function Ft(e,t){var i=Ar&&e.markedSpans,r;if(i)for(var n=void 0,L=0;L<i.length;++L)n=i[L],n.marker.collapsed&&(t?n.from:n.to)==null&&(!r||pr(r,n.marker)<0)&&(r=n.marker);return r}function mr(e){return Ft(e,!0)}function Xt(e){return Ft(e,!1)}function yi(e,t){var i=Ar&&e.markedSpans,r;if(i)for(var n=0;n<i.length;++n){var L=i[n];L.marker.collapsed&&(L.from==null||L.from<t)&&(L.to==null||L.to>t)&&(!r||pr(r,L.marker)<0)&&(r=L.marker)}return r}function nr(e,t,i,r,n){var L=ft(e,t),H=Ar&&L.markedSpans;if(H)for(var Q=0;Q<H.length;++Q){var J=H[Q];if(!J.marker.collapsed)continue;var ee=J.marker.find(0),fe=St(ee.from,i)||qt(J.marker)-qt(n),ge=St(ee.to,r)||Ut(J.marker)-Ut(n);if(fe>=0&&ge<=0||fe<=0&&ge>=0)continue;if(fe<=0&&(J.marker.inclusiveRight&&n.inclusiveLeft?St(ee.to,i)>=0:St(ee.to,i)>0)||fe>=0&&(J.marker.inclusiveRight&&n.inclusiveLeft?St(ee.from,r)<=0:St(ee.from,r)<0))return!0}}function ar(e){for(var t;t=mr(e);)e=t.find(-1,!0).line;return e}function ii(e){for(var t;t=Xt(e);)e=t.find(1,!0).line;return e}function bi(e){for(var t,i;t=Xt(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function xi(e,t){var i=ft(e,t),r=ar(i);return i==r?t:Ot(r)}function Fn(e,t){if(t>e.lastLine())return t;var i=ft(e,t),r;if(!Qr(e,i))return t;for(;r=Xt(i);)i=r.find(1,!0).line;return Ot(i)+1}function Qr(e,t){var i=Ar&&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&&Xi(e,t,r))return!0}}function Xi(e,t,i){if(i.to==null){var r=i.marker.find(1,!0);return Xi(e,r.line,$r(r.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(var n=void 0,L=0;L<t.markedSpans.length;++L)if(n=t.markedSpans[L],n.marker.collapsed&&!n.marker.widgetNode&&n.from==i.to&&(n.to==null||n.to!=i.from)&&(n.marker.inclusiveLeft||i.marker.inclusiveRight)&&Xi(e,t,n))return!0}function Ir(e){e=ar(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 L=i.parent;L;i=L,L=i.parent)for(var H=0;H<L.children.length;++H){var Q=L.children[H];if(Q==i)break;t+=Q.height}return t}function Yi(e){if(e.height==0)return 0;for(var t=e.text.length,i,r=e;i=mr(r);){var n=i.find(0,!0);r=n.from.line,t+=n.from.ch-n.to.ch}for(r=e;i=Xt(r);){var L=i.find(0,!0);t-=r.text.length-L.from.ch,r=L.to.line,t+=r.text.length-L.to.ch}return t}function ci(e){var t=e.display,i=e.doc;t.maxLine=ft(i,i.first),t.maxLineLength=Yi(t.maxLine),t.maxLineChanged=!0,i.iter(function(r){var n=Yi(r);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var Ei=function(e,t,i){this.text=e,Pi(this,t),this.height=i?i(this):1};Ei.prototype.lineNo=function(){return Ot(this)},ye(Ei);function ua(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Oi(e),Pi(e,i);var n=r?r(e):1;n!=e.height&&wr(e,n)}function ha(e){e.parent=null,Oi(e)}var Qa={},Ja={};function da(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?Ja:Qa;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function jn(e,t){var i=C("span",null,null,P?"padding-right: .1px":null),r={pre:C("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 L=n?t.rest[n-1]:t.line,H=void 0;r.pos=0,r.addToken=Tt,xt(e.display.measure)&&(H=Je(L,e.doc.direction))&&(r.addToken=Dt(r.addToken,H)),r.map=[];var Q=t!=e.display.externalMeasured&&Ot(L);Ht(L,r,ze(e,L,Q)),L.styleClasses&&(L.styleClasses.bgClass&&(r.bgClass=j(L.styleClasses.bgClass,r.bgClass||"")),L.styleClasses.textClass&&(r.textClass=j(L.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(At(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(P){var J=r.content.lastChild;(/\bcm-tab\b/.test(J.className)||J.querySelector&&J.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Ie(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=j(r.pre.className,r.textClass||"")),r}function pt(e){var t=o("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Tt(e,t,i,r,n,L,H){if(!t)return;var Q=e.splitSpaces?bt(t,e.trailingSpace):t,J=e.cm.state.specialChars,ee=!1,fe;if(!J.test(t))e.col+=t.length,fe=document.createTextNode(Q),e.map.push(e.pos,e.pos+t.length,fe),W&&F<9&&(ee=!0),e.pos+=t.length;else{fe=document.createDocumentFragment();for(var ge=0;;){J.lastIndex=ge;var ke=J.exec(t),Ae=ke?ke.index-ge:t.length-ge;if(Ae){var je=document.createTextNode(Q.slice(ge,ge+Ae));W&&F<9?fe.appendChild(o("span",[je])):fe.appendChild(je),e.map.push(e.pos,e.pos+Ae,je),e.col+=Ae,e.pos+=Ae}if(!ke)break;ge+=Ae+1;var Ve=void 0;if(ke[0]==" "){var Qe=e.cm.options.tabSize,tt=Qe-e.col%Qe;Ve=fe.appendChild(o("span",ue(tt),"cm-tab")),Ve.setAttribute("role","presentation"),Ve.setAttribute("cm-text"," "),e.col+=tt}else ke[0]=="\r"||ke[0]==`
`?(Ve=fe.appendChild(o("span",ke[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ve.setAttribute("cm-text",ke[0]),e.col+=1):(Ve=e.cm.options.specialCharPlaceholder(ke[0]),Ve.setAttribute("cm-text",ke[0]),W&&F<9?fe.appendChild(o("span",[Ve])):fe.appendChild(Ve),e.col+=1);e.map.push(e.pos,e.pos+1,Ve),e.pos++}}if(e.trailingSpace=Q.charCodeAt(t.length-1)==32,i||r||n||ee||L||H){var ht=i||"";r&&(ht+=r),n&&(ht+=n);var rt=o("span",[fe],ht,L);if(H)for(var dt in H)H.hasOwnProperty(dt)&&dt!="style"&&dt!="class"&&rt.setAttribute(dt,H[dt]);return e.content.appendChild(rt)}e.content.appendChild(fe)}function bt(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;n<e.length;n++){var L=e.charAt(n);L==" "&&i&&(n==e.length-1||e.charCodeAt(n+1)==32)&&(L="\xA0"),r+=L,i=L==" "}return r}function Dt(e,t){return function(i,r,n,L,H,Q,J){n=n?n+" cm-force-border":"cm-force-border";for(var ee=i.pos,fe=ee+r.length;;){for(var ge=void 0,ke=0;ke<t.length&&!(ge=t[ke],ge.to>ee&&ge.from<=ee);ke++);if(ge.to>=fe)return e(i,r,n,L,H,Q,J);e(i,r.slice(0,ge.to-ee),n,L,null,Q,J),L=null,r=r.slice(ge.to-ee),ee=ge.to}}}function Nt(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 Ht(e,t,i){var r=e.markedSpans,n=e.text,L=0;if(!r){for(var H=1;H<i.length;H+=2)t.addToken(t,n.slice(L,L=i[H]),da(i[H+1],t.cm.options));return}for(var Q=n.length,J=0,ee=1,fe="",ge,ke,Ae=0,je,Ve,Qe,tt,ht;;){if(Ae==J){je=Ve=Qe=ke="",ht=null,tt=null,Ae=Infinity;for(var rt=[],dt=void 0,Et=0;Et<r.length;++Et){var vt=r[Et],_t=vt.marker;if(_t.type=="bookmark"&&vt.from==J&&_t.widgetNode)rt.push(_t);else if(vt.from<=J&&(vt.to==null||vt.to>J||_t.collapsed&&vt.to==J&&vt.from==J)){if(vt.to!=null&&vt.to!=J&&Ae>vt.to&&(Ae=vt.to,Ve=""),_t.className&&(je+=" "+_t.className),_t.css&&(ke=(ke?ke+";":"")+_t.css),_t.startStyle&&vt.from==J&&(Qe+=" "+_t.startStyle),_t.endStyle&&vt.to==Ae&&(dt||(dt=[])).push(_t.endStyle,vt.to),_t.title&&((ht||(ht={})).title=_t.title),_t.attributes)for(var Yt in _t.attributes)(ht||(ht={}))[Yt]=_t.attributes[Yt];_t.collapsed&&(!tt||pr(tt.marker,_t)<0)&&(tt=vt)}else vt.from>J&&Ae>vt.from&&(Ae=vt.from)}if(dt)for(var dr=0;dr<dt.length;dr+=2)dt[dr+1]==Ae&&(Ve+=" "+dt[dr]);if(!tt||tt.from==J)for(var Jt=0;Jt<rt.length;++Jt)Nt(t,0,rt[Jt]);if(tt&&(tt.from||0)==J){if(Nt(t,(tt.to==null?Q+1:tt.to)-J,tt.marker,tt.from==null),tt.to==null)return;tt.to==J&&(tt=!1)}}if(J>=Q)break;for(var Br=Math.min(Q,Ae);;){if(fe){var kr=J+fe.length;if(!tt){var tr=kr>Br?fe.slice(0,Br-J):fe;t.addToken(t,tr,ge?ge+je:je,Qe,J+tr.length==Ae?Ve:"",ke,ht)}if(kr>=Br){fe=fe.slice(Br-J),J=Br;break}J=kr,Qe=""}fe=n.slice(L,L=i[ee++]),ge=da(i[ee++],t.cm.options)}}}function Pt(e,t,i){this.line=t,this.rest=bi(t),this.size=this.rest?Ot(te(this.rest))-i+1:1,this.node=this.text=null,this.hidden=Qr(e,t)}function Qt(e,t,i){for(var r=[],n,L=t;L<i;L=n){var H=new Pt(e.doc,ft(e.doc,L),L);n=L+H.size,r.push(H)}return r}var lr=null;function kt(e){lr?lr.ops.push(e):e.ownsGroup=lr={ops:[e],delayedCallbacks:[]}}function Mi(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 zt(e,t){var i=e.ownsGroup;if(!i)return;try{Mi(i)}finally{lr=null,t(i)}}var gr=null;function Vt(e,t){var i=nt(e,t);if(!i.length)return;var r=Array.prototype.slice.call(arguments,2),n;lr?n=lr.delayedCallbacks:gr?n=gr:(n=gr=[],setTimeout(Yr,0));for(var L=function(Q){n.push(function(){return i[Q].apply(null,r)})},H=0;H<i.length;++H)L(H)}function Yr(){var e=gr;gr=null;for(var t=0;t<e.length;++t)e[t]()}function pn(e,t,i,r){for(var n=0;n<t.changes.length;n++){var L=t.changes[n];L=="text"?Ms(e,t):L=="gutter"?qa(e,t,i,r):L=="class"?ca(e,t):L=="widget"&&Is(e,t,r)}t.changes=null}function mn(e){return e.node==e.text&&(e.node=o("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),W&&F<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(o("div",null,i),r.firstChild),e.display.input.setUneditable(t.background)}}function Za(e,t){var i=e.display.externalMeasured;return i&&i.line==t.line?(e.display.externalMeasured=null,t.measure=i.measure,i.built):jn(e,t)}function Ms(e,t){var i=t.text.className,r=Za(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,ca(e,t)):i&&(t.text.className=i)}function ca(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=o("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 L=t.line.gutterMarkers;if(e.options.lineNumbers||L){var H=mn(t),Q=t.gutter=o("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(Q),H.insertBefore(Q,t.text),t.line.gutterClass&&(Q.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!L||!L["CodeMirror-linenumbers"])&&(t.lineNumber=Q.appendChild(o("div",gi(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),L)for(var J=0;J<e.display.gutterSpecs.length;++J){var ee=e.display.gutterSpecs[J].className,fe=L.hasOwnProperty(ee)&&L[ee];fe&&Q.appendChild(o("div",[fe],"CodeMirror-gutter-elt","left: "+r.gutterLeft[ee]+"px; width: "+r.gutterWidth[ee]+"px"))}}}function Is(e,t,i){t.alignable&&(t.alignable=null);for(var r=E("CodeMirror-linewidget"),n=t.node.firstChild,L=void 0;n;n=L)L=n.nextSibling,r.test(n.className)&&t.node.removeChild(n);eo(e,t,i)}function Ns(e,t,i,r){var n=Za(e,t);return t.text=t.node=n.pre,n.bgClass&&(t.bgClass=n.bgClass),n.textClass&&(t.textClass=n.textClass),ca(e,t),qa(e,t,i,r),eo(e,t,r),t.node}function eo(e,t,i){if(to(e,t.line,t,i,!0),t.rest)for(var r=0;r<t.rest.length;r++)to(e,t.rest[r],t,i,!1)}function to(e,t,i,r,n){if(!t.widgets)return;for(var L=mn(i),H=0,Q=t.widgets;H<Q.length;++H){var J=Q[H],ee=o("div",[J.node],"CodeMirror-linewidget"+(J.className?" "+J.className:""));J.handleMouseEvents||ee.setAttribute("cm-ignore-events","true"),Bs(J,ee,i,r),e.display.input.setUneditable(ee),n&&J.above?L.insertBefore(ee,i.gutter||i.text):L.appendChild(ee),Vt(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(!v(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;"),h(t.display.measure,o("div",[e.node],null,i))}return e.height=e.node.parentNode.offsetHeight}function fi(e,t){for(var i=De(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 Wn(e){return e.lineSpace.offsetTop}function fa(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function ro(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=h(e.measure,o("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 ni(e){return he-e.display.nativeBarWidth}function Ii(e){return e.display.scroller.clientWidth-ni(e)-e.display.barWidth}function pa(e){return e.display.scroller.clientHeight-ni(e)-e.display.barHeight}function Us(e,t,i){var r=e.options.lineWrapping,n=r&&Ii(e);if(!t.measure.heights||r&&t.measure.width!=n){var L=t.measure.heights=[];if(r){t.measure.width=n;for(var H=t.text.firstChild.getClientRects(),Q=0;Q<H.length-1;Q++){var J=H[Q],ee=H[Q+1];Math.abs(J.bottom-ee.bottom)>2&&L.push((J.bottom+ee.top)/2-i.top)}}L.push(i.bottom-i.top)}}function io(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(Ot(e.rest[n])>i)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Fs(e,t){t=ar(t);var i=Ot(t),r=e.display.externalMeasured=new Pt(e.doc,t,i);r.lineN=i;var n=r.built=jn(e,r);return r.text=n.pre,h(e.display.lineMeasure,n.pre),r}function no(e,t,i,r){return ai(e,$i(e,t),i,r)}function ma(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Ui(e,t)];var i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function $i(e,t){var i=Ot(t),r=ma(e,i);r&&!r.text?r=null:r&&r.changes&&(pn(e,r,i,Ea(e)),e.curOp.forceUpdate=!0),r||(r=Fs(e,t));var n=io(r,t,i);return{line:t,view:r,rect:null,map:n.map,cache:n.cache,before:n.before,hasHeights:!1}}function ai(e,t,i,r,n){t.before&&(i=-1);var L=i+(r||""),H;return t.cache.hasOwnProperty(L)?H=t.cache[L]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Us(e,t.view,t.rect),t.hasHeights=!0),H=Ws(e,t,i,r),H.bogus||(t.cache[L]=H)),{left:H.left,right:H.right,top:n?H.rtop:H.top,bottom:n?H.rbottom:H.bottom}}var ao={left:0,right:0,top:0,bottom:0};function oo(e,t,i){for(var r,n,L,H,Q,J,ee=0;ee<e.length;ee+=3)if(Q=e[ee],J=e[ee+1],t<Q?(n=0,L=1,H="left"):t<J?(n=t-Q,L=n+1):(ee==e.length-3||t==J&&e[ee+3]>t)&&(L=J-Q,n=L-1,t>=J&&(H="right")),n!=null){if(r=e[ee+2],Q==J&&i==(r.insertLeft?"left":"right")&&(H=i),i=="left"&&n==0)for(;ee&&e[ee-2]==e[ee-3]&&e[ee-1].insertLeft;)r=e[(ee-=3)+2],H="left";if(i=="right"&&n==J-Q)for(;ee<e.length-3&&e[ee+3]==e[ee+4]&&!e[ee+5].insertLeft;)r=e[(ee+=3)+2],H="right";break}return{node:r,start:n,end:L,collapse:H,coverStart:Q,coverEnd:J}}function js(e,t){var i=ao;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=oo(t.map,i,r),L=n.node,H=n.start,Q=n.end,J=n.collapse,ee;if(L.nodeType==3){for(var fe=0;fe<4;fe++){for(;H&&Ue(t.line.text.charAt(n.coverStart+H));)--H;for(;n.coverStart+Q<n.coverEnd&&Ue(t.line.text.charAt(n.coverStart+Q));)++Q;if(W&&F<9&&H==0&&Q==n.coverEnd-n.coverStart?ee=L.parentNode.getBoundingClientRect():ee=js(x(L,H,Q).getClientRects(),r),ee.left||ee.right||H==0)break;Q=H,H=H-1,J="right"}W&&F<11&&(ee=Hs(e.display.measure,ee))}else{H>0&&(J=r="right");var ge;e.options.lineWrapping&&(ge=L.getClientRects()).length>1?ee=ge[r=="right"?ge.length-1:0]:ee=L.getBoundingClientRect()}if(W&&F<9&&!H&&(!ee||!ee.left&&!ee.right)){var ke=L.parentNode.getClientRects()[0];ke?ee={left:ke.left,right:ke.left+Ji(e.display),top:ke.top,bottom:ke.bottom}:ee=ao}for(var Ae=ee.top-t.rect.top,je=ee.bottom-t.rect.top,Ve=(Ae+je)/2,Qe=t.view.measure.heights,tt=0;tt<Qe.length-1&&!(Ve<Qe[tt]);tt++);var ht=tt?Qe[tt-1]:0,rt=Qe[tt],dt={left:(J=="right"?ee.right:ee.left)-t.rect.left,right:(J=="left"?ee.left:ee.right)-t.rect.left,top:ht,bottom:rt};return!ee.left&&!ee.right&&(dt.bogus=!0),e.options.singleCursorHeightPerLine||(dt.rtop=Ae,dt.rbottom=je),dt}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 so(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 lo(e){e.display.externalMeasure=null,c(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)so(e.display.view[t])}function vn(e){lo(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function uo(){return f&&d?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function ho(){return f&&d?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function ga(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 Hn(e,t,i,r,n){if(!n){var L=ga(t);i.top+=L,i.bottom+=L}if(r=="line")return i;r||(r="local");var H=Ir(t);if(r=="local"?H+=Wn(e.display):H-=e.display.viewOffset,r=="page"||r=="window"){var Q=e.display.lineSpace.getBoundingClientRect();H+=Q.top+(r=="window"?0:ho());var J=Q.left+(r=="window"?0:uo());i.left+=J,i.right+=J}return i.top+=H,i.bottom+=H,i}function co(e,t,i){if(i=="div")return t;var r=t.left,n=t.top;if(i=="page")r-=uo(),n-=ho();else if(i=="local"||!i){var L=e.display.sizer.getBoundingClientRect();r+=L.left,n+=L.top}var H=e.display.lineSpace.getBoundingClientRect();return{left:r-H.left,top:n-H.top}}function va(e,t,i,r,n){return r||(r=ft(e.doc,t.line)),Hn(e,r,no(e,r,t.ch,n),i)}function Jr(e,t,i,r,n,L){r=r||ft(e.doc,t.line),n||(n=$i(e,r));function H(je,Ve){var Qe=ai(e,n,je,Ve?"right":"left",L);return Ve?Qe.left=Qe.right:Qe.right=Qe.left,Hn(e,r,Qe,i)}var Q=Je(r,e.doc.direction),J=t.ch,ee=t.sticky;if(J>=r.text.length?(J=r.text.length,ee="before"):J<=0&&(J=0,ee="after"),!Q)return H(ee=="before"?J-1:J,ee=="before");function fe(je,Ve,Qe){var tt=Q[Ve],ht=tt.level==1;return H(Qe?je-1:je,ht!=Qe)}var ge=Ze(Q,J,ee),ke=et,Ae=fe(J,ge,ee=="before");return ke!=null&&(Ae.other=fe(J,ke,ee!="before")),Ae}function fo(e,t){var i=0;t=l(e.doc,t),e.options.lineWrapping||(i=Ji(e.display)*t.ch);var r=ft(e.doc,t.line),n=Ir(r)+Wn(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function ya(e,t,i,r,n){var L=Xe(e,t,i);return L.xRel=n,r&&(L.outside=r),L}function ba(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return ya(r.first,0,null,-1,-1);var n=Vr(r,i),L=r.first+r.size-1;if(n>L)return ya(r.first+r.size-1,ft(r,L).text.length,null,1,1);t<0&&(t=0);for(var H=ft(r,n);;){var Q=zs(e,H,n,t,i),J=yi(H,Q.ch+(Q.xRel>0||Q.outside>0?1:0));if(!J)return Q;var ee=J.find(1);if(ee.line==n)return ee;H=ft(r,n=ee.line)}}function po(e,t,i,r){r-=ga(t);var n=t.text.length,L=at(function(H){return ai(e,i,H-1).bottom<=r},n,0);return n=at(function(H){return ai(e,i,H).top>r},L,n),{begin:L,end:n}}function mo(e,t,i,r){i||(i=$i(e,t));var n=Hn(e,t,ai(e,i,r),"line").top;return po(e,t,i,n)}function xa(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function zs(e,t,i,r,n){n-=Ir(t);var L=$i(e,t),H=ga(t),Q=0,J=t.text.length,ee=!0,fe=Je(t,e.doc.direction);if(fe){var ge=(e.options.lineWrapping?Ks:Gs)(e,t,i,L,fe,r,n);ee=ge.level!=1,Q=ee?ge.from:ge.to-1,J=ee?ge.to:ge.from-1}var ke=null,Ae=null,je=at(function(Et){var vt=ai(e,L,Et);return vt.top+=H,vt.bottom+=H,xa(vt,r,n,!1)?(vt.top<=n&&vt.left<=r&&(ke=Et,Ae=vt),!0):!1},Q,J),Ve,Qe,tt=!1;if(Ae){var ht=r-Ae.left<Ae.right-r,rt=ht==ee;je=ke+(rt?0:1),Qe=rt?"after":"before",Ve=ht?Ae.left:Ae.right}else{!ee&&(je==J||je==Q)&&je++,Qe=je==0?"after":je==t.text.length?"before":ai(e,L,je-(ee?1:0)).bottom+H<=n==ee?"after":"before";var dt=Jr(e,Xe(i,je,Qe),"line",t,L);Ve=dt.left,tt=n<dt.top?-1:n>=dt.bottom?1:0}return je=Fe(t.text,je,1),ya(i,je,Qe,tt,r-Ve)}function Gs(e,t,i,r,n,L,H){var Q=at(function(ge){var ke=n[ge],Ae=ke.level!=1;return xa(Jr(e,Xe(i,Ae?ke.to:ke.from,Ae?"before":"after"),"line",t,r),L,H,!0)},0,n.length-1),J=n[Q];if(Q>0){var ee=J.level!=1,fe=Jr(e,Xe(i,ee?J.from:J.to,ee?"after":"before"),"line",t,r);xa(fe,L,H,!0)&&fe.top>H&&(J=n[Q-1])}return J}function Ks(e,t,i,r,n,L,H){var Q=po(e,t,r,H),J=Q.begin,ee=Q.end;/\s/.test(t.text.charAt(ee-1))&&ee--;for(var fe=null,ge=null,ke=0;ke<n.length;ke++){var Ae=n[ke];if(Ae.from>=ee||Ae.to<=J)continue;var je=Ae.level!=1,Ve=ai(e,r,je?Math.min(ee,Ae.to)-1:Math.max(J,Ae.from)).right,Qe=Ve<L?L-Ve+1e9:Ve-L;(!fe||ge>Qe)&&(fe=Ae,ge=Qe)}return fe||(fe=n[n.length-1]),fe.from<J&&(fe={from:J,to:fe.to,level:fe.level}),fe.to>ee&&(fe={from:fe.from,to:ee,level:fe.level}),fe}var Ni;function Qi(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Ni==null){Ni=o("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Ni.appendChild(document.createTextNode("x")),Ni.appendChild(o("br"));Ni.appendChild(document.createTextNode("x"))}h(e.measure,Ni);var i=Ni.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),c(e.measure),i||1}function Ji(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=o("span","xxxxxxxxxx"),i=o("pre",[t],"CodeMirror-line-like");h(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function Ea(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,L=t.gutters.firstChild,H=0;L;L=L.nextSibling,++H){var Q=e.display.gutterSpecs[H].className;i[Q]=L.offsetLeft+L.clientLeft+n,r[Q]=L.clientWidth}return{fixedPos:Sa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Sa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function go(e){var t=Qi(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/Ji(e.display)-3);return function(n){if(Qr(e.doc,n))return 0;var L=0;if(n.widgets)for(var H=0;H<n.widgets.length;H++)n.widgets[H].height&&(L+=n.widgets[H].height);return i?L+(Math.ceil(n.text.length/r)||1)*t:L+t}}function Ca(e){var t=e.doc,i=go(e);t.iter(function(r){var n=i(r);n!=r.height&&wr(r,n)})}function Bi(e,t,i,r){var n=e.display;if(!i&&De(t).getAttribute("cm-not-content")=="true")return null;var L,H,Q=n.lineSpace.getBoundingClientRect();try{L=t.clientX-Q.left,H=t.clientY-Q.top}catch(ge){return null}var J=ba(e,L,H),ee;if(r&&J.xRel>0&&(ee=ft(e.doc,J.line).text).length==J.ch){var fe=Y(ee,ee.length,e.options.tabSize)-ee.length;J=Xe(J.line,Math.max(0,Math.round((L-ro(e.display).left)/Ji(e.display))-fe))}return J}function Ui(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 Lr(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)Ar&&xi(e.doc,t)<n.viewTo&&Ci(e);else if(i<=n.viewFrom)Ar&&Fn(e.doc,i+r)>n.viewFrom?Ci(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)Ci(e);else if(t<=n.viewFrom){var L=zn(e,i,i+r,1);L?(n.view=n.view.slice(L.index),n.viewFrom=L.lineN,n.viewTo+=r):Ci(e)}else if(i>=n.viewTo){var H=zn(e,t,t,-1);H?(n.view=n.view.slice(0,H.index),n.viewTo=H.lineN):Ci(e)}else{var Q=zn(e,t,t,-1),J=zn(e,i,i+r,1);Q&&J?(n.view=n.view.slice(0,Q.index).concat(Qt(e,Q.lineN,J.lineN)).concat(n.view.slice(J.index)),n.viewTo+=r):Ci(e)}var ee=n.externalMeasured;ee&&(i<ee.lineN?ee.lineN+=r:t<ee.lineN+ee.size&&(n.externalMeasured=null))}function Si(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 L=r.view[Ui(e,t)];if(L.node==null)return;var H=L.changes||(L.changes=[]);ae(H,i)==-1&&H.push(i)}function Ci(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=Ui(e,t),L,H=e.display.view;if(!Ar||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var Q=e.display.viewFrom,J=0;J<n;J++)Q+=H[J].size;if(Q!=t){if(r>0){if(n==H.length-1)return null;L=Q+H[n].size-t,n++}else L=Q-t;t+=L,i+=L}for(;xi(e.doc,i)!=i;){if(n==(r<0?0:H.length-1))return null;i+=r*H[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=Qt(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=Qt(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Ui(e,t))),r.viewFrom=t,r.viewTo<i?r.view=r.view.concat(Qt(e,r.viewTo,i)):r.viewTo>i&&(r.view=r.view.slice(0,Ui(e,i)))),r.viewTo=i}function vo(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 yo(e,t){t===void 0&&(t=!0);for(var i=e.doc,r={},n=r.cursors=document.createDocumentFragment(),L=r.selection=document.createDocumentFragment(),H=0;H<i.sel.ranges.length;H++){if(!t&&H==i.sel.primIndex)continue;var Q=i.sel.ranges[H];if(Q.from().line>=e.display.viewTo||Q.to().line<e.display.viewFrom)continue;var J=Q.empty();(J||e.options.showCursorWhenSelecting)&&bo(e,Q.head,n),J||Xs(e,Q,L)}return r}function bo(e,t,i){var r=Jr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),n=i.appendChild(o("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 L=i.appendChild(o("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));L.style.display="",L.style.left=r.other.left+"px",L.style.top=r.other.top+"px",L.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Gn(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,i){var r=e.display,n=e.doc,L=document.createDocumentFragment(),H=ro(e.display),Q=H.left,J=Math.max(r.sizerWidth,Ii(e)-r.sizer.offsetLeft)-H.right,ee=n.direction=="ltr";function fe(rt,dt,Et,vt){dt<0&&(dt=0),dt=Math.round(dt),vt=Math.round(vt),L.appendChild(o("div",null,"CodeMirror-selected","position: absolute; left: "+rt+`px;
top: `+dt+"px; width: "+(Et==null?J-rt:Et)+`px;
height: `+(vt-dt)+"px"))}function ge(rt,dt,Et){var vt=ft(n,rt),_t=vt.text.length,Yt,dr;function Jt(tr,Rr){return va(e,Xe(rt,tr),"div",vt,Rr)}function Br(tr,Rr,vr){var or=mo(e,vt,null,tr),rr=Rr=="ltr"==(vr=="after")?"left":"right",Zt=vr=="after"?or.begin:or.end-(/\s/.test(vt.text.charAt(or.end-1))?2:1);return Jt(Zt,rr)[rr]}var kr=Je(vt,n.direction);return it(kr,dt||0,Et==null?_t:Et,function(tr,Rr,vr,or){var rr=vr=="ltr",Zt=Jt(tr,rr?"left":"right"),Or=Jt(Rr-1,rr?"right":"left"),dn=dt==null&&tr==0,Di=Et==null&&Rr==_t,Er=or==0,oi=!kr||or==kr.length-1;if(Or.top-Zt.top<=3){var cr=(ee?dn:Di)&&Er,Ya=(ee?Di:dn)&&oi,mi=cr?Q:(rr?Zt:Or).left,zi=Ya?J:(rr?Or:Zt).right;fe(mi,Zt.top,zi-mi,Zt.bottom)}else{var Gi,Cr,cn,$a;rr?(Gi=ee&&dn&&Er?Q:Zt.left,Cr=ee?J:Br(tr,vr,"before"),cn=ee?Q:Br(Rr,vr,"after"),$a=ee&&Di&&oi?J:Or.right):(Gi=ee?Br(tr,vr,"before"):Q,Cr=!ee&&dn&&Er?J:Zt.right,cn=!ee&&Di&&oi?Q:Or.left,$a=ee?Br(Rr,vr,"after"):J),fe(Gi,Zt.top,Cr-Gi,Zt.bottom),Zt.bottom<Or.top&&fe(Q,Zt.bottom,null,Or.top),fe(cn,Or.top,$a-cn,Or.bottom)}(!Yt||Gn(Zt,Yt)<0)&&(Yt=Zt),Gn(Or,Yt)<0&&(Yt=Or),(!dr||Gn(Zt,dr)<0)&&(dr=Zt),Gn(Or,dr)<0&&(dr=Or)}),{start:Yt,end:dr}}var ke=t.from(),Ae=t.to();if(ke.line==Ae.line)ge(ke.line,ke.ch,Ae.ch);else{var je=ft(n,ke.line),Ve=ft(n,Ae.line),Qe=ar(je)==ar(Ve),tt=ge(ke.line,ke.ch,Qe?je.text.length+1:null).end,ht=ge(Ae.line,Qe?0:null,Ae.ch).start;Qe&&(tt.top<ht.top-2?(fe(tt.right,tt.top,null,tt.bottom),fe(Q,ht.top,ht.left,ht.bottom)):fe(tt.right,tt.top,ht.left-tt.right,tt.bottom)),tt.bottom<ht.top&&fe(Q,tt.bottom,null,ht.top)}i.appendChild(L)}function Ta(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 xo(e){e.state.focused||(e.display.input.focus(),wa(e))}function Eo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Zi(e))},100)}function wa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Ie(e,"focus",e,t),e.state.focused=!0,B(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),P&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ta(e)}function Zi(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Ie(e,"blur",e,t),e.state.focused=!1,g(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Kn(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var n=t.view[r],L=e.options.lineWrapping,H=void 0,Q=0;if(n.hidden)continue;if(W&&F<8){var J=n.node.offsetTop+n.node.offsetHeight;H=J-i,i=J}else{var ee=n.node.getBoundingClientRect();H=ee.bottom-ee.top,!L&&n.text.firstChild&&(Q=n.text.firstChild.getBoundingClientRect().right-ee.left-1)}var fe=n.line.height-H;if((fe>.005||fe<-.005)&&(wr(n.line,H),So(n.line),n.rest))for(var ge=0;ge<n.rest.length;ge++)So(n.rest[ge]);if(Q>e.display.sizerWidth){var ke=Math.ceil(Q/Ji(e.display));ke>e.display.maxLineLength&&(e.display.maxLineLength=ke,e.display.maxLine=n.line,e.display.maxLineChanged=!0)}}}function So(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 Vn(e,t,i){var r=i&&i.top!=null?Math.max(0,i.top):e.scroller.scrollTop;r=Math.floor(r-Wn(e));var n=i&&i.bottom!=null?i.bottom:r+e.wrapper.clientHeight,L=Vr(t,r),H=Vr(t,n);if(i&&i.ensure){var Q=i.ensure.from.line,J=i.ensure.to.line;Q<L?(L=Q,H=Vr(t,Ir(ft(t,Q))+e.wrapper.clientHeight)):Math.min(J,t.lastLine())>=H&&(L=Vr(t,Ir(ft(t,J))-e.wrapper.clientHeight),H=J)}return{from:L,to:Math.max(H,L+1)}}function Ys(e,t){if(He(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&&!S){var L=o("div","\u200B",null,`position: absolute;
top: `+(t.top-i.viewOffset-Wn(e.display))+`px;
height: `+(t.bottom-t.top+ni(e)+i.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(L),L.scrollIntoView(n),e.display.lineSpace.removeChild(L)}}function $s(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(t=t.ch?Xe(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,i=t.sticky=="before"?Xe(t.line,t.ch+1,"before"):t);for(var L=0;L<5;L++){var H=!1,Q=Jr(e,t),J=!i||i==t?Q:Jr(e,i);n={left:Math.min(Q.left,J.left),top:Math.min(Q.top,J.top)-r,right:Math.max(Q.left,J.left),bottom:Math.max(Q.bottom,J.bottom)+r};var ee=Aa(e,n),fe=e.doc.scrollTop,ge=e.doc.scrollLeft;if(ee.scrollTop!=null&&(xn(e,ee.scrollTop),Math.abs(e.doc.scrollTop-fe)>1&&(H=!0)),ee.scrollLeft!=null&&(Fi(e,ee.scrollLeft),Math.abs(e.doc.scrollLeft-ge)>1&&(H=!0)),!H)break}return n}function Qs(e,t){var i=Aa(e,t);i.scrollTop!=null&&xn(e,i.scrollTop),i.scrollLeft!=null&&Fi(e,i.scrollLeft)}function Aa(e,t){var i=e.display,r=Qi(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,L=pa(e),H={};t.bottom-t.top>L&&(t.bottom=t.top+L);var Q=e.doc.height+fa(i),J=t.top<r,ee=t.bottom>Q-r;if(t.top<n)H.scrollTop=J?0:t.top;else if(t.bottom>n+L){var fe=Math.min(t.top,(ee?Q:t.bottom)-L);fe!=n&&(H.scrollTop=fe)}var ge=e.options.fixedGutter?0:i.gutters.offsetWidth,ke=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-ge,Ae=Ii(e)-i.gutters.offsetWidth,je=t.right-t.left>Ae;return je&&(t.right=t.left+Ae),t.left<10?H.scrollLeft=0:t.left<ke?H.scrollLeft=Math.max(0,t.left+ge-(je?0:10)):t.right>Ae+ke-3&&(H.scrollLeft=t.right+(je?0:10)-Ae),H}function _a(e,t){if(t==null)return;Xn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function qi(e){Xn(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)&&Xn(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Js(e,t){Xn(e),e.curOp.scrollToPos=t}function Xn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=fo(e,t.from),r=fo(e,t.to);Co(e,i,r,t.margin)}}function Co(e,t,i,r){var n=Aa(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;k||Da(e,{top:t}),To(e,t,!0),k&&Da(e),Cn(e,100)}function To(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 Fi(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,Do(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+fa(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+ni(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var ji=function(e,t,i){this.cm=i;var r=this.vert=o("div",[o("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=o("div",[o("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=n.tabIndex=-1,e(r),e(n),Re(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Re(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,W&&F<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};ji.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 L=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+L)+"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}},ji.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},ji.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},ji.prototype.zeroWidthHack=function(){var e=s&&!A?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new q,this.disableVert=new q},ji.prototype.enableZeroWidthBar=function(e,t,i){e.style.pointerEvents="auto";function r(){var n=e.getBoundingClientRect(),L=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);L!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},ji.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 en(e,t){t||(t=En(e));var i=e.display.barWidth,r=e.display.barHeight;wo(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&Kn(e),wo(e,En(e)),i=e.display.barWidth,r=e.display.barHeight}function wo(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 Ao={native:ji,null:Sn};function _o(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&g(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Ao[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Re(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"?Fi(e,t):xn(e,t)},e),e.display.scrollbars.addClass&&B(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function Wi(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:++Zs},kt(e.curOp)}function Hi(e){var t=e.curOp;t&&zt(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 L=0;L<t.length;L++)il(t[L]);for(var H=0;H<t.length;H++)nl(t[H])}function el(e){var t=e.cm,i=t.display;ol(t),e.updateMaxLine&&ci(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 Yn(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&La(e.cm,e.update)}function rl(e){var t=e.cm,i=t.display;e.updatedDisplay&&Kn(t),e.barMeasure=En(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=no(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+ni(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-Ii(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&&Fi(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var i=e.focus&&e.focus==R();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,i),(e.updatedDisplay||e.startHeight!=t.doc.height)&&en(t,e.barMeasure),e.updatedDisplay&&Ra(t,e.barMeasure),e.selectionChanged&&Ta(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),i&&xo(e.cm)}function nl(e){var t=e.cm,i=t.display,r=t.doc;if(e.updatedDisplay&&Lo(t,e.update),i.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(i.wheelStartX=i.wheelStartY=null),e.scrollTop!=null&&To(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Fi(t,e.scrollLeft,!0,!0),e.scrollToPos){var n=$s(t,l(r,e.scrollToPos.from),l(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,n)}var L=e.maybeHiddenMarkers,H=e.maybeUnhiddenMarkers;if(L)for(var Q=0;Q<L.length;++Q)L[Q].lines.length||Ie(L[Q],"hide");if(H)for(var J=0;J<H.length;++J)H[J].lines.length&&Ie(H[J],"unhide");i.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Ie(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Nr(e,t){if(e.curOp)return t();Wi(e);try{return t()}finally{Hi(e)}}function ur(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Wi(e);try{return t.apply(e,arguments)}finally{Hi(e)}}}function Sr(e){return function(){if(this.curOp)return e.apply(this,arguments);Wi(this);try{return e.apply(this,arguments)}finally{Hi(this)}}}function hr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Wi(t);try{return e.apply(this,arguments)}finally{Hi(t)}}}function Cn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,I(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var i=+new Date+e.options.workTime,r=Oe(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(L){if(r.line>=e.display.viewFrom){var H=L.styles,Q=L.text.length>e.options.maxHighlightLength?Tr(t.mode,r.state):null,J=ve(e,L,r,!0);Q&&(r.state=Q),L.styles=J.styles;var ee=L.styleClasses,fe=J.classes;fe?L.styleClasses=fe:ee&&(L.styleClasses=null);for(var ge=!H||H.length!=L.styles.length||ee!=fe&&(!ee||!fe||ee.bgClass!=fe.bgClass||ee.textClass!=fe.textClass),ke=0;!ge&&ke<H.length;++ke)ge=H[ke]!=L.styles[ke];ge&&n.push(r.line),L.stateAfter=r.save(),r.nextLine()}else L.text.length<=e.options.maxHighlightLength&&ct(e,L.text,r),L.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&&Nr(e,function(){for(var L=0;L<n.length;L++)Si(e,n[L],"text")})}var Yn=function(e,t,i){var r=e.display;this.viewport=t,this.visible=Vn(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Ii(e),this.force=i,this.dims=Ea(e),this.events=[]};Yn.prototype.signal=function(e,t){pe(e,t)&&this.events.push(arguments)},Yn.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Ie.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=ni(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=ni(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=R();if(!t||!v(e.display.lineDiv,t))return null;var i={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&v(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==R())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&v(document.body,e.anchorNode)&&v(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 La(e,t){var i=e.display,r=e.doc;if(t.editorIsHidden)return Ci(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&&vo(e)==0)return!1;ko(e)&&(Ci(e),t.dims=Ea(e));var n=r.first+r.size,L=Math.max(t.visible.from-e.options.viewportMargin,r.first),H=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFrom<L&&L-i.viewFrom<20&&(L=Math.max(r.first,i.viewFrom)),i.viewTo>H&&i.viewTo-H<20&&(H=Math.min(n,i.viewTo)),Ar&&(L=xi(e.doc,L),H=Fn(e.doc,H));var Q=L!=i.viewFrom||H!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Vs(e,L,H),i.viewOffset=Ir(ft(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var J=vo(e);if(!Q&&J==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var ee=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(ee),c(i.cursorDiv),c(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,Q&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Cn(e,400)),i.updateLineNumbers=null,!0}function Lo(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Ii(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+fa(e.display)-pa(e),i.top)}),t.visible=Vn(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Vn(e.display,e.doc,i));if(!La(e,t))break;Kn(e);var n=En(e);yn(e),en(e,n),Ra(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 Da(e,t){var i=new Yn(e,t);if(La(e,i)){Kn(e),Lo(e,i);var r=En(e);yn(e),en(e,r),Ra(e,r),i.finish()}}function ul(e,t,i){var r=e.display,n=e.options.lineNumbers,L=r.lineDiv,H=L.firstChild;function Q(je){var Ve=je.nextSibling;return P&&s&&e.display.currentWheelTarget==je?je.style.display="none":je.parentNode.removeChild(je),Ve}for(var J=r.view,ee=r.viewFrom,fe=0;fe<J.length;fe++){var ge=J[fe];if(!ge.hidden)if(!ge.node||ge.node.parentNode!=L){var ke=Ns(e,ge,ee,i);L.insertBefore(ke,H)}else{for(;H!=ge.node;)H=Q(H);var Ae=n&&t!=null&&t<=ee&&ge.lineNumber;ge.changes&&(ae(ge.changes,"gutter")>-1&&(Ae=!1),pn(e,ge,ee,i)),Ae&&(c(ge.lineNumber),ge.lineNumber.appendChild(document.createTextNode(gi(e.options,ee)))),H=ge.node.nextSibling}ee+=ge.size}for(;H;)H=Q(H)}function ka(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Ra(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+ni(e)+"px"}function Do(e){var t=e.display,i=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Sa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,L=r+"px",H=0;H<i.length;H++)if(!i[H].hidden){e.options.fixedGutter&&(i[H].gutter&&(i[H].gutter.style.left=L),i[H].gutterBackground&&(i[H].gutterBackground.style.left=L));var Q=i[H].alignable;if(Q)for(var J=0;J<Q.length;J++)Q[J].style.left=L}e.options.fixedGutter&&(t.gutters.style.left=r+n+"px")}function ko(e){if(!e.options.lineNumbers)return!1;var t=e.doc,i=gi(e.options,t.first+t.size-1),r=e.display;if(i.length!=r.lineNumChars){var n=r.measure.appendChild(o("div",[o("div",i)],"CodeMirror-linenumber CodeMirror-gutter-elt")),L=n.firstChild.offsetWidth,H=n.offsetWidth-L;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(L,r.lineGutter.offsetWidth-H)+1,r.lineNumWidth=r.lineNumInnerWidth+H,r.lineNumChars=r.lineNumInnerWidth?i.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",ka(e.display),!0}return!1}function Oa(e,t){for(var i=[],r=!1,n=0;n<e.length;n++){var L=e[n],H=null;if(typeof L!="string"&&(H=L.style,L=L.className),L=="CodeMirror-linenumbers")if(t)r=!0;else continue;i.push({className:L,style:H})}return t&&!r&&i.push({className:"CodeMirror-linenumbers",style:null}),i}function Ro(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],L=n.className,H=n.style,Q=t.appendChild(o("div",null,"CodeMirror-gutter "+L));H&&(Q.style.cssText=H),L=="CodeMirror-linenumbers"&&(e.lineGutter=Q,Q.style.width=(e.lineNumWidth||1)+"px")}t.style.display=i.length?"":"none",ka(e)}function Tn(e){Ro(e.display),Lr(e),Do(e)}function hl(e,t,i,r){var n=this;this.input=i,n.scrollbarFiller=o("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=o("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=C("div",null,"CodeMirror-code"),n.selectionDiv=o("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=o("div",null,"CodeMirror-cursors"),n.measure=o("div",null,"CodeMirror-measure"),n.lineMeasure=o("div",null,"CodeMirror-measure"),n.lineSpace=C("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none");var L=C("div",[n.lineSpace],"CodeMirror-lines");n.mover=o("div",[L],null,"position: relative"),n.sizer=o("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=o("div",null,null,"position: absolute; height: "+he+"px; width: 1px;"),n.gutters=o("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=o("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=o("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),W&&F<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),!P&&!(k&&a)&&(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=Oa(r.gutters,r.lineNumbers),Ro(n),i.init(n)}var $n=0,Hr=null;W?Hr=-.53:k?Hr=15:f?Hr=-.7:M&&(Hr=-1/3);function Oo(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=Oo(e);return t.x*=Hr,t.y*=Hr,t}function Po(e,t){var i=Oo(t),r=i.x,n=i.y,L=e.display,H=L.scroller,Q=H.scrollWidth>H.clientWidth,J=H.scrollHeight>H.clientHeight;if(!(r&&Q||n&&J))return;if(n&&s&&P){e:for(var ee=t.target,fe=L.view;ee!=H;ee=ee.parentNode)for(var ge=0;ge<fe.length;ge++)if(fe[ge].node==ee){e.display.currentWheelTarget=ee;break e}}if(r&&!k&&!b&&Hr!=null){n&&J&&xn(e,Math.max(0,H.scrollTop+n*Hr)),Fi(e,Math.max(0,H.scrollLeft+r*Hr)),(!n||n&&J)&&re(t),L.wheelStartX=null;return}if(n&&Hr!=null){var ke=n*Hr,Ae=e.doc.scrollTop,je=Ae+L.wrapper.clientHeight;ke<0?Ae=Math.max(0,Ae+ke-50):je=Math.min(e.doc.height,je+ke+50),Da(e,{top:Ae,bottom:je})}$n<20&&(L.wheelStartX==null?(L.wheelStartX=H.scrollLeft,L.wheelStartY=H.scrollTop,L.wheelDX=r,L.wheelDY=n,setTimeout(function(){if(L.wheelStartX==null)return;var Ve=H.scrollLeft-L.wheelStartX,Qe=H.scrollTop-L.wheelStartY,tt=Qe&&L.wheelDY&&Qe/L.wheelDY||Ve&&L.wheelDX&&Ve/L.wheelDX;if(L.wheelStartX=L.wheelStartY=null,!tt)return;Hr=(Hr*$n+tt)/($n+1),++$n},200)):(L.wheelDX+=r,L.wheelDY+=n))}var zr=function(e,t){this.ranges=e,this.primIndex=t};zr.prototype.primary=function(){return this.ranges[this.primIndex]},zr.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(!ei(i.anchor,r.anchor)||!ei(i.head,r.head))return!1}return!0},zr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new jt(hi(this.ranges[t].anchor),hi(this.ranges[t].head));return new zr(e,this.primIndex)},zr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},zr.prototype.contains=function(e,t){t||(t=e);for(var i=0;i<this.ranges.length;i++){var r=this.ranges[i];if(St(t,r.from())>=0&&St(e,r.to())<=0)return i}return-1};var jt=function(e,t){this.anchor=e,this.head=t};jt.prototype.from=function(){return ki(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 Zr(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(ke,Ae){return St(ke.from(),Ae.from())}),i=ae(t,n);for(var L=1;L<t.length;L++){var H=t[L],Q=t[L-1],J=St(Q.to(),H.from());if(r&&!H.empty()?J>0:J>=0){var ee=ki(Q.from(),H.from()),fe=di(Q.to(),H.to()),ge=Q.empty()?H.from()==H.head:Q.from()==Q.head;L<=i&&--i,t.splice(--L,2,new jt(ge?fe:ee,ge?ee:fe))}}return new zr(t,i)}function Ti(e,t){return new zr([new jt(e,t||e)],0)}function wi(e){return e.text?Xe(e.from.line+e.text.length-1,te(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Mo(e,t){if(St(e,t.from)<0)return e;if(St(e,t.to)<=0)return wi(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+=wi(t).ch-t.to.ch),Xe(i,r)}function Pa(e,t){for(var i=[],r=0;r<e.sel.ranges.length;r++){var n=e.sel.ranges[r];i.push(new jt(Mo(n.anchor,t),Mo(n.head,t)))}return Zr(e.cm,i,e.sel.primIndex)}function Io(e,t,i){return e.line==t.line?Xe(i.line,e.ch-t.ch+i.ch):Xe(i.line+(e.line-t.line),e.ch)}function cl(e,t,i){for(var r=[],n=Xe(e.first,0),L=n,H=0;H<t.length;H++){var Q=t[H],J=Io(Q.from,n,L),ee=Io(wi(Q),n,L);if(n=Q.to,L=ee,i=="around"){var fe=e.sel.ranges[H],ge=St(fe.head,fe.anchor)<0;r[H]=new jt(ge?ee:J,ge?J:ee)}else r[H]=new jt(J,J)}return new zr(r,e.sel.primIndex)}function Ma(e){e.doc.mode=Gr(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&&Lr(e)}function No(e,t){return t.from.ch==0&&t.to.ch==0&&te(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ia(e,t,i,r){function n(ht){return i?i[ht]:null}function L(ht,rt,dt){ua(ht,rt,dt,r),Vt(ht,"change",ht,t)}function H(ht,rt){for(var dt=[],Et=ht;Et<rt;++Et)dt.push(new Ei(ee[Et],n(Et),r));return dt}var Q=t.from,J=t.to,ee=t.text,fe=ft(e,Q.line),ge=ft(e,J.line),ke=te(ee),Ae=n(ee.length-1),je=J.line-Q.line;if(t.full)e.insert(0,H(0,ee.length)),e.remove(ee.length,e.size-ee.length);else if(No(e,t)){var Ve=H(0,ee.length-1);L(ge,ge.text,Ae),je&&e.remove(Q.line,je),Ve.length&&e.insert(Q.line,Ve)}else if(fe==ge)if(ee.length==1)L(fe,fe.text.slice(0,Q.ch)+ke+fe.text.slice(J.ch),Ae);else{var Qe=H(1,ee.length-1);Qe.push(new Ei(ke+fe.text.slice(J.ch),Ae,r)),L(fe,fe.text.slice(0,Q.ch)+ee[0],n(0)),e.insert(Q.line+1,Qe)}else if(ee.length==1)L(fe,fe.text.slice(0,Q.ch)+ee[0]+ge.text.slice(J.ch),n(0)),e.remove(Q.line+1,je);else{L(fe,fe.text.slice(0,Q.ch)+ee[0],n(0)),L(ge,ke+ge.text.slice(J.ch),Ae);var tt=H(1,ee.length-1);je>1&&e.remove(Q.line+1,je-1),e.insert(Q.line+1,tt)}Vt(e,"change",e,t)}function Ai(e,t,i){function r(n,L,H){if(n.linked)for(var Q=0;Q<n.linked.length;++Q){var J=n.linked[Q];if(J.doc==L)continue;var ee=H&&J.sharedHist;if(i&&!ee)continue;t(J.doc,ee),r(J.doc,n,ee)}}r(e,null,!0)}function Bo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ca(e),Ma(e),Uo(e),e.options.lineWrapping||ci(e),e.options.mode=t.modeOption,Lr(e)}function Uo(e){(e.doc.direction=="rtl"?B:g)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Nr(e,function(){Uo(e),Lr(e)})}function Qn(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 Na(e,t){var i={from:hi(t.from),to:wi(t),text:Ur(e,t.from,t.to)};return Wo(e,i,t.from.line,t.to.line+1),Ai(e,function(r){return Wo(r,i,t.from.line,t.to.line+1)},!0),i}function Fo(e){for(;e.length;){var t=te(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Fo(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 jo(e,t,i,r){var n=e.history;n.undone.length=0;var L=+new Date,H,Q;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>L-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(H=pl(n,n.lastOp==r)))Q=te(H.changes),St(t.from,t.to)==0&&St(t.from,Q.to)==0?Q.to=wi(t):H.changes.push(Na(e,t));else{var J=te(n.done);for((!J||!J.ranges)&&Jn(e.sel,n.done),H={changes:[Na(e,t)],generation:n.generation},n.done.push(H);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=L,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,Q||Ie(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,L=r&&r.origin;i==n.lastSelOp||L&&n.lastSelOrigin==L&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==L||ml(e,L,te(n.done),t))?n.done[n.done.length-1]=t:Jn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=L,n.lastSelOp=i,r&&r.clearRedo!==!1&&Fo(n.undone)}function Jn(e,t){var i=te(t);i&&i.ranges&&i.equals(e)||t.push(e)}function Wo(e,t,i,r){var n=t["spans_"+e.id],L=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(H){H.markedSpans&&((n||(n=t["spans_"+e.id]={}))[L]=H.markedSpans),++L})}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 Ho(e,t){var i=yl(e,t),r=Pr(e,t);if(!i)return r;if(!r)return i;for(var n=0;n<i.length;++n){var L=i[n],H=r[n];if(L&&H){e:for(var Q=0;Q<H.length;++Q){for(var J=H[Q],ee=0;ee<L.length;++ee)if(L[ee].marker==J.marker)continue e;L.push(J)}}else H&&(i[n]=H)}return i}function tn(e,t,i){for(var r=[],n=0;n<e.length;++n){var L=e[n];if(L.ranges){r.push(i?zr.prototype.deepCopy.call(L):L);continue}var H=L.changes,Q=[];r.push({changes:Q});for(var J=0;J<H.length;++J){var ee=H[J],fe=void 0;if(Q.push({from:ee.from,to:ee.to,text:ee.text}),t)for(var ge in ee)(fe=ge.match(/^spans_(\d+)$/))&&(ae(t,Number(fe[1]))>-1&&(te(Q)[ge]=ee[ge],delete ee[ge]))}}return r}function Ba(e,t,i,r){if(r){var n=e.anchor;if(i){var L=St(t,n)<0;L!=St(i,n)<0?(n=t,t=i):L!=St(t,i)<0&&(t=i)}return new jt(n,t)}else return new jt(i||t,t)}function Zn(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),xr(e,new zr([Ba(e.sel.primary(),t,i,n)],0),r)}function zo(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),L=0;L<e.sel.ranges.length;L++)r[L]=Ba(e.sel.ranges[L],t[L],null,n);var H=Zr(e.cm,r,e.sel.primIndex);xr(e,H,i)}function Ua(e,t,i,r){var n=e.sel.ranges.slice(0);n[t]=i,xr(e,Zr(e.cm,n,e.sel.primIndex),r)}function Go(e,t,i,r){xr(e,Ti(t,i),r)}function bl(e,t,i){var r={ranges:t.ranges,update:function(n){this.ranges=[];for(var L=0;L<n.length;L++)this.ranges[L]=new jt(l(e,n[L].anchor),l(e,n[L].head))},origin:i&&i.origin};return Ie(e,"beforeSelectionChange",e,r),e.cm&&Ie(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Zr(e.cm,r.ranges,r.ranges.length-1):t}function Ko(e,t,i){var r=e.history.done,n=te(r);n&&n.ranges?(r[r.length-1]=t,qn(e,t,i)):xr(e,t,i)}function xr(e,t,i){qn(e,t,i),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,i)}function qn(e,t,i){(pe(e,"beforeSelectionChange")||e.cm&&pe(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,i));var r=i&&i.bias||(St(t.primary().head,e.sel.primary().head)<0?-1:1);Vo(e,Yo(e,t,r,!0)),!(i&&i.scroll===!1)&&e.cm&&qi(e.cm)}function Vo(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Se(e.cm)),Vt(e,"cursorActivity",e)}function Xo(e){Vo(e,Yo(e,e.sel,null,!1))}function Yo(e,t,i,r){for(var n,L=0;L<t.ranges.length;L++){var H=t.ranges[L],Q=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[L],J=ea(e,H.anchor,Q&&Q.anchor,i,r),ee=ea(e,H.head,Q&&Q.head,i,r);(n||J!=H.anchor||ee!=H.head)&&(n||(n=t.ranges.slice(0,L)),n[L]=new jt(J,ee))}return n?Zr(e.cm,n,t.primIndex):t}function rn(e,t,i,r,n){var L=ft(e,t.line);if(L.markedSpans)for(var H=0;H<L.markedSpans.length;++H){var Q=L.markedSpans[H],J=Q.marker,ee="selectLeft"in J?!J.selectLeft:J.inclusiveLeft,fe="selectRight"in J?!J.selectRight:J.inclusiveRight;if((Q.from==null||(ee?Q.from<=t.ch:Q.from<t.ch))&&(Q.to==null||(fe?Q.to>=t.ch:Q.to>t.ch))){if(n&&(Ie(J,"beforeCursorEnter"),J.explicitlyCleared))if(L.markedSpans){--H;continue}else break;if(!J.atomic)continue;if(i){var ge=J.find(r<0?1:-1),ke=void 0;if((r<0?fe:ee)&&(ge=$o(e,ge,-r,ge&&ge.line==t.line?L:null)),ge&&ge.line==t.line&&(ke=St(ge,i))&&(r<0?ke<0:ke>0))return rn(e,ge,t,r,n)}var Ae=J.find(r<0?-1:1);return(r<0?ee:fe)&&(Ae=$o(e,Ae,r,Ae.line==t.line?L:null)),Ae?rn(e,Ae,t,r,n):null}}return t}function ea(e,t,i,r,n){var L=r||1,H=rn(e,t,i,L,n)||!n&&rn(e,t,i,L,!0)||rn(e,t,i,-L,n)||!n&&rn(e,t,i,-L,!0);return H||(e.cantEdit=!0,Xe(e.first,0))}function $o(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?l(e,Xe(t.line-1)):null:i>0&&t.ch==(r||ft(e,t.line)).text.length?t.line<e.first+e.size-1?Xe(t.line+1,0):null:new Xe(t.line,t.ch+i)}function Qo(e){e.setSelection(Xe(e.firstLine(),0),Xe(e.lastLine()),be)}function Jo(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,L,H,Q){n&&(r.from=l(e,n)),L&&(r.to=l(e,L)),H&&(r.text=H),Q!==void 0&&(r.origin=Q)}),Ie(e,"beforeChange",e,r),e.cm&&Ie(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 nn(e,t,i){if(e.cm){if(!e.cm.curOp)return ur(e.cm,nn)(e,t,i);if(e.cm.state.suppressEdits)return}if((pe(e,"beforeChange")||e.cm&&pe(e.cm,"beforeChange"))&&(t=Jo(e,t,!0),!t))return;var r=Ki&&!i&&Ri(e,t.from,t.to);if(r)for(var n=r.length-1;n>=0;--n)Zo(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text,origin:t.origin});else Zo(e,t)}function Zo(e,t){if(t.text.length==1&&t.text[0]==""&&St(t.from,t.to)==0)return;var i=Pa(e,t);jo(e,t,i,e.cm?e.cm.curOp.id:NaN),An(e,t,i,Pr(e,t));var r=[];Ai(e,function(n,L){!L&&ae(r,n.history)==-1&&(rs(n.history,t),r.push(n.history)),An(n,t,null,Pr(n,t))})}function ta(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!i)return;for(var n=e.history,L,H=e.sel,Q=t=="undo"?n.done:n.undone,J=t=="undo"?n.undone:n.done,ee=0;ee<Q.length&&!(L=Q[ee],i?L.ranges&&!L.equals(e.sel):!L.ranges);ee++);if(ee==Q.length)return;for(n.lastOrigin=n.lastSelOrigin=null;;)if(L=Q.pop(),L.ranges){if(Jn(L,J),i&&!L.equals(e.sel)){xr(e,L,{clearRedo:!1});return}H=L}else if(r){Q.push(L);return}else break;var fe=[];Jn(H,J),J.push({changes:fe,generation:n.generation}),n.generation=L.generation||++n.maxGeneration;for(var ge=pe(e,"beforeChange")||e.cm&&pe(e.cm,"beforeChange"),ke=function(Ve){var Qe=L.changes[Ve];if(Qe.origin=t,ge&&!Jo(e,Qe,!1))return Q.length=0,{};fe.push(Na(e,Qe));var tt=Ve?Pa(e,Qe):te(Q);An(e,Qe,tt,Ho(e,Qe)),!Ve&&e.cm&&e.cm.scrollIntoView({from:Qe.from,to:wi(Qe)});var ht=[];Ai(e,function(rt,dt){!dt&&ae(ht,rt.history)==-1&&(rs(rt.history,Qe),ht.push(rt.history)),An(rt,Qe,null,Ho(rt,Qe))})},Ae=L.changes.length-1;Ae>=0;--Ae){var je=ke(Ae);if(je)return je.v}}function qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new zr(ce(e.sel.ranges,function(n){return new jt(Xe(n.anchor.line+t,n.anchor.ch),Xe(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm){Lr(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;r<i.viewTo;r++)Si(e.cm,r,"gutter")}}function An(e,t,i,r){if(e.cm&&!e.cm.curOp)return ur(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:Xe(e.first,0),to:Xe(t.to.line+n,t.to.ch),text:[te(t.text)],origin:t.origin}}var L=e.lastLine();t.to.line>L&&(t={from:t.from,to:Xe(L,ft(e,L).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Ur(e,t.from,t.to),i||(i=Pa(e,t)),e.cm?xl(e.cm,t,r):Ia(e,t,r),qn(e,i,be),e.cantEdit&&ea(e,Xe(e.firstLine(),0))&&(e.cantEdit=!1)}function xl(e,t,i){var r=e.doc,n=e.display,L=t.from,H=t.to,Q=!1,J=L.line;e.options.lineWrapping||(J=Ot(ar(ft(r,L.line))),r.iter(J,H.line+1,function(Ae){if(Ae==n.maxLine)return Q=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Se(e),Ia(r,t,i,go(e)),e.options.lineWrapping||(r.iter(J,L.line+t.text.length,function(Ae){var je=Yi(Ae);je>n.maxLineLength&&(n.maxLine=Ae,n.maxLineLength=je,n.maxLineChanged=!0,Q=!1)}),Q&&(e.curOp.updateMaxLine=!0)),Xr(r,L.line),Cn(e,400);var ee=t.text.length-(H.line-L.line)-1;t.full?Lr(e):L.line==H.line&&t.text.length==1&&!No(e.doc,t)?Si(e,L.line,"text"):Lr(e,L.line,H.line+1,ee);var fe=pe(e,"changes"),ge=pe(e,"change");if(ge||fe){var ke={from:L,to:H,text:t.text,removed:t.removed,origin:t.origin};ge&&Vt(e,"change",e,ke),fe&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(ke)}e.display.selForContextMenu=null}function an(e,t,i,r,n){var L;r||(r=i),St(r,i)<0&&(L=[r,i],i=L[0],r=L[1]),typeof t=="string"&&(t=e.splitLines(t)),nn(e,{from:i,to:r,text:t,origin:n})}function es(e,t,i,r){i<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function ts(e,t,i,r){for(var n=0;n<e.length;++n){var L=e[n],H=!0;if(L.ranges){L.copied||(L=e[n]=L.deepCopy(),L.copied=!0);for(var Q=0;Q<L.ranges.length;Q++)es(L.ranges[Q].anchor,t,i,r),es(L.ranges[Q].head,t,i,r);continue}for(var J=0;J<L.changes.length;++J){var ee=L.changes[J];if(i<ee.from.line)ee.from=Xe(ee.from.line+r,ee.from.ch),ee.to=Xe(ee.to.line+r,ee.to.ch);else if(t<=ee.to.line){H=!1;break}}H||(e.splice(0,n+1),n=0)}}function rs(e,t){var i=t.from.line,r=t.to.line,n=t.text.length-(r-i)-1;ts(e.done,i,r,n),ts(e.undone,i,r,n)}function _n(e,t,i,r){var n=t,L=t;return typeof t=="number"?L=ft(e,V(e,t)):n=Ot(t),n==null?null:(r(L,n)&&e.cm&&Si(e.cm,n,i),L)}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),Vt(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 Dn(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}Dn.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 L=Math.min(t,n-e),H=r.height;if(r.removeInner(e,L),this.height-=H-r.height,n==L&&(this.children.splice(i--,1),r.parent=null),(t-=L)==0)break;e=0}else e-=n}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Ln))){var Q=[];this.collapse(Q),this.children=[new Ln(Q)],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],L=n.chunkSize();if(e<=L){if(n.insertInner(e,t,i),n.lines&&n.lines.length>50){for(var H=n.lines.length%25+25,Q=H;Q<n.lines.length;){var J=new Ln(n.lines.slice(Q,Q+=25));n.height-=J.height,this.children.splice(++r,0,J),J.parent=this}n.lines=n.lines.slice(0,H),this.maybeSpill()}break}e-=L}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),i=new Dn(t);if(e.parent){e.size-=i.size,e.height-=i.height;var n=ae(e.parent.children,e);e.parent.children.splice(n+1,0,i)}else{var r=new Dn(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],L=n.chunkSize();if(e<L){var H=Math.min(t,L-e);if(n.iterN(e,H,i))return!0;if((t-=H)==0)break;e=0}else e-=L}}};var kn=function(e,t,i){if(i)for(var r in i)i.hasOwnProperty(r)&&(this[r]=i[r]);this.doc=e,this.node=t};kn.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,i=this.line,r=Ot(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 L=gn(this);wr(i,Math.max(0,i.height-L)),e&&(Nr(e,function(){is(e,i,-L),Si(e,r,"widget")}),Vt(e,"lineWidgetCleared",e,this,r))},kn.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;Qr(this.doc,r)||wr(r,r.height+n),i&&Nr(i,function(){i.curOp.forceUpdate=!0,is(i,r,n),Vt(i,"lineWidgetChanged",i,e,Ot(r))})},ye(kn);function is(e,t,i){Ir(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&_a(e,i)}function El(e,t,i,r){var n=new kn(e,i,r),L=e.cm;return L&&n.noHScroll&&(L.display.alignWidgets=!0),_n(e,t,"widget",function(H){var Q=H.widgets||(H.widgets=[]);if(n.insertAt==null?Q.push(n):Q.splice(Math.min(Q.length-1,Math.max(0,n.insertAt)),0,n),n.line=H,L&&!Qr(e,H)){var J=Ir(H)<e.scrollTop;wr(H,H.height+gn(n)),J&&_a(L,n.height),L.curOp.forceUpdate=!0}return!0}),L&&Vt(L,"lineWidgetAdded",L,n,typeof t=="number"?t:Ot(t)),n}var ns=0,_i=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ns};_i.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&Wi(e),pe(this,"clear")){var i=this.find();i&&Vt(this,"clear",i.from,i.to)}for(var r=null,n=null,L=0;L<this.lines.length;++L){var H=this.lines[L],Q=$r(H.markedSpans,this);e&&!this.collapsed?Si(e,Ot(H),"text"):e&&(Q.to!=null&&(n=Ot(H)),Q.from!=null&&(r=Ot(H))),H.markedSpans=ri(H.markedSpans,Q),Q.from==null&&this.collapsed&&!Qr(this.doc,H)&&e&&wr(H,Qi(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var J=0;J<this.lines.length;++J){var ee=ar(this.lines[J]),fe=Yi(ee);fe>e.display.maxLineLength&&(e.display.maxLine=ee,e.display.maxLineLength=fe,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Lr(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Xo(e.doc)),e&&Vt(e,"markerCleared",e,this,r,n),t&&Hi(e),this.parent&&this.parent.clear()},_i.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n<this.lines.length;++n){var L=this.lines[n],H=$r(L.markedSpans,this);if(H.from!=null&&(i=Xe(t?L:Ot(L),H.from),e==-1))return i;if(H.to!=null&&(r=Xe(t?L:Ot(L),H.to),e==1))return r}return i&&{from:i,to:r}},_i.prototype.changed=function(){var e=this,t=this.find(-1,!0),i=this,r=this.doc.cm;if(!t||!r)return;Nr(r,function(){var n=t.line,L=Ot(t.line),H=ma(r,L);if(H&&(so(H),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Qr(i.doc,n)&&i.height!=null){var Q=i.height;i.height=null;var J=gn(i)-Q;J&&wr(n,n.height+J)}Vt(r,"markerChanged",r,e)})},_i.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ae(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},_i.prototype.detachLine=function(e){if(this.lines.splice(ae(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ye(_i);function on(e,t,i,r,n){if(r&&r.shared)return Sl(e,t,i,r,n);if(e.cm&&!e.cm.curOp)return ur(e.cm,on)(e,t,i,r,n);var L=new _i(e,n),H=St(t,i);if(r&&N(r,L,!1),H>0||H==0&&L.clearWhenEmpty!==!1)return L;if(L.replacedWith&&(L.collapsed=!0,L.widgetNode=C("span",[L.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||L.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(L.widgetNode.insertLeft=!0)),L.collapsed){if(nr(e,t.line,t,i,L)||t.line!=i.line&&nr(e,i.line,t,i,L))throw new Error("Inserting collapsed marker partially overlapping an existing one");ti()}L.addToHistory&&jo(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var Q=t.line,J=e.cm,ee;if(e.iter(Q,i.line+1,function(ge){J&&L.collapsed&&!J.options.lineWrapping&&ar(ge)==J.display.maxLine&&(ee=!0),L.collapsed&&Q!=t.line&&wr(ge,0),Wr(ge,new vi(L,Q==t.line?t.ch:null,Q==i.line?i.ch:null)),++Q}),L.collapsed&&e.iter(t.line,i.line+1,function(ge){Qr(e,ge)&&wr(ge,0)}),L.clearOnEnter&&Re(L,"beforeCursorEnter",function(){return L.clear()}),L.readOnly&&(_r(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),L.collapsed&&(L.id=++ns,L.atomic=!0),J){if(ee&&(J.curOp.updateMaxLine=!0),L.collapsed)Lr(J,t.line,i.line+1);else if(L.className||L.startStyle||L.endStyle||L.css||L.attributes||L.title)for(var fe=t.line;fe<=i.line;fe++)Si(J,fe,"text");L.atomic&&Xo(J.doc),Vt(J,"markerAdded",J,L)}return L}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();Vt(this,"clear")},Rn.prototype.find=function(e,t){return this.primary.find(e,t)},ye(Rn);function Sl(e,t,i,r,n){r=N(r),r.shared=!1;var L=[on(e,t,i,r,n)],H=L[0],Q=r.widgetNode;return Ai(e,function(J){Q&&(r.widgetNode=Q.cloneNode(!0)),L.push(on(J,l(J,t),l(J,i),r,n));for(var ee=0;ee<J.linked.length;++ee)if(J.linked[ee].isParent)return;H=te(L)}),new Rn(L,H)}function as(e){return e.findMarks(Xe(e.first,0),e.clipPos(Xe(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(),L=e.clipPos(n.from),H=e.clipPos(n.to);if(St(L,H)){var Q=on(e,L,H,r.primary,r.primary.type);r.markers.push(Q),Q.parent=r}}}function Tl(e){for(var t=function(r){var n=e[r],L=[n.primary.doc];Ai(n.primary.doc,function(J){return L.push(J)});for(var H=0;H<n.markers.length;H++){var Q=n.markers[H];ae(L,Q.doc)==-1&&(Q.parent=null,n.markers.splice(H--,1))}},i=0;i<e.length;i++)t(i)}var wl=0,Dr=function(e,t,i,r,n){if(!(this instanceof Dr))return new Dr(e,t,i,r,n);i==null&&(i=0),Dn.call(this,[new Ln([new Ei("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=i;var L=Xe(i,0);this.sel=Ti(L),this.history=new Qn(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)),Ia(this,{from:L,to:L,text:e}),xr(this,Ti(L),be)};Dr.prototype=Le(Dn.prototype,{constructor:Dr,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:hr(function(e){var t=Xe(this.first,0),i=this.first+this.size-1;nn(this,{from:t,to:Xe(i,ft(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&bn(this.cm,0,0),xr(this,Ti(t),be)}),replaceRange:function(e,t,i,r){t=l(this,t),i=i?l(this,i):t,an(this,e,t,i,r)},getRange:function(e,t,i){var r=Ur(this,l(this,e),l(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(ui(this,e))return ft(this,e)},getLineNumber:function(e){return Ot(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=ft(this,e)),ar(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return l(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:hr(function(e,t,i){Go(this,l(this,typeof e=="number"?Xe(e,t||0):e),null,i)}),setSelection:hr(function(e,t,i){Go(this,l(this,e),l(this,t||e),i)}),extendSelection:hr(function(e,t,i){Zn(this,l(this,e),t&&l(this,t),i)}),extendSelections:hr(function(e,t){zo(this,z(this,e),t)}),extendSelectionsBy:hr(function(e,t){var i=ce(this.sel.ranges,e);zo(this,z(this,i),t)}),setSelections:hr(function(e,t,i){if(!e.length)return;for(var r=[],n=0;n<e.length;n++)r[n]=new jt(l(this,e[n].anchor),l(this,e[n].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),xr(this,Zr(this.cm,r,t),i)}),addSelection:hr(function(e,t,i){var r=this.sel.ranges.slice(0);r.push(new jt(l(this,e),l(this,t||e))),xr(this,Zr(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=Ur(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=Ur(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:hr(function(e,t,i){for(var r=[],n=this.sel,L=0;L<n.ranges.length;L++){var H=n.ranges[L];r[L]={from:H.from(),to:H.to(),text:this.splitLines(e[L]),origin:i}}for(var Q=t&&t!="end"&&cl(this,r,t),J=r.length-1;J>=0;J--)nn(this,r[J]);Q?Ko(this,Q):this.cm&&qi(this.cm)}),undo:hr(function(){ta(this,"undo")}),redo:hr(function(){ta(this,"redo")}),undoSelection:hr(function(){ta(this,"undo",!0)}),redoSelection:hr(function(){ta(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 Qn(this.history.maxGeneration),Ai(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:tn(this.history.done),undone:tn(this.history.undone)}},setHistory:function(e){var t=this.history=new Qn(this.history.maxGeneration);t.done=tn(e.done.slice(0),null,!0),t.undone=tn(e.undone.slice(0),null,!0)},setGutterMarker:hr(function(e,t,i){return _n(this,e,"gutter",function(r){var n=r.gutterMarkers||(r.gutterMarkers={});return n[t]=i,!i&&Be(n)&&(r.gutterMarkers=null),!0})}),clearGutter:hr(function(e){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&_n(t,i,"gutter",function(){return i.gutterMarkers[e]=null,Be(i.gutterMarkers)&&(i.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!ui(this,e))return null;if(t=e,e=ft(this,e),!e)return null}else if(t=Ot(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:hr(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(E(i).test(r[n]))return!1;r[n]+=" "+i}return!0})}),removeLineClass:hr(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",L=r[n];if(L)if(i==null)r[n]=null;else{var H=L.match(E(i));if(!H)return!1;var Q=H.index+H[0].length;r[n]=L.slice(0,H.index)+(!H.index||Q==L.length?"":" ")+L.slice(Q)||null}else return!1;return!0})}),addLineWidget:hr(function(e,t,i){return El(this,e,t,i)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return on(this,l(this,e),l(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=l(this,e),on(this,e,e,i,"bookmark")},findMarksAt:function(e){e=l(this,e);var t=[],i=ft(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=l(this,e),t=l(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(L){var H=L.markedSpans;if(H)for(var Q=0;Q<H.length;Q++){var J=H[Q];!(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 L=n.text.length+r;if(L>e)return t=e,!0;e-=L,++i}),l(this,Xe(i,t))},indexFromPos:function(e){e=l(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 Dr(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 Dr(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,as(this)),r},unlinkDoc:function(e){if(e instanceof $t&&(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(as(this));break}if(e.history==this.history){var r=[e.id];Ai(e,function(n){return r.push(n.id)},!0),e.history=new Qn(null),e.history.done=tn(this.history.done,r),e.history.undone=tn(this.history.undone,r)}},iterLinkedDocs:function(e){Ai(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):mt(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:hr(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)})}),Dr.prototype.eachLine=Dr.prototype.iter;var os=0;function Al(e){var t=this;if(ss(t),He(t,e)||fi(t.display,e))return;re(e),W&&(os=+new Date);var i=Bi(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,L=Array(n),H=0,Q=function(){++H==n&&ur(t,function(){i=l(t.doc,i);var Ae={from:i,to:i,text:t.doc.splitLines(L.filter(function(je){return je!=null}).join(t.doc.lineSeparator())),origin:"paste"};nn(t.doc,Ae),Ko(t.doc,Ti(l(t.doc,i),l(t.doc,wi(Ae))))})()},J=function(Ae,je){if(t.options.allowDropFileTypes&&ae(t.options.allowDropFileTypes,Ae.type)==-1){Q();return}var Ve=new FileReader;Ve.onerror=function(){return Q()},Ve.onload=function(){var Qe=Ve.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Qe)){Q();return}L[je]=Qe,Q()},Ve.readAsText(Ae)},ee=0;ee<r.length;ee++)J(r[ee],ee);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 fe=e.dataTransfer.getData("Text");if(fe){var ge;if(t.state.draggingText&&!t.state.draggingText.copy&&(ge=t.listSelections()),qn(t.doc,Ti(i,i)),ge)for(var ke=0;ke<ge.length;++ke)an(t.doc,"",ge[ke].anchor,ge[ke].head,"drag");t.replaceSelection(fe,"around","paste"),t.display.input.focus()}}catch(Ae){}}}function _l(e,t){if(W&&(!e.state.draggingText||+new Date-os<100)){de(t);return}if(He(e,t)||fi(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!M){var i=o("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",b&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),b&&i.parentNode.removeChild(i)}}function Ll(e,t){var i=Bi(e,t);if(!i)return;var r=document.createDocumentFragment();bo(e,i,r),e.display.dragCursor||(e.display.dragCursor=o("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),h(e.display.dragCursor,r)}function ss(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ls(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 L=0;L<i.length;L++)e(i[L])})}var us=!1;function Dl(){if(us)return;kl(),us=!0}function kl(){var e;Re(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ls(Rl)},100))}),Re(window,"blur",function(){return ls(Zi)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Li={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++)Li[On+48]=Li[On+96]=String(On);for(var ra=65;ra<=90;ra++)Li[ra]=String.fromCharCode(ra);for(var Pn=1;Pn<=12;Pn++)Li[Pn+111]=Li[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=s?pi.macDefault:pi.pcDefault;function Ol(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var i,r,n,L,H=0;H<t.length-1;H++){var Q=t[H];if(/^(cmd|meta|m)$/i.test(Q))L=!0;else if(/^a(lt)?$/i.test(Q))i=!0;else if(/^(c|ctrl|control)$/i.test(Q))r=!0;else if(/^s(hift)?$/i.test(Q))n=!0;else throw new Error("Unrecognized modifier name: "+Q)}return i&&(e="Alt-"+e),r&&(e="Ctrl-"+e),L&&(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=ce(i.split(" "),Ol),L=0;L<n.length;L++){var H=void 0,Q=void 0;L==n.length-1?(Q=n.join(" "),H=r):(Q=n.slice(0,L+1).join(" "),H="...");var J=t[Q];if(!J)t[Q]=H;else if(J!=H)throw new Error("Inconsistent bindings for "+Q)}delete e[i]}for(var ee in t)e[ee]=t[ee];return e}function sn(e,t,i,r){t=ia(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 sn(e,t.fallthrough,i,r);for(var L=0;L<t.fallthrough.length;L++){var H=sn(e,t.fallthrough[L],i,r);if(H)return H}}}function hs(e){var t=typeof e=="string"?e:Li[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ds(e,t,i){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(p?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(p?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!i&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function cs(e,t){if(b&&e.keyCode==34&&e.char)return!1;var i=Li[e.keyCode];return i==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(i=e.code),ds(i,e,t))}function ia(e){return typeof e=="string"?pi[e]:e}function ln(e,t){for(var i=e.doc.sel.ranges,r=[],n=0;n<i.length;n++){for(var L=t(i[n]);r.length&&St(L.from,te(r).to)<=0;){var H=r.pop();if(St(H.from,L.from)<0){L.from=H.from;break}}r.push(L)}Nr(e,function(){for(var Q=r.length-1;Q>=0;Q--)an(e.doc,"",r[Q].from,r[Q].to,"+delete");qi(e)})}function Fa(e,t,i){var r=Fe(e.text,t+i,i);return r<0||r>e.text.length?null:r}function ja(e,t,i){var r=Fa(e,t.ch,i);return r==null?null:new Xe(t.line,r,i<0?"after":"before")}function Wa(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var L=Je(i,t.doc.direction);if(L){var H=n<0?te(L):L[0],Q=n<0==(H.level==1),J=Q?"after":"before",ee;if(H.level>0||t.doc.direction=="rtl"){var fe=$i(t,i);ee=n<0?i.text.length-1:0;var ge=ai(t,fe,ee).top;ee=at(function(ke){return ai(t,fe,ke).top==ge},n<0==(H.level==1)?H.from:H.to-1,ee),J=="before"&&(ee=Fa(i,ee,1))}else ee=n<0?H.to:H.from;return new Xe(r,ee,J)}}return new Xe(r,n<0?i.text.length:0,n<0?"before":"after")}function Ml(e,t,i,r){var n=Je(t,e.doc.direction);if(!n)return ja(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 L=Ze(n,i.ch,i.sticky),H=n[L];if(e.doc.direction=="ltr"&&H.level%2==0&&(r>0?H.to>i.ch:H.from<i.ch))return ja(t,i,r);var Q=function(tt,ht){return Fa(t,tt instanceof Xe?tt.ch:tt,ht)},J,ee=function(tt){return e.options.lineWrapping?(J=J||$i(e,t),mo(e,t,J,tt)):{begin:0,end:t.text.length}},fe=ee(i.sticky=="before"?Q(i,-1):i.ch);if(e.doc.direction=="rtl"||H.level==1){var ge=H.level==1==r<0,ke=Q(i,ge?1:-1);if(ke!=null&&(ge?ke<=H.to&&ke<=fe.end:ke>=H.from&&ke>=fe.begin)){var Ae=ge?"before":"after";return new Xe(i.line,ke,Ae)}}var je=function(tt,ht,rt){for(var dt=function(Yt,dr){return dr?new Xe(i.line,Q(Yt,1),"before"):new Xe(i.line,Yt,"after")};tt>=0&&tt<n.length;tt+=ht){var Et=n[tt],vt=ht>0==(Et.level!=1),_t=vt?rt.begin:Q(rt.end,-1);if(Et.from<=_t&&_t<Et.to)return dt(_t,vt);if(_t=vt?Et.from:Q(Et.to,-1),rt.begin<=_t&&_t<rt.end)return dt(_t,vt)}},Ve=je(L+r,r,fe);if(Ve)return Ve;var Qe=r>0?fe.end:Q(fe.begin,-1);return Qe!=null&&!(r>0&&Qe==t.text.length)&&(Ve=je(r>0?0:n.length-1,r,ee(Qe)),Ve)?Ve:null}var Mn={selectAll:Qo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),be)},killLine:function(e){return ln(e,function(t){if(t.empty()){var i=ft(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line<e.lastLine()?{from:t.head,to:Xe(t.head.line+1,0)}:{from:t.head,to:Xe(t.head.line,i)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return ln(e,function(t){return{from:Xe(t.from().line,0),to:l(e.doc,Xe(t.to().line+1,0))}})},delLineLeft:function(e){return ln(e,function(t){return{from:Xe(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return ln(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 ln(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(Xe(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Xe(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return fs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ps(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")},Te)},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")},Te)},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/)?ps(e,t.head):r},Te)},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 L=i[n].from(),H=Y(e.getLine(L.line),L.ch,r);t.push(ue(r-H%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Nr(e,function(){for(var t=e.listSelections(),i=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var n=t[r].head,L=ft(e.doc,n.line).text;if(L){if(n.ch==L.length&&(n=new Xe(n.line,n.ch-1)),n.ch>0)n=new Xe(n.line,n.ch+1),e.replaceRange(L.charAt(n.ch-1)+L.charAt(n.ch-2),Xe(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var H=ft(e.doc,n.line-1).text;H&&(n=new Xe(n.line,1),e.replaceRange(L.charAt(0)+e.doc.lineSeparator()+H.charAt(H.length-1),Xe(n.line-1,H.length-1),n,"+transpose"))}}i.push(new jt(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return Nr(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);qi(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function fs(e,t){var i=ft(e.doc,t),r=ar(i);return r!=i&&(t=Ot(r)),Wa(!0,e,r,t,1)}function Il(e,t){var i=ft(e.doc,t),r=ii(i);return r!=i&&(t=Ot(r)),Wa(!0,e,i,t,-1)}function ps(e,t){var i=fs(e,t.line),r=ft(e.doc,i.line),n=Je(r,e.doc.direction);if(!n||n[0].level==0){var L=Math.max(i.ch,r.text.search(/\S/)),H=t.line==i.line&&t.ch<=L&&t.ch;return Xe(i.line,H?0:L,i.sticky)}return i}function na(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)!=_e}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=sn(t,e.state.keyMaps[r],i,e);if(n)return n}return e.options.extraKeys&&sn(t,e.options.extraKeys,i,e)||sn(t,e.options.keyMap,i,e)}var Bl=new q;function In(e,t,i,r){var n=e.state.keySeq;if(n){if(hs(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())}),ms(e,n+" "+t,i,r))return!0}return ms(e,t,i,r)}function ms(e,t,i,r){var n=Nl(e,t,r);return n=="multi"&&(e.state.keySeq=t),n=="handled"&&Vt(e,"keyHandled",e,t,i),(n=="handled"||n=="multi")&&(re(i),Ta(e)),!!n}function gs(e,t){var i=cs(t,!0);return i?t.shiftKey&&!e.state.keySeq?In(e,"Shift-"+i,t,function(r){return na(e,r,!0)})||In(e,i,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return na(e,r)}):In(e,i,t,function(r){return na(e,r)}):!1}function Ul(e,t,i){return In(e,"'"+i+"'",t,function(r){return na(e,r,!0)})}var Ha=null;function vs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=R(),He(t,e))return;W&&F<11&&e.keyCode==27&&(e.returnValue=!1);var i=e.keyCode;t.display.shift=i==16||e.shiftKey;var r=gs(t,e);b&&(Ha=r?i:null,!r&&i==88&&!Rt&&(s?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),k&&!s&&!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;B(t,"CodeMirror-crosshair");function i(r){(r.keyCode==18||!r.altKey)&&(g(t,"CodeMirror-crosshair"),qe(document,"keyup",i),qe(document,"mouseover",i))}Re(document,"keyup",i),Re(document,"mouseover",i)}function ys(e){e.keyCode==16&&(this.doc.sel.shift=!1),He(this,e)}function bs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(fi(t.display,e)||He(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var i=e.keyCode,r=e.charCode;if(b&&i==Ha){Ha=null,re(e);return}if(b&&(!e.which||e.which<10)&&gs(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,za=function(e,t,i){this.time=e,this.pos=t,this.button=i};za.prototype.compare=function(e,t,i){return this.time+jl>e&&St(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 za(i,e,t),Nn=null,"double"):(Nn=new za(i,e,t),Bn=null,"single")}function xs(e){var t=this,i=t.display;if(He(t,e)||i.activeTouch&&i.input.supportsTouch())return;if(i.input.ensurePolled(),i.shift=e.shiftKey,fi(i,e)){P||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(Ga(t,e))return;var r=Bi(t,e),n=Me(e),L=r?Wl(r,n):"single";if(window.focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,n,r,L,e))return;n==1?r?Gl(t,r,L,e):De(e)==i.scroller&&re(e):n==2?(r&&Zn(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(D?t.display.input.onContextMenu(e):Eo(t))}function Hl(e,t,i,r,n){var L="Click";return r=="double"?L="Double"+L:r=="triple"&&(L="Triple"+L),L=(t==1?"Left":t==2?"Middle":"Right")+L,In(e,ds(L,n),n,function(H){if(typeof H=="string"&&(H=Mn[H]),!H)return!1;var Q=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Q=H(e,i)!=_e}finally{e.state.suppressEdits=!1}return Q})}function zl(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var L=u?i.shiftKey&&i.metaKey:i.altKey;n.unit=L?"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=s?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(s?i.altKey:i.ctrlKey)),n}function Gl(e,t,i,r){W?setTimeout(I(xo,e),0):e.curOp.focus=R();var n=zl(e,i,r),L=e.doc.sel,H;e.options.dragDrop&&Ye&&!e.isReadOnly()&&i=="single"&&(H=L.contains(t))>-1&&(St((H=L.ranges[H]).from(),t)<0||t.xRel>0)&&(St(H.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,L=!1,H=ur(e,function(ee){P&&(n.scroller.draggable=!1),e.state.draggingText=!1,qe(n.wrapper.ownerDocument,"mouseup",H),qe(n.wrapper.ownerDocument,"mousemove",Q),qe(n.scroller,"dragstart",J),qe(n.scroller,"drop",H),L||(re(ee),r.addNew||Zn(e.doc,i,null,null,r.extend),P&&!M||W&&F==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),Q=function(ee){L=L||Math.abs(t.clientX-ee.clientX)+Math.abs(t.clientY-ee.clientY)>=10},J=function(){return L=!0};P&&(n.scroller.draggable=!0),e.state.draggingText=H,H.copy=!r.moveOnDrag,n.scroller.dragDrop&&n.scroller.dragDrop(),Re(n.wrapper.ownerDocument,"mouseup",H),Re(n.wrapper.ownerDocument,"mousemove",Q),Re(n.scroller,"dragstart",J),Re(n.scroller,"drop",H),Eo(e),setTimeout(function(){return n.input.focus()},20)}function Es(e,t,i){if(i=="char")return new jt(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new jt(Xe(t.line,0),l(e.doc,Xe(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,L=e.doc;re(t);var H,Q,J=L.sel,ee=J.ranges;if(r.addNew&&!r.extend?(Q=L.sel.contains(i),Q>-1?H=ee[Q]:H=new jt(i,i)):(H=L.sel.primary(),Q=L.sel.primIndex),r.unit=="rectangle")r.addNew||(H=new jt(i,i)),i=Bi(e,t,!0,!0),Q=-1;else{var fe=Es(e,i,r.unit);r.extend?H=Ba(H,fe.anchor,fe.head,r.extend):H=fe}r.addNew?Q==-1?(Q=ee.length,xr(L,Zr(e,ee.concat([H]),Q),{scroll:!1,origin:"*mouse"})):ee.length>1&&ee[Q].empty()&&r.unit=="char"&&!r.extend?(xr(L,Zr(e,ee.slice(0,Q).concat(ee.slice(Q+1)),0),{scroll:!1,origin:"*mouse"}),J=L.sel):Ua(L,Q,H,Ce):(Q=0,xr(L,new zr([H],0),Ce),J=L.sel);var ge=i;function ke(rt){if(St(ge,rt)==0)return;if(ge=rt,r.unit=="rectangle"){for(var dt=[],Et=e.options.tabSize,vt=Y(ft(L,i.line).text,i.ch,Et),_t=Y(ft(L,rt.line).text,rt.ch,Et),Yt=Math.min(vt,_t),dr=Math.max(vt,_t),Jt=Math.min(i.line,rt.line),Br=Math.min(e.lastLine(),Math.max(i.line,rt.line));Jt<=Br;Jt++){var kr=ft(L,Jt).text,tr=Ee(kr,Yt,Et);Yt==dr?dt.push(new jt(Xe(Jt,tr),Xe(Jt,tr))):kr.length>tr&&dt.push(new jt(Xe(Jt,tr),Xe(Jt,Ee(kr,dr,Et))))}dt.length||dt.push(new jt(i,i)),xr(L,Zr(e,J.ranges.slice(0,Q).concat(dt),Q),{origin:"*mouse",scroll:!1}),e.scrollIntoView(rt)}else{var Rr=H,vr=Es(e,rt,r.unit),or=Rr.anchor,rr;St(vr.anchor,or)>0?(rr=vr.head,or=ki(Rr.from(),vr.anchor)):(rr=vr.anchor,or=di(Rr.to(),vr.head));var Zt=J.ranges.slice(0);Zt[Q]=Xl(e,new jt(l(L,or),rr)),xr(L,Zr(e,Zt,Q),Ce)}}var Ae=n.wrapper.getBoundingClientRect(),je=0;function Ve(rt){var dt=++je,Et=Bi(e,rt,!0,r.unit=="rectangle");if(!Et)return;if(St(Et,ge)!=0){e.curOp.focus=R(),ke(Et);var vt=Vn(n,L);(Et.line>=vt.to||Et.line<vt.from)&&setTimeout(ur(e,function(){je==dt&&Ve(rt)}),150)}else{var _t=rt.clientY<Ae.top?-20:rt.clientY>Ae.bottom?20:0;_t&&setTimeout(ur(e,function(){if(je!=dt)return;n.scroller.scrollTop+=_t,Ve(rt)}),50)}}function Qe(rt){e.state.selectingText=!1,je=Infinity,rt&&(re(rt),n.input.focus()),qe(n.wrapper.ownerDocument,"mousemove",tt),qe(n.wrapper.ownerDocument,"mouseup",ht),L.history.lastSelOrigin=null}var tt=ur(e,function(rt){rt.buttons===0||!Me(rt)?Qe(rt):Ve(rt)}),ht=ur(e,Qe);e.state.selectingText=ht,Re(n.wrapper.ownerDocument,"mousemove",tt),Re(n.wrapper.ownerDocument,"mouseup",ht)}function Xl(e,t){var i=t.anchor,r=t.head,n=ft(e.doc,i.line);if(St(i,r)==0&&i.sticky==r.sticky)return t;var L=Je(n);if(!L)return t;var H=Ze(L,i.ch,i.sticky),Q=L[H];if(Q.from!=i.ch&&Q.to!=i.ch)return t;var J=H+(Q.from==i.ch==(Q.level!=1)?0:1);if(J==0||J==L.length)return t;var ee;if(r.line!=i.line)ee=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var fe=Ze(L,r.ch,r.sticky),ge=fe-H||(r.ch-i.ch)*(Q.level==1?-1:1);fe==J-1||fe==J?ee=ge<0:ee=ge>0}var ke=L[J+(ee?-1:0)],Ae=ee==(ke.level==1),je=Ae?ke.from:ke.to,Ve=Ae?"after":"before";return i.ch==je&&i.sticky==Ve?t:new jt(new Xe(i.line,je,Ve),r)}function Ss(e,t,i,r){var n,L;if(t.touches)n=t.touches[0].clientX,L=t.touches[0].clientY;else try{n=t.clientX,L=t.clientY}catch(ke){return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&re(t);var H=e.display,Q=H.lineDiv.getBoundingClientRect();if(L>Q.bottom||!pe(e,i))return le(t);L-=Q.top-H.viewOffset;for(var J=0;J<e.display.gutterSpecs.length;++J){var ee=H.gutters.childNodes[J];if(ee&&ee.getBoundingClientRect().right>=n){var fe=Vr(e.doc,L),ge=e.display.gutterSpecs[J];return Ie(e,i,e,fe,ge.className,t),le(t)}}}function Ga(e,t){return Ss(e,t,"gutterClick",!0)}function Cs(e,t){if(fi(e.display,t)||Yl(e,t))return;if(He(e,t,"contextmenu"))return;D||e.display.input.onContextMenu(t)}function Yl(e,t){return pe(e,"gutterContextMenu")?Ss(e,t,"gutterContextMenu",!1):!1}function Ts(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 un={toString:function(){return"CodeMirror.Init"}},ws={},aa={};function $l(e){var t=e.optionHandlers;function i(r,n,L,H){e.defaults[r]=n,L&&(t[r]=H?function(Q,J,ee){ee!=un&&L(Q,J,ee)}:L)}e.defineOption=i,e.Init=un,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,Ma(r)},!0),i("indentUnit",2,Ma,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){wn(r),vn(r),Lr(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!n)return;var L=[],H=r.doc.first;r.doc.iter(function(J){for(var ee=0;;){var fe=J.text.indexOf(n,ee);if(fe==-1)break;ee=fe+n.length,L.push(Xe(H,fe))}H++});for(var Q=L.length-1;Q>=0;Q--)an(r.doc,n,L[Q],Xe(L[Q].line,L[Q].ch+n.length))}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,n,L){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),L!=un&&r.refresh()}),i("specialCharPlaceholder",pt,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",a?"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",!_),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Ts(r),Tn(r)},!0),i("keyMap","default",function(r,n,L){var H=ia(n),Q=L!=un&&ia(L);Q&&Q.detach&&Q.detach(r,H),H.attach&&H.attach(r,Q||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Jl,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=Oa(n,r.options.lineNumbers),Tn(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?Sa(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return en(r)},!0),i("scrollbarStyle","native",function(r){_o(r),en(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=Oa(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,Ql),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 Ql(e,t,i){var r=i&&i!=un;if(!t!=!r){var n=e.display.dragFunctions,L=t?Re:qe;L(e.display.scroller,"dragstart",n.start),L(e.display.scroller,"dragenter",n.enter),L(e.display.scroller,"dragover",n.over),L(e.display.scroller,"dragleave",n.leave),L(e.display.scroller,"drop",n.drop)}}function Jl(e){e.options.lineWrapping?(B(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(g(e.display.wrapper,"CodeMirror-wrap"),ci(e)),Ca(e),Lr(e),vn(e),setTimeout(function(){return en(e)},100)}function $t(e,t){var i=this;if(!(this instanceof $t))return new $t(e,t);this.options=t=t?N(t):{},N(ws,t,!1);var r=t.value;typeof r=="string"?r=new Dr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new $t.inputStyles[t.inputStyle](this),L=this.display=new hl(e,r,n,t);L.wrapper.CodeMirror=this,Ts(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),_o(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 q,keySeq:null,specialChars:null},t.autofocus&&!a&&L.input.focus(),W&&F<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Zl(this),Dl(),Wi(this),this.curOp.forceUpdate=!0,Bo(this,r),t.autofocus&&!a||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&wa(i)},20):Zi(this);for(var H in aa)aa.hasOwnProperty(H)&&aa[H](this,t[H],un);ko(this),t.finishInit&&t.finishInit(this);for(var Q=0;Q<Ka.length;++Q)Ka[Q](this);Hi(this),P&&t.lineWrapping&&getComputedStyle(L.lineDiv).textRendering=="optimizelegibility"&&(L.lineDiv.style.textRendering="auto")}$t.defaults=ws,$t.optionHandlers=aa;function Zl(e){var t=e.display;Re(t.scroller,"mousedown",ur(e,xs)),W&&F<11?Re(t.scroller,"dblclick",ur(e,function(J){if(He(e,J))return;var ee=Bi(e,J);if(!ee||Ga(e,J)||fi(e.display,J))return;re(J);var fe=e.findWordAt(ee);Zn(e.doc,fe.anchor,fe.head)})):Re(t.scroller,"dblclick",function(J){return He(e,J)||re(J)}),Re(t.scroller,"contextmenu",function(J){return Cs(e,J)}),Re(t.input.getField(),"contextmenu",function(J){t.scroller.contains(J.target)||Cs(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 L(J){if(J.touches.length!=1)return!1;var ee=J.touches[0];return ee.radiusX<=1&&ee.radiusY<=1}function H(J,ee){if(ee.left==null)return!0;var fe=ee.left-J.left,ge=ee.top-J.top;return fe*fe+ge*ge>20*20}Re(t.scroller,"touchstart",function(J){if(!He(e,J)&&!L(J)&&!Ga(e,J)){t.input.ensurePolled(),clearTimeout(i);var ee=+new Date;t.activeTouch={start:ee,moved:!1,prev:ee-r.end<=300?r:null},J.touches.length==1&&(t.activeTouch.left=J.touches[0].pageX,t.activeTouch.top=J.touches[0].pageY)}}),Re(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Re(t.scroller,"touchend",function(J){var ee=t.activeTouch;if(ee&&!fi(t,J)&&ee.left!=null&&!ee.moved&&new Date-ee.start<300){var fe=e.coordsChar(t.activeTouch,"page"),ge;!ee.prev||H(ee,ee.prev)?ge=new jt(fe,fe):!ee.prev.prev||H(ee,ee.prev.prev)?ge=e.findWordAt(fe):ge=new jt(Xe(fe.line,0),l(e.doc,Xe(fe.line+1,0))),e.setSelection(ge.anchor,ge.head),e.focus(),re(J)}n()}),Re(t.scroller,"touchcancel",n),Re(t.scroller,"scroll",function(){t.scroller.clientHeight&&(xn(e,t.scroller.scrollTop),Fi(e,t.scroller.scrollLeft,!0),Ie(e,"scroll",e))}),Re(t.scroller,"mousewheel",function(J){return Po(e,J)}),Re(t.scroller,"DOMMouseScroll",function(J){return Po(e,J)}),Re(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(J){He(e,J)||de(J)},over:function(J){He(e,J)||(Ll(e,J),de(J))},start:function(J){return _l(e,J)},drop:ur(e,Al),leave:function(J){He(e,J)||ss(e)}};var Q=t.input.getField();Re(Q,"keyup",function(J){return ys.call(e,J)}),Re(Q,"keydown",ur(e,vs)),Re(Q,"keypress",ur(e,bs)),Re(Q,"focus",function(J){return wa(e,J)}),Re(Q,"blur",function(J){return Zi(e,J)})}var Ka=[];$t.defineInitHook=function(e){return Ka.push(e)};function Un(e,t,i,r){var n=e.doc,L;i==null&&(i="add"),i=="smart"&&(n.mode.indent?L=Oe(e,t).state:i="prev");var H=e.options.tabSize,Q=ft(n,t),J=Y(Q.text,null,H);Q.stateAfter&&(Q.stateAfter=null);var ee=Q.text.match(/^\s*/)[0],fe;if(!r&&!/\S/.test(Q.text))fe=0,i="not";else if(i=="smart"&&(fe=n.mode.indent(L,Q.text.slice(ee.length),Q.text),fe==_e||fe>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?fe=Y(ft(n,t-1).text,null,H):fe=0:i=="add"?fe=J+e.options.indentUnit:i=="subtract"?fe=J-e.options.indentUnit:typeof i=="number"&&(fe=J+i),fe=Math.max(0,fe);var ge="",ke=0;if(e.options.indentWithTabs)for(var Ae=Math.floor(fe/H);Ae;--Ae)ke+=H,ge+=" ";if(ke<fe&&(ge+=ue(fe-ke)),ge!=ee)return an(n,ge,Xe(t,0),Xe(t,ee.length),"+input"),Q.stateAfter=null,!0;for(var je=0;je<n.sel.ranges.length;je++){var Ve=n.sel.ranges[je];if(Ve.head.line==t&&Ve.head.ch<ee.length){var Qe=Xe(t,ee.length);Ua(n,je,new jt(Qe,Qe));break}}}var qr=null;function oa(e){qr=e}function Va(e,t,i,r,n){var L=e.doc;e.display.shift=!1,r||(r=L.sel);var H=+new Date-200,Q=n=="paste"||e.state.pasteIncoming>H,J=mt(t),ee=null;if(Q&&r.ranges.length>1)if(qr&&qr.text.join(`
`)==t){if(r.ranges.length%qr.text.length==0){ee=[];for(var fe=0;fe<qr.text.length;fe++)ee.push(L.splitLines(qr.text[fe]))}}else J.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(ee=ce(J,function(tt){return[tt]}));for(var ge=e.curOp.updateInput,ke=r.ranges.length-1;ke>=0;ke--){var Ae=r.ranges[ke],je=Ae.from(),Ve=Ae.to();Ae.empty()&&(i&&i>0?je=Xe(je.line,je.ch-i):e.state.overwrite&&!Q?Ve=Xe(Ve.line,Math.min(ft(L,Ve.line).text.length,Ve.ch+te(J).length)):Q&&qr&&qr.lineWise&&qr.text.join(`
`)==J.join(`
`)&&(je=Ve=Xe(je.line,0)));var Qe={from:je,to:Ve,text:ee?ee[ke%ee.length]:J,origin:n||(Q?"paste":e.state.cutIncoming>H?"cut":"+input")};nn(e.doc,Qe),Vt(e,"inputRead",e,Qe)}t&&!Q&&_s(e,t),qi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ge),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function As(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Nr(t,function(){return Va(t,i,0,null,"paste")}),!0}function _s(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 L=e.getModeAt(n.head),H=!1;if(L.electricChars){for(var Q=0;Q<L.electricChars.length;Q++)if(t.indexOf(L.electricChars.charAt(Q))>-1){H=Un(e,n.head.line,"smart");break}}else L.electricInput&&(L.electricInput.test(ft(e.doc,n.head.line).text.slice(0,n.head.ch))&&(H=Un(e,n.head.line,"smart")));H&&Vt(e,"electricInput",e,n.head.line)}}function Ls(e){for(var t=[],i=[],r=0;r<e.doc.sel.ranges.length;r++){var n=e.doc.sel.ranges[r].head.line,L={anchor:Xe(n,0),head:Xe(n+1,0)};i.push(L),t.push(e.getRange(L.anchor,L.head))}return{text:t,ranges:i}}function Ds(e,t,i,r){e.setAttribute("autocorrect",i?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function ks(){var e=o("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=o("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return P?e.style.width="1000px":e.setAttribute("wrap","off"),T&&(e.style.border="1px solid black"),Ds(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 L=this.options,H=L[r];if(L[r]==n&&r!="mode")return;L[r]=n,t.hasOwnProperty(r)&&ur(this,t[r])(this,n,H),Ie(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"](ia(r))},removeKeyMap:function(r){for(var n=this.state.keyMaps,L=0;L<n.length;++L)if(n[L]==r||n[L].name==r)return n.splice(L,1),!0},addOverlay:Sr(function(r,n){var L=r.token?r:e.getMode(this.options,r);if(L.startState)throw new Error("Overlays may not be stateful.");se(this.state.overlays,{mode:L,modeSpec:r,opaque:n&&n.opaque,priority:n&&n.priority||0},function(H){return H.priority}),this.state.modeGen++,Lr(this)}),removeOverlay:Sr(function(r){for(var n=this.state.overlays,L=0;L<n.length;++L){var H=n[L].modeSpec;if(H==r||typeof r=="string"&&H.name==r){n.splice(L,1),this.state.modeGen++,Lr(this);return}}}),indentLine:Sr(function(r,n,L){typeof n!="string"&&typeof n!="number"&&(n==null?n=this.options.smartIndent?"smart":"prev":n=n?"add":"subtract"),ui(this.doc,r)&&Un(this,r,n,L)}),indentSelection:Sr(function(r){for(var n=this.doc.sel.ranges,L=-1,H=0;H<n.length;H++){var Q=n[H];if(Q.empty())Q.head.line>L&&(Un(this,Q.head.line,r,!0),L=Q.head.line,H==this.doc.sel.primIndex&&qi(this));else{var J=Q.from(),ee=Q.to(),fe=Math.max(L,J.line);L=Math.min(this.lastLine(),ee.line-(ee.ch?0:1))+1;for(var ge=fe;ge<L;++ge)Un(this,ge,r);var ke=this.doc.sel.ranges;J.ch==0&&n.length==ke.length&&ke[H].from().ch>0&&Ua(this.doc,H,new jt(J,ke[H].to()),be)}}}),getTokenAt:function(r,n){return Wt(this,r,n)},getLineTokens:function(r,n){return Wt(this,Xe(r),n,!0)},getTokenTypeAt:function(r){r=l(this.doc,r);var n=ze(this,ft(this.doc,r.line)),L=0,H=(n.length-1)/2,Q=r.ch,J;if(Q==0)J=n[2];else for(;;){var ee=L+H>>1;if((ee?n[ee*2-1]:0)>=Q)H=ee;else if(n[ee*2+1]<Q)L=ee+1;else{J=n[ee*2+2];break}}var fe=J?J.indexOf("overlay "):-1;return fe<0?J:fe==0?null:J.slice(0,fe-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 L=[];if(!i.hasOwnProperty(n))return L;var H=i[n],Q=this.getModeAt(r);if(typeof Q[n]=="string")H[Q[n]]&&L.push(H[Q[n]]);else if(Q[n])for(var J=0;J<Q[n].length;J++){var ee=H[Q[n][J]];ee&&L.push(ee)}else Q.helperType&&H[Q.helperType]?L.push(H[Q.helperType]):H[Q.name]&&L.push(H[Q.name]);for(var fe=0;fe<H._global.length;fe++){var ge=H._global[fe];ge.pred(Q,this)&&ae(L,ge.val)==-1&&L.push(ge.val)}return L},getStateAfter:function(r,n){var L=this.doc;return r=V(L,r==null?L.first+L.size-1:r),Oe(this,r+1,n).state},cursorCoords:function(r,n){var L,H=this.doc.sel.primary();return r==null?L=H.head:typeof r=="object"?L=l(this.doc,r):L=r?H.from():H.to(),Jr(this,L,n||"page")},charCoords:function(r,n){return va(this,l(this.doc,r),n||"page")},coordsChar:function(r,n){return r=co(this,r,n||"page"),ba(this,r.left,r.top)},lineAtHeight:function(r,n){return r=co(this,{top:r,left:0},n||"page").top,Vr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,n,L){var H=!1,Q;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,H=!0),Q=ft(this.doc,r)}else Q=r;return Hn(this,Q,{top:0,left:0},n||"page",L||H).top+(H?this.doc.height-Ir(Q):0)},defaultTextHeight:function(){return Qi(this.display)},defaultCharWidth:function(){return Ji(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,L,H,Q){var J=this.display;r=Jr(this,l(this.doc,r));var ee=r.bottom,fe=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),J.sizer.appendChild(n),H=="over")ee=r.top;else if(H=="above"||H=="near"){var ge=Math.max(J.wrapper.clientHeight,this.doc.height),ke=Math.max(J.sizer.clientWidth,J.lineSpace.clientWidth);(H=="above"||r.bottom+n.offsetHeight>ge)&&r.top>n.offsetHeight?ee=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=ge&&(ee=r.bottom),fe+n.offsetWidth>ke&&(fe=ke-n.offsetWidth)}n.style.top=ee+"px",n.style.left=n.style.right="",Q=="right"?(fe=J.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(Q=="left"?fe=0:Q=="middle"&&(fe=(J.sizer.clientWidth-n.offsetWidth)/2),n.style.left=fe+"px"),L&&Qs(this,{left:fe,top:ee,right:fe+n.offsetWidth,bottom:ee+n.offsetHeight})},triggerOnKeyDown:Sr(vs),triggerOnKeyPress:Sr(bs),triggerOnKeyUp:ys,triggerOnMouseDown:Sr(xs),execCommand:function(r){if(Mn.hasOwnProperty(r))return Mn[r].call(null,this)},triggerElectric:Sr(function(r){_s(this,r)}),findPosH:function(r,n,L,H){var Q=1;n<0&&(Q=-1,n=-n);for(var J=l(this.doc,r),ee=0;ee<n&&!(J=Xa(this.doc,J,Q,L,H),J.hitSide);++ee);return J},moveH:Sr(function(r,n){var L=this;this.extendSelectionsBy(function(H){return L.display.shift||L.doc.extend||H.empty()?Xa(L.doc,H.head,r,n,L.options.rtlMoveVisually):r<0?H.from():H.to()},Te)}),deleteH:Sr(function(r,n){var L=this.doc.sel,H=this.doc;L.somethingSelected()?H.replaceSelection("",null,"+delete"):ln(this,function(Q){var J=Xa(H,Q.head,r,n,!1);return r<0?{from:J,to:Q.head}:{from:Q.head,to:J}})}),findPosV:function(r,n,L,H){var Q=1,J=H;n<0&&(Q=-1,n=-n);for(var ee=l(this.doc,r),fe=0;fe<n;++fe){var ge=Jr(this,ee,"div");if(J==null?J=ge.left:ge.left=J,ee=Rs(this,ge,Q,L),ee.hitSide)break}return ee},moveV:Sr(function(r,n){var L=this,H=this.doc,Q=[],J=!this.display.shift&&!H.extend&&H.sel.somethingSelected();if(H.extendSelectionsBy(function(fe){if(J)return r<0?fe.from():fe.to();var ge=Jr(L,fe.head,"div");fe.goalColumn!=null&&(ge.left=fe.goalColumn),Q.push(ge.left);var ke=Rs(L,ge,r,n);return n=="page"&&fe==H.sel.primary()&&_a(L,va(L,ke,"div").top-ge.top),ke},Te),Q.length)for(var ee=0;ee<H.sel.ranges.length;ee++)H.sel.ranges[ee].goalColumn=Q[ee]}),findWordAt:function(r){var n=this.doc,L=ft(n,r.line).text,H=r.ch,Q=r.ch;if(L){var J=this.getHelper(r,"wordChars");(r.sticky=="before"||Q==L.length)&&H?--H:++Q;for(var ee=L.charAt(H),fe=Ne(ee,J)?function(ge){return Ne(ge,J)}:/\s/.test(ee)?function(ge){return/\s/.test(ge)}:function(ge){return!/\s/.test(ge)&&!Ne(ge)};H>0&&fe(L.charAt(H-1));)--H;for(;Q<L.length&&fe(L.charAt(Q));)++Q}return new jt(Xe(r.line,H),Xe(r.line,Q))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?B(this.display.cursorDiv,"CodeMirror-overwrite"):g(this.display.cursorDiv,"CodeMirror-overwrite"),Ie(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==R()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Sr(function(r,n){bn(this,r,n)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-ni(this)-this.display.barHeight,width:r.scrollWidth-ni(this)-this.display.barWidth,clientHeight:pa(this),clientWidth:Ii(this)}},scrollIntoView:Sr(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:Xe(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):Co(this,r.from,r.to,r.margin)}),setSize:Sr(function(r,n){var L=this,H=function(J){return typeof J=="number"||/^\d+$/.test(String(J))?J+"px":J};r!=null&&(this.display.wrapper.style.width=H(r)),n!=null&&(this.display.wrapper.style.height=H(n)),this.options.lineWrapping&&lo(this);var Q=this.display.viewFrom;this.doc.iter(Q,this.display.viewTo,function(J){if(J.widgets){for(var ee=0;ee<J.widgets.length;ee++)if(J.widgets[ee].noHScroll){Si(L,Q,"widget");break}}++Q}),this.curOp.forceUpdate=!0,Ie(this,"refresh",this)}),operation:function(r){return Nr(this,r)},startOperation:function(){return Wi(this)},endOperation:function(){return Hi(this)},refresh:Sr(function(){var r=this.display.cachedTextHeight;Lr(this),this.curOp.forceUpdate=!0,vn(this),bn(this,this.doc.scrollLeft,this.doc.scrollTop),ka(this.display),(r==null||Math.abs(r-Qi(this.display))>.5||this.options.lineWrapping)&&Ca(this),Ie(this,"refresh",this)}),swapDoc:Sr(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),Bo(this,r),vn(this),this.display.input.reset(),bn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Vt(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}},ye(e),e.registerHelper=function(r,n,L){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=L},e.registerGlobalHelper=function(r,n,L,H){e.registerHelper(r,n,H),i[r]._global.push({pred:L,val:H})}}function Xa(e,t,i,r,n){var L=t,H=i,Q=ft(e,t.line),J=n&&e.direction=="rtl"?-i:i;function ee(){var ht=t.line+J;return ht<e.first||ht>=e.first+e.size?!1:(t=new Xe(ht,t.ch,t.sticky),Q=ft(e,ht))}function fe(ht){var rt;if(r=="codepoint"){var dt=Q.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(dt)?rt=null:rt=new Xe(t.line,Math.max(0,Math.min(Q.text.length,t.ch+i*(dt>=55296&&dt<56320?2:1))),-i)}else n?rt=Ml(e.cm,Q,t,i):rt=ja(Q,t,i);if(rt==null)if(!ht&&ee())t=Wa(n,e.cm,Q,t.line,J);else return!1;else t=rt;return!0}if(r=="char"||r=="codepoint")fe();else if(r=="column")fe(!0);else if(r=="word"||r=="group")for(var ge=null,ke=r=="group",Ae=e.cm&&e.cm.getHelper(t,"wordChars"),je=!0;!(i<0&&!fe(!je));je=!1){var Ve=Q.text.charAt(t.ch)||`
`,Qe=Ne(Ve,Ae)?"w":ke&&Ve==`
`?"n":!ke||/\s/.test(Ve)?null:"p";if(ke&&!je&&!Qe&&(Qe="s"),ge&&ge!=Qe){i<0&&(i=1,fe(),t.sticky="after");break}if(Qe&&(ge=Qe),i>0&&!fe(!je))break}var tt=ea(e,t,L,H,!0);return ei(L,tt)&&(tt.hitSide=!0),tt}function Rs(e,t,i,r){var n=e.doc,L=t.left,H;if(r=="page"){var Q=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),J=Math.max(Q-.5*Qi(e.display),3);H=(i>0?t.bottom:t.top)+i*J}else r=="line"&&(H=i>0?t.bottom+3:t.top-3);for(var ee;!(ee=ba(e,L,H),!ee.outside);){if(i<0?H<=0:H>=n.height){ee.hitSide=!0;break}H+=i*5}return ee}var Gt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new q,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;Ds(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function L(Q){for(var J=Q.target;J;J=J.parentNode){if(J==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(J.className))break}return!1}Re(n,"paste",function(Q){if(!L(Q)||He(r,Q)||As(Q,r))return;F<=11&&setTimeout(ur(r,function(){return t.updateFromDOM()}),20)}),Re(n,"compositionstart",function(Q){t.composing={data:Q.data,done:!1}}),Re(n,"compositionupdate",function(Q){t.composing||(t.composing={data:Q.data,done:!1})}),Re(n,"compositionend",function(Q){t.composing&&(Q.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Re(n,"touchstart",function(){return i.forceCompositionEnd()}),Re(n,"input",function(){t.composing||t.readFromDOMSoon()});function H(Q){if(!L(Q)||He(r,Q))return;if(r.somethingSelected())oa({lineWise:!1,text:r.getSelections()}),Q.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var J=Ls(r);oa({lineWise:!0,text:J.text}),Q.type=="cut"&&r.operation(function(){r.setSelections(J.ranges,0,be),r.replaceSelection("",null,"cut")})}else return;if(Q.clipboardData){Q.clipboardData.clearData();var ee=qr.text.join(`
`);if(Q.clipboardData.setData("Text",ee),Q.clipboardData.getData("Text")==ee){Q.preventDefault();return}}var fe=ks(),ge=fe.firstChild;r.display.lineSpace.insertBefore(fe,r.display.lineSpace.firstChild),ge.value=qr.text.join(`
`);var ke=document.activeElement;K(ge),setTimeout(function(){r.display.lineSpace.removeChild(fe),ke.focus(),ke==n&&i.showPrimarySelection()},50)}Re(n,"copy",H),Re(n,"cut",H)},Gt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Gt.prototype.prepareSelection=function(){var e=yo(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 L=sa(t,e.anchorNode,e.anchorOffset),H=sa(t,e.focusNode,e.focusOffset);if(L&&!L.bad&&H&&!H.bad&&St(ki(L,H),r)==0&&St(di(L,H),n)==0)return;var Q=t.display.view,J=r.line>=t.display.viewFrom&&Os(t,r)||{node:Q[0].measure.map[2],offset:0},ee=n.line<t.display.viewTo&&Os(t,n);if(!ee){var fe=Q[Q.length-1].measure,ge=fe.maps?fe.maps[fe.maps.length-1]:fe.map;ee={node:ge[ge.length-1],offset:ge[ge.length-2]-ge[ge.length-3]}}if(!J||!ee){e.removeAllRanges();return}var ke=e.rangeCount&&e.getRangeAt(0),Ae;try{Ae=x(J.node,J.offset,ee.offset,ee.node)}catch(je){}Ae&&(!k&&t.state.focused?(e.collapse(J.node,J.offset),Ae.collapsed||(e.removeAllRanges(),e.addRange(Ae))):(e.removeAllRanges(),e.addRange(Ae)),ke&&e.anchorNode==null?e.addRange(ke):k&&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){h(this.cm.display.cursorDiv,e.cursors),h(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 v(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():Nr(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&&f&&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=sa(t,e.anchorNode,e.anchorOffset),r=sa(t,e.focusNode,e.focusOffset);i&&r&&Nr(t,function(){xr(t.doc,Ti(i,r),be),(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=Xe(r.line-1,ft(e.doc,r.line-1).length)),n.ch==ft(e.doc,n.line).text.length&&n.line<e.lastLine()&&(n=Xe(n.line+1,0)),r.line<t.viewFrom||n.line>t.viewTo-1)return!1;var L,H,Q;r.line==t.viewFrom||(L=Ui(e,r.line))==0?(H=Ot(t.view[0].line),Q=t.view[0].node):(H=Ot(t.view[L].line),Q=t.view[L-1].node.nextSibling);var J=Ui(e,n.line),ee,fe;if(J==t.view.length-1?(ee=t.viewTo-1,fe=t.lineDiv.lastChild):(ee=Ot(t.view[J+1].line)-1,fe=t.view[J+1].node.previousSibling),!Q)return!1;for(var ge=e.doc.splitLines(tu(e,Q,fe,H,ee)),ke=Ur(e.doc,Xe(H,0),Xe(ee,ft(e.doc,ee).text.length));ge.length>1&&ke.length>1;)if(te(ge)==te(ke))ge.pop(),ke.pop(),ee--;else if(ge[0]==ke[0])ge.shift(),ke.shift(),H++;else break;for(var Ae=0,je=0,Ve=ge[0],Qe=ke[0],tt=Math.min(Ve.length,Qe.length);Ae<tt&&Ve.charCodeAt(Ae)==Qe.charCodeAt(Ae);)++Ae;for(var ht=te(ge),rt=te(ke),dt=Math.min(ht.length-(ge.length==1?Ae:0),rt.length-(ke.length==1?Ae:0));je<dt&&ht.charCodeAt(ht.length-je-1)==rt.charCodeAt(rt.length-je-1);)++je;if(ge.length==1&&ke.length==1&&H==r.line)for(;Ae&&Ae>r.ch&&ht.charCodeAt(ht.length-je-1)==rt.charCodeAt(rt.length-je-1);)Ae--,je++;ge[ge.length-1]=ht.slice(0,ht.length-je).replace(/^\u200b+/,""),ge[0]=ge[0].slice(Ae).replace(/\u200b+$/,"");var Et=Xe(H,Ae),vt=Xe(ee,ke.length?te(ke).length-je:0);if(ge.length>1||ge[0]||St(Et,vt))return an(e.doc,ge,Et,vt,"+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())&&Nr(this.cm,function(){return Lr(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()||ur(this.cm,Va)(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 Os(e,t){var i=ma(e,t.line);if(!i||i.hidden)return null;var r=ft(e.doc,t.line),n=io(i,r,t.line),L=Je(r,e.doc.direction),H="left";if(L){var Q=Ze(L,t.ch);H=Q%2?"right":"left"}var J=oo(n.map,t.ch,H);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 hn(e,t){return t&&(e.bad=!0),e}function tu(e,t,i,r,n){var L="",H=!1,Q=e.doc.lineSeparator(),J=!1;function ee(Ae){return function(je){return je.id==Ae}}function fe(){H&&(L+=Q,J&&(L+=Q),H=J=!1)}function ge(Ae){Ae&&(fe(),L+=Ae)}function ke(Ae){if(Ae.nodeType==1){var je=Ae.getAttribute("cm-text");if(je){ge(je);return}var Ve=Ae.getAttribute("cm-marker"),Qe;if(Ve){var tt=e.findMarks(Xe(r,0),Xe(n+1,0),ee(+Ve));tt.length&&(Qe=tt[0].find(0))&&ge(Ur(e.doc,Qe.from,Qe.to).join(Q));return}if(Ae.getAttribute("contenteditable")=="false")return;var ht=/^(pre|div|p|li|table|br)$/i.test(Ae.nodeName);if(!/^br$/i.test(Ae.nodeName)&&Ae.textContent.length==0)return;ht&&fe();for(var rt=0;rt<Ae.childNodes.length;rt++)ke(Ae.childNodes[rt]);/^(pre|p)$/i.test(Ae.nodeName)&&(J=!0),ht&&(H=!0)}else Ae.nodeType==3&&ge(Ae.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(ke(t),t==i);)t=t.nextSibling,J=!1;return L}function sa(e,t,i){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[i],!r)return hn(e.clipPos(Xe(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 L=e.display.view[n];if(L.node==r)return ru(L,t,i)}}function ru(e,t,i){var r=e.text.firstChild,n=!1;if(!t||!v(r,t))return hn(Xe(Ot(e.line),0),!0);if(t==r&&(n=!0,t=r.childNodes[i],i=0,!t)){var L=e.rest?te(e.rest):e.line;return hn(Xe(Ot(L),L.text.length),n)}var H=t.nodeType==3?t:null,Q=t;for(!H&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(H=t.firstChild,i&&(i=H.nodeValue.length));Q.parentNode!=r;)Q=Q.parentNode;var J=e.measure,ee=J.maps;function fe(Qe,tt,ht){for(var rt=-1;rt<(ee?ee.length:0);rt++)for(var dt=rt<0?J.map:ee[rt],Et=0;Et<dt.length;Et+=3){var vt=dt[Et+2];if(vt==Qe||vt==tt){var _t=Ot(rt<0?e.line:e.rest[rt]),Yt=dt[Et]+ht;return(ht<0||vt!=Qe)&&(Yt=dt[Et+(ht?1:0)]),Xe(_t,Yt)}}}var ge=fe(H,Q,i);if(ge)return hn(ge,n);for(var ke=Q.nextSibling,Ae=H?H.nodeValue.length-i:0;ke;ke=ke.nextSibling){if(ge=fe(ke,ke.firstChild,0),ge)return hn(Xe(ge.line,ge.ch-Ae),n);Ae+=ke.textContent.length}for(var je=Q.previousSibling,Ve=i;je;je=je.previousSibling){if(ge=fe(je,je.firstChild,-1),ge)return hn(Xe(ge.line,ge.ch+Ve),n);Ve+=je.textContent.length}}var er=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new q,this.hasSelection=!1,this.composing=null};er.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),T&&(n.style.width="0px"),Re(n,"input",function(){W&&F>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),Re(n,"paste",function(H){if(He(r,H)||As(H,r))return;r.state.pasteIncoming=+new Date,i.fastPoll()});function L(H){if(He(r,H))return;if(r.somethingSelected())oa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var Q=Ls(r);oa({lineWise:!0,text:Q.text}),H.type=="cut"?r.setSelections(Q.ranges,null,be):(i.prevInput="",n.value=Q.text.join(`
`),K(n))}else return;H.type=="cut"&&(r.state.cutIncoming=+new Date)}Re(n,"cut",L),Re(n,"copy",L),Re(e.scroller,"paste",function(H){if(fi(e,H)||He(r,H))return;if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var Q=new Event("paste");Q.clipboardData=H.clipboardData,n.dispatchEvent(Q)}),Re(e.lineSpace,"selectstart",function(H){fi(e,H)||re(H)}),Re(n,"compositionstart",function(){var H=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:H,range:r.markText(H,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Re(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},er.prototype.createField=function(e){this.wrapper=ks(),this.textarea=this.wrapper.firstChild},er.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},er.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=yo(e);if(e.options.moveInputWithCursor){var n=Jr(e,i.sel.primary().head,"div"),L=t.wrapper.getBoundingClientRect(),H=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+H.top-L.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+H.left-L.left))}return r},er.prototype.showSelection=function(e){var t=this.cm,i=t.display;h(i.cursorDiv,e.cursors),h(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},er.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&&K(this.textarea),W&&F>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",W&&F>=9&&(this.hasSelection=null))},er.prototype.getField=function(){return this.textarea},er.prototype.supportsTouch=function(){return!1},er.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!a||R()!=this.textarea))try{this.textarea.focus()}catch(e){}},er.prototype.blur=function(){this.textarea.blur()},er.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},er.prototype.receivedFocus=function(){this.slowPoll()},er.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()})},er.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)},er.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||ot(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(W&&F>=9&&this.hasSelection===n||s&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var L=n.charCodeAt(0);if(L==8203&&!r&&(r="\u200B"),L==8666)return this.reset(),this.cm.execCommand("undo")}for(var H=0,Q=Math.min(r.length,n.length);H<Q&&r.charCodeAt(H)==n.charCodeAt(H);)++H;return Nr(t,function(){Va(t,n.slice(H),r.length-H,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},er.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},er.prototype.onKeyPress=function(){W&&F>=9&&(this.hasSelection=null),this.fastPoll()},er.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var L=Bi(i,e),H=r.scroller.scrollTop;if(!L||b)return;var Q=i.options.resetSelectionOnContextMenu;Q&&i.doc.sel.contains(L)==-1&&ur(i,xr)(i.doc,Ti(L),be);var J=n.style.cssText,ee=t.wrapper.style.cssText,fe=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-fe.top-5)+"px; left: "+(e.clientX-fe.left-5)+`px;
z-index: 1000; background: `+(W?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ge;P&&(ge=window.scrollY),r.input.focus(),P&&window.scrollTo(null,ge),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=Ae,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function ke(){if(n.selectionStart!=null){var Ve=i.somethingSelected(),Qe="\u200B"+(Ve?n.value:"");n.value="\u21DA",n.value=Qe,t.prevInput=Ve?"":"\u200B",n.selectionStart=1,n.selectionEnd=Qe.length,r.selForContextMenu=i.doc.sel}}function Ae(){if(t.contextMenuPending!=Ae)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=ee,n.style.cssText=J,W&&F<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=H),n.selectionStart!=null){(!W||W&&F<9)&&ke();var Ve=0,Qe=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?ur(i,Qo)(i):Ve++<10?r.detectingSelectAll=setTimeout(Qe,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Qe,200)}}if(W&&F>=9&&ke(),D){de(e);var je=function(){qe(window,"mouseup",je),setTimeout(Ae,20)};Re(window,"mouseup",je)}else setTimeout(Ae,50)},er.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},er.prototype.setUneditable=function(){},er.prototype.needsContentAttribute=!1;function iu(e,t){if(t=t?N(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=R();t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=Q.getValue()}var n;if(e.form&&(Re(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var L=e.form;n=L.submit;try{var H=L.submit=function(){r(),L.submit=n,L.submit(),L.submit=H}}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&&(qe(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var Q=$t(function(J){return e.parentNode.insertBefore(J,e.nextSibling)},t);return Q}function nu(e){e.off=qe,e.on=Re,e.wheelEventPixels=dl,e.Doc=Dr,e.splitLines=mt,e.countColumn=Y,e.findColumn=Ee,e.isWordChar=Pe,e.Pass=_e,e.signal=Ie,e.Line=Ei,e.changeEnd=wi,e.scrollbarModel=Ao,e.Pos=Xe,e.cmpPos=St,e.modes=Bt,e.mimeModes=wt,e.resolveMode=gt,e.getMode=Gr,e.modeExtensions=br,e.extendMode=fr,e.copyState=Tr,e.startState=Kr,e.innerMode=si,e.commands=Mn,e.keyMap=pi,e.keyName=cs,e.isModifierKey=hs,e.lookupKey=sn,e.normalizeKeyMap=Pl,e.StringStream=It,e.SharedTextMarker=Rn,e.TextMarker=_i,e.LineWidget=kn,e.e_preventDefault=re,e.e_stopPropagation=oe,e.e_stop=de,e.addClass=B,e.contains=v,e.rmClass=g,e.keyNames=Li}$l($t),ql($t);var au="iter insert remove copy getEditor constructor".split(" ");for(var la in Dr.prototype)Dr.prototype.hasOwnProperty(la)&&ae(au,la)<0&&($t.prototype[la]=function(e){return function(){return e.apply(this.doc,arguments)}}(Dr.prototype[la]));return ye(Dr),$t.inputStyles={textarea:er,contenteditable:Gt},$t.defineMode=function(e){!$t.defaults.mode&&e!="null"&&($t.defaults.mode=e),yr.apply(this,arguments)},$t.defineMIME=ir,$t.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),$t.defineMIME("text/plain","null"),$t.defineExtension=function(e,t){$t.prototype[e]=t},$t.defineDocExtension=function(e,t){Dr.prototype[e]=t},$t.fromTextArea=iu,nu($t),$t.version="5.58.2",$t})},Y1PL:function(lt,$e,ie){"use strict";ie.r($e),ie.d($e,"ResizableTextArea",function(){return ae});var ne=ie("wx14"),$=ie("1OyB"),k=ie("vuIU"),X=ie("Ji7U"),U=ie("LK+K"),O=ie("q1tI"),W=ie("VTBJ"),F=ie("rePB"),P=ie("Zm9Q"),w=ie("Kwbf"),f=ie("c+Xe"),b=ie("m+aA"),M=ie("bdgK"),A=new Map;function S(be){be.forEach(function(Ce){var Te,Ee=Ce.target;(Te=A.get(Ee))===null||Te===void 0||Te.forEach(function(me){return me(Ee)})})}var T=new M.default(S),d=null,a=null;function s(be,Ce){A.has(be)||(A.set(be,new Set),T.observe(be)),A.get(be).add(Ce)}function u(be,Ce){A.has(be)&&(A.get(be).delete(Ce),A.get(be).size||(T.unobserve(be),A.delete(be)))}var _=function(be){Object(X.a)(Te,be);var Ce=Object(U.a)(Te);function Te(){return Object($.a)(this,Te),Ce.apply(this,arguments)}return Object(k.a)(Te,[{key:"render",value:function(){return this.props.children}}]),Te}(O.Component),m=O.createContext(null);function p(be){var Ce=be.children,Te=be.onBatchResize,Ee=O.useRef(0),me=O.useRef([]),ue=O.useContext(m),te=O.useCallback(function(ce,se,we){Ee.current+=1;var Le=Ee.current;me.current.push({size:ce,element:se,data:we}),Promise.resolve().then(function(){Le===Ee.current&&(Te==null||Te(me.current),me.current=[])}),ue==null||ue(ce,se,we)},[Te,ue]);return O.createElement(m.Provider,{value:te},Ce)}function D(be){var Ce=be.children,Te=be.disabled,Ee=O.useRef(null),me=O.useRef(null),ue=O.useContext(m),te=O.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ce=O.isValidElement(Ce)&&Object(f.c)(Ce),se=ce?Ce.ref:null,we=O.useMemo(function(){return Object(f.a)(se,Ee)},[se,Ee]),Le=O.useRef(be);Le.current=be;var xe=O.useCallback(function(Pe){var Ne=Le.current,Be=Ne.onResize,We=Ne.data,Ue=Pe.getBoundingClientRect(),Fe=Ue.width,at=Ue.height,it=Pe.offsetWidth,et=Pe.offsetHeight,Ze=Math.floor(Fe),ut=Math.floor(at);if(te.current.width!==Ze||te.current.height!==ut||te.current.offsetWidth!==it||te.current.offsetHeight!==et){var Je={width:Ze,height:ut,offsetWidth:it,offsetHeight:et};te.current=Je;var st=it===Math.round(Fe)?Fe:it,Re=et===Math.round(at)?at:et,nt=Object(W.a)(Object(W.a)({},Je),{},{offsetWidth:st,offsetHeight:Re});ue==null||ue(nt,Pe,We),Be&&Promise.resolve().then(function(){Be(nt,Pe)})}},[]);return O.useEffect(function(){var Pe=Object(b.a)(Ee.current)||Object(b.a)(me.current);return Pe&&!Te&&s(Pe,xe),function(){return u(Pe,xe)}},[Ee.current,Te]),O.createElement(_,{ref:me},ce?O.cloneElement(Ce,{ref:we}):Ce)}var E="rc-observer-key";function g(be){var Ce=be.children,Te=Object(P.a)(Ce);return Te.map(function(Ee,me){var ue=(Ee==null?void 0:Ee.key)||"".concat(E,"-").concat(me);return O.createElement(D,Object(ne.a)({},be,{key:ue}),Ee)})}g.Collection=p;var c=g,h=ie("bT9E"),o=ie("TSYQ"),C=ie.n(o),x=`
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
`,v=["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"],R={},B;function j(be){var Ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Te=be.getAttribute("id")||be.getAttribute("data-reactid")||be.getAttribute("name");if(Ce&&R[Te])return R[Te];var Ee=window.getComputedStyle(be),me=Ee.getPropertyValue("box-sizing")||Ee.getPropertyValue("-moz-box-sizing")||Ee.getPropertyValue("-webkit-box-sizing"),ue=parseFloat(Ee.getPropertyValue("padding-bottom"))+parseFloat(Ee.getPropertyValue("padding-top")),te=parseFloat(Ee.getPropertyValue("border-bottom-width"))+parseFloat(Ee.getPropertyValue("border-top-width")),ce=v.map(function(we){return"".concat(we,":").concat(Ee.getPropertyValue(we))}).join(";"),se={sizingStyle:ce,paddingSize:ue,borderSize:te,boxSizing:me};return Ce&&Te&&(R[Te]=se),se}function K(be){var Ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Ee=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;B||(B=document.createElement("textarea"),B.setAttribute("tab-index","-1"),B.setAttribute("aria-hidden","true"),document.body.appendChild(B)),be.getAttribute("wrap")?B.setAttribute("wrap",be.getAttribute("wrap")):B.removeAttribute("wrap");var me=j(be,Ce),ue=me.paddingSize,te=me.borderSize,ce=me.boxSizing,se=me.sizingStyle;B.setAttribute("style","".concat(se,";").concat(x)),B.value=be.value||be.placeholder||"";var we=Number.MIN_SAFE_INTEGER,Le=Number.MAX_SAFE_INTEGER,xe=B.scrollHeight,Pe;if(ce==="border-box"?xe+=te:ce==="content-box"&&(xe-=ue),Te!==null||Ee!==null){B.value=" ";var Ne=B.scrollHeight-ue;Te!==null&&(we=Ne*Te,ce==="border-box"&&(we=we+ue+te),xe=Math.max(we,xe)),Ee!==null&&(Le=Ne*Ee,ce==="border-box"&&(Le=Le+ue+te),Pe=xe>Le?"":"hidden",xe=Math.min(Le,xe))}return{height:xe,minHeight:we,maxHeight:Le,overflowY:Pe,resize:"none"}}var I=ie("Gytx"),N=ie.n(I),Y;(function(be){be[be.NONE=0]="NONE",be[be.RESIZING=1]="RESIZING",be[be.RESIZED=2]="RESIZED"})(Y||(Y={}));var q=function(be){Object(X.a)(Te,be);var Ce=Object(U.a)(Te);function Te(Ee){var me;return Object($.a)(this,Te),me=Ce.call(this,Ee),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,ce=me.props,se=ce.autoSize,we=ce.onResize;if(te!==Y.NONE)return;typeof we=="function"&&we(ue),se&&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,ce=ue.maxRows,se=K(me.textArea,!1,te,ce);me.setState({textareaStyles:se,resizeStatus:Y.RESIZING},function(){cancelAnimationFrame(me.resizeFrameId),me.resizeFrameId=requestAnimationFrame(function(){me.setState({resizeStatus:Y.RESIZED},function(){me.resizeFrameId=requestAnimationFrame(function(){me.setState({resizeStatus:Y.NONE}),me.fixFirefoxAutoScroll()})})})})},me.renderTextArea=function(){var ue=me.props,te=ue.prefixCls,ce=te===void 0?"rc-textarea":te,se=ue.autoSize,we=ue.onResize,Le=ue.className,xe=ue.disabled,Pe=me.state,Ne=Pe.textareaStyles,Be=Pe.resizeStatus,We=Object(h.a)(me.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ue=C()(ce,Le,Object(F.a)({},"".concat(ce,"-disabled"),xe));"value"in We&&(We.value=We.value||"");var Fe=Object(W.a)(Object(W.a)(Object(W.a)({},me.props.style),Ne),Be===Y.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return O.createElement(c,{onResize:me.handleResize,disabled:!(se||we)},O.createElement("textarea",Object(ne.a)({},We,{className:Ue,style:Fe,ref:me.saveTextArea})))},me.state={textareaStyles:{},resizeStatus:Y.NONE},me}return Object(k.a)(Te,[{key:"componentDidUpdate",value:function(me){(me.value!==this.props.value||!N()(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()}}]),Te}(O.Component),ae=q,he=function(be){Object(X.a)(Te,be);var Ce=Object(U.a)(Te);function Te(Ee){var me;Object($.a)(this,Te),me=Ce.call(this,Ee),me.resizableTextArea=void 0,me.focus=function(){me.resizableTextArea.textArea.focus()},me.saveTextArea=function(te){me.resizableTextArea=te},me.handleChange=function(te){var ce=me.props.onChange;me.setValue(te.target.value,function(){me.resizableTextArea.resizeTextarea()}),ce&&ce(te)},me.handleKeyDown=function(te){var ce=me.props,se=ce.onPressEnter,we=ce.onKeyDown;te.keyCode===13&&se&&se(te),we&&we(te)};var ue=typeof Ee.value=="undefined"||Ee.value===null?Ee.defaultValue:Ee.value;return me.state={value:ue},me}return Object(k.a)(Te,[{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 O.createElement(ae,Object(ne.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}}]),Te}(O.Component),_e=$e.default=he},ZW9T:function(lt,$e,ie){"use strict";ie.d($e,"a",function(){return _});var ne=ie("k1fw"),$=ie("miYZ"),k=ie("tsqr"),X=ie("rAM+"),U=ie("tJVT"),O=ie("PpiC"),W=ie("q1tI"),F=ie.n(W),P=ie("bdgK");function w(m,p,D,E,g){var c=p.getWordUntilPosition(D),h={startLineNumber:D.lineNumber,endLineNumber:D.lineNumber,startColumn:c.startColumn,endColumn:c.endColumn},o=E.map(function(C){return{label:C,kind:m.languages.CompletionItemKind.Keyword,insertText:C,insertTextRules:m.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:h}});return g.map(function(C){o.push(Object(ne.a)(Object(ne.a)({},C),{},{range:h}))}),o}var f=function(m){var p={label:"ifelse",kind:m.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`),insertTextRules:m.languages.CompletionItemInsertTextRule.InsertAsSnippet},D=["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"];m.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(h,o){var C=w(m,h,o,D,[p]);return{suggestions:C}}});var E=["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"];m.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(h,o){var C=[{label:"print",kind:m.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
`),insertTextRules:m.languages.CompletionItemInsertTextRule.InsertAsSnippet}],x=w(m,h,o,E,C);return{suggestions:x}}});var g=["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"];m.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(h,o){var C=[p,{label:"main",kind:m.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
`),insertTextRules:m.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:m.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
`),insertTextRules:m.languages.CompletionItemInsertTextRule.InsertAsSnippet}],x=w(m,h,o,g,C);return{suggestions:x}}})},b="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",M=ie("LvDl");function A(m){return/^\d+$/.test(m)?"".concat(m,"px"):m}function S(){}var T=!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 a(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],p=m;if(Array.isArray(m)){for(var D=0;D<m.length;D++){var E=d[m[D]];if(E)return E}return p[0]}return d[p]||p}var s=null,u=$e.b=function(m){var p=m.width,D=p===void 0?"100%":p,E=m.height,g=E===void 0?"100%":E,c=m.value,h=m.language,o=h===void 0?"javascript":h,C=m.style,x=C===void 0?{}:C,v=m.options,R=v===void 0?{}:v,B=m.overrideServices,j=B===void 0?{}:B,K=m.theme,I=K===void 0?"vs-dark":K,N=m.onEditBlur,Y=m.onSave,q=m.autoHeight,ae=q===void 0?!1:q,he=m.forbidCopy,_e=he===void 0?!1:he,be=m.onChange,Ce=be===void 0?S:be,Te=m.editorDidMount,Ee=Te===void 0?S:Te,me=m.onFocus,ue=me===void 0?S:me,te=m.filename,ce=te===void 0?"educoder.txt":te,se=Object(O.a)(m,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),we=Object(W.useRef)(),Le=Object(W.useRef)({}),xe=Object(W.useRef)(),Pe=Object(W.useRef)(!1),Ne=Object(W.useRef)(),Be=Object(W.useState)(!1),We=Object(U.a)(Be,2),Ue=We[0],Fe=We[1];function at(){var le;return we.current&&(le=new P.default(function(de){var De=Object(X.a)(de),Me;try{for(De.s();!(Me=De.n()).done;){var Ye=Me.value;(Ye.target.offsetHeight>0||Ye.target.offsetWidth>0)&&Le.current.instance.layout()}}catch(yt){De.e(yt)}finally{De.f()}}),le.observe(we.current)),le}function it(){k.b.warn(decodeURIComponent(b))}var et=function(){var de=Le.current.instance;if(c!=null&&de&&Ue){var De=de.getModel();De&&c!==De.getValue()&&(T=!0,De.setValue(c),de.layout(),T=!1)}};Object(W.useEffect)(function(){xe.current&&clearTimeout(xe.current),xe.current=setTimeout(function(){et()},500)},[c,Ue,Le.current]);function Ze(){var le=Le.current.instance;if(le){var de=le.getSelection(),De=Le.current.pastePos||{},Me=new s.Range(De.startLineNumber||de.endLineNumber,De.startColumn||de.endColumn,De.endLineNumber||de.endLineNumber,De.endColumn||de.endColumn);setTimeout(function(){le.executeEdits("",[{range:Me,text:""}])},300)}}function ut(le){(window.navigator.platform.match("Mac")?le.metaKey:le.ctrlKey)&&le.keyCode==83&&(le.preventDefault(),Y())}var Je=function(){if(ae&&Le.current.instance){var de=Le.current.instance.getContentHeight();re(de<g?g:de)}else re(g)};function st(le){var de=document.createEvent("MouseEvents");de.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),le.dispatchEvent(de)}function Re(le,de){var De=window.URL||window.webkitURL||window,Me=new Blob([de]),Ye=document.createElementNS("http://www.w3.org/1999/xhtml","a");Ye.href=De.createObjectURL(Me),Ye.download=le,st(Ye)}Object(W.useEffect)(function(){Je()},[Je]),Object(W.useEffect)(function(){we.current&&!Ue&&ie.e(27).then(ie.t.bind(null,"M/lh",7)).then(function(le){try{s=le,Le.current.instance=s.editor.create(we.current,{value:c,language:a(o),theme:I,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},j);var de=Le.current.instance;if(Ee(de,s),setTimeout(function(){Je(),Le.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Re(ce||"educoder.txt",de.getValue())}})},500),Le.current.subscription=de.onDidChangeModelContent(function(Me){Pe.current?clearTimeout(Ne.current):(Je(),Ce(de.getValue(),Me)),Ne.current=setTimeout(function(){Pe.current=!1},500)}),window.Monaco||f(s),_e&&(de.addCommand(s.KeyMod.CtrlCmd|s.KeyMod.Shift|s.KeyCode.KEY_V,function(){return it(),null}),de.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_C,function(){return it(),null})),window.Monaco=s,N&&de.onDidBlurEditorWidget(function(){N(de.getValue())}),ue&&de.onDidFocusEditorText(function(){ue(de.getValue())}),_e){de.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_V,function(){return it(),null}),de.onDidPaste(function(Me){Le.current.pastePos=Me});try{window.addEventListener("paste",Ze)}catch(Me){}}var De=at();return Fe(!0),function(){var Me=Le.current.instance;Me.dispose();var Ye=Me.getModel();Ye&&Ye.dispose(),Le.current.subscription&&Le.current.subscription.dispose(),_e&&window.removeEventListener("paste",Ze),De.unobserve(we.current)}}catch(Me){}})},[]),Object(W.useEffect)(function(){var le=Le.current.instance;if(le&&Ue)return document.addEventListener("keydown",ut,!1),function(){document.removeEventListener("keydown",ut)}},[Y,Ue]),Object(W.useEffect)(function(){var le=Le.current.instance;if(le&&Ue){var de=a(o);s.editor.setModelLanguage(le.getModel(),de),console.log("language:",o,le.getModel(),de)}},[o,Ue]),Object(W.useEffect)(function(){var le=Le.current.instance;le&&Ue&&s.editor.setTheme(I)},[I,Ue]),Object(W.useEffect)(function(){var le=Le.current.instance;le&&Ue&&(le.updateOptions(Object(ne.a)({},R)),setTimeout(function(){le.getModel().updateOptions(Object(ne.a)({},R))},200))},[JSON.stringify(R),Ue]),Object(W.useEffect)(function(){var le=Le.current.instance;le&&Ue&&le.layout()},[D,g,Ue]);var nt=Object(W.useState)(A(D)),qe=Object(U.a)(nt,2),Ie=qe[0],He=qe[1],Se=Object(W.useState)(A(g)),pe=Object(U.a)(Se,2),ye=pe[0],re=pe[1],oe=Object(ne.a)(Object(ne.a)({},x),{},{width:Ie,height:ye});return F.a.createElement("div",{className:"my-monaco-editor",ref:we,style:oe})};function _(m){var p=m.width,D=p===void 0?"100%":p,E=m.height,g=E===void 0?"100%":E,c=m.original,h=m.modified,o=m.language,C=m.options,x=C===void 0?{}:C,v=Object(W.useRef)(),R=Object(W.useState)(null),B=Object(U.a)(R,2),j=B[0],K=B[1];function I(ae){var he;return v.current&&(he=new P.default(function(_e){var be=Object(X.a)(_e),Ce;try{for(be.s();!(Ce=be.n()).done;){var Te=Ce.value;(Te.target.offsetHeight>0||Te.target.offsetWidth>0)&&ae.layout()}}catch(Ee){be.e(Ee)}finally{be.f()}}),he.observe(v.current)),he}Object(W.useEffect)(function(){v.current&&ie.e(27).then(ie.t.bind(null,"M/lh",7)).then(function(ae){s=ae;var he=s.editor.createDiffEditor(v.current,Object(ne.a)(Object(ne.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},x),{},{wordWrap:!0}));K(he);var _e=I(he);return function(){he.dispose();var be=he.getModel();be&&be.dispose(),_e.unobserve(v.current)}})},[]),Object(W.useEffect)(function(){j&&j.setModel({original:s.editor.createModel(c,o),modified:s.editor.createModel(h,o)})},[c,h,o,j]);var N=A(D),Y=A(g),q={width:N,height:Y};return F.a.createElement("div",{className:"my-diff-editor",ref:v,style:q})}},ZpRC:function(lt,$e,ie){"use strict";function ne(f){return typeof f=="object"&&f!=null&&f.nodeType===1}function $(f,b){return(!b||f!=="hidden")&&f!=="visible"&&f!=="clip"}function k(f,b){if(f.clientHeight<f.scrollHeight||f.clientWidth<f.scrollWidth){var M=getComputedStyle(f,null);return $(M.overflowY,b)||$(M.overflowX,b)||function(A){var S=function(T){if(!T.ownerDocument||!T.ownerDocument.defaultView)return null;try{return T.ownerDocument.defaultView.frameElement}catch(d){return null}}(A);return!!S&&(S.clientHeight<A.scrollHeight||S.clientWidth<A.scrollWidth)}(f)}return!1}function X(f,b,M,A,S,T,d,a){return T<f&&d>b||T>f&&d<b?0:T<=f&&a<=M||d>=b&&a>=M?T-f-A:d>b&&a<M||T<f&&a>M?d-b+S:0}var U=function(f,b){var M=window,A=b.scrollMode,S=b.block,T=b.inline,d=b.boundary,a=b.skipOverflowHiddenElements,s=typeof d=="function"?d:function(Ne){return Ne!==d};if(!ne(f))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,_=[],m=f;ne(m)&&s(m);){if((m=m.parentElement)===u){_.push(m);break}m!=null&&m===document.body&&k(m)&&!k(document.documentElement)||m!=null&&k(m,a)&&_.push(m)}for(var p=M.visualViewport?M.visualViewport.width:innerWidth,D=M.visualViewport?M.visualViewport.height:innerHeight,E=window.scrollX||pageXOffset,g=window.scrollY||pageYOffset,c=f.getBoundingClientRect(),h=c.height,o=c.width,C=c.top,x=c.right,v=c.bottom,R=c.left,B=S==="start"||S==="nearest"?C:S==="end"?v:C+h/2,j=T==="center"?R+o/2:T==="end"?x:R,K=[],I=0;I<_.length;I++){var N=_[I],Y=N.getBoundingClientRect(),q=Y.height,ae=Y.width,he=Y.top,_e=Y.right,be=Y.bottom,Ce=Y.left;if(A==="if-needed"&&C>=0&&R>=0&&v<=D&&x<=p&&C>=he&&v<=be&&R>=Ce&&x<=_e)return K;var Te=getComputedStyle(N),Ee=parseInt(Te.borderLeftWidth,10),me=parseInt(Te.borderTopWidth,10),ue=parseInt(Te.borderRightWidth,10),te=parseInt(Te.borderBottomWidth,10),ce=0,se=0,we="offsetWidth"in N?N.offsetWidth-N.clientWidth-Ee-ue:0,Le="offsetHeight"in N?N.offsetHeight-N.clientHeight-me-te:0;if(u===N)ce=S==="start"?B:S==="end"?B-D:S==="nearest"?X(g,g+D,D,me,te,g+B,g+B+h,h):B-D/2,se=T==="start"?j:T==="center"?j-p/2:T==="end"?j-p:X(E,E+p,p,Ee,ue,E+j,E+j+o,o),ce=Math.max(0,ce+g),se=Math.max(0,se+E);else{ce=S==="start"?B-he-me:S==="end"?B-be+te+Le:S==="nearest"?X(he,be,q,me,te+Le,B,B+h,h):B-(he+q/2)+Le/2,se=T==="start"?j-Ce-Ee:T==="center"?j-(Ce+ae/2)+we/2:T==="end"?j-_e+ue+we:X(Ce,_e,ae,Ee,ue+we,j,j+o,o);var xe=N.scrollLeft,Pe=N.scrollTop;B+=Pe-(ce=Math.max(0,Math.min(Pe+ce,N.scrollHeight-q+Le))),j+=xe-(se=Math.max(0,Math.min(xe+se,N.scrollWidth-ae+we)))}K.push({el:N,top:ce,left:se})}return K};function O(f){return f===Object(f)&&Object.keys(f).length!==0}function W(f,b){b===void 0&&(b="auto");var M="scrollBehavior"in document.body.style;f.forEach(function(A){var S=A.el,T=A.top,d=A.left;S.scroll&&M?S.scroll({top:T,left:d,behavior:b}):(S.scrollTop=T,S.scrollLeft=d)})}function F(f){return f===!1?{block:"end",inline:"nearest"}:O(f)?f:{block:"start",inline:"nearest"}}function P(f,b){var M=!f.ownerDocument.documentElement.contains(f);if(O(b)&&typeof b.behavior=="function")return b.behavior(M?[]:U(f,b));if(M)return;var A=F(b);return W(U(f,A),A.behavior)}var w=$e.a=P},Zss7:function(lt,$e,ie){var ne;(function($){var k=/^\s+/,X=/\s+$/,U=0,O=$.round,W=$.min,F=$.max,P=$.random;function w(te,ce){if(te=te||"",ce=ce||{},te instanceof w)return te;if(!(this instanceof w))return new w(te,ce);var se=f(te);this._originalInput=te,this._r=se.r,this._g=se.g,this._b=se.b,this._a=se.a,this._roundA=O(100*this._a)/100,this._format=ce.format||se.format,this._gradientType=ce.gradientType,this._r<1&&(this._r=O(this._r)),this._g<1&&(this._g=O(this._g)),this._b<1&&(this._b=O(this._b)),this._ok=se.ok,this._tc_id=U++}w.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(),ce,se,we,Le,xe,Pe;return ce=te.r/255,se=te.g/255,we=te.b/255,ce<=.03928?Le=ce/12.92:Le=$.pow((ce+.055)/1.055,2.4),se<=.03928?xe=se/12.92:xe=$.pow((se+.055)/1.055,2.4),we<=.03928?Pe=we/12.92:Pe=$.pow((we+.055)/1.055,2.4),.2126*Le+.7152*xe+.0722*Pe},setAlpha:function(te){return this._a=K(te),this._roundA=O(100*this._a)/100,this},toHsv:function(){var te=S(this._r,this._g,this._b);return{h:te.h*360,s:te.s,v:te.v,a:this._a}},toHsvString:function(){var te=S(this._r,this._g,this._b),ce=O(te.h*360),se=O(te.s*100),we=O(te.v*100);return this._a==1?"hsv("+ce+", "+se+"%, "+we+"%)":"hsva("+ce+", "+se+"%, "+we+"%, "+this._roundA+")"},toHsl:function(){var te=M(this._r,this._g,this._b);return{h:te.h*360,s:te.s,l:te.l,a:this._a}},toHslString:function(){var te=M(this._r,this._g,this._b),ce=O(te.h*360),se=O(te.s*100),we=O(te.l*100);return this._a==1?"hsl("+ce+", "+se+"%, "+we+"%)":"hsla("+ce+", "+se+"%, "+we+"%, "+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 a(this._r,this._g,this._b,this._a,te)},toHex8String:function(te){return"#"+this.toHex8(te)},toRgb:function(){return{r:O(this._r),g:O(this._g),b:O(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+O(this._r)+", "+O(this._g)+", "+O(this._b)+")":"rgba("+O(this._r)+", "+O(this._g)+", "+O(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:O(I(this._r,255)*100)+"%",g:O(I(this._g,255)*100)+"%",b:O(I(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+O(I(this._r,255)*100)+"%, "+O(I(this._g,255)*100)+"%, "+O(I(this._b,255)*100)+"%)":"rgba("+O(I(this._r,255)*100)+"%, "+O(I(this._g,255)*100)+"%, "+O(I(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:B[d(this._r,this._g,this._b,!0)]||!1},toFilter:function(te){var ce="#"+s(this._r,this._g,this._b,this._a),se=ce,we=this._gradientType?"GradientType = 1, ":"";if(te){var Le=w(te);se="#"+s(Le._r,Le._g,Le._b,Le._a)}return"progid:DXImageTransform.Microsoft.gradient("+we+"startColorstr="+ce+",endColorstr="+se+")"},toString:function(te){var ce=!!te;te=te||this._format;var se=!1,we=this._a<1&&this._a>=0,Le=!ce&&we&&(te==="hex"||te==="hex6"||te==="hex3"||te==="hex4"||te==="hex8"||te==="name");return Le?te==="name"&&this._a===0?this.toName():this.toRgbString():(te==="rgb"&&(se=this.toRgbString()),te==="prgb"&&(se=this.toPercentageRgbString()),(te==="hex"||te==="hex6")&&(se=this.toHexString()),te==="hex3"&&(se=this.toHexString(!0)),te==="hex4"&&(se=this.toHex8String(!0)),te==="hex8"&&(se=this.toHex8String()),te==="name"&&(se=this.toName()),te==="hsl"&&(se=this.toHslString()),te==="hsv"&&(se=this.toHsvString()),se||this.toHexString())},clone:function(){return w(this.toString())},_applyModification:function(te,ce){var se=te.apply(null,[this].concat([].slice.call(ce)));return this._r=se._r,this._g=se._g,this._b=se._b,this.setAlpha(se._a),this},lighten:function(){return this._applyModification(p,arguments)},brighten:function(){return this._applyModification(D,arguments)},darken:function(){return this._applyModification(E,arguments)},desaturate:function(){return this._applyModification(u,arguments)},saturate:function(){return this._applyModification(_,arguments)},greyscale:function(){return this._applyModification(m,arguments)},spin:function(){return this._applyModification(g,arguments)},_applyCombination:function(te,ce){return te.apply(null,[this].concat([].slice.call(ce)))},analogous:function(){return this._applyCombination(x,arguments)},complement:function(){return this._applyCombination(c,arguments)},monochromatic:function(){return this._applyCombination(v,arguments)},splitcomplement:function(){return this._applyCombination(C,arguments)},triad:function(){return this._applyCombination(h,arguments)},tetrad:function(){return this._applyCombination(o,arguments)}},w.fromRatio=function(te,ce){if(typeof te=="object"){var se={};for(var we in te)te.hasOwnProperty(we)&&(we==="a"?se[we]=te[we]:se[we]=_e(te[we]));te=se}return w(te,ce)};function f(te){var ce={r:0,g:0,b:0},se=1,we=null,Le=null,xe=null,Pe=!1,Ne=!1;return typeof te=="string"&&(te=me(te)),typeof te=="object"&&(Ee(te.r)&&Ee(te.g)&&Ee(te.b)?(ce=b(te.r,te.g,te.b),Pe=!0,Ne=String(te.r).substr(-1)==="%"?"prgb":"rgb"):Ee(te.h)&&Ee(te.s)&&Ee(te.v)?(we=_e(te.s),Le=_e(te.v),ce=T(te.h,we,Le),Pe=!0,Ne="hsv"):Ee(te.h)&&Ee(te.s)&&Ee(te.l)&&(we=_e(te.s),xe=_e(te.l),ce=A(te.h,we,xe),Pe=!0,Ne="hsl"),te.hasOwnProperty("a")&&(se=te.a)),se=K(se),{ok:Pe,format:te.format||Ne,r:W(255,F(ce.r,0)),g:W(255,F(ce.g,0)),b:W(255,F(ce.b,0)),a:se}}function b(te,ce,se){return{r:I(te,255)*255,g:I(ce,255)*255,b:I(se,255)*255}}function M(te,ce,se){te=I(te,255),ce=I(ce,255),se=I(se,255);var we=F(te,ce,se),Le=W(te,ce,se),xe,Pe,Ne=(we+Le)/2;if(we==Le)xe=Pe=0;else{var Be=we-Le;Pe=Ne>.5?Be/(2-we-Le):Be/(we+Le);switch(we){case te:xe=(ce-se)/Be+(ce<se?6:0);break;case ce:xe=(se-te)/Be+2;break;case se:xe=(te-ce)/Be+4;break}xe/=6}return{h:xe,s:Pe,l:Ne}}function A(te,ce,se){var we,Le,xe;te=I(te,360),ce=I(ce,100),se=I(se,100);function Pe(We,Ue,Fe){return Fe<0&&(Fe+=1),Fe>1&&(Fe-=1),Fe<1/6?We+(Ue-We)*6*Fe:Fe<1/2?Ue:Fe<2/3?We+(Ue-We)*(2/3-Fe)*6:We}if(ce===0)we=Le=xe=se;else{var Ne=se<.5?se*(1+ce):se+ce-se*ce,Be=2*se-Ne;we=Pe(Be,Ne,te+1/3),Le=Pe(Be,Ne,te),xe=Pe(Be,Ne,te-1/3)}return{r:we*255,g:Le*255,b:xe*255}}function S(te,ce,se){te=I(te,255),ce=I(ce,255),se=I(se,255);var we=F(te,ce,se),Le=W(te,ce,se),xe,Pe,Ne=we,Be=we-Le;if(Pe=we===0?0:Be/we,we==Le)xe=0;else{switch(we){case te:xe=(ce-se)/Be+(ce<se?6:0);break;case ce:xe=(se-te)/Be+2;break;case se:xe=(te-ce)/Be+4;break}xe/=6}return{h:xe,s:Pe,v:Ne}}function T(te,ce,se){te=I(te,360)*6,ce=I(ce,100),se=I(se,100);var we=$.floor(te),Le=te-we,xe=se*(1-ce),Pe=se*(1-Le*ce),Ne=se*(1-(1-Le)*ce),Be=we%6,We=[se,Pe,xe,xe,Ne,se][Be],Ue=[Ne,se,se,Pe,xe,xe][Be],Fe=[xe,xe,Ne,se,se,Pe][Be];return{r:We*255,g:Ue*255,b:Fe*255}}function d(te,ce,se,we){var Le=[he(O(te).toString(16)),he(O(ce).toString(16)),he(O(se).toString(16))];return we&&Le[0].charAt(0)==Le[0].charAt(1)&&Le[1].charAt(0)==Le[1].charAt(1)&&Le[2].charAt(0)==Le[2].charAt(1)?Le[0].charAt(0)+Le[1].charAt(0)+Le[2].charAt(0):Le.join("")}function a(te,ce,se,we,Le){var xe=[he(O(te).toString(16)),he(O(ce).toString(16)),he(O(se).toString(16)),he(be(we))];return Le&&xe[0].charAt(0)==xe[0].charAt(1)&&xe[1].charAt(0)==xe[1].charAt(1)&&xe[2].charAt(0)==xe[2].charAt(1)&&xe[3].charAt(0)==xe[3].charAt(1)?xe[0].charAt(0)+xe[1].charAt(0)+xe[2].charAt(0)+xe[3].charAt(0):xe.join("")}function s(te,ce,se,we){var Le=[he(be(we)),he(O(te).toString(16)),he(O(ce).toString(16)),he(O(se).toString(16))];return Le.join("")}w.equals=function(te,ce){return!te||!ce?!1:w(te).toRgbString()==w(ce).toRgbString()},w.random=function(){return w.fromRatio({r:P(),g:P(),b:P()})};function u(te,ce){ce=ce===0?0:ce||10;var se=w(te).toHsl();return se.s-=ce/100,se.s=N(se.s),w(se)}function _(te,ce){ce=ce===0?0:ce||10;var se=w(te).toHsl();return se.s+=ce/100,se.s=N(se.s),w(se)}function m(te){return w(te).desaturate(100)}function p(te,ce){ce=ce===0?0:ce||10;var se=w(te).toHsl();return se.l+=ce/100,se.l=N(se.l),w(se)}function D(te,ce){ce=ce===0?0:ce||10;var se=w(te).toRgb();return se.r=F(0,W(255,se.r-O(255*-(ce/100)))),se.g=F(0,W(255,se.g-O(255*-(ce/100)))),se.b=F(0,W(255,se.b-O(255*-(ce/100)))),w(se)}function E(te,ce){ce=ce===0?0:ce||10;var se=w(te).toHsl();return se.l-=ce/100,se.l=N(se.l),w(se)}function g(te,ce){var se=w(te).toHsl(),we=(se.h+ce)%360;return se.h=we<0?360+we:we,w(se)}function c(te){var ce=w(te).toHsl();return ce.h=(ce.h+180)%360,w(ce)}function h(te){var ce=w(te).toHsl(),se=ce.h;return[w(te),w({h:(se+120)%360,s:ce.s,l:ce.l}),w({h:(se+240)%360,s:ce.s,l:ce.l})]}function o(te){var ce=w(te).toHsl(),se=ce.h;return[w(te),w({h:(se+90)%360,s:ce.s,l:ce.l}),w({h:(se+180)%360,s:ce.s,l:ce.l}),w({h:(se+270)%360,s:ce.s,l:ce.l})]}function C(te){var ce=w(te).toHsl(),se=ce.h;return[w(te),w({h:(se+72)%360,s:ce.s,l:ce.l}),w({h:(se+216)%360,s:ce.s,l:ce.l})]}function x(te,ce,se){ce=ce||6,se=se||30;var we=w(te).toHsl(),Le=360/se,xe=[w(te)];for(we.h=(we.h-(Le*ce>>1)+720)%360;--ce;)we.h=(we.h+Le)%360,xe.push(w(we));return xe}function v(te,ce){ce=ce||6;for(var se=w(te).toHsv(),we=se.h,Le=se.s,xe=se.v,Pe=[],Ne=1/ce;ce--;)Pe.push(w({h:we,s:Le,v:xe})),xe=(xe+Ne)%1;return Pe}w.mix=function(te,ce,se){se=se===0?0:se||50;var we=w(te).toRgb(),Le=w(ce).toRgb(),xe=se/100,Pe={r:(Le.r-we.r)*xe+we.r,g:(Le.g-we.g)*xe+we.g,b:(Le.b-we.b)*xe+we.b,a:(Le.a-we.a)*xe+we.a};return w(Pe)},w.readability=function(te,ce){var se=w(te),we=w(ce);return($.max(se.getLuminance(),we.getLuminance())+.05)/($.min(se.getLuminance(),we.getLuminance())+.05)},w.isReadable=function(te,ce,se){var we=w.readability(te,ce),Le,xe;xe=!1,Le=ue(se);switch(Le.level+Le.size){case"AAsmall":case"AAAlarge":xe=we>=4.5;break;case"AAlarge":xe=we>=3;break;case"AAAsmall":xe=we>=7;break}return xe},w.mostReadable=function(te,ce,se){var we=null,Le=0,xe,Pe,Ne,Be;se=se||{},Pe=se.includeFallbackColors,Ne=se.level,Be=se.size;for(var We=0;We<ce.length;We++)xe=w.readability(te,ce[We]),xe>Le&&(Le=xe,we=w(ce[We]));return w.isReadable(te,we,{level:Ne,size:Be})||!Pe?we:(se.includeFallbackColors=!1,w.mostReadable(te,["#fff","#000"],se))};var R=w.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},B=w.hexNames=j(R);function j(te){var ce={};for(var se in te)te.hasOwnProperty(se)&&(ce[te[se]]=se);return ce}function K(te){return te=parseFloat(te),(isNaN(te)||te<0||te>1)&&(te=1),te}function I(te,ce){q(te)&&(te="100%");var se=ae(te);return te=W(ce,F(0,parseFloat(te))),se&&(te=parseInt(te*ce,10)/100),$.abs(te-ce)<1e-6?1:te%ce/parseFloat(ce)}function N(te){return W(1,F(0,te))}function Y(te){return parseInt(te,16)}function q(te){return typeof te=="string"&&te.indexOf(".")!=-1&&parseFloat(te)===1}function ae(te){return typeof te=="string"&&te.indexOf("%")!=-1}function he(te){return te.length==1?"0"+te:""+te}function _e(te){return te<=1&&(te=te*100+"%"),te}function be(te){return $.round(parseFloat(te)*255).toString(16)}function Ce(te){return Y(te)/255}var Te=function(){var te="[-\\+]?\\d+%?",ce="[-\\+]?\\d*\\.\\d+%?",se="(?:"+ce+")|(?:"+te+")",we="[\\s|\\(]+("+se+")[,|\\s]+("+se+")[,|\\s]+("+se+")\\s*\\)?",Le="[\\s|\\(]+("+se+")[,|\\s]+("+se+")[,|\\s]+("+se+")[,|\\s]+("+se+")\\s*\\)?";return{CSS_UNIT:new RegExp(se),rgb:new RegExp("rgb"+we),rgba:new RegExp("rgba"+Le),hsl:new RegExp("hsl"+we),hsla:new RegExp("hsla"+Le),hsv:new RegExp("hsv"+we),hsva:new RegExp("hsva"+Le),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 Ee(te){return!!Te.CSS_UNIT.exec(te)}function me(te){te=te.replace(k,"").replace(X,"").toLowerCase();var ce=!1;if(R[te])te=R[te],ce=!0;else if(te=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var se;return(se=Te.rgb.exec(te))?{r:se[1],g:se[2],b:se[3]}:(se=Te.rgba.exec(te))?{r:se[1],g:se[2],b:se[3],a:se[4]}:(se=Te.hsl.exec(te))?{h:se[1],s:se[2],l:se[3]}:(se=Te.hsla.exec(te))?{h:se[1],s:se[2],l:se[3],a:se[4]}:(se=Te.hsv.exec(te))?{h:se[1],s:se[2],v:se[3]}:(se=Te.hsva.exec(te))?{h:se[1],s:se[2],v:se[3],a:se[4]}:(se=Te.hex8.exec(te))?{r:Y(se[1]),g:Y(se[2]),b:Y(se[3]),a:Ce(se[4]),format:ce?"name":"hex8"}:(se=Te.hex6.exec(te))?{r:Y(se[1]),g:Y(se[2]),b:Y(se[3]),format:ce?"name":"hex"}:(se=Te.hex4.exec(te))?{r:Y(se[1]+""+se[1]),g:Y(se[2]+""+se[2]),b:Y(se[3]+""+se[3]),a:Ce(se[4]+""+se[4]),format:ce?"name":"hex8"}:(se=Te.hex3.exec(te))?{r:Y(se[1]+""+se[1]),g:Y(se[2]+""+se[2]),b:Y(se[3]+""+se[3]),format:ce?"name":"hex"}:!1}function ue(te){var ce,se;return te=te||{level:"AA",size:"small"},ce=(te.level||"AA").toUpperCase(),se=(te.size||"small").toLowerCase(),ce!=="AA"&&ce!=="AAA"&&(ce="AA"),se!=="small"&&se!=="large"&&(se="small"),{level:ce,size:se}}lt.exports?lt.exports=w:!(ne=function(){return w}.call($e,ie,$e,lt),ne!==void 0&&(lt.exports=ne))})(Math)},aRTE:function(lt,$e){lt.exports={L:1,M:0,Q:3,H:2}},bT9E:function(lt,$e,ie){"use strict";ie.d($e,"a",function(){return $});var ne=ie("VTBJ");function $(k,X){var U=Object(ne.a)({},k);return Array.isArray(X)&&X.forEach(function(O){delete U[O]}),U}},c5Ni:function(lt,$e,ie){},dQei:function(lt,$e){for(var ie={glog:function($){if($<1)throw new Error("glog("+$+")");return ie.LOG_TABLE[$]},gexp:function($){for(;$<0;)$+=255;for(;$>=256;)$-=255;return ie.EXP_TABLE[$]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},ne=0;ne<8;ne++)ie.EXP_TABLE[ne]=1<<ne;for(var ne=8;ne<256;ne++)ie.EXP_TABLE[ne]=ie.EXP_TABLE[ne-4]^ie.EXP_TABLE[ne-5]^ie.EXP_TABLE[ne-6]^ie.EXP_TABLE[ne-8];for(var ne=0;ne<255;ne++)ie.LOG_TABLE[ie.EXP_TABLE[ne]]=ne;lt.exports=ie},dWSS:function(lt,$e,ie){var ne=ie("dQei");function $(k,X){if(k.length==null)throw new Error(k.length+"/"+X);for(var U=0;U<k.length&&k[U]==0;)U++;this.num=new Array(k.length-U+X);for(var O=0;O<k.length-U;O++)this.num[O]=k[O+U]}$.prototype={get:function(k){return this.num[k]},getLength:function(){return this.num.length},multiply:function(k){for(var X=new Array(this.getLength()+k.getLength()-1),U=0;U<this.getLength();U++)for(var O=0;O<k.getLength();O++)X[U+O]^=ne.gexp(ne.glog(this.get(U))+ne.glog(k.get(O)));return new $(X,0)},mod:function(k){if(this.getLength()-k.getLength()<0)return this;for(var X=ne.glog(this.get(0))-ne.glog(k.get(0)),U=new Array(this.getLength()),O=0;O<this.getLength();O++)U[O]=this.get(O);for(var O=0;O<k.getLength();O++)U[O]^=ne.gexp(ne.glog(k.get(O))+X);return new $(U,0).mod(k)}},lt.exports=$},dejd:function(lt,$e,ie){},dmUQ:function(lt,$e,ie){"use strict";var ne=ie("Ff2n"),$=ie("rePB"),k=ie("1OyB"),X=ie("vuIU"),U=ie("Ji7U"),O=ie("md7G"),W=ie("foSv"),F=ie("q1tI"),P=ie.n(F),w=ie("TSYQ"),f=ie.n(w),b=ie("4IlW");function M(h,o){var C=Object.keys(h);if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(h);o&&(x=x.filter(function(v){return Object.getOwnPropertyDescriptor(h,v).enumerable})),C.push.apply(C,x)}return C}function A(h){for(var o=1;o<arguments.length;o++){var C=arguments[o]!=null?arguments[o]:{};o%2?M(Object(C),!0).forEach(function(x){Object($.a)(h,x,C[x])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(C)):M(Object(C)).forEach(function(x){Object.defineProperty(h,x,Object.getOwnPropertyDescriptor(C,x))})}return h}function S(h){var o=T();return function(){var x=Object(W.a)(h),v;if(o){var R=Object(W.a)(this).constructor;v=Reflect.construct(x,arguments,R)}else v=x.apply(this,arguments);return Object(O.a)(this,v)}}function T(){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(h){return!1}}function d(){}function a(h){h.preventDefault()}var s=function(o){return o.replace(/[^\w.-]+/g,"")},u=200,_=600,m=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,p=function(o){return o!=null},D=function(o,C){return C===o||typeof C=="number"&&typeof o=="number"&&isNaN(C)&&isNaN(o)},E=function(h){Object(U.a)(C,h);var o=S(C);function C(x){var v;Object(k.a)(this,C),v=o.call(this,x),v.onKeyDown=function(j){var K=v.props,I=K.onKeyDown,N=K.onPressEnter;if(j.keyCode===b.a.UP){var Y=v.getRatio(j);v.up(j,Y,null),v.stop()}else if(j.keyCode===b.a.DOWN){var q=v.getRatio(j);v.down(j,q,null),v.stop()}else j.keyCode===b.a.ENTER&&N&&N(j);if(v.recordCursorPosition(),v.lastKeyCode=j.keyCode,I){for(var ae=arguments.length,he=new Array(ae>1?ae-1:0),_e=1;_e<ae;_e++)he[_e-1]=arguments[_e];I.apply(void 0,[j].concat(he))}},v.onKeyUp=function(j){var K=v.props.onKeyUp;if(v.stop(),v.recordCursorPosition(),K){for(var I=arguments.length,N=new Array(I>1?I-1:0),Y=1;Y<I;Y++)N[Y-1]=arguments[Y];K.apply(void 0,[j].concat(N))}},v.onChange=function(j){var K=v.props.onChange;v.state.focused&&(v.inputting=!0),v.rawInput=v.props.parser(v.getValueFromEvent(j)),v.setState({inputValue:v.rawInput}),K(v.toNumber(v.rawInput))},v.onMouseUp=function(){var j=v.props.onMouseUp;v.recordCursorPosition(),j&&j.apply(void 0,arguments)},v.onFocus=function(){var j;v.setState({focused:!0}),(j=v.props).onFocus.apply(j,arguments)},v.onBlur=function(){var j=v.props.onBlur;v.inputting=!1,v.setState({focused:!1});var K=v.getCurrentValidValue(v.state.inputValue),I=v.setValue(K,d);if(j){var N=v.input.value,Y=v.getInputDisplayValue({focus:!1,value:I});v.input.value=Y&&Number(Y),j.apply(void 0,arguments),v.input.value=N}},v.getRatio=function(j){var K=1;return j.metaKey||j.ctrlKey?K=.1:j.shiftKey&&(K=10),K},v.getFullNum=function(j){return isNaN(j)?j:/e/i.test(String(j))?Number(j).toFixed(18).replace(/\.?0+$/,""):j},v.getPrecision=function(j){if(p(v.props.precision))return v.props.precision;var K=String(j);if(K.indexOf("e-")>=0)return parseInt(K.slice(K.indexOf("e-")+2),10);var I=0;return K.indexOf(".")>=0&&(I=K.length-K.indexOf(".")-1),I},v.getInputDisplayValue=function(j){var K=j||v.state,I=K.focused,N=K.inputValue,Y=K.value,q;I?q=N:q=v.toPrecisionAsStep(Y),q==null&&(q="");var ae=v.formatWrapper(q);return p(v.props.decimalSeparator)&&(ae=ae.toString().replace(".",v.props.decimalSeparator)),ae},v.recordCursorPosition=function(){try{v.cursorStart=v.input.selectionStart,v.cursorEnd=v.input.selectionEnd,v.currentValue=v.input.value,v.cursorBefore=v.input.value.substring(0,v.cursorStart),v.cursorAfter=v.input.value.substring(v.cursorEnd)}catch(j){}},v.restoreByAfter=function(j){if(j===void 0)return!1;var K=v.input.value,I=K.lastIndexOf(j);if(I===-1)return!1;var N=v.cursorBefore.length;return v.lastKeyCode===b.a.DELETE&&v.cursorBefore.charAt(N-1)===j[0]?(v.fixCaret(N,N),!0):I+j.length===K.length?(v.fixCaret(I,I),!0):!1},v.partRestoreByAfter=function(j){return j===void 0?!1:Array.prototype.some.call(j,function(K,I){var N=j.substring(I);return v.restoreByAfter(N)})},v.isNotCompleteNumber=function(j){return isNaN(j)||j===""||j===null||j&&j.toString().indexOf(".")===j.toString().length-1},v.stop=function(){v.autoStepTimer&&clearTimeout(v.autoStepTimer)},v.down=function(j,K,I){v.pressingUpOrDown=!0,v.step("down",j,K,I)},v.up=function(j,K,I){v.pressingUpOrDown=!0,v.step("up",j,K,I)},v.saveInput=function(j){v.input=j};var R=x.value;R===void 0&&(R=x.defaultValue),v.state={focused:x.autoFocus};var B=v.getValidValue(v.toNumber(R));return v.state=A(A({},v.state),{},{inputValue:v.toPrecisionAsStep(B),value:B}),v}return Object(X.a)(C,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(v){var R=this.props,B=R.value,j=R.onChange,K=R.max,I=R.min,N=this.state.focused;if(v){if(!D(v.value,B)||!D(v.max,K)||!D(v.min,I)){var Y=N?B:this.getValidValue(B),q;this.pressingUpOrDown?q=Y:this.inputting?q=this.rawInput:q=this.toPrecisionAsStep(Y),this.setState({value:Y,inputValue:q})}var ae="value"in this.props?B:this.state.value;"max"in this.props&&v.max!==K&&typeof ae=="number"&&ae>K&&j&&j(K),"min"in this.props&&v.min!==I&&typeof ae=="number"&&ae<I&&j&&j(I)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var he=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===b.a.BACKSPACE?he=this.cursorStart-1:this.lastKeyCode===b.a.DELETE&&(he=this.cursorStart):he=this.input.value.length,this.fixCaret(he,he)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case b.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case b.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(_e){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(v){var R=v;return R===""?R="":this.isNotCompleteNumber(parseFloat(R))?R=this.state.value:R=this.getValidValue(R),this.toNumber(R)}},{key:"getValueFromEvent",value:function(v){var R=v.target.value.trim().replace(/。/g,".");return p(this.props.decimalSeparator)&&(R=R.replace(this.props.decimalSeparator,".")),R}},{key:"getValidValue",value:function(v){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,j=parseFloat(v);return isNaN(j)?v:(j<R&&(j=R),j>B&&(j=B),j)}},{key:"setValue",value:function(v,R){var B=this.props.precision,j=this.isNotCompleteNumber(parseFloat(v))?null:parseFloat(v),K=this.state.value,I=K===void 0?null:K,N=this.state.inputValue,Y=N===void 0?null:N,q=typeof j=="number"?j.toFixed(B):"".concat(j),ae=j!==I||q!=="".concat(Y);return"value"in this.props?(Y=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:Y},R)):this.setState({value:j,inputValue:this.toPrecisionAsStep(v)},R),ae&&this.props.onChange(j),j}},{key:"getMaxPrecision",value:function(v){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,B=this.props,j=B.precision,K=B.step;if(p(j))return j;var I=this.getPrecision(R),N=this.getPrecision(K),Y=this.getPrecision(v);return v?Math.max(Y,I+N):I+N}},{key:"getPrecisionFactor",value:function(v){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,B=this.getMaxPrecision(v,R);return Math.pow(10,B)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(v){return this.props.formatter?this.props.formatter(v):v}},{key:"toPrecisionAsStep",value:function(v){if(this.isNotCompleteNumber(v)||v==="")return v;var R=Math.abs(this.getMaxPrecision(v));return isNaN(R)?v.toString():Number(v).toFixed(R)}},{key:"toNumber",value:function(v){var R=this.props.precision,B=this.state.focused,j=v&&v.length>16&&B;return this.isNotCompleteNumber(v)||j?v:p(R)?Math.round(v*Math.pow(10,R))/Math.pow(10,R):Number(v)}},{key:"upStep",value:function(v,R){var B=this.props.step,j=this.getPrecisionFactor(v,R),K=Math.abs(this.getMaxPrecision(v,R)),I=((j*v+j*B*R)/j).toFixed(K);return this.toNumber(I)}},{key:"downStep",value:function(v,R){var B=this.props.step,j=this.getPrecisionFactor(v,R),K=Math.abs(this.getMaxPrecision(v,R)),I=((j*v-j*B*R)/j).toFixed(K);return this.toNumber(I)}},{key:"step",value:function(v,R){var B=this,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,K=arguments.length>3?arguments[3]:void 0;this.stop(),R&&(R.persist(),R.preventDefault());var I=this.props;if(I.disabled)return;var N=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(N))return;var Y=this["".concat(v,"Step")](N,j),q=Y>I.max||Y<I.min;if(Y>I.max?Y=I.max:Y<I.min&&(Y=I.min),this.setValue(Y,null),this.setState({focused:!0},function(){B.pressingUpOrDown=!1}),q)return;this.autoStepTimer=setTimeout(function(){B[v](R,j,!0)},K?u:_)}},{key:"fixCaret",value:function(v,R){if(v===void 0||R===void 0||!this.input||!this.input.value)return;try{var B=this.input.selectionStart,j=this.input.selectionEnd;(v!==B||R!==j)&&this.input.setSelectionRange(v,R)}catch(K){}}},{key:"render",value:function(){var v,R=this.props,B=R.prefixCls,j=R.disabled,K=R.readOnly,I=R.useTouch,N=R.autoComplete,Y=R.upHandler,q=R.downHandler,ae=R.className,he=R.max,_e=R.min,be=R.style,Ce=R.title,Te=R.onMouseEnter,Ee=R.onMouseLeave,me=R.onMouseOver,ue=R.onMouseOut,te=R.required,ce=R.onClick,se=R.tabIndex,we=R.type,Le=R.placeholder,xe=R.id,Pe=R.inputMode,Ne=R.pattern,Be=R.step,We=R.maxLength,Ue=R.autoFocus,Fe=R.name,at=R.onPaste,it=R.onInput,et=Object(ne.a)(R,["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"]),Ze=this.state,ut=Ze.value,Je=Ze.focused,st=f()(B,(v={},Object($.a)(v,ae,!!ae),Object($.a)(v,"".concat(B,"-disabled"),j),Object($.a)(v,"".concat(B,"-focused"),Je),v)),Re={};Object.keys(et).forEach(function(de){(de.substr(0,5)==="data-"||de.substr(0,5)==="aria-"||de==="role")&&(Re[de]=et[de])});var nt=!K&&!j,qe=this.getInputDisplayValue(null),Ie=(ut||ut===0)&&(isNaN(ut)||Number(ut)>=he),He=(ut||ut===0)&&(isNaN(ut)||Number(ut)<=_e),Se=Ie||j||K,pe=He||j||K,ye=f()("".concat(B,"-handler"),"".concat(B,"-handler-up"),Object($.a)({},"".concat(B,"-handler-up-disabled"),Se)),re=f()("".concat(B,"-handler"),"".concat(B,"-handler-down"),Object($.a)({},"".concat(B,"-handler-down-disabled"),pe)),oe=I?{onTouchStart:Se?d:this.up,onTouchEnd:this.stop}:{onMouseDown:Se?d:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},le=I?{onTouchStart:pe?d:this.down,onTouchEnd:this.stop}:{onMouseDown:pe?d:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return P.a.createElement("div",{className:st,style:be,title:Ce,onMouseEnter:Te,onMouseLeave:Ee,onMouseOver:me,onMouseOut:ue,onFocus:function(){return null},onBlur:function(){return null}},P.a.createElement("div",{className:"".concat(B,"-handler-wrap")},P.a.createElement("span",Object.assign({unselectable:"on"},oe,{role:"button","aria-label":"Increase Value","aria-disabled":Se,className:ye}),Y||P.a.createElement("span",{unselectable:"on",className:"".concat(B,"-handler-up-inner"),onClick:a})),P.a.createElement("span",Object.assign({unselectable:"on"},le,{role:"button","aria-label":"Decrease Value","aria-disabled":pe,className:re}),q||P.a.createElement("span",{unselectable:"on",className:"".concat(B,"-handler-down-inner"),onClick:a}))),P.a.createElement("div",{className:"".concat(B,"-input-wrap")},P.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":_e,"aria-valuemax":he,"aria-valuenow":ut,required:te,type:we,placeholder:Le,onPaste:at,onClick:ce,onMouseUp:this.onMouseUp,className:"".concat(B,"-input"),tabIndex:se,autoComplete:N,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:nt?this.onKeyDown:d,onKeyUp:nt?this.onKeyUp:d,autoFocus:Ue,maxLength:We,readOnly:K,disabled:j,max:he,min:_e,step:Be,name:Fe,title:Ce,id:xe,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(qe),pattern:Ne,inputMode:Pe,onInput:it},Re))))}}]),C}(P.a.Component);E.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:m,min:-m,step:1,style:{},onChange:d,onKeyDown:d,onPressEnter:d,onFocus:d,onBlur:d,parser:s,required:!1,autoComplete:"off"};var g=E,c=$e.a=g},f4xo:function(lt,$e,ie){var ne=ie("nVVt");function $(k){this.mode=ne.MODE_8BIT_BYTE,this.data=k}$.prototype={getLength:function(k){return this.data.length},write:function(k){for(var X=0;X<this.data.length;X++)k.put(this.data.charCodeAt(X),8)}},lt.exports=$},h78n:function(lt,$e,ie){"use strict";ie.d($e,"a",function(){return v});var ne=ie("q1tI"),$=ie.n(ne),k=ie("TSYQ"),X=ie.n(k),U={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},O=function(j){var K=j.map(function(){return Object(ne.useRef)()}),I=Object(ne.useRef)();return Object(ne.useEffect)(function(){var N=Date.now(),Y=!1;Object.keys(K).forEach(function(q){var ae=K[q].current;if(!ae)return;Y=!0;var he=ae.style;he.transitionDuration=".3s, .3s, .3s, .06s",I.current&&N-I.current<100&&(he.transitionDuration="0s, 0s")}),Y&&(I.current=Date.now())}),[K]};function W(){return W=Object.assign||function(B){for(var j=1;j<arguments.length;j++){var K=arguments[j];for(var I in K)Object.prototype.hasOwnProperty.call(K,I)&&(B[I]=K[I])}return B},W.apply(this,arguments)}function F(B,j){return M(B)||b(B,j)||w(B,j)||P()}function P(){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(B,j){if(!B)return;if(typeof B=="string")return f(B,j);var K=Object.prototype.toString.call(B).slice(8,-1);if(K==="Object"&&B.constructor&&(K=B.constructor.name),K==="Map"||K==="Set")return Array.from(B);if(K==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(K))return f(B,j)}function f(B,j){(j==null||j>B.length)&&(j=B.length);for(var K=0,I=new Array(j);K<j;K++)I[K]=B[K];return I}function b(B,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(B)))return;var K=[],I=!0,N=!1,Y=void 0;try{for(var q=B[Symbol.iterator](),ae;!(I=(ae=q.next()).done)&&!(K.push(ae.value),j&&K.length===j);I=!0);}catch(he){N=!0,Y=he}finally{try{!I&&q.return!=null&&q.return()}finally{if(N)throw Y}}return K}function M(B){if(Array.isArray(B))return B}function A(B,j){if(B==null)return{};var K=S(B,j),I,N;if(Object.getOwnPropertySymbols){var Y=Object.getOwnPropertySymbols(B);for(N=0;N<Y.length;N++){if(I=Y[N],j.indexOf(I)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(B,I))continue;K[I]=B[I]}}return K}function S(B,j){if(B==null)return{};var K={},I=Object.keys(B),N,Y;for(Y=0;Y<I.length;Y++){if(N=I[Y],j.indexOf(N)>=0)continue;K[N]=B[N]}return K}var T=function(j){var K=j.className,I=j.percent,N=j.prefixCls,Y=j.strokeColor,q=j.strokeLinecap,ae=j.strokeWidth,he=j.style,_e=j.trailColor,be=j.trailWidth,Ce=j.transition,Te=A(j,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete Te.gapPosition;var Ee=Array.isArray(I)?I:[I],me=Array.isArray(Y)?Y:[Y],ue=O(Ee),te=F(ue,1),ce=te[0],se=ae/2,we=100-ae/2,Le="M ".concat(q==="round"?se:0,",").concat(se,`
L `).concat(q==="round"?we:100,",").concat(se),xe="0 0 100 ".concat(ae),Pe=0;return $.a.createElement("svg",W({className:X()("".concat(N,"-line"),K),viewBox:xe,preserveAspectRatio:"none",style:he},Te),$.a.createElement("path",{className:"".concat(N,"-line-trail"),d:Le,strokeLinecap:q,stroke:_e,strokeWidth:be||ae,fillOpacity:"0"}),Ee.map(function(Ne,Be){var We={strokeDasharray:"".concat(Ne,"px, 100px"),strokeDashoffset:"-".concat(Pe,"px"),transition:Ce||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Ue=me[Be]||me[me.length-1];return Pe+=Ne,$.a.createElement("path",{key:Be,className:"".concat(N,"-line-path"),d:Le,strokeLinecap:q,stroke:Ue,strokeWidth:ae,fillOpacity:"0",ref:ce[Be],style:We})}))};T.defaultProps=U;var d=T;function a(){return a=Object.assign||function(B){for(var j=1;j<arguments.length;j++){var K=arguments[j];for(var I in K)Object.prototype.hasOwnProperty.call(K,I)&&(B[I]=K[I])}return B},a.apply(this,arguments)}function s(B,j){return D(B)||p(B,j)||_(B,j)||u()}function u(){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 _(B,j){if(!B)return;if(typeof B=="string")return m(B,j);var K=Object.prototype.toString.call(B).slice(8,-1);if(K==="Object"&&B.constructor&&(K=B.constructor.name),K==="Map"||K==="Set")return Array.from(B);if(K==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(K))return m(B,j)}function m(B,j){(j==null||j>B.length)&&(j=B.length);for(var K=0,I=new Array(j);K<j;K++)I[K]=B[K];return I}function p(B,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(B)))return;var K=[],I=!0,N=!1,Y=void 0;try{for(var q=B[Symbol.iterator](),ae;!(I=(ae=q.next()).done)&&!(K.push(ae.value),j&&K.length===j);I=!0);}catch(he){N=!0,Y=he}finally{try{!I&&q.return!=null&&q.return()}finally{if(N)throw Y}}return K}function D(B){if(Array.isArray(B))return B}function E(B,j){if(B==null)return{};var K=g(B,j),I,N;if(Object.getOwnPropertySymbols){var Y=Object.getOwnPropertySymbols(B);for(N=0;N<Y.length;N++){if(I=Y[N],j.indexOf(I)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(B,I))continue;K[I]=B[I]}}return K}function g(B,j){if(B==null)return{};var K={},I=Object.keys(B),N,Y;for(Y=0;Y<I.length;Y++){if(N=I[Y],j.indexOf(N)>=0)continue;K[N]=B[N]}return K}var c=0;function h(B){return+B.replace("%","")}function o(B){return Array.isArray(B)?B:[B]}function C(B,j,K,I){var N=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,Y=arguments.length>5?arguments[5]:void 0,q=50-I/2,ae=0,he=-q,_e=0,be=-2*q;switch(Y){case"left":ae=-q,he=0,_e=2*q,be=0;break;case"right":ae=q,he=0,_e=-2*q,be=0;break;case"bottom":he=q,be=2*q;break;default:}var Ce="M 50,50 m ".concat(ae,",").concat(he,`
a `).concat(q,",").concat(q," 0 1 1 ").concat(_e,",").concat(-be,`
a `).concat(q,",").concat(q," 0 1 1 ").concat(-_e,",").concat(be),Te=Math.PI*2*q,Ee={stroke:K,strokeDasharray:"".concat(j/100*(Te-N),"px ").concat(Te,"px"),strokeDashoffset:"-".concat(N/2+B/100*(Te-N),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:Ce,pathStyle:Ee}}var x=function(j){var K=j.prefixCls,I=j.strokeWidth,N=j.trailWidth,Y=j.gapDegree,q=j.gapPosition,ae=j.trailColor,he=j.strokeLinecap,_e=j.style,be=j.className,Ce=j.strokeColor,Te=j.percent,Ee=E(j,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),me=Object(ne.useMemo)(function(){return c+=1,c},[]),ue=C(0,100,ae,I,Y,q),te=ue.pathString,ce=ue.pathStyle,se=o(Te),we=o(Ce),Le=we.find(function(We){return Object.prototype.toString.call(We)==="[object Object]"}),xe=O(se),Pe=s(xe,1),Ne=Pe[0],Be=function(){var Ue=0;return se.map(function(Fe,at){var it=we[at]||we[we.length-1],et=Object.prototype.toString.call(it)==="[object Object]"?"url(#".concat(K,"-gradient-").concat(me,")"):"",Ze=C(Ue,Fe,it,I,Y,q);return Ue+=Fe,$.a.createElement("path",{key:at,className:"".concat(K,"-circle-path"),d:Ze.pathString,stroke:et,strokeLinecap:he,strokeWidth:I,opacity:Fe===0?0:1,fillOpacity:"0",style:Ze.pathStyle,ref:Ne[at]})})};return $.a.createElement("svg",a({className:X()("".concat(K,"-circle"),be),viewBox:"0 0 100 100",style:_e},Ee),Le&&$.a.createElement("defs",null,$.a.createElement("linearGradient",{id:"".concat(K,"-gradient-").concat(me),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Le).sort(function(We,Ue){return h(We)-h(Ue)}).map(function(We,Ue){return $.a.createElement("stop",{key:Ue,offset:We,stopColor:Le[We]})}))),$.a.createElement("path",{className:"".concat(K,"-circle-trail"),d:te,stroke:ae,strokeLinecap:he,strokeWidth:N||I,fillOpacity:"0",style:ce}),Be().reverse())};x.defaultProps=U;var v=x,R={Line:d,Circle:v}},kSUc:function(lt,$e,ie){},lZu9:function(lt,$e,ie){(function(ne){ne(ie("VrN/"),ie("1eCo"),ie("8EBN"))})(function(ne){"use strict";ne.defineMode("markdown",function($,k){var X=ne.getMode($,"text/html"),U=X.name=="null";function O(I){if(ne.findModeByName){var N=ne.findModeByName(I);N&&(I=N.mime||N.mimes[0])}var Y=ne.getMode($,I);return Y.name=="null"?null:Y}k.highlightFormatting===void 0&&(k.highlightFormatting=!1),k.maxBlockquoteDepth===void 0&&(k.maxBlockquoteDepth=0),k.taskLists===void 0&&(k.taskLists=!1),k.strikethrough===void 0&&(k.strikethrough=!1),k.emoji===void 0&&(k.emoji=!1),k.fencedCodeBlockHighlighting===void 0&&(k.fencedCodeBlockHighlighting=!0),k.fencedCodeBlockDefaultMode===void 0&&(k.fencedCodeBlockDefaultMode="text/plain"),k.xml===void 0&&(k.xml=!0),k.tokenTypeOverrides===void 0&&(k.tokenTypeOverrides={});var W={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var F in W)W.hasOwnProperty(F)&&k.tokenTypeOverrides[F]&&(W[F]=k.tokenTypeOverrides[F]);var P=/^([*\-_])(?:\s*\1){2,}\s*$/,w=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,f=/^\[(x| )\](?=\s)/i,b=k.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,M=/^ {0,3}(?:\={1,}|-{2,})\s*$/,A=/^[^#!\[\]*_\\<>` "'(~:]+/,S=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,T=/^\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]/,a=" ";function s(I,N,Y){return N.f=N.inline=Y,Y(I,N)}function u(I,N,Y){return N.f=N.block=Y,Y(I,N)}function _(I){return!I||!/\S/.test(I.string)}function m(I){if(I.linkTitle=!1,I.linkHref=!1,I.linkText=!1,I.em=!1,I.strong=!1,I.strikethrough=!1,I.quote=0,I.indentedCode=!1,I.f==D){var N=U;if(!N){var Y=ne.innerMode(X,I.htmlState);N=Y.mode.name=="xml"&&Y.state.tagStart===null&&!Y.state.context&&Y.state.tokenize.isInText}N&&(I.f=h,I.block=p,I.htmlState=null)}return I.trailingSpace=0,I.trailingSpaceNewLine=!1,I.prevLine=I.thisLine,I.thisLine={stream:null},null}function p(I,N){var Y=I.column()===N.indentation,q=_(N.prevLine.stream),ae=N.indentedCode,he=N.prevLine.hr,_e=N.list!==!1,be=(N.listStack[N.listStack.length-1]||0)+3;N.indentedCode=!1;var Ce=N.indentation;if(N.indentationDiff===null&&(N.indentationDiff=N.indentation,_e)){for(N.list=null;Ce<N.listStack[N.listStack.length-1];)N.listStack.pop(),N.listStack.length?N.indentation=N.listStack[N.listStack.length-1]:N.list=!1;N.list!==!1&&(N.indentationDiff=Ce-N.listStack[N.listStack.length-1])}var Te=!q&&!he&&!N.prevLine.header&&(!_e||!ae)&&!N.prevLine.fencedCodeEnd,Ee=(N.list===!1||he||q)&&N.indentation<=be&&I.match(P),me=null;if(N.indentationDiff>=4&&(ae||N.prevLine.fencedCodeEnd||N.prevLine.header||q))return I.skipToEnd(),N.indentedCode=!0,W.code;if(I.eatSpace())return null;if(Y&&N.indentation<=be&&(me=I.match(b))&&me[1].length<=6)return N.quote=0,N.header=me[1].length,N.thisLine.header=!0,k.highlightFormatting&&(N.formatting="header"),N.f=N.inline,g(N);if(N.indentation<=be&&I.eat(">"))return N.quote=Y?1:N.quote+1,k.highlightFormatting&&(N.formatting="quote"),I.eatSpace(),g(N);if(!Ee&&!N.setext&&Y&&N.indentation<=be&&(me=I.match(w))){var ue=me[1]?"ol":"ul";return N.indentation=Ce+I.current().length,N.list=!0,N.quote=0,N.listStack.push(N.indentation),N.em=!1,N.strong=!1,N.code=!1,N.strikethrough=!1,k.taskLists&&I.match(f,!1)&&(N.taskList=!0),N.f=N.inline,k.highlightFormatting&&(N.formatting=["list","list-"+ue]),g(N)}else{if(Y&&N.indentation<=be&&(me=I.match(S,!0)))return N.quote=0,N.fencedEndRE=new RegExp(me[1]+"+ *$"),N.localMode=k.fencedCodeBlockHighlighting&&O(me[2]||k.fencedCodeBlockDefaultMode),N.localMode&&(N.localState=ne.startState(N.localMode)),N.f=N.block=E,k.highlightFormatting&&(N.formatting="code-block"),N.code=-1,g(N);if(N.setext||(!Te||!_e)&&!N.quote&&N.list===!1&&!N.code&&!Ee&&!T.test(I.string)&&(me=I.lookAhead(1))&&(me=me.match(M)))return N.setext?(N.header=N.setext,N.setext=0,I.skipToEnd(),k.highlightFormatting&&(N.formatting="header")):(N.header=me[0].charAt(0)=="="?1:2,N.setext=N.header),N.thisLine.header=!0,N.f=N.inline,g(N);if(Ee)return I.skipToEnd(),N.hr=!0,N.thisLine.hr=!0,W.hr;if(I.peek()==="[")return s(I,N,R)}return s(I,N,N.inline)}function D(I,N){var Y=X.token(I,N.htmlState);if(!U){var q=ne.innerMode(X,N.htmlState);(q.mode.name=="xml"&&q.state.tagStart===null&&!q.state.context&&q.state.tokenize.isInText||N.md_inside&&I.current().indexOf(">")>-1)&&(N.f=h,N.block=p,N.htmlState=null)}return Y}function E(I,N){var Y=N.listStack[N.listStack.length-1]||0,q=N.indentation<Y,ae=Y+3;if(N.fencedEndRE&&N.indentation<=ae&&(q||I.match(N.fencedEndRE))){k.highlightFormatting&&(N.formatting="code-block");var he;return q||(he=g(N)),N.localMode=N.localState=null,N.block=p,N.f=h,N.fencedEndRE=null,N.code=0,N.thisLine.fencedCodeEnd=!0,q?u(I,N,N.block):he}else return N.localMode?N.localMode.token(I,N.localState):(I.skipToEnd(),W.code)}function g(I){var N=[];if(I.formatting){N.push(W.formatting),typeof I.formatting=="string"&&(I.formatting=[I.formatting]);for(var Y=0;Y<I.formatting.length;Y++)N.push(W.formatting+"-"+I.formatting[Y]),I.formatting[Y]==="header"&&N.push(W.formatting+"-"+I.formatting[Y]+"-"+I.header),I.formatting[Y]==="quote"&&(!k.maxBlockquoteDepth||k.maxBlockquoteDepth>=I.quote?N.push(W.formatting+"-"+I.formatting[Y]+"-"+I.quote):N.push("error"))}if(I.taskOpen)return N.push("meta"),N.length?N.join(" "):null;if(I.taskClosed)return N.push("property"),N.length?N.join(" "):null;if(I.linkHref?N.push(W.linkHref,"url"):(I.strong&&N.push(W.strong),I.em&&N.push(W.em),I.strikethrough&&N.push(W.strikethrough),I.emoji&&N.push(W.emoji),I.linkText&&N.push(W.linkText),I.code&&N.push(W.code),I.image&&N.push(W.image),I.imageAltText&&N.push(W.imageAltText,"link"),I.imageMarker&&N.push(W.imageMarker)),I.header&&N.push(W.header,W.header+"-"+I.header),I.quote&&(N.push(W.quote),!k.maxBlockquoteDepth||k.maxBlockquoteDepth>=I.quote?N.push(W.quote+"-"+I.quote):N.push(W.quote+"-"+k.maxBlockquoteDepth)),I.list!==!1){var q=(I.listStack.length-1)%3;q?q===1?N.push(W.list2):N.push(W.list3):N.push(W.list1)}return I.trailingSpaceNewLine?N.push("trailing-space-new-line"):I.trailingSpace&&N.push("trailing-space-"+(I.trailingSpace%2?"a":"b")),N.length?N.join(" "):null}function c(I,N){return I.match(A,!0)?g(N):void 0}function h(I,N){var Y=N.text(I,N);if(typeof Y!="undefined")return Y;if(N.list)return N.list=null,g(N);if(N.taskList){var q=I.match(f,!0)[1]===" ";return q?N.taskOpen=!0:N.taskClosed=!0,k.highlightFormatting&&(N.formatting="task"),N.taskList=!1,g(N)}if(N.taskOpen=!1,N.taskClosed=!1,N.header&&I.match(/^#+$/,!0))return k.highlightFormatting&&(N.formatting="header"),g(N);var ae=I.next();if(N.linkTitle){N.linkTitle=!1;var he=ae;ae==="("&&(he=")"),he=(he+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var _e="^\\s*(?:[^"+he+"\\\\]+|\\\\\\\\|\\\\.)"+he;if(I.match(new RegExp(_e),!0))return W.linkHref}if(ae==="`"){var be=N.formatting;k.highlightFormatting&&(N.formatting="code"),I.eatWhile("`");var Ce=I.current().length;if(N.code==0&&(!N.quote||Ce==1))return N.code=Ce,g(N);if(Ce==N.code){var Te=g(N);return N.code=0,Te}else return N.formatting=be,g(N)}else if(N.code)return g(N);if(ae==="\\"&&(I.next(),k.highlightFormatting)){var Ee=g(N),me=W.formatting+"-escape";return Ee?Ee+" "+me:me}if(ae==="!"&&I.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return N.imageMarker=!0,N.image=!0,k.highlightFormatting&&(N.formatting="image"),g(N);if(ae==="["&&N.imageMarker&&I.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return N.imageMarker=!1,N.imageAltText=!0,k.highlightFormatting&&(N.formatting="image"),g(N);if(ae==="]"&&N.imageAltText){k.highlightFormatting&&(N.formatting="image");var Ee=g(N);return N.imageAltText=!1,N.image=!1,N.inline=N.f=C,Ee}if(ae==="["&&!N.image)return N.linkText&&I.match(/^.*?\]/)||(N.linkText=!0,k.highlightFormatting&&(N.formatting="link")),g(N);if(ae==="]"&&N.linkText){k.highlightFormatting&&(N.formatting="link");var Ee=g(N);return N.linkText=!1,N.inline=N.f=I.match(/\(.*?\)| ?\[.*?\]/,!1)?C:h,Ee}if(ae==="<"&&I.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=o,k.highlightFormatting&&(N.formatting="link");var Ee=g(N);return Ee?Ee+=" ":Ee="",Ee+W.linkInline}if(ae==="<"&&I.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=o,k.highlightFormatting&&(N.formatting="link");var Ee=g(N);return Ee?Ee+=" ":Ee="",Ee+W.linkEmail}if(k.xml&&ae==="<"&&I.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var ue=I.string.indexOf(">",I.pos);if(ue!=-1){var te=I.string.substring(I.start,ue);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(te)&&(N.md_inside=!0)}return I.backUp(1),N.htmlState=ne.startState(X),u(I,N,D)}if(k.xml&&ae==="<"&&I.match(/^\/\w*?>/))return N.md_inside=!1,"tag";if(ae==="*"||ae==="_"){for(var ce=1,se=I.pos==1?" ":I.string.charAt(I.pos-2);ce<3&&I.eat(ae);)ce++;var we=I.peek()||" ",Le=!/\s/.test(we)&&(!d.test(we)||/\s/.test(se)||d.test(se)),xe=!/\s/.test(se)&&(!d.test(se)||/\s/.test(we)||d.test(we)),Pe=null,Ne=null;if(ce%2&&(!N.em&&Le&&(ae==="*"||!xe||d.test(se))?Pe=!0:N.em==ae&&xe&&(ae==="*"||!Le||d.test(we))&&(Pe=!1)),ce>1&&(!N.strong&&Le&&(ae==="*"||!xe||d.test(se))?Ne=!0:N.strong==ae&&xe&&(ae==="*"||!Le||d.test(we))&&(Ne=!1)),Ne!=null||Pe!=null){k.highlightFormatting&&(N.formatting=Pe==null?"strong":Ne==null?"em":"strong em"),Pe===!0&&(N.em=ae),Ne===!0&&(N.strong=ae);var Te=g(N);return Pe===!1&&(N.em=!1),Ne===!1&&(N.strong=!1),Te}}else if(ae===" "&&(I.eat("*")||I.eat("_"))){if(I.peek()===" ")return g(N);I.backUp(1)}if(k.strikethrough){if(ae==="~"&&I.eatWhile(ae)){if(N.strikethrough){k.highlightFormatting&&(N.formatting="strikethrough");var Te=g(N);return N.strikethrough=!1,Te}else if(I.match(/^[^\s]/,!1))return N.strikethrough=!0,k.highlightFormatting&&(N.formatting="strikethrough"),g(N)}else if(ae===" "&&I.match(/^~~/,!0)){if(I.peek()===" ")return g(N);I.backUp(2)}}if(k.emoji&&ae===":"&&I.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){N.emoji=!0,k.highlightFormatting&&(N.formatting="emoji");var Be=g(N);return N.emoji=!1,Be}return ae===" "&&(I.match(/^ +$/,!1)?N.trailingSpace++:N.trailingSpace&&(N.trailingSpaceNewLine=!0)),g(N)}function o(I,N){var Y=I.next();if(Y===">"){N.f=N.inline=h,k.highlightFormatting&&(N.formatting="link");var q=g(N);return q?q+=" ":q="",q+W.linkInline}return I.match(/^[^>]+/,!0),W.linkInline}function C(I,N){if(I.eatSpace())return null;var Y=I.next();return Y==="("||Y==="["?(N.f=N.inline=v(Y==="("?")":"]"),k.highlightFormatting&&(N.formatting="link-string"),N.linkHref=!0,g(N)):"error"}var x={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function v(I){return function(N,Y){var q=N.next();if(q===I){Y.f=Y.inline=h,k.highlightFormatting&&(Y.formatting="link-string");var ae=g(Y);return Y.linkHref=!1,ae}return N.match(x[I]),Y.linkHref=!0,g(Y)}}function R(I,N){return I.match(/^([^\]\\]|\\.)*\]:/,!1)?(N.f=B,I.next(),k.highlightFormatting&&(N.formatting="link"),N.linkText=!0,g(N)):s(I,N,h)}function B(I,N){if(I.match(/^\]:/,!0)){N.f=N.inline=j,k.highlightFormatting&&(N.formatting="link");var Y=g(N);return N.linkText=!1,Y}return I.match(/^([^\]\\]|\\.)+/,!0),W.linkText}function j(I,N){return I.eatSpace()?null:(I.match(/^[^\s]+/,!0),I.peek()===void 0?N.linkTitle=!0:I.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),N.f=N.inline=h,W.linkHref+" url")}var K={startState:function(){return{f:p,prevLine:{stream:null},thisLine:{stream:null},block:p,htmlState:null,indentation:0,inline:h,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(I){return{f:I.f,prevLine:I.prevLine,thisLine:I.thisLine,block:I.block,htmlState:I.htmlState&&ne.copyState(X,I.htmlState),indentation:I.indentation,localMode:I.localMode,localState:I.localMode?ne.copyState(I.localMode,I.localState):null,inline:I.inline,text:I.text,formatting:!1,linkText:I.linkText,linkTitle:I.linkTitle,linkHref:I.linkHref,code:I.code,em:I.em,strong:I.strong,strikethrough:I.strikethrough,emoji:I.emoji,header:I.header,setext:I.setext,hr:I.hr,taskList:I.taskList,list:I.list,listStack:I.listStack.slice(0),quote:I.quote,indentedCode:I.indentedCode,trailingSpace:I.trailingSpace,trailingSpaceNewLine:I.trailingSpaceNewLine,md_inside:I.md_inside,fencedEndRE:I.fencedEndRE}},token:function(I,N){if(N.formatting=!1,I!=N.thisLine.stream){if(N.header=0,N.hr=!1,I.match(/^\s*$/,!0))return m(N),null;if(N.prevLine=N.thisLine,N.thisLine={stream:I},N.taskList=!1,N.trailingSpace=0,N.trailingSpaceNewLine=!1,!N.localState&&(N.f=N.block,N.f!=D)){var Y=I.match(/^\s*/,!0)[0].replace(/\t/g,a).length;if(N.indentation=Y,N.indentationDiff=null,Y>0)return null}}return N.f(I,N)},innerMode:function(I){return I.block==D?{state:I.htmlState,mode:X}:I.localState?{state:I.localState,mode:I.localMode}:{state:I,mode:K}},indent:function(I,N,Y){return I.block==D&&X.indent?X.indent(I.htmlState,N,Y):I.localState&&I.localMode.indent?I.localMode.indent(I.localState,N,Y):ne.Pass},blankLine:m,getType:g,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return K},"xml"),ne.defineMIME("text/markdown","markdown"),ne.defineMIME("text/x-markdown","markdown")})},nVVt:function(lt,$e){lt.exports={MODE_NUMBER:1<<0,MODE_ALPHA_NUM:1<<1,MODE_8BIT_BYTE:1<<2,MODE_KANJI:1<<3}},osHv:function(lt,$e,ie){(function(ne){ne(ie("VrN/"))})(function(ne){"use strict";var $=ne.Pos;function k(d,a){return d.line-a.line||d.ch-a.ch}var X="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",U=X+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",O=new RegExp("<(/?)(["+X+"]["+U+"]*)","g");function W(d,a,s,u){this.line=a,this.ch=s,this.cm=d,this.text=d.getLine(a),this.min=u?Math.max(u.from,d.firstLine()):d.firstLine(),this.max=u?Math.min(u.to-1,d.lastLine()):d.lastLine()}function F(d,a){var s=d.cm.getTokenTypeAt($(d.line,a));return s&&/\btag\b/.test(s)}function P(d){return d.line>=d.max?void 0:(d.ch=0,d.text=d.cm.getLine(++d.line),!0)}function w(d){return d.line<=d.min?void 0:(d.text=d.cm.getLine(--d.line),d.ch=d.text.length,!0)}function f(d){for(;;){var a=d.text.indexOf(">",d.ch);if(a==-1){if(P(d))continue;return}if(!F(d,a+1)){d.ch=a+1;continue}var s=d.text.lastIndexOf("/",a),u=s>-1&&!/\S/.test(d.text.slice(s+1,a));return d.ch=a+1,u?"selfClose":"regular"}}function b(d){for(;;){var a=d.ch?d.text.lastIndexOf("<",d.ch-1):-1;if(a==-1){if(w(d))continue;return}if(!F(d,a+1)){d.ch=a;continue}O.lastIndex=a,d.ch=a;var s=O.exec(d.text);if(s&&s.index==a)return s}}function M(d){for(;;){O.lastIndex=d.ch;var a=O.exec(d.text);if(!a){if(P(d))continue;return}if(!F(d,a.index+1)){d.ch=a.index+1;continue}return d.ch=a.index+a[0].length,a}}function A(d){for(;;){var a=d.ch?d.text.lastIndexOf(">",d.ch-1):-1;if(a==-1){if(w(d))continue;return}if(!F(d,a+1)){d.ch=a;continue}var s=d.text.lastIndexOf("/",a),u=s>-1&&!/\S/.test(d.text.slice(s+1,a));return d.ch=a+1,u?"selfClose":"regular"}}function S(d,a){for(var s=[];;){var u=M(d),_,m=d.line,p=d.ch-(u?u[0].length:0);if(!u||!(_=f(d)))return;if(_=="selfClose")continue;if(u[1]){for(var D=s.length-1;D>=0;--D)if(s[D]==u[2]){s.length=D;break}if(D<0&&(!a||a==u[2]))return{tag:u[2],from:$(m,p),to:$(d.line,d.ch)}}else s.push(u[2])}}function T(d,a){for(var s=[];;){var u=A(d);if(!u)return;if(u=="selfClose"){b(d);continue}var _=d.line,m=d.ch,p=b(d);if(!p)return;if(p[1])s.push(p[2]);else{for(var D=s.length-1;D>=0;--D)if(s[D]==p[2]){s.length=D;break}if(D<0&&(!a||a==p[2]))return{tag:p[2],from:$(d.line,d.ch),to:$(_,m)}}}}ne.registerHelper("fold","xml",function(d,a){for(var s=new W(d,a.line,0);;){var u=M(s);if(!u||s.line!=a.line)return;var _=f(s);if(!_)return;if(!u[1]&&_!="selfClose"){var m=$(s.line,s.ch),p=S(s,u[2]);return p&&k(p.from,m)>0?{from:m,to:p.from}:null}}}),ne.findMatchingTag=function(d,a,s){var u=new W(d,a.line,a.ch,s);if(u.text.indexOf(">")==-1&&u.text.indexOf("<")==-1)return;var _=f(u),m=_&&$(u.line,u.ch),p=_&&b(u);if(!_||!p||k(u,a)>0)return;var D={from:$(u.line,u.ch),to:m,tag:p[2]};return _=="selfClose"?{open:D,close:null,at:"open"}:p[1]?{open:T(u,p[2]),close:D,at:"close"}:(u=new W(d,m.line,m.ch,s),{open:D,close:S(u,p[2]),at:"open"})},ne.findEnclosingTag=function(d,a,s,u){for(var _=new W(d,a.line,a.ch,s);;){var m=T(_,u);if(!m)break;var p=new W(d,a.line,a.ch,s),D=S(p,m.tag);if(D)return{open:m,close:D}}},ne.scanForClosingTag=function(d,a,s,u){var _=new W(d,a.line,a.ch,u?{from:0,to:u}:null);return S(_,s)}})},p5ED:function(lt,$e,ie){"use strict";var ne=ie("+L6B"),$=ie("2/Rp"),k=ie("5Dmo"),X=ie("3S7+"),U=ie("k1fw"),O=ie("9og8"),W=ie("tJVT"),F=ie("WmNS"),P=ie.n(F),w=ie("q1tI"),f=ie.n(w),b=ie("vHTk"),M=ie.n(b),A=ie("yEEn"),S=ie("ZW9T"),T=ie("1vsH"),d=ie("V0Rq"),a=ie("m3rI"),s=function(_){var m=_.name,p=_.data,D=_.theme,E=_.type,g=_.filename,c=_.monacoEditor,h=_.className,o=_.style,C=_.close,x=_.onClose,v=_.hasMask,R=_.otherData,B=R===void 0?{}:R,j=Object(w.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),K=Object(W.a)(j,2),I=K[0],N=K[1],Y=Object(w.useState)(""),q=Object(W.a)(Y,2),ae=q[0],he=q[1],_e=Object(w.useState)(),be=Object(W.a)(_e,2),Ce=be[0],Te=be[1],Ee,me=1024*1024,ue=10*me,te=Object(w.useRef)();E==="office"&&(Ee=Object(T.R)(p).filesize,Ee>ue&&(E="other")),g&&(c.filename=g),Object(w.useEffect)(function(){var Le,xe,Pe=(Le=document.cookie)===null||Le===void 0||((xe=Le.replace(/\s/g,""))===null||xe===void 0)?void 0:xe.split(";");Pe==null||Pe.map(function(Ne){var Be=Ne.split("=");Be[0]==="_educoder_session"&&he(Be[1])})},[]),Object(w.useEffect)(function(){E==="office"&&ce()},[E]);var ce=function(){var Le=Object(O.a)(P.a.mark(function xe(){var Pe,Ne,Be;return P.a.wrap(function(Ue){for(;;)switch(Ue.prev=Ue.next){case 0:return console.log("data:",p),Pe=p,p.startsWith("http")||(Pe=location.origin+Pe),Ne=new URL(Pe).pathname.split("/").pop(),Ue.next=6,Object(d.U)({attachment_id:Ne});case 6:Be=Ue.sent,Te(Be);case 8:case"end":return Ue.stop()}},xe)}));return function(){return Le.apply(this,arguments)}}(),se=function(){if(p.startsWith("http")||p.startsWith("blob:")){we();return}Object(T.x)(g||"educoder",p,g)},we=function(){Object(T.v)(g||"educoder",decodeURIComponent(p))};return f.a.createElement("div",{style:Object(U.a)({},o||{}),className:"".concat(v&&M.a.bgBlack," ").concat(E?M.a.wrp:"hide")},C&&f.a.createElement("div",{className:M.a.close,ref:te},f.a.createElement(X.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return te.current}},f.a.createElement("span",{onClick:we},f.a.createElement("i",{className:"icon-quxiaozhiding"}))),f.a.createElement(X.a,{title:"\u5173\u95ED",getPopupContainer:function(){return te.current}},f.a.createElement("span",{className:"",onClick:function(){x(),Te(null)}},f.a.createElement("i",{className:"icon-guanbi1"})))),f.a.createElement("div",{className:"".concat(M.a[h]," ").concat(h," ").concat(M.a.monaco," ").concat(E==="txt"?"show":"hide")},E==="txt"&&f.a.createElement(S.b,c)),E==="audio"&&f.a.createElement("audio",{src:"".concat((p==null?void 0:p.indexOf("http://"))>-1||(p==null?void 0:p.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(p),autoPlay:!0}),E==="video"&&f.a.createElement(f.a.Fragment,null,(p==null?void 0:p.indexOf("http"))>-1?f.a.createElement("video",{controls:!0,src:"".concat(p),autoPlay:!0}):f.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(p),autoPlay:!0})),E==="office"&&Ce&&f.a.createElement("iframe",{src:"/react/build/office.html?key=".concat(Ce.key,"&url=").concat(a.a.API_SERVER+Ce.url,"&callbackUrl=").concat(a.a.API_SERVER+Ce.callbackUrl,"&fileType=").concat(Ce.fileType,"&title=").concat(Ce.title,"&model=view")}),(E==="xlsx"||E==="doc"||E==="pptx"||E==="docx")&&f.a.createElement("iframe",{src:"/react/build/office.html?key=".concat(B.key,"&url=").concat(a.a.API_SERVER+B.url,"&callbackUrl=").concat(a.a.API_SERVER+B.callbackUrl,"&fileType=").concat(B.fileType,"&title=").concat(B.title,"&model=").concat(B.model)}),E==="html"&&f.a.createElement("iframe",{src:p+"&disposition=inline"}),E==="pdf"&&f.a.createElement("embed",{className:M.a.embed,src:p,type:"application/pdf"}),E==="image"&&f.a.createElement("img",{src:"".concat((p==null?void 0:p.indexOf("http://"))>-1||(p==null?void 0:p.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(p)}),E==="other"&&f.a.createElement("div",null,f.a.createElement($.a,{type:"primary",size:"large",onClick:se},f.a.createElement(A.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),E==="download"&&f.a.createElement($.a,{type:"primary",size:"large",onClick:se},f.a.createElement(A.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))};$e.a=s},"p77/":function(lt,$e,ie){},"rAM+":function(lt,$e,ie){"use strict";ie.d($e,"a",function(){return $});var ne=ie("Qw5x");function $(k,X){var U;if(typeof Symbol=="undefined"||k[Symbol.iterator]==null){if(Array.isArray(k)||(U=Object(ne.a)(k))||X&&k&&typeof k.length=="number"){U&&(k=U);var O=0,W=function(){};return{s:W,n:function(){return O>=k.length?{done:!0}:{done:!1,value:k[O++]}},e:function(b){throw b},f:W}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var F=!0,P=!1,w;return{s:function(){U=k[Symbol.iterator]()},n:function(){var b=U.next();return F=b.done,b},e:function(b){P=!0,w=b},f:function(){try{!F&&U.return!=null&&U.return()}finally{if(P)throw w}}}}},rUJ1:function(lt,$e){const ie=/[&<>"']/,ne=/[&<>"']/g,$=/[<>"']|&(?!#?\w+;)/,k=/[<>"']|&(?!#?\w+;)/g,X={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},U=E=>X[E];function O(E,g){if(g){if(ie.test(E))return E.replace(ne,U)}else if($.test(E))return E.replace(k,U);return E}const W=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function F(E){return E.replace(W,(g,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 P=/(^|[^\[])\^/g;function w(E,g){E=E.source||E,g=g||"";const c={replace:(h,o)=>(o=o.source||o,o=o.replace(P,"$1"),E=E.replace(h,o),c),getRegex:()=>new RegExp(E,g)};return c}const f=/[^\w:]/g,b=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function M(E,g,c){if(E){let h;try{h=decodeURIComponent(F(c)).replace(f,"").toLowerCase()}catch(o){return null}if(h.indexOf("javascript:")===0||h.indexOf("vbscript:")===0||h.indexOf("data:")===0)return null}g&&!b.test(c)&&(c=a(g,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(h){return null}return c}const A={},S=/^[^:]+:\/*[^/]*$/,T=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(E,g){A[" "+E]||(S.test(E)?A[" "+E]=E+"/":A[" "+E]=m(E,"/",!0)),E=A[" "+E];const c=E.indexOf(":")===-1;return g.substring(0,2)==="//"?c?g:E.replace(T,"$1")+g:g.charAt(0)==="/"?c?g:E.replace(d,"$1")+g:E+g}const s={exec:function(){}};function u(E){let g=1,c,h;for(;g<arguments.length;g++){c=arguments[g];for(h in c)Object.prototype.hasOwnProperty.call(c,h)&&(E[h]=c[h])}return E}function _(E,g){const c=E.replace(/\|/g,(C,x,v)=>{let R=!1,B=x;for(;--B>=0&&v[B]==="\\";)R=!R;return R?"|":" |"}),h=c.split(/ \|/);let o=0;if(h.length>g)h.splice(g);else for(;h.length<g;)h.push("");for(;o<h.length;o++)h[o]=h[o].trim().replace(/\\\|/g,"|");return h}function m(E,g,c){const h=E.length;if(h===0)return"";let o=0;for(;o<h;){const C=E.charAt(h-o-1);if(C===g&&!c)o++;else if(C!==g&&c)o++;else break}return E.substr(0,h-o)}function p(E,g){if(E.indexOf(g[1])===-1)return-1;const c=E.length;let h=0,o=0;for(;o<c;o++)if(E[o]==="\\")o++;else if(E[o]===g[0])h++;else if(E[o]===g[1]&&(h--,h<0))return o;return-1}function D(E){E&&E.sanitize&&!E.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")}lt.exports={escape:O,unescape:F,edit:w,cleanUrl:M,resolveUrl:a,noopTest:s,merge:u,splitCells:_,rtrim:m,findClosingBracket:p,checkSanitizeDeprecation:D}},rcnY:function(lt,$e,ie){var ne=ie("aRTE");function $(k,X){this.totalCount=k,this.dataCount=X}$.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],$.getRSBlocks=function(k,X){var U=$.getRsBlockTable(k,X);if(U==null)throw new Error("bad rs block @ typeNumber:"+k+"/errorCorrectLevel:"+X);for(var O=U.length/3,W=new Array,F=0;F<O;F++)for(var P=U[F*3+0],w=U[F*3+1],f=U[F*3+2],b=0;b<P;b++)W.push(new $(w,f));return W},$.getRsBlockTable=function(k,X){switch(X){case ne.L:return $.RS_BLOCK_TABLE[(k-1)*4+0];case ne.M:return $.RS_BLOCK_TABLE[(k-1)*4+1];case ne.Q:return $.RS_BLOCK_TABLE[(k-1)*4+2];case ne.H:return $.RS_BLOCK_TABLE[(k-1)*4+3];default:return}},lt.exports=$},ulZh:function(lt,$e,ie){typeof window!="undefined"&&function($,k){lt.exports=k()}(this,function(){return function(ne){var $={};function k(X){if($[X])return $[X].exports;var U=$[X]={i:X,l:!1,exports:{}};return ne[X].call(U.exports,U,U.exports,k),U.l=!0,U.exports}return k.m=ne,k.c=$,k.d=function(X,U,O){k.o(X,U)||Object.defineProperty(X,U,{enumerable:!0,get:O})},k.r=function(X){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(X,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(X,"__esModule",{value:!0})},k.t=function(X,U){if(U&1&&(X=k(X)),U&8)return X;if(U&4&&typeof X=="object"&&X&&X.__esModule)return X;var O=Object.create(null);if(k.r(O),Object.defineProperty(O,"default",{enumerable:!0,value:X}),U&2&&typeof X!="string")for(var W in X)k.d(O,W,function(F){return X[F]}.bind(null,W));return O},k.n=function(X){var U=X&&X.__esModule?function(){return X.default}:function(){return X};return k.d(U,"a",U),U},k.o=function(X,U){return Object.prototype.hasOwnProperty.call(X,U)},k.p="/dist/",k(k.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ne,$,k){"use strict";var X=Object.prototype.hasOwnProperty,U="~";function O(){}Object.create&&(O.prototype=Object.create(null),new O().__proto__||(U=!1));function W(f,b,M){this.fn=f,this.context=b,this.once=M||!1}function F(f,b,M,A,S){if(typeof M!="function")throw new TypeError("The listener must be a function");var T=new W(M,A||f,S),d=U?U+b:b;return f._events[d]?f._events[d].fn?f._events[d]=[f._events[d],T]:f._events[d].push(T):(f._events[d]=T,f._eventsCount++),f}function P(f,b){--f._eventsCount===0?f._events=new O:delete f._events[b]}function w(){this._events=new O,this._eventsCount=0}w.prototype.eventNames=function(){var b=[],M,A;if(this._eventsCount===0)return b;for(A in M=this._events)X.call(M,A)&&b.push(U?A.slice(1):A);return Object.getOwnPropertySymbols?b.concat(Object.getOwnPropertySymbols(M)):b},w.prototype.listeners=function(b){var M=U?U+b:b,A=this._events[M];if(!A)return[];if(A.fn)return[A.fn];for(var S=0,T=A.length,d=new Array(T);S<T;S++)d[S]=A[S].fn;return d},w.prototype.listenerCount=function(b){var M=U?U+b:b,A=this._events[M];return A?A.fn?1:A.length:0},w.prototype.emit=function(b,M,A,S,T,d){var a=U?U+b:b;if(!this._events[a])return!1;var s=this._events[a],u=arguments.length,_,m;if(s.fn){s.once&&this.removeListener(b,s.fn,void 0,!0);switch(u){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,M),!0;case 3:return s.fn.call(s.context,M,A),!0;case 4:return s.fn.call(s.context,M,A,S),!0;case 5:return s.fn.call(s.context,M,A,S,T),!0;case 6:return s.fn.call(s.context,M,A,S,T,d),!0}for(m=1,_=new Array(u-1);m<u;m++)_[m-1]=arguments[m];s.fn.apply(s.context,_)}else{var p=s.length,D;for(m=0;m<p;m++){s[m].once&&this.removeListener(b,s[m].fn,void 0,!0);switch(u){case 1:s[m].fn.call(s[m].context);break;case 2:s[m].fn.call(s[m].context,M);break;case 3:s[m].fn.call(s[m].context,M,A);break;case 4:s[m].fn.call(s[m].context,M,A,S);break;default:if(!_)for(D=1,_=new Array(u-1);D<u;D++)_[D-1]=arguments[D];s[m].fn.apply(s[m].context,_)}}}return!0},w.prototype.on=function(b,M,A){return F(this,b,M,A,!1)},w.prototype.once=function(b,M,A){return F(this,b,M,A,!0)},w.prototype.removeListener=function(b,M,A,S){var T=U?U+b:b;if(!this._events[T])return this;if(!M)return P(this,T),this;var d=this._events[T];if(d.fn)d.fn===M&&(!S||d.once)&&(!A||d.context===A)&&P(this,T);else{for(var a=0,s=[],u=d.length;a<u;a++)(d[a].fn!==M||S&&!d[a].once||A&&d[a].context!==A)&&s.push(d[a]);s.length?this._events[T]=s.length===1?s[0]:s:P(this,T)}return this},w.prototype.removeAllListeners=function(b){var M;return b?(M=U?U+b:b,this._events[M]&&P(this,M)):(this._events=new O,this._eventsCount=0),this},w.prototype.off=w.prototype.removeListener,w.prototype.addListener=w.prototype.on,w.prefixed=U,w.EventEmitter=w,ne.exports=w},"./node_modules/url-toolkit/src/url-toolkit.js":function(ne,$,k){(function(X){var U=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,O=/^([^\/?#]*)([^]*)$/,W=/(?:\/|^)\.(?=\/)/g,F=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,P={buildAbsoluteURL:function(w,f,b){if(b=b||{},w=w.trim(),f=f.trim(),!f){if(!b.alwaysNormalize)return w;var M=P.parseURL(w);if(!M)throw new Error("Error trying to parse base URL.");return M.path=P.normalizePath(M.path),P.buildURLFromParts(M)}var A=P.parseURL(f);if(!A)throw new Error("Error trying to parse relative URL.");if(A.scheme)return b.alwaysNormalize?(A.path=P.normalizePath(A.path),P.buildURLFromParts(A)):f;var S=P.parseURL(w);if(!S)throw new Error("Error trying to parse base URL.");if(!S.netLoc&&S.path&&S.path[0]!=="/"){var T=O.exec(S.path);S.netLoc=T[1],S.path=T[2]}S.netLoc&&!S.path&&(S.path="/");var d={scheme:S.scheme,netLoc:A.netLoc,path:null,params:A.params,query:A.query,fragment:A.fragment};if(!A.netLoc&&(d.netLoc=S.netLoc,A.path[0]!=="/"))if(!A.path)d.path=S.path,A.params||(d.params=S.params,A.query||(d.query=S.query));else{var a=S.path,s=a.substring(0,a.lastIndexOf("/")+1)+A.path;d.path=P.normalizePath(s)}return d.path===null&&(d.path=b.alwaysNormalize?P.normalizePath(A.path):A.path),P.buildURLFromParts(d)},parseURL:function(w){var f=U.exec(w);return f?{scheme:f[1]||"",netLoc:f[2]||"",path:f[3]||"",params:f[4]||"",query:f[5]||"",fragment:f[6]||""}:null},normalizePath:function(w){for(w=w.split("").reverse().join("").replace(W,"");w.length!==(w=w.replace(F,"")).length;);return w.split("").reverse().join("")},buildURLFromParts:function(w){return w.scheme+w.netLoc+w.path+w.params+w.query+w.fragment}};ne.exports=P})(this)},"./node_modules/webworkify-webpack/index.js":function(ne,$,k){function X(b){var M={};function A(T){if(M[T])return M[T].exports;var d=M[T]={i:T,l:!1,exports:{}};return b[T].call(d.exports,d,d.exports,A),d.l=!0,d.exports}A.m=b,A.c=M,A.i=function(T){return T},A.d=function(T,d,a){A.o(T,d)||Object.defineProperty(T,d,{configurable:!1,enumerable:!0,get:a})},A.r=function(T){Object.defineProperty(T,"__esModule",{value:!0})},A.n=function(T){var d=T&&T.__esModule?function(){return T.default}:function(){return T};return A.d(d,"a",d),d},A.o=function(T,d){return Object.prototype.hasOwnProperty.call(T,d)},A.p="/",A.oe=function(T){throw console.error(T),T};var S=A(A.s=ENTRY_MODULE);return S.default||S}var U="[\\.|\\-|\\+|\\w|/|@]+",O="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+U+").*?\\)";function W(b){return(b+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function F(b){return!isNaN(1*b)}function P(b,M,A){var S={};S[A]=[];var T=M.toString(),d=T.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!d)return S;for(var a=d[1],s=new RegExp("(\\\\n|\\W)"+W(a)+O,"g"),u;u=s.exec(T);){if(u[3]==="dll-reference")continue;S[A].push(u[3])}for(s=new RegExp("\\("+W(a)+'\\("(dll-reference\\s('+U+'))"\\)\\)'+O,"g");u=s.exec(T);)b[u[2]]||(S[A].push(u[1]),b[u[2]]=k(u[1]).m),S[u[2]]=S[u[2]]||[],S[u[2]].push(u[4]);for(var _=Object.keys(S),m=0;m<_.length;m++)for(var p=0;p<S[_[m]].length;p++)F(S[_[m]][p])&&(S[_[m]][p]=1*S[_[m]][p]);return S}function w(b){var M=Object.keys(b);return M.reduce(function(A,S){return A||b[S].length>0},!1)}function f(b,M){for(var A={main:[M]},S={main:[]},T={main:{}};w(A);)for(var d=Object.keys(A),a=0;a<d.length;a++){var s=d[a],u=A[s],_=u.pop();if(T[s]=T[s]||{},T[s][_]||!b[s][_])continue;T[s][_]=!0,S[s]=S[s]||[],S[s].push(_);for(var m=P(b,b[s][_],s),p=Object.keys(m),D=0;D<p.length;D++)A[p[D]]=A[p[D]]||[],A[p[D]]=A[p[D]].concat(m[p[D]])}return S}ne.exports=function(b,M){M=M||{};var A={main:k.m},S=M.all?{main:Object.keys(A.main)}:f(A,b),T="";Object.keys(S).filter(function(_){return _!=="main"}).forEach(function(_){for(var m=0;S[_][m];)m++;S[_].push(m),A[_][m]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",T=T+"var "+_+" = ("+X.toString().replace("ENTRY_MODULE",JSON.stringify(m))+")({"+S[_].map(function(p){return""+JSON.stringify(p)+": "+A[_][p].toString()}).join(",")+`});
`}),T=T+"new (("+X.toString().replace("ENTRY_MODULE",JSON.stringify(b))+")({"+S.main.map(function(_){return""+JSON.stringify(_)+": "+A.main[_].toString()}).join(",")+"}))(self);";var d=new window.Blob([T],{type:"text/javascript"});if(M.bare)return d;var a=window.URL||window.webkitURL||window.mozURL||window.msURL,s=a.createObjectURL(d),u=new window.Worker(s);return u.objectURL=s,u}},"./src/config.ts":function(ne,$,k){"use strict";k.r($),k.d($,"hlsDefaultConfig",function(){return D}),k.d($,"mergeConfig",function(){return g}),k.d($,"enableStreamingMode",function(){return c});var X=k("./src/controller/abr-controller.ts"),U=k("./src/controller/audio-stream-controller.ts"),O=k("./src/controller/audio-track-controller.ts"),W=k("./src/controller/subtitle-stream-controller.ts"),F=k("./src/controller/subtitle-track-controller.ts"),P=k("./src/controller/buffer-controller.ts"),w=k("./src/controller/timeline-controller.ts"),f=k("./src/controller/cap-level-controller.ts"),b=k("./src/controller/fps-controller.ts"),M=k("./src/controller/eme-controller.ts"),A=k("./src/controller/cmcd-controller.ts"),S=k("./src/utils/xhr-loader.ts"),T=k("./src/utils/fetch-loader.ts"),d=k("./src/utils/cues.ts"),a=k("./src/utils/mediakeys-helper.ts"),s=k("./src/utils/logger.ts");function u(){return u=Object.assign||function(h){for(var o=1;o<arguments.length;o++){var C=arguments[o];for(var x in C)Object.prototype.hasOwnProperty.call(C,x)&&(h[x]=C[x])}return h},u.apply(this,arguments)}function _(h,o){var C=Object.keys(h);if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(h);o&&(x=x.filter(function(v){return Object.getOwnPropertyDescriptor(h,v).enumerable})),C.push.apply(C,x)}return C}function m(h){for(var o=1;o<arguments.length;o++){var C=arguments[o]!=null?arguments[o]:{};o%2?_(Object(C),!0).forEach(function(x){p(h,x,C[x])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(C)):_(Object(C)).forEach(function(x){Object.defineProperty(h,x,Object.getOwnPropertyDescriptor(C,x))})}return h}function p(h,o,C){return o in h?Object.defineProperty(h,o,{value:C,enumerable:!0,configurable:!0,writable:!0}):h[o]=C,h}var D=m(m({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:S.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:X.default,bufferController:P.default,capLevelController:f.default,fpsController:b.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:a.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},E()),{},{subtitleStreamController:W.SubtitleStreamController,subtitleTrackController:F.default,timelineController:w.TimelineController,audioStreamController:U.default,audioTrackController:O.default,emeController:M.default,cmcdController:A.default});function E(){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 g(h,o){if((o.liveSyncDurationCount||o.liveMaxLatencyDurationCount)&&(o.liveSyncDuration||o.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(o.liveMaxLatencyDurationCount!==void 0&&(o.liveSyncDurationCount===void 0||o.liveMaxLatencyDurationCount<=o.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(o.liveMaxLatencyDuration!==void 0&&(o.liveSyncDuration===void 0||o.liveMaxLatencyDuration<=o.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return u({},h,o)}function c(h){var o=h.loader;if(o!==T.default&&o!==S.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),h.progressive=!1;else{var C=Object(T.fetchSupported)();C&&(h.loader=T.default,h.progressive=!0,h.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ne,$,k){"use strict";k.r($);var X=k("./src/polyfills/number.ts"),U=k("./src/utils/ewma-bandwidth-estimator.ts"),O=k("./src/events.ts"),W=k("./src/utils/buffer-helper.ts"),F=k("./src/errors.ts"),P=k("./src/types/loader.ts"),w=k("./src/utils/logger.ts");function f(A,S){for(var T=0;T<S.length;T++){var d=S[T];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(A,d.key,d)}}function b(A,S,T){return S&&f(A.prototype,S),T&&f(A,T),A}var M=function(){function A(T){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=T;var d=T.config;this.bwEstimator=new U.default(d.abrEwmaSlowVoD,d.abrEwmaFastVoD,d.abrEwmaDefaultEstimate),this.registerListeners()}var S=A.prototype;return S.registerListeners=function(){var d=this.hls;d.on(O.Events.FRAG_LOADING,this.onFragLoading,this),d.on(O.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(O.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.on(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(O.Events.ERROR,this.onError,this)},S.unregisterListeners=function(){var d=this.hls;d.off(O.Events.FRAG_LOADING,this.onFragLoading,this),d.off(O.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(O.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.off(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(O.Events.ERROR,this.onError,this)},S.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},S.onFragLoading=function(d,a){var s=a.frag;if(s.type===P.PlaylistLevelType.MAIN&&!this.timer){var u;this.fragCurrent=s,this.partCurrent=(u=a.part)!=null?u:null,this.timer=self.setInterval(this.onCheck,100)}},S.onLevelLoaded=function(d,a){var s=this.hls.config;a.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},S._abandonRulesCheck=function(){var d=this.fragCurrent,a=this.partCurrent,s=this.hls,u=s.autoLevelEnabled,_=s.config,m=s.media;if(!d||!m)return;var p=a?a.stats:d.stats,D=a?a.duration:d.duration;if(p.aborted){w.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!u||m.paused||!m.playbackRate||!m.readyState)return;var E=performance.now()-p.loading.start,g=Math.abs(m.playbackRate);if(E<=500*D/g)return;var c=s.levels,h=s.minAutoLevel,o=c[d.level],C=p.total||Math.max(p.loaded,Math.round(D*o.maxBitrate/8)),x=Math.max(1,p.bwEstimate?p.bwEstimate/8:p.loaded*1e3/E),v=(C-p.loaded)/x,R=m.currentTime,B=(W.BufferHelper.bufferInfo(m,R,_.maxBufferHole).end-R)/g;if(B>=2*D/g||v<=B)return;var j=Number.POSITIVE_INFINITY,K;for(K=d.level-1;K>h;K--){var I=c[K].maxBitrate;if(j=D*I/(8*.8*x),j<B)break}if(j>=v)return;var N=this.bwEstimator.getEstimate();w.logger.warn("Fragment "+d.sn+(a?" part "+a.index:"")+" of level "+d.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+K+`
Current BW estimate: `+(Object(X.isFiniteNumber)(N)?(N/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+v.toFixed(3)+` s
Estimated load time for the next fragment: `+j.toFixed(3)+` s
Time to underbuffer: `+B.toFixed(3)+" s"),s.nextLoadLevel=K,this.bwEstimator.sample(E,p.loaded),this.clearTimer(),d.loader&&(this.fragCurrent=this.partCurrent=null,d.loader.abort()),s.trigger(O.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:a,stats:p})},S.onFragLoaded=function(d,a){var s=a.frag,u=a.part;if(s.type===P.PlaylistLevelType.MAIN&&Object(X.isFiniteNumber)(s.sn)){var _=u?u.stats:s.stats,m=u?u.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var p=this.hls.levels[s.level],D=(p.loaded?p.loaded.bytes:0)+_.loaded,E=(p.loaded?p.loaded.duration:0)+m;p.loaded={bytes:D,duration:E},p.realBitrate=Math.round(8*D/E)}if(s.bitrateTest){var g={stats:_,frag:s,part:u,id:s.type};this.onFragBuffered(O.Events.FRAG_BUFFERED,g),s.bitrateTest=!1}}},S.onFragBuffered=function(d,a){var s=a.frag,u=a.part,_=u?u.stats:s.stats;if(_.aborted)return;if(s.type!==P.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var m=_.parsing.end-_.loading.start;this.bwEstimator.sample(m,_.loaded),_.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=m/1e3:this.bitrateTestDelay=0},S.onError=function(d,a){switch(a.details){case F.ErrorDetails.FRAG_LOAD_ERROR:case F.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},S.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},S.getNextABRAutoLevel=function(){var d=this.fragCurrent,a=this.partCurrent,s=this.hls,u=s.maxAutoLevel,_=s.config,m=s.minAutoLevel,p=s.media,D=a?a.duration:d?d.duration:0,E=p?p.currentTime:0,g=p&&p.playbackRate!==0?Math.abs(p.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():_.abrEwmaDefaultEstimate,h=(W.BufferHelper.bufferInfo(p,E,_.maxBufferHole).end-E)/g,o=this.findBestLevel(c,m,u,h,_.abrBandWidthFactor,_.abrBandWidthUpFactor);if(o>=0)return o;w.logger.trace((h?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var C=D?Math.min(D,_.maxStarvationDelay):_.maxStarvationDelay,x=_.abrBandWidthFactor,v=_.abrBandWidthUpFactor;if(!h){var R=this.bitrateTestDelay;if(R){var B=D?Math.min(D,_.maxLoadingDelay):_.maxLoadingDelay;C=B-R,w.logger.trace("bitrate test took "+Math.round(1e3*R)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*C)+" ms"),x=v=1}}return o=this.findBestLevel(c,m,u,h+C,x,v),Math.max(o,0)},S.findBestLevel=function(d,a,s,u,_,m){for(var p,D=this.fragCurrent,E=this.partCurrent,g=this.lastLoadedFragLevel,c=this.hls.levels,h=c[g],o=!!(h!=null&&(p=h.details)!==null&&p!==void 0&&p.live),C=h==null?void 0:h.codecSet,x=E?E.duration:D?D.duration:0,v=s;v>=a;v--){var R=c[v];if(!R||C&&R.codecSet!==C)continue;var B=R.details,j=(E?B==null?void 0:B.partTarget:B==null?void 0:B.averagetargetduration)||x,K=void 0;v<=g?K=_*d:K=m*d;var I=c[v].maxBitrate,N=I*j/K;if(w.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+v+"/"+Math.round(K)+"/"+I+"/"+j+"/"+u+"/"+N),K>I&&(!N||o&&!this.bitrateTestDelay||N<u))return v}return-1},b(A,[{key:"nextAutoLevel",get:function(){var d=this._nextAutoLevel,a=this.bwEstimator;if(d!==-1&&(!a||!a.canEstimate()))return d;var s=this.getNextABRAutoLevel();return d!==-1&&(s=Math.min(d,s)),s},set:function(d){this._nextAutoLevel=d}}]),A}();$.default=M},"./src/controller/audio-stream-controller.ts":function(ne,$,k){"use strict";k.r($);var X=k("./src/polyfills/number.ts"),U=k("./src/controller/base-stream-controller.ts"),O=k("./src/events.ts"),W=k("./src/utils/buffer-helper.ts"),F=k("./src/controller/fragment-tracker.ts"),P=k("./src/types/level.ts"),w=k("./src/types/loader.ts"),f=k("./src/loader/fragment.ts"),b=k("./src/demux/chunk-cache.ts"),M=k("./src/demux/transmuxer-interface.ts"),A=k("./src/types/transmuxer.ts"),S=k("./src/controller/fragment-finders.ts"),T=k("./src/utils/discontinuities.ts"),d=k("./src/errors.ts"),a=k("./src/utils/logger.ts");function s(){return s=Object.assign||function(D){for(var E=1;E<arguments.length;E++){var g=arguments[E];for(var c in g)Object.prototype.hasOwnProperty.call(g,c)&&(D[c]=g[c])}return D},s.apply(this,arguments)}function u(D,E){D.prototype=Object.create(E.prototype),D.prototype.constructor=D,_(D,E)}function _(D,E){return _=Object.setPrototypeOf||function(c,h){return c.__proto__=h,c},_(D,E)}var m=100,p=function(D){u(E,D);function E(c,h){var o;return o=D.call(this,c,h,"[audio-stream-controller]")||this,o.videoBuffer=null,o.videoTrackCC=-1,o.waitingVideoCC=-1,o.audioSwitch=!1,o.trackId=-1,o.waitingData=null,o.mainDetails=null,o.bufferFlushed=!1,o._registerListeners(),o}var g=E.prototype;return g.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},g._registerListeners=function(){var h=this.hls;h.on(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.on(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(O.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),h.on(O.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.on(O.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.on(O.Events.ERROR,this.onError,this),h.on(O.Events.BUFFER_RESET,this.onBufferReset,this),h.on(O.Events.BUFFER_CREATED,this.onBufferCreated,this),h.on(O.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.on(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.on(O.Events.FRAG_BUFFERED,this.onFragBuffered,this)},g._unregisterListeners=function(){var h=this.hls;h.off(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(O.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),h.off(O.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.off(O.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.off(O.Events.ERROR,this.onError,this),h.off(O.Events.BUFFER_RESET,this.onBufferReset,this),h.off(O.Events.BUFFER_CREATED,this.onBufferCreated,this),h.off(O.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.off(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.off(O.Events.FRAG_BUFFERED,this.onFragBuffered,this)},g.onInitPtsFound=function(h,o){var C=o.frag,x=o.id,v=o.initPTS;if(x==="main"){var R=C.cc;this.initPTS[C.cc]=v,this.log("InitPTS for cc: "+R+" found from main: "+v),this.videoTrackCC=R,this.state===U.State.WAITING_INIT_PTS&&this.tick()}},g.startLoad=function(h){if(!this.levels){this.startPosition=h,this.state=U.State.STOPPED;return}var o=this.lastCurrentTime;this.stopLoad(),this.setInterval(m),this.fragLoadError=0,o>0&&h===-1?(this.log("Override startPosition with lastCurrentTime @"+o.toFixed(3)),this.state=U.State.IDLE):(this.loadedmetadata=!1,this.state=U.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=h,this.tick()},g.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_TRACK:{var h,o=this.levels,C=this.trackId,x=o==null||((h=o[C])===null||h===void 0)?void 0:h.details;if(x){if(this.waitForCdnTuneIn(x))break;this.state=U.State.WAITING_INIT_PTS}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var v,R=performance.now(),B=this.retryDate;(!B||R>=B||(v=this.media)!==null&&v!==void 0&&v.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=U.State.IDLE);break}case U.State.WAITING_INIT_PTS:{var j=this.waitingData;if(j){var K=j.frag,I=j.part,N=j.cache,Y=j.complete;if(this.initPTS[K.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.FRAG_LOADING;var q=N.flush(),ae={frag:K,part:I,payload:q,networkDetails:null};this._handleFragmentLoadProgress(ae),Y&&D.prototype._handleFragmentLoadComplete.call(this,ae)}else if(this.videoTrackCC!==this.waitingVideoCC)a.logger.log("Waiting fragment cc ("+K.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var he=this.getLoadPosition(),_e=W.BufferHelper.bufferInfo(this.mediaBuffer,he,this.config.maxBufferHole),be=Object(S.fragmentWithinToleranceTest)(_e.end,this.config.maxFragLookUpTolerance,K);be<0&&(a.logger.log("Waiting fragment cc ("+K.cc+") @ "+K.start+" cancelled because another fragment at "+_e.end+" is needed"),this.clearWaitingFragment())}}else this.state=U.State.IDLE}}this.onTickEnd()},g.clearWaitingFragment=function(){var h=this.waitingData;h&&(this.fragmentTracker.removeFragment(h.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.IDLE)},g.onTickEnd=function(){var h=this.media;if(!h||!h.readyState)return;var o=this.mediaBuffer?this.mediaBuffer:h,C=o.buffered;!this.loadedmetadata&&C.length&&(this.loadedmetadata=!0),this.lastCurrentTime=h.currentTime},g.doTickIdle=function(){var h,o,C=this.hls,x=this.levels,v=this.media,R=this.trackId,B=C.config;if(!x||!x[R])return;if(!v&&(this.startFragRequested||!B.startFragPrefetch))return;var j=x[R],K=j.details;if(!K||K.live&&this.levelLastLoaded!==R||this.waitForCdnTuneIn(K)){this.state=U.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,f.ElementaryStreamTypes.AUDIO,w.PlaylistLevelType.AUDIO));var I=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,w.PlaylistLevelType.AUDIO);if(I===null)return;var N=I.len,Y=this.getMaxBufferLength(),q=this.audioSwitch;if(N>=Y&&!q)return;if(!q&&this._streamEnded(I,K)){C.trigger(O.Events.BUFFER_EOS,{type:"audio"}),this.state=U.State.ENDED;return}var ae=K.fragments,he=ae[0].start,_e=I.end;if(q){var be=this.getLoadPosition();_e=be,K.PTSKnown&&be<he&&((I.end>he||I.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),v.currentTime=he+.05))}var Ce=this.getNextFragment(_e,K);if(!Ce){this.bufferFlushed=!0;return}((h=Ce.decryptdata)===null||h===void 0?void 0:h.keyFormat)==="identity"&&!((o=Ce.decryptdata)!==null&&o!==void 0&&o.key)?this.loadKey(Ce,K):this.loadFragment(Ce,K,_e)},g.getMaxBufferLength=function(){var h=D.prototype.getMaxBufferLength.call(this),o=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,w.PlaylistLevelType.MAIN);return o===null?h:Math.max(h,o.len)},g.onMediaDetaching=function(){this.videoBuffer=null,D.prototype.onMediaDetaching.call(this)},g.onAudioTracksUpdated=function(h,o){var C=o.audioTracks;this.resetTransmuxer(),this.levels=C.map(function(x){return new P.Level(x)})},g.onAudioTrackSwitching=function(h,o){var C=!!o.url;this.trackId=o.id;var x=this.fragCurrent;x!=null&&x.loader&&x.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),C?this.setInterval(m):this.resetTransmuxer(),C?(this.audioSwitch=!0,this.state=U.State.IDLE):this.state=U.State.STOPPED,this.tick()},g.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},g.onLevelLoaded=function(h,o){this.mainDetails=o.details},g.onAudioTrackLoaded=function(h,o){var C,x=this.levels,v=o.details,R=o.id;if(!x){this.warn("Audio tracks were reset while loading level "+R);return}this.log("Track "+R+" loaded ["+v.startSN+","+v.endSN+"],duration:"+v.totalduration);var B=x[R],j=0;if(v.live||(C=B.details)!==null&&C!==void 0&&C.live){var K=this.mainDetails;if(v.fragments[0]||(v.deltaUpdateFailed=!0),v.deltaUpdateFailed||!K)return;!B.details&&v.hasProgramDateTime&&K.hasProgramDateTime?(Object(T.alignMediaPlaylistByPDT)(v,K),j=v.fragments[0].start):j=this.alignPlaylists(v,B.details)}B.details=v,this.levelLastLoaded=R,!this.startFragRequested&&(this.mainDetails||!v.live)&&this.setStartPosition(B.details,j),this.state===U.State.WAITING_TRACK&&!this.waitForCdnTuneIn(v)&&(this.state=U.State.IDLE),this.tick()},g._handleFragmentLoadProgress=function(h){var o,C=h.frag,x=h.part,v=h.payload,R=this.config,B=this.trackId,j=this.levels;if(!j){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+C.sn+" of level "+C.level+" will not be buffered");return}var K=j[B];console.assert(K,"Audio track is defined on fragment load progress");var I=K.details;console.assert(I,"Audio track details are defined on fragment load progress");var N=R.defaultAudioCodec||K.audioCodec||"mp4a.40.2",Y=this.transmuxer;Y||(Y=this.transmuxer=new M.default(this.hls,w.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var q=this.initPTS[C.cc],ae=(o=C.initSegment)===null||o===void 0?void 0:o.data;if(q!==void 0){var he=!1,_e=x?x.index:-1,be=_e!==-1,Ce=new A.ChunkMetadata(C.level,C.sn,C.stats.chunkCount,v.byteLength,_e,be);Y.push(v,ae,N,"",C,x,I.totalduration,he,Ce,q)}else{a.logger.log("Unknown video PTS for cc "+C.cc+", waiting for video PTS before demuxing audio frag "+C.sn+" of ["+I.startSN+" ,"+I.endSN+"],track "+B);var Te=this.waitingData=this.waitingData||{frag:C,part:x,cache:new b.default,complete:!1},Ee=Te.cache;Ee.push(new Uint8Array(v)),this.waitingVideoCC=this.videoTrackCC,this.state=U.State.WAITING_INIT_PTS}},g._handleFragmentLoadComplete=function(h){if(this.waitingData){this.waitingData.complete=!0;return}D.prototype._handleFragmentLoadComplete.call(this,h)},g.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},g.onBufferCreated=function(h,o){var C=o.tracks.audio;C&&(this.mediaBuffer=C.buffer),o.tracks.video&&(this.videoBuffer=o.tracks.video.buffer)},g.onFragBuffered=function(h,o){var C=o.frag,x=o.part;if(C.type!==w.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(C)){this.warn("Fragment "+C.sn+(x?" p: "+x.index:"")+" of level "+C.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}C.sn!=="initSegment"&&(this.fragPrevious=C,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(O.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(C,x)},g.onError=function(h,o){switch(o.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(w.PlaylistLevelType.AUDIO,o);break;case d.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case d.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==U.State.ERROR&&this.state!==U.State.STOPPED&&(this.state=o.fatal?U.State.ERROR:U.State.IDLE,this.warn(o.details+" while loading frag, switching to "+this.state+" state"));break;case d.ErrorDetails.BUFFER_FULL_ERROR:if(o.parent==="audio"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var C=!0,x=this.getFwdBufferInfo(this.mediaBuffer,w.PlaylistLevelType.AUDIO);x&&x.len>.5&&(C=!this.reduceMaxBufferLength(x.len)),C&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,D.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},g.onBufferFlushed=function(h,o){var C=o.type;C===f.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},g._handleTransmuxComplete=function(h){var o,C="audio",x=this.hls,v=h.remuxResult,R=h.chunkMeta,B=this.getCurrentContext(R);if(!B){this.warn("The loading context changed while buffering fragment "+R.sn+" of level "+R.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(R.level);return}var j=B.frag,K=B.part,I=v.audio,N=v.text,Y=v.id3,q=v.initSegment;if(this.fragContextChanged(j))return;if(this.state=U.State.PARSING,this.audioSwitch&&I&&this.completeAudioSwitch(),q!=null&&q.tracks&&(this._bufferInitSegment(q.tracks,j,R),x.trigger(O.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:C,tracks:q.tracks})),I){var ae=I.startPTS,he=I.endPTS,_e=I.startDTS,be=I.endDTS;K&&(K.elementaryStreams[f.ElementaryStreamTypes.AUDIO]={startPTS:ae,endPTS:he,startDTS:_e,endDTS:be}),j.setElementaryStreamInfo(f.ElementaryStreamTypes.AUDIO,ae,he,_e,be),this.bufferFragmentData(I,j,K,R)}if(Y!=null&&(o=Y.samples)!==null&&o!==void 0&&o.length){var Ce=s({frag:j,id:C},Y);x.trigger(O.Events.FRAG_PARSING_METADATA,Ce)}if(N){var Te=s({frag:j,id:C},N);x.trigger(O.Events.FRAG_PARSING_USERDATA,Te)}},g._bufferInitSegment=function(h,o,C){if(this.state!==U.State.PARSING)return;h.video&&delete h.video;var x=h.audio;if(!x)return;x.levelCodec=x.codec,x.id="audio",this.log("Init audio buffer, container:"+x.container+", codecs[parsed]=["+x.codec+"]"),this.hls.trigger(O.Events.BUFFER_CODECS,h);var v=x.initSegment;if(v!=null&&v.byteLength){var R={type:"audio",frag:o,part:null,chunkMeta:C,parent:o.type,data:v};this.hls.trigger(O.Events.BUFFER_APPENDING,R)}this.tick()},g.loadFragment=function(h,o,C){var x=this.fragmentTracker.getState(h);this.fragCurrent=h,(this.audioSwitch||x===F.FragmentState.NOT_LOADED||x===F.FragmentState.PARTIAL)&&(h.sn==="initSegment"?this._loadInitSegment(h):o.live&&!Object(X.isFiniteNumber)(this.initPTS[h.cc])?(this.log("Waiting for video PTS in continuity counter "+h.cc+" of live stream before loading audio fragment "+h.sn+" of level "+this.trackId),this.state=U.State.WAITING_INIT_PTS):(this.startFragRequested=!0,D.prototype.loadFragment.call(this,h,o,C)))},g.completeAudioSwitch=function(){var h=this.hls,o=this.media,C=this.trackId;o&&(this.log("Switching audio track : flushing all audio"),D.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,h.trigger(O.Events.AUDIO_TRACK_SWITCHED,{id:C})},E}(U.default);$.default=p},"./src/controller/audio-track-controller.ts":function(ne,$,k){"use strict";k.r($);var X=k("./src/events.ts"),U=k("./src/errors.ts"),O=k("./src/controller/base-playlist-controller.ts"),W=k("./src/types/loader.ts");function F(M,A){for(var S=0;S<A.length;S++){var T=A[S];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(M,T.key,T)}}function P(M,A,S){return A&&F(M.prototype,A),S&&F(M,S),M}function w(M,A){M.prototype=Object.create(A.prototype),M.prototype.constructor=M,f(M,A)}function f(M,A){return f=Object.setPrototypeOf||function(T,d){return T.__proto__=d,T},f(M,A)}var b=function(M){w(A,M);function A(T){var d;return d=M.call(this,T,"[audio-track-controller]")||this,d.tracks=[],d.groupId=null,d.tracksInGroup=[],d.trackId=-1,d.trackName="",d.selectDefaultTrack=!0,d.registerListeners(),d}var S=A.prototype;return S.registerListeners=function(){var d=this.hls;d.on(X.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(X.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(X.Events.LEVEL_LOADING,this.onLevelLoading,this),d.on(X.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.on(X.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(X.Events.ERROR,this.onError,this)},S.unregisterListeners=function(){var d=this.hls;d.off(X.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(X.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(X.Events.LEVEL_LOADING,this.onLevelLoading,this),d.off(X.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.off(X.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(X.Events.ERROR,this.onError,this)},S.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,M.prototype.destroy.call(this)},S.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},S.onManifestParsed=function(d,a){this.tracks=a.audioTracks||[]},S.onAudioTrackLoaded=function(d,a){var s=a.id,u=a.details,_=this.tracksInGroup[s];if(!_){this.warn("Invalid audio track id "+s);return}var m=_.details;_.details=a.details,this.log("audioTrack "+s+" loaded ["+u.startSN+"-"+u.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,a,m))},S.onLevelLoading=function(d,a){this.switchLevel(a.level)},S.onLevelSwitching=function(d,a){this.switchLevel(a.level)},S.switchLevel=function(d){var a=this.hls.levels[d];if(!(a!=null&&a.audioGroupIds))return;var s=a.audioGroupIds[a.urlId];if(this.groupId!==s){this.groupId=s;var u=this.tracks.filter(function(m){return!s||m.groupId===s});this.selectDefaultTrack&&!u.some(function(m){return m.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=u;var _={audioTracks:u};this.log("Updating audio tracks, "+u.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(X.Events.AUDIO_TRACKS_UPDATED,_),this.selectInitialTrack()}},S.onError=function(d,a){if(M.prototype.onError.call(this,d,a),a.fatal||!a.context)return;a.context.type===W.PlaylistContextType.AUDIO_TRACK&&a.context.id===this.trackId&&a.context.groupId===this.groupId&&this.retryLoadingOrFail(a)},S.setAudioTrack=function(d){var a=this.tracksInGroup;if(d<0||d>=a.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=a[this.trackId];this.log("Now switching to audio-track index "+d);var u=a[d],_=u.id,m=u.groupId,p=m===void 0?"":m,D=u.name,E=u.type,g=u.url;if(this.trackId=d,this.trackName=D,this.selectDefaultTrack=!1,this.hls.trigger(X.Events.AUDIO_TRACK_SWITCHING,{id:_,groupId:p,name:D,type:E,url:g}),u.details&&!u.details.live)return;var c=this.switchParams(u.url,s==null?void 0:s.details);this.loadPlaylist(c)},S.selectInitialTrack=function(){var d=this.tracksInGroup;console.assert(d.length,"Initial audio track should be selected when tracks are known");var a=this.trackName,s=this.findTrackId(a)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(X.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},S.findTrackId=function(d){for(var a=this.tracksInGroup,s=0;s<a.length;s++){var u=a[s];if((!this.selectDefaultTrack||u.default)&&(!d||d===u.name))return u.id}return-1},S.loadPlaylist=function(d){var a=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(a)){var s=a.id,u=a.groupId,_=a.url;if(d)try{_=d.addDirectives(_)}catch(m){this.warn("Could not construct new URL with HLS Delivery Directives: "+m)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(X.Events.AUDIO_TRACK_LOADING,{url:_,id:s,groupId:u,deliveryDirectives:d||null})}},P(A,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(d){this.selectDefaultTrack=!1,this.setAudioTrack(d)}}]),A}(O.default);$.default=b},"./src/controller/base-playlist-controller.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return P});var X=k("./src/polyfills/number.ts"),U=k("./src/types/level.ts"),O=k("./src/controller/level-helper.ts"),W=k("./src/utils/logger.ts"),F=k("./src/errors.ts"),P=function(){function w(b,M){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=W.logger.log.bind(W.logger,M+":"),this.warn=W.logger.warn.bind(W.logger,M+":"),this.hls=b}var f=w.prototype;return f.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},f.onError=function(M,A){A.fatal&&A.type===F.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},f.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},f.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},f.stopLoad=function(){this.canLoad=!1,this.clearTimer()},f.switchParams=function(M,A){var S=A==null?void 0:A.renditionReports;if(S)for(var T=0;T<S.length;T++){var d=S[T],a=""+d.URI;if(a===M.substr(-a.length)){var s=parseInt(d["LAST-MSN"]),u=parseInt(d["LAST-PART"]);if(A&&this.hls.config.lowLatencyMode){var _=Math.min(A.age-A.partTarget,A.targetduration);u!==void 0&&_>A.partTarget&&(u+=1)}if(Object(X.isFiniteNumber)(s))return new U.HlsUrlParameters(s,Object(X.isFiniteNumber)(u)?u:void 0,U.HlsSkip.No)}}},f.loadPlaylist=function(M){},f.shouldLoadTrack=function(M){return this.canLoad&&M&&!!M.url&&(!M.details||M.details.live)},f.playlistLoaded=function(M,A,S){var T=this,d=A.details,a=A.stats,s=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(d.advancedDateTime=Date.now()-s,d.live||S!=null&&S.live){if(d.reloaded(S),S&&this.log("live playlist "+M+" "+(d.advanced?"REFRESHED "+d.lastPartSn+"-"+d.lastPartIndex:"MISSED")),S&&d.fragments.length>0&&Object(O.mergeDetails)(S,d),!this.canLoad||!d.live)return;var u,_=void 0,m=void 0;if(d.canBlockReload&&d.endSN&&d.advanced){var p=this.hls.config.lowLatencyMode,D=d.lastPartSn,E=d.endSN,g=d.lastPartIndex,c=g!==-1,h=D===E,o=p?0:g;c?(_=h?E+1:D,m=h?o:g+1):_=E+1;var C=d.age,x=C+d.ageHeader,v=Math.min(x-d.partTarget,d.targetduration*1.5);if(v>0){if(S&&v>S.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+S.tuneInGoal+" to: "+v+" with playlist age: "+d.age),v=0;else{var R=Math.floor(v/d.targetduration);if(_+=R,m!==void 0){var B=Math.round(v%d.targetduration/d.partTarget);m+=B}this.log("CDN Tune-in age: "+d.ageHeader+"s last advanced "+C.toFixed(2)+"s goal: "+v+" skip sn "+R+" to part "+m)}d.tuneInGoal=v}if(u=this.getDeliveryDirectives(d,A.deliveryDirectives,_,m),p||!h){this.loadPlaylist(u);return}}else u=this.getDeliveryDirectives(d,A.deliveryDirectives,_,m);var j=Object(O.computeReloadInterval)(d,a);_!==void 0&&d.canBlockReload&&(j-=d.partTarget||1),this.log("reload live playlist "+M+" in "+Math.round(j)+" ms"),this.timer=self.setTimeout(function(){return T.loadPlaylist(u)},j)}else this.clearTimer()},f.getDeliveryDirectives=function(M,A,S,T){var d=Object(U.getSkipValue)(M,S);return A!=null&&A.skip&&M.deltaUpdateFailed&&(S=A.msn,T=A.part,d=U.HlsSkip.No),new U.HlsUrlParameters(S,T,d)},f.retryLoadingOrFail=function(M){var A=this,S=this.hls.config,T=this.retryCount<S.levelLoadingMaxRetry;if(T){var d;if(this.retryCount++,M.details.indexOf("LoadTimeOut")>-1&&(d=M.context)!==null&&d!==void 0&&d.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+M.details+'"'),this.loadPlaylist();else{var a=Math.min(Math.pow(2,this.retryCount)*S.levelLoadingRetryDelay,S.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return A.loadPlaylist()},a),this.warn("retry playlist loading #"+this.retryCount+" in "+a+' ms after "'+M.details+'"')}}else this.warn('cannot recover from error "'+M.details+'"'),this.clearTimer(),M.fatal=!0;return T},w}()},"./src/controller/base-stream-controller.ts":function(ne,$,k){"use strict";k.r($),k.d($,"State",function(){return E}),k.d($,"default",function(){return g});var X=k("./src/polyfills/number.ts"),U=k("./src/task-loop.ts"),O=k("./src/controller/fragment-tracker.ts"),W=k("./src/utils/buffer-helper.ts"),F=k("./src/utils/logger.ts"),P=k("./src/events.ts"),w=k("./src/errors.ts"),f=k("./src/types/transmuxer.ts"),b=k("./src/utils/mp4-tools.ts"),M=k("./src/utils/discontinuities.ts"),A=k("./src/controller/fragment-finders.ts"),S=k("./src/controller/level-helper.ts"),T=k("./src/loader/fragment-loader.ts"),d=k("./src/crypt/decrypter.ts"),a=k("./src/utils/time-ranges.ts"),s=k("./src/types/loader.ts");function u(c,h){for(var o=0;o<h.length;o++){var C=h[o];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(c,C.key,C)}}function _(c,h,o){return h&&u(c.prototype,h),o&&u(c,o),c}function m(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function p(c,h){c.prototype=Object.create(h.prototype),c.prototype.constructor=c,D(c,h)}function D(c,h){return D=Object.setPrototypeOf||function(C,x){return C.__proto__=x,C},D(c,h)}var E={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"},g=function(c){p(h,c);function h(C,x,v){var R;return R=c.call(this)||this,R.hls=void 0,R.fragPrevious=null,R.fragCurrent=null,R.fragmentTracker=void 0,R.transmuxer=null,R._state=E.STOPPED,R.media=void 0,R.mediaBuffer=void 0,R.config=void 0,R.bitrateTest=!1,R.lastCurrentTime=0,R.nextLoadPosition=0,R.startPosition=0,R.loadedmetadata=!1,R.fragLoadError=0,R.retryDate=0,R.levels=null,R.fragmentLoader=void 0,R.levelLastLoaded=null,R.startFragRequested=!1,R.decrypter=void 0,R.initPTS=[],R.onvseeking=null,R.onvended=null,R.logPrefix="",R.log=void 0,R.warn=void 0,R.logPrefix=v,R.log=F.logger.log.bind(F.logger,v+":"),R.warn=F.logger.warn.bind(F.logger,v+":"),R.hls=C,R.fragmentLoader=new T.default(C.config),R.fragmentTracker=x,R.config=C.config,R.decrypter=new d.default(C,C.config),C.on(P.Events.KEY_LOADED,R.onKeyLoaded,m(R)),R}var o=h.prototype;return o.doTick=function(){this.onTickEnd()},o.onTickEnd=function(){},o.startLoad=function(x){},o.stopLoad=function(){this.fragmentLoader.abort();var x=this.fragCurrent;x&&this.fragmentTracker.removeFragment(x),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=E.STOPPED},o._streamEnded=function(x,v){var R=this.fragCurrent,B=this.fragmentTracker;if(!v.live&&R&&R.sn===v.endSN&&!x.nextStart){var j=B.getState(R);return j===O.FragmentState.PARTIAL||j===O.FragmentState.OK}return!1},o.onMediaAttached=function(x,v){var R=this.media=this.mediaBuffer=v.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),R.addEventListener("seeking",this.onvseeking),R.addEventListener("ended",this.onvended);var B=this.config;this.levels&&B.autoStartLoad&&this.state===E.STOPPED&&this.startLoad(B.startPosition)},o.onMediaDetaching=function(){var x=this.media;x!=null&&x.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),x&&(x.removeEventListener("seeking",this.onvseeking),x.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},o.onMediaSeeking=function(){var x=this.config,v=this.fragCurrent,R=this.media,B=this.mediaBuffer,j=this.state,K=R?R.currentTime:0,I=W.BufferHelper.bufferInfo(B||R,K,x.maxBufferHole);if(this.log("media seeking to "+(Object(X.isFiniteNumber)(K)?K.toFixed(3):K)+", state: "+j),j===E.ENDED)this.resetLoadingState();else if(v&&!I.len){var N=x.maxFragLookUpTolerance,Y=v.start-N,q=v.start+v.duration+N,ae=K>q;(K<Y||ae)&&(ae&&v.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),v.loader.abort()),this.resetLoadingState())}R&&(this.lastCurrentTime=K),!this.loadedmetadata&&!I.len&&(this.nextLoadPosition=this.startPosition=K),this.tickImmediate()},o.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},o.onKeyLoaded=function(x,v){if(this.state!==E.KEY_LOADING||v.frag!==this.fragCurrent||!this.levels)return;this.state=E.IDLE;var R=this.levels[v.frag.level].details;R&&this.loadFragment(v.frag,R,v.frag.start)},o.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},o.onHandlerDestroyed=function(){this.state=E.STOPPED,this.hls.off(P.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,c.prototype.onHandlerDestroyed.call(this)},o.loadKey=function(x,v){this.log("Loading key for "+x.sn+" of ["+v.startSN+"-"+v.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+x.level),this.state=E.KEY_LOADING,this.fragCurrent=x,this.hls.trigger(P.Events.KEY_LOADING,{frag:x})},o.loadFragment=function(x,v,R){this._loadFragForPlayback(x,v,R)},o._loadFragForPlayback=function(x,v,R){var B=this,j=function(I){if(B.fragContextChanged(x)){B.warn("Fragment "+x.sn+(I.part?" p: "+I.part.index:"")+" of level "+x.level+" was dropped during download."),B.fragmentTracker.removeFragment(x);return}x.stats.chunkCount++,B._handleFragmentLoadProgress(I)};this._doFragLoad(x,v,R,j).then(function(K){if(!K)return;B.fragLoadError=0;var I=B.state;if(B.fragContextChanged(x)){(I===E.FRAG_LOADING||I===E.BACKTRACKING||!B.fragCurrent&&I===E.PARSING)&&(B.fragmentTracker.removeFragment(x),B.state=E.IDLE);return}if("payload"in K&&(B.log("Loaded fragment "+x.sn+" of level "+x.level),B.hls.trigger(P.Events.FRAG_LOADED,K),B.state===E.BACKTRACKING)){B.fragmentTracker.backtrack(x,K),B.resetFragmentLoading(x);return}B._handleFragmentLoadComplete(K)}).catch(function(K){B.warn(K),B.resetFragmentLoading(x)})},o.flushMainBuffer=function(x,v,R){if(R===void 0&&(R=null),!(x-v))return;var B={startOffset:x,endOffset:v,type:R};this.fragLoadError=0,this.hls.trigger(P.Events.BUFFER_FLUSHING,B)},o._loadInitSegment=function(x){var v=this;this._doFragLoad(x).then(function(R){if(!R||v.fragContextChanged(x)||!v.levels)throw new Error("init load aborted");return R}).then(function(R){var B=v.hls,j=R.payload,K=x.decryptdata;if(j&&j.byteLength>0&&K&&K.key&&K.iv&&K.method==="AES-128"){var I=self.performance.now();return v.decrypter.webCryptoDecrypt(new Uint8Array(j),K.key.buffer,K.iv.buffer).then(function(N){var Y=self.performance.now();return B.trigger(P.Events.FRAG_DECRYPTED,{frag:x,payload:N,stats:{tstart:I,tdecrypt:Y}}),R.payload=N,R})}return R}).then(function(R){var B=v.fragCurrent,j=v.hls,K=v.levels;if(!K)throw new Error("init load aborted, missing levels");var I=K[x.level].details;console.assert(I,"Level details are defined when init segment is loaded");var N=x.stats;v.state=E.IDLE,v.fragLoadError=0,x.data=new Uint8Array(R.payload),N.parsing.start=N.buffering.start=self.performance.now(),N.parsing.end=N.buffering.end=self.performance.now(),R.frag===B&&j.trigger(P.Events.FRAG_BUFFERED,{stats:N,frag:B,part:null,id:x.type}),v.tick()}).catch(function(R){v.warn(R),v.resetFragmentLoading(x)})},o.fragContextChanged=function(x){var v=this.fragCurrent;return!x||!v||x.level!==v.level||x.sn!==v.sn||x.urlId!==v.urlId},o.fragBufferedComplete=function(x,v){var R=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+x.type+" sn: "+x.sn+(v?" part: "+v.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+x.level+" "+a.default.toString(W.BufferHelper.getBuffered(R))),this.state=E.IDLE,this.tick()},o._handleFragmentLoadComplete=function(x){var v=this.transmuxer;if(!v)return;var R=x.frag,B=x.part,j=x.partsLoaded,K=!j||j.length===0||j.some(function(N){return!N}),I=new f.ChunkMetadata(R.level,R.sn,R.stats.chunkCount+1,0,B?B.index:-1,!K);v.flush(I)},o._handleFragmentLoadProgress=function(x){},o._doFragLoad=function(x,v,R,B){var j=this;if(R===void 0&&(R=null),!this.levels)throw new Error("frag load aborted, missing levels");if(R=Math.max(x.start,R||0),this.config.lowLatencyMode&&v){var K=v.partList;if(K&&B){R>x.end&&v.fragmentHint&&(x=v.fragmentHint);var I=this.getNextPart(K,x,R);if(I>-1){var N=K[I];return this.log("Loading part sn: "+x.sn+" p: "+N.index+" cc: "+x.cc+" of playlist ["+v.startSN+"-"+v.endSN+"] parts [0-"+I+"-"+(K.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+x.level+", target: "+parseFloat(R.toFixed(3))),this.nextLoadPosition=N.start+N.duration,this.state=E.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:x,part:K[I],targetBufferTime:R}),this.doFragPartsLoad(x,K,I,B).catch(function(Y){return j.handleFragLoadError(Y)})}else if(!x.url||this.loadedEndOfParts(K,R))return Promise.resolve(null)}}return this.log("Loading fragment "+x.sn+" cc: "+x.cc+" "+(v?"of ["+v.startSN+"-"+v.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+x.level+", target: "+parseFloat(R.toFixed(3))),Object(X.isFiniteNumber)(x.sn)&&!this.bitrateTest&&(this.nextLoadPosition=x.start+x.duration),this.state=E.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:x,targetBufferTime:R}),this.fragmentLoader.load(x,B).catch(function(Y){return j.handleFragLoadError(Y)})},o.doFragPartsLoad=function(x,v,R,B){var j=this;return new Promise(function(K,I){var N=[],Y=function q(ae){var he=v[ae];j.fragmentLoader.loadPart(x,he,B).then(function(_e){N[he.index]=_e;var be=_e.part;j.hls.trigger(P.Events.FRAG_LOADED,_e);var Ce=v[ae+1];if(Ce&&Ce.fragment===x)q(ae+1);else return K({frag:x,part:be,partsLoaded:N})}).catch(I)};Y(R)})},o.handleFragLoadError=function(x){var v=x.data;return v&&v.details===w.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(v.frag,v.part):this.hls.trigger(P.Events.ERROR,v),null},o._handleTransmuxerFlush=function(x){var v=this.getCurrentContext(x);if(!v||this.state!==E.PARSING){this.fragCurrent||(this.state=E.IDLE);return}var R=v.frag,B=v.part,j=v.level,K=self.performance.now();R.stats.parsing.end=K,B&&(B.stats.parsing.end=K),this.updateLevelTiming(R,B,j,x.partial)},o.getCurrentContext=function(x){var v=this.levels,R=x.level,B=x.sn,j=x.part;if(!v||!v[R])return this.warn("Levels object was unset while buffering fragment "+B+" of level "+R+". The current chunk will not be buffered."),null;var K=v[R],I=j>-1?Object(S.getPartWith)(K,B,j):null,N=I?I.fragment:Object(S.getFragmentWithSN)(K,B,this.fragCurrent);return N?{frag:N,part:I,level:K}:null},o.bufferFragmentData=function(x,v,R,B){if(!x||this.state!==E.PARSING)return;var j=x.data1,K=x.data2,I=j;if(j&&K&&(I=Object(b.appendUint8Array)(j,K)),!I||!I.length)return;var N={type:x.type,frag:v,part:R,chunkMeta:B,parent:v.type,data:I};this.hls.trigger(P.Events.BUFFER_APPENDING,N),x.dropped&&x.independent&&!R&&this.flushBufferGap(v)},o.flushBufferGap=function(x){var v=this.media;if(!v)return;if(!W.BufferHelper.isBuffered(v,v.currentTime)){this.flushMainBuffer(0,x.start);return}var R=v.currentTime,B=W.BufferHelper.bufferInfo(v,R,0),j=x.duration,K=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),I=Math.max(Math.min(x.start-K,B.end-K),R+K);x.start-I>K&&this.flushMainBuffer(I,x.start)},o.getFwdBufferInfo=function(x,v){var R=this.config,B=this.getLoadPosition();if(!Object(X.isFiniteNumber)(B))return null;var j=W.BufferHelper.bufferInfo(x,B,R.maxBufferHole);if(j.len===0&&j.nextStart!==void 0){var K=this.fragmentTracker.getBufferedFrag(B,v);if(K&&j.nextStart<K.end)return W.BufferHelper.bufferInfo(x,B,Math.max(j.nextStart,R.maxBufferHole))}return j},o.getMaxBufferLength=function(x){var v=this.config,R;return x?R=Math.max(8*v.maxBufferSize/x,v.maxBufferLength):R=v.maxBufferLength,Math.min(R,v.maxMaxBufferLength)},o.reduceMaxBufferLength=function(x){var v=this.config,R=x||v.maxBufferLength;return v.maxMaxBufferLength>=R?(v.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+v.maxMaxBufferLength+"s"),!0):!1},o.getNextFragment=function(x,v){var R,B,j=v.fragments,K=j.length;if(!K)return null;var I=this.config,N=j[0].start,Y;if(v.live){var q=I.initialLiveManifestSize;if(K<q)return this.warn("Not enough fragments to start playback (have: "+K+", need: "+q+")"),null;!v.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(Y=this.getInitialLiveFragment(v,j),this.startPosition=Y?this.hls.liveSyncPosition||Y.start:x)}else x<=N&&(Y=j[0]);if(!Y){var ae=I.lowLatencyMode?v.partEnd:v.fragmentEnd;Y=this.getFragmentAtPosition(x,ae,v)}return(R=Y)!==null&&R!==void 0&&R.initSegment&&!((B=Y)!==null&&B!==void 0&&B.initSegment.data)&&!this.bitrateTest&&(Y=Y.initSegment),Y},o.getNextPart=function(x,v,R){for(var B=-1,j=!1,K=!0,I=0,N=x.length;I<N;I++){var Y=x[I];if(K=K&&!Y.independent,B>-1&&R<Y.start)break;var q=Y.loaded;!q&&(j||Y.independent||K)&&Y.fragment===v&&(B=I),j=q}return B},o.loadedEndOfParts=function(x,v){var R=x[x.length-1];return R&&v>R.start&&R.loaded},o.getInitialLiveFragment=function(x,v){var R=this.fragPrevious,B=null;if(R){if(x.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+R.programDateTime),B=Object(A.findFragmentByPDT)(v,R.endProgramDateTime,this.config.maxFragLookUpTolerance)),!B){var j=R.sn+1;if(j>=x.startSN&&j<=x.endSN){var K=v[j-x.startSN];R.cc===K.cc&&(B=K,this.log("Live playlist, switching playlist, load frag with next SN: "+B.sn))}B||(B=Object(A.findFragWithCC)(v,R.cc),B&&this.log("Live playlist, switching playlist, load frag with same CC: "+B.sn))}}else{var I=this.hls.liveSyncPosition;I!==null&&(B=this.getFragmentAtPosition(I,this.bitrateTest?x.fragmentEnd:x.edge,x))}return B},o.getFragmentAtPosition=function(x,v,R){var B=this.config,j=this.fragPrevious,K=R.fragments,I=R.endSN,N=R.fragmentHint,Y=B.maxFragLookUpTolerance,q=!!(B.lowLatencyMode&&R.partList&&N);q&&N&&!this.bitrateTest&&(K=K.concat(N),I=N.sn);var ae;if(x<v){var he=x>v-Y?0:Y;ae=Object(A.findFragmentByPTS)(j,K,x,he)}else ae=K[K.length-1];if(ae){var _e=ae.sn-R.startSN,be=j&&ae.level===j.level,Ce=K[_e+1],Te=this.fragmentTracker.getState(ae);if(Te===O.FragmentState.BACKTRACKED){ae=null;for(var Ee=_e;K[Ee]&&this.fragmentTracker.getState(K[Ee])===O.FragmentState.BACKTRACKED;)j?ae=K[Ee--]:ae=K[--Ee];ae||(ae=Ce)}else j&&ae.sn===j.sn&&!q&&(be&&(ae.sn<I&&this.fragmentTracker.getState(Ce)!==O.FragmentState.OK?(this.log("SN "+ae.sn+" just loaded, load next one: "+Ce.sn),ae=Ce):ae=null))}return ae},o.synchronizeToLiveEdge=function(x){var v=this.config,R=this.media;if(!R)return;var B=this.hls.liveSyncPosition,j=R.currentTime,K=x.fragments[0].start,I=x.edge,N=j>=K-v.maxFragLookUpTolerance&&j<=I;if(B!==null&&R.duration>B&&(j<B||!N)){var Y=v.liveMaxLatencyDuration!==void 0?v.liveMaxLatencyDuration:v.liveMaxLatencyDurationCount*x.targetduration;(!N&&R.readyState<4||j<I-Y)&&(this.loadedmetadata||(this.nextLoadPosition=B),R.readyState&&(this.warn("Playback: "+j.toFixed(3)+" is located too far from the end of live sliding playlist: "+I+", reset currentTime to : "+B.toFixed(3)),R.currentTime=B))}},o.alignPlaylists=function(x,v){var R=this.levels,B=this.levelLastLoaded,j=this.fragPrevious,K=B!==null?R[B]:null,I=x.fragments.length;if(!I)return this.warn("No fragments in live playlist"),0;var N=x.fragments[0].start,Y=!v,q=x.alignedSliding&&Object(X.isFiniteNumber)(N);if(Y||!q&&!N){Object(M.alignStream)(j,K,x);var ae=x.fragments[0].start;return this.log("Live playlist sliding: "+ae.toFixed(2)+" start-sn: "+(v?v.startSN:"na")+"->"+x.startSN+" prev-sn: "+(j?j.sn:"na")+" fragments: "+I),ae}return N},o.waitForCdnTuneIn=function(x){var v=3;return x.live&&x.canBlockReload&&x.tuneInGoal>Math.max(x.partHoldBack,x.partTarget*v)},o.setStartPosition=function(x,v){var R=this.startPosition;if(R<v&&(R=-1),R===-1||this.lastCurrentTime===-1){var B=x.startTimeOffset;Object(X.isFiniteNumber)(B)?(R=v+B,B<0&&(R+=x.totalduration),R=Math.min(Math.max(v,R),v+x.totalduration),this.log("Start time offset "+B+" found in playlist, adjust startPosition to "+R),this.startPosition=R):x.live?R=this.hls.liveSyncPosition||v:this.startPosition=R=0,this.lastCurrentTime=R}this.nextLoadPosition=R},o.getLoadPosition=function(){var x=this.media,v=0;return this.loadedmetadata&&x?v=x.currentTime:this.nextLoadPosition&&(v=this.nextLoadPosition),v},o.handleFragLoadAborted=function(x,v){this.transmuxer&&x.sn!=="initSegment"&&x.stats.aborted&&(this.warn("Fragment "+x.sn+(v?" part"+v.index:"")+" of level "+x.level+" was aborted"),this.resetFragmentLoading(x))},o.resetFragmentLoading=function(x){(!this.fragCurrent||!this.fragContextChanged(x))&&(this.state=E.IDLE)},o.onFragmentOrKeyLoadError=function(x,v){if(v.fatal)return;var R=v.frag;if(!R||R.type!==x)return;var B=this.fragCurrent;console.assert(B&&R.sn===B.sn&&R.level===B.level&&R.urlId===B.urlId,"Frag load error must match current frag to retry");var j=this.config;if(this.fragLoadError+1<=j.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(R.level))return;var K=Math.min(Math.pow(2,this.fragLoadError)*j.fragLoadingRetryDelay,j.fragLoadingMaxRetryTimeout);this.warn("Fragment "+R.sn+" of "+x+" "+R.level+" failed to load, retrying in "+K+"ms"),this.retryDate=self.performance.now()+K,this.fragLoadError++,this.state=E.FRAG_LOADING_WAITING_RETRY}else v.levelRetry?(x===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=E.IDLE):(F.logger.error(v.details+" reaches max retry, redispatch as fatal ..."),v.fatal=!0,this.hls.stopLoad(),this.state=E.ERROR)},o.afterBufferFlushed=function(x,v,R){if(!x)return;var B=W.BufferHelper.getBuffered(x);this.fragmentTracker.detectEvictedFragments(v,B,R),this.state===E.ENDED&&this.resetLoadingState()},o.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=E.IDLE},o.resetLiveStartWhenNotLoaded=function(x){if(!this.loadedmetadata){this.startFragRequested=!1;var v=this.levels?this.levels[x].details:null;if(v!=null&&v.live)return this.startPosition=-1,this.setStartPosition(v,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},o.updateLevelTiming=function(x,v,R,B){var j=this,K=R.details;console.assert(!!K,"level.details must be defined");var I=Object.keys(x.elementaryStreams).reduce(function(N,Y){var q=x.elementaryStreams[Y];if(q){var ae=q.endPTS-q.startPTS;if(ae<=0)return j.warn("Could not parse fragment "+x.sn+" "+Y+" duration reliably ("+ae+") resetting transmuxer to fallback to playlist timing"),j.resetTransmuxer(),N||!1;var he=B?0:Object(S.updateFragPTSDTS)(K,x,q.startPTS,q.endPTS,q.startDTS,q.endDTS);return j.hls.trigger(P.Events.LEVEL_PTS_UPDATED,{details:K,level:R,drift:he,type:Y,frag:x,start:q.startPTS,end:q.endPTS}),!0}return N},!1);I?(this.state=E.PARSED,this.hls.trigger(P.Events.FRAG_PARSED,{frag:x,part:v})):this.resetLoadingState()},o.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},_(h,[{key:"state",get:function(){return this._state},set:function(x){var v=this._state;v!==x&&(this._state=x,this.log(v+"->"+x))}}]),h}(U.default)},"./src/controller/buffer-controller.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return A});var X=k("./src/polyfills/number.ts"),U=k("./src/events.ts"),O=k("./src/utils/logger.ts"),W=k("./src/errors.ts"),F=k("./src/utils/buffer-helper.ts"),P=k("./src/utils/mediasource-helper.ts"),w=k("./src/loader/fragment.ts"),f=k("./src/controller/buffer-operation-queue.ts"),b=Object(P.getMediaSource)(),M=/([ha]vc.)(?:\.[^.,]+)+/,A=function(){function S(d){var a=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var s=a.hls,u=a.media,_=a.mediaSource;O.logger.log("[buffer-controller]: Media source opened"),u&&(a.updateMediaElementDuration(),s.trigger(U.Events.MEDIA_ATTACHED,{media:u})),_&&_.removeEventListener("sourceopen",a._onMediaSourceOpen),a.checkPendingTracks()},this._onMediaSourceClose=function(){O.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){O.logger.log("[buffer-controller]: Media source ended")},this.hls=d,this._initSourceBuffer(),this.registerListeners()}var T=S.prototype;return T.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},T.destroy=function(){this.unregisterListeners(),this.details=null},T.registerListeners=function(){var a=this.hls;a.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(U.Events.BUFFER_RESET,this.onBufferReset,this),a.on(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.on(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.on(U.Events.BUFFER_EOS,this.onBufferEos,this),a.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.on(U.Events.FRAG_PARSED,this.onFragParsed,this),a.on(U.Events.FRAG_CHANGED,this.onFragChanged,this)},T.unregisterListeners=function(){var a=this.hls;a.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(U.Events.BUFFER_RESET,this.onBufferReset,this),a.off(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.off(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.off(U.Events.BUFFER_EOS,this.onBufferEos,this),a.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.off(U.Events.FRAG_PARSED,this.onFragParsed,this),a.off(U.Events.FRAG_CHANGED,this.onFragChanged,this)},T._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new f.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},T.onManifestParsed=function(a,s){var u=2;(s.audio&&!s.video||!s.altAudio)&&(u=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=u,this.details=null,O.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},T.onMediaAttaching=function(a,s){var u=this.media=s.media;if(u&&b){var _=this.mediaSource=new b;_.addEventListener("sourceopen",this._onMediaSourceOpen),_.addEventListener("sourceended",this._onMediaSourceEnded),_.addEventListener("sourceclose",this._onMediaSourceClose),u.src=self.URL.createObjectURL(_),this._objectUrl=u.src}},T.onMediaDetaching=function(){var a=this.media,s=this.mediaSource,u=this._objectUrl;if(s){if(O.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(_){O.logger.warn("[buffer-controller]: onMediaDetaching: "+_.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),a&&(u&&self.URL.revokeObjectURL(u),a.src===u?(a.removeAttribute("src"),a.load()):O.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(U.Events.MEDIA_DETACHED,void 0)},T.onBufferReset=function(){var a=this;this.getSourceBufferTypes().forEach(function(s){var u=a.sourceBuffer[s];try{u&&(a.removeBufferListeners(s),a.mediaSource&&a.mediaSource.removeSourceBuffer(u),a.sourceBuffer[s]=void 0)}catch(_){O.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",_)}}),this._initSourceBuffer()},T.onBufferCodecs=function(a,s){var u=this,_=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(m){if(_){var p=u.tracks[m];if(p&&typeof p.buffer.changeType=="function"){var D=s[m],E=D.codec,g=D.levelCodec,c=D.container,h=(p.levelCodec||p.codec).replace(M,"$1"),o=(g||E).replace(M,"$1");if(h!==o){var C=c+";codecs="+(g||E);u.appendChangeType(m,C)}}}else u.pendingTracks[m]=s[m]}),_)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},T.appendChangeType=function(a,s){var u=this,_=this.operationQueue,m={execute:function(){var D=u.sourceBuffer[a];D&&(O.logger.log("[buffer-controller]: changing "+a+" sourceBuffer type to "+s),D.changeType(s)),_.shiftAndExecuteNext(a)},onStart:function(){},onComplete:function(){},onError:function(D){O.logger.warn("[buffer-controller]: Failed to change "+a+" SourceBuffer type",D)}};_.append(m,a)},T.onBufferAppending=function(a,s){var u=this,_=this.hls,m=this.operationQueue,p=this.tracks,D=s.data,E=s.type,g=s.frag,c=s.part,h=s.chunkMeta,o=h.buffering[E],C=self.performance.now();o.start=C;var x=g.stats.buffering,v=c?c.stats.buffering:null;x.start===0&&(x.start=C),v&&v.start===0&&(v.start=C);var R=p.audio,B=E==="audio"&&h.id===1&&(R==null?void 0:R.container)==="audio/mpeg",j={execute:function(){if(o.executeStart=self.performance.now(),B){var I=u.sourceBuffer[E];if(I){var N=g.start-I.timestampOffset;Math.abs(N)>=.1&&(O.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+g.start+" (delta: "+N+") sn: "+g.sn+")"),I.timestampOffset=g.start)}}u.appendExecutor(D,E)},onStart:function(){},onComplete:function(){var I=self.performance.now();o.executeEnd=o.end=I,x.first===0&&(x.first=I),v&&v.first===0&&(v.first=I);var N=u.sourceBuffer,Y={};for(var q in N)Y[q]=F.BufferHelper.getBuffered(N[q]);u.appendError=0,u.hls.trigger(U.Events.BUFFER_APPENDED,{type:E,frag:g,part:c,chunkMeta:h,parent:g.type,timeRanges:Y})},onError:function(I){O.logger.error("[buffer-controller]: Error encountered while trying to append to the "+E+" SourceBuffer",I);var N={type:W.ErrorTypes.MEDIA_ERROR,parent:g.type,details:W.ErrorDetails.BUFFER_APPEND_ERROR,err:I,fatal:!1};I.code===DOMException.QUOTA_EXCEEDED_ERR?N.details=W.ErrorDetails.BUFFER_FULL_ERROR:(u.appendError++,N.details=W.ErrorDetails.BUFFER_APPEND_ERROR,u.appendError>_.config.appendErrorMaxRetry&&(O.logger.error("[buffer-controller]: Failed "+_.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),N.fatal=!0)),_.trigger(U.Events.ERROR,N)}};m.append(j,E)},T.onBufferFlushing=function(a,s){var u=this,_=this.operationQueue,m=function(D){return{execute:u.removeExecutor.bind(u,D,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){u.hls.trigger(U.Events.BUFFER_FLUSHED,{type:D})},onError:function(g){O.logger.warn("[buffer-controller]: Failed to remove from "+D+" SourceBuffer",g)}}};s.type?_.append(m(s.type),s.type):this.getSourceBufferTypes().forEach(function(p){_.append(m(p),p)})},T.onFragParsed=function(a,s){var u=this,_=s.frag,m=s.part,p=[],D=m?m.elementaryStreams:_.elementaryStreams;D[w.ElementaryStreamTypes.AUDIOVIDEO]?p.push("audiovideo"):(D[w.ElementaryStreamTypes.AUDIO]&&p.push("audio"),D[w.ElementaryStreamTypes.VIDEO]&&p.push("video"));var E=function(){var c=self.performance.now();_.stats.buffering.end=c,m&&(m.stats.buffering.end=c);var h=m?m.stats:_.stats;u.hls.trigger(U.Events.FRAG_BUFFERED,{frag:_,part:m,stats:h,id:_.type})};p.length===0&&O.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+_.type+" level: "+_.level+" sn: "+_.sn),this.blockBuffers(E,p)},T.onFragChanged=function(a,s){this.flushBackBuffer()},T.onBufferEos=function(a,s){var u=this,_=this.getSourceBufferTypes().reduce(function(m,p){var D=u.sourceBuffer[p];return(!s.type||s.type===p)&&(D&&!D.ended&&(D.ended=!0,O.logger.log("[buffer-controller]: "+p+" sourceBuffer now EOS"))),m&&!!(!D||D.ended)},!0);_&&this.blockBuffers(function(){var m=u.mediaSource;if(!m||m.readyState!=="open")return;m.endOfStream()})},T.onLevelUpdated=function(a,s){var u=s.details;if(!u.fragments.length)return;this.details=u,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},T.flushBackBuffer=function(){var a=this.hls,s=this.details,u=this.media,_=this.sourceBuffer;if(!u||s===null)return;var m=this.getSourceBufferTypes();if(!m.length)return;var p=s.live&&a.config.liveBackBufferLength!==null?a.config.liveBackBufferLength:a.config.backBufferLength;if(!Object(X.isFiniteNumber)(p)||p<0)return;var D=u.currentTime,E=s.levelTargetDuration,g=Math.max(p,E),c=Math.floor(D/E)*E-g;m.forEach(function(h){var o=_[h];if(o){var C=F.BufferHelper.getBuffered(o);C.length>0&&c>C.start(0)&&(a.trigger(U.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),s.live&&a.trigger(U.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),a.trigger(U.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:h}))}})},T.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var a=this.details,s=this.hls,u=this.media,_=this.mediaSource,m=a.fragments[0].start+a.totalduration,p=u.duration,D=Object(X.isFiniteNumber)(_.duration)?_.duration:0;a.live&&s.config.liveDurationInfinity?(O.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),_.duration=Infinity,this.updateSeekableRange(a)):(m>D&&m>p||!Object(X.isFiniteNumber)(p))&&(O.logger.log("[buffer-controller]: Updating Media Source duration to "+m.toFixed(3)),_.duration=m)},T.updateSeekableRange=function(a){var s=this.mediaSource,u=a.fragments,_=u.length;if(_&&a.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var m=Math.max(0,u[0].start),p=Math.max(m,m+a.totalduration);s.setLiveSeekableRange(m,p)}},T.checkPendingTracks=function(){var a=this.bufferCodecEventsExpected,s=this.operationQueue,u=this.pendingTracks,_=Object.keys(u).length;if(_&&!a||_===2){this.createSourceBuffers(u),this.pendingTracks={};var m=this.getSourceBufferTypes();if(m.length===0){this.hls.trigger(U.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}m.forEach(function(p){s.executeNext(p)})}},T.createSourceBuffers=function(a){var s=this.sourceBuffer,u=this.mediaSource;if(!u)throw Error("createSourceBuffers called when mediaSource was null");var _=0;for(var m in a)if(!s[m]){var p=a[m];if(!p)throw Error("source buffer exists for track "+m+", however track does not");var D=p.levelCodec||p.codec,E=p.container+";codecs="+D;O.logger.log("[buffer-controller]: creating sourceBuffer("+E+")");try{var g=s[m]=u.addSourceBuffer(E),c=m;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[m]={buffer:g,codec:D,container:p.container,levelCodec:p.levelCodec,id:p.id},_++}catch(h){O.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+h.message),this.hls.trigger(U.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:h,mimeType:E})}}_&&this.hls.trigger(U.Events.BUFFER_CREATED,{tracks:this.tracks})},T._onSBUpdateStart=function(a){var s=this.operationQueue,u=s.current(a);u.onStart()},T._onSBUpdateEnd=function(a){var s=this.operationQueue,u=s.current(a);u.onComplete(),s.shiftAndExecuteNext(a)},T._onSBUpdateError=function(a,s){O.logger.error("[buffer-controller]: "+a+" SourceBuffer error",s),this.hls.trigger(U.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var u=this.operationQueue.current(a);u&&u.onError(s)},T.removeExecutor=function(a,s,u){var _=this.media,m=this.mediaSource,p=this.operationQueue,D=this.sourceBuffer,E=D[a];if(!_||!m||!E){O.logger.warn("[buffer-controller]: Attempting to remove from the "+a+" SourceBuffer, but it does not exist"),p.shiftAndExecuteNext(a);return}var g=Object(X.isFiniteNumber)(_.duration)?_.duration:Infinity,c=Object(X.isFiniteNumber)(m.duration)?m.duration:Infinity,h=Math.max(0,s),o=Math.min(u,g,c);o>h?(O.logger.log("[buffer-controller]: Removing ["+h+","+o+"] from the "+a+" SourceBuffer"),console.assert(!E.updating,a+" sourceBuffer must not be updating"),E.remove(h,o)):p.shiftAndExecuteNext(a)},T.appendExecutor=function(a,s){var u=this.operationQueue,_=this.sourceBuffer,m=_[s];if(!m){O.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),u.shiftAndExecuteNext(s);return}m.ended=!1,console.assert(!m.updating,s+" sourceBuffer must not be updating"),m.appendBuffer(a)},T.blockBuffers=function(a,s){var u=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){O.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(a);return}var _=this.operationQueue,m=s.map(function(p){return _.appendBlocker(p)});Promise.all(m).then(function(){a(),s.forEach(function(p){var D=u.sourceBuffer[p];(!D||!D.updating)&&_.shiftAndExecuteNext(p)})})},T.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},T.addBufferListener=function(a,s,u){var _=this.sourceBuffer[a];if(!_)return;var m=u.bind(this,a);this.listeners[a].push({event:s,listener:m}),_.addEventListener(s,m)},T.removeBufferListeners=function(a){var s=this.sourceBuffer[a];if(!s)return;this.listeners[a].forEach(function(u){s.removeEventListener(u.event,u.listener)})},S}()},"./src/controller/buffer-operation-queue.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return U});var X=k("./src/utils/logger.ts"),U=function(){function O(F){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=F}var W=O.prototype;return W.append=function(P,w){var f=this.queues[w];f.push(P),f.length===1&&this.buffers[w]&&this.executeNext(w)},W.insertAbort=function(P,w){var f=this.queues[w];f.unshift(P),this.executeNext(w)},W.appendBlocker=function(P){var w,f=new Promise(function(M){w=M}),b={execute:w,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(b,P),f},W.executeNext=function(P){var w=this.buffers,f=this.queues,b=w[P],M=f[P];if(M.length){var A=M[0];try{A.execute()}catch(S){X.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),A.onError(S),(!b||!b.updating)&&(M.shift(),this.executeNext(P))}}},W.shiftAndExecuteNext=function(P){this.queues[P].shift(),this.executeNext(P)},W.current=function(P){return this.queues[P][0]},O}()},"./src/controller/cap-level-controller.ts":function(ne,$,k){"use strict";k.r($);var X=k("./src/events.ts");function U(F,P){for(var w=0;w<P.length;w++){var f=P[w];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(F,f.key,f)}}function O(F,P,w){return P&&U(F.prototype,P),w&&U(F,w),F}var W=function(){function F(w){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=w,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var P=F.prototype;return P.setStreamController=function(f){this.streamController=f},P.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},P.registerListeners=function(){var f=this.hls;f.on(X.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),f.on(X.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),f.on(X.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.on(X.Events.BUFFER_CODECS,this.onBufferCodecs,this),f.on(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.unregisterListener=function(){var f=this.hls;f.off(X.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),f.off(X.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),f.off(X.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.off(X.Events.BUFFER_CODECS,this.onBufferCodecs,this),f.off(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.onFpsDropLevelCapping=function(f,b){F.isLevelAllowed(b.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(b.droppedLevel)},P.onMediaAttaching=function(f,b){this.media=b.media instanceof HTMLVideoElement?b.media:null},P.onManifestParsed=function(f,b){var M=this.hls;this.restrictedLevels=[],this.firstLevel=b.firstLevel,M.config.capLevelToPlayerSize&&b.video&&this.startCapping()},P.onBufferCodecs=function(f,b){var M=this.hls;M.config.capLevelToPlayerSize&&b.video&&this.startCapping()},P.onMediaDetaching=function(){this.stopCapping()},P.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var f=this.hls.levels;if(f.length){var b=this.hls;b.autoLevelCapping=this.getMaxLevel(f.length-1),b.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=b.autoLevelCapping}}},P.getMaxLevel=function(f){var b=this,M=this.hls.levels;if(!M.length)return-1;var A=M.filter(function(S,T){return F.isLevelAllowed(T,b.restrictedLevels)&&T<=f});return this.clientRect=null,F.getMaxLevelByMediaSize(A,this.mediaWidth,this.mediaHeight)},P.startCapping=function(){if(this.timer)return;this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize()},P.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},P.getDimensions=function(){if(this.clientRect)return this.clientRect;var f=this.media,b={width:0,height:0};if(f){var M=f.getBoundingClientRect();b.width=M.width,b.height=M.height,!b.width&&!b.height&&(b.width=M.right-M.left||f.width||0,b.height=M.bottom-M.top||f.height||0)}return this.clientRect=b,b},F.isLevelAllowed=function(f,b){return b===void 0&&(b=[]),b.indexOf(f)===-1},F.getMaxLevelByMediaSize=function(f,b,M){if(!f||!f.length)return-1;for(var A=function(s,u){return u?s.width!==u.width||s.height!==u.height:!0},S=f.length-1,T=0;T<f.length;T+=1){var d=f[T];if((d.width>=b||d.height>=M)&&A(d,f[T+1])){S=T;break}}return S},O(F,[{key:"mediaWidth",get:function(){return this.getDimensions().width*F.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*F.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var f=1;try{f=self.devicePixelRatio}catch(b){}return f}}]),F}();$.default=W},"./src/controller/cmcd-controller.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return A});var X=k("./src/events.ts"),U=k("./src/types/cmcd.ts"),O=k("./src/utils/buffer-helper.ts"),W=k("./src/utils/logger.ts");function F(S,T){for(var d=0;d<T.length;d++){var a=T[d];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(S,a.key,a)}}function P(S,T,d){return T&&F(S.prototype,T),d&&F(S,d),S}function w(S,T){var d=typeof Symbol!="undefined"&&S[Symbol.iterator]||S["@@iterator"];if(d)return(d=d.call(S)).next.bind(d);if(Array.isArray(S)||(d=f(S))||T&&S&&typeof S.length=="number"){d&&(S=d);var a=0;return function(){return a>=S.length?{done:!0}:{done:!1,value:S[a++]}}}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 f(S,T){if(!S)return;if(typeof S=="string")return b(S,T);var d=Object.prototype.toString.call(S).slice(8,-1);if(d==="Object"&&S.constructor&&(d=S.constructor.name),d==="Map"||d==="Set")return Array.from(S);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return b(S,T)}function b(S,T){(T==null||T>S.length)&&(T=S.length);for(var d=0,a=new Array(T);d<T;d++)a[d]=S[d];return a}function M(){return M=Object.assign||function(S){for(var T=1;T<arguments.length;T++){var d=arguments[T];for(var a in d)Object.prototype.hasOwnProperty.call(d,a)&&(S[a]=d[a])}return S},M.apply(this,arguments)}var A=function(){function S(d){var a=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(){a.initialized&&(a.starved=!0),a.buffering=!0},this.onPlaying=function(){a.initialized||(a.initialized=!0),a.buffering=!1},this.applyPlaylistData=function(_){try{a.apply(_,{ot:U.CMCDObjectType.MANIFEST,su:!a.initialized})}catch(m){W.logger.warn("Could not generate manifest CMCD data.",m)}},this.applyFragmentData=function(_){try{var m=_.frag,p=a.hls.levels[m.level],D=a.getObjectType(m),E={d:m.duration*1e3,ot:D};(D===U.CMCDObjectType.VIDEO||D===U.CMCDObjectType.AUDIO||D==U.CMCDObjectType.MUXED)&&(E.br=p.bitrate/1e3,E.tb=a.getTopBandwidth(D),E.bl=a.getBufferLength(D)),a.apply(_,E)}catch(g){W.logger.warn("Could not generate segment CMCD data.",g)}},this.hls=d;var s=this.config=d.config,u=s.cmcd;u!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=u.sessionId||S.uuid(),this.cid=u.contentId,this.useHeaders=u.useHeaders===!0,this.registerListeners())}var T=S.prototype;return T.registerListeners=function(){var a=this.hls;a.on(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(X.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.on(X.Events.BUFFER_CREATED,this.onBufferCreated,this)},T.unregisterListeners=function(){var a=this.hls;a.off(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(X.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.off(X.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},T.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},T.onMediaAttached=function(a,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},T.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},T.onBufferCreated=function(a,s){var u,_;this.audioBuffer=(u=s.tracks.audio)===null||u===void 0?void 0:u.buffer,this.videoBuffer=(_=s.tracks.video)===null||_===void 0?void 0:_.buffer},T.createData=function(){var a;return{v:U.CMCDVersion,sf:U.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(a=this.media)===null||a===void 0?void 0:a.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},T.apply=function(a,s){s===void 0&&(s={}),M(s,this.createData());var u=s.ot===U.CMCDObjectType.INIT||s.ot===U.CMCDObjectType.VIDEO||s.ot===U.CMCDObjectType.MUXED;if(this.starved&&u&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var _=S.toHeaders(s);if(!Object.keys(_).length)return;a.headers||(a.headers={}),M(a.headers,_)}else{var m=S.toQuery(s);if(!m)return;a.url=S.appendQueryToUri(a.url,m)}},T.getObjectType=function(a){var s=a.type;return s==="subtitle"?U.CMCDObjectType.TIMED_TEXT:a.sn==="initSegment"?U.CMCDObjectType.INIT:s==="audio"?U.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?U.CMCDObjectType.VIDEO:U.CMCDObjectType.MUXED:void 0},T.getTopBandwidth=function(a){for(var s=0,u=a===U.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,_=w(u),m;!(m=_()).done;){var p=m.value;p.bitrate>s&&(s=p.bitrate)}return s>0?s:NaN},T.getBufferLength=function(a){var s=this.hls.media,u=a===U.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!u||!s)return NaN;var _=O.BufferHelper.bufferInfo(u,s.currentTime,this.config.maxBufferHole);return _.len*1e3},T.createPlaylistLoader=function(){var a=this.config.pLoader,s=this.applyPlaylistData,u=a||this.config.loader;return function(){function _(p){this.loader=void 0,this.loader=new u(p)}var m=_.prototype;return m.destroy=function(){this.loader.destroy()},m.abort=function(){this.loader.abort()},m.load=function(D,E,g){s(D),this.loader.load(D,E,g)},P(_,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),_}()},T.createFragmentLoader=function(){var a=this.config.fLoader,s=this.applyFragmentData,u=a||this.config.loader;return function(){function _(p){this.loader=void 0,this.loader=new u(p)}var m=_.prototype;return m.destroy=function(){this.loader.destroy()},m.abort=function(){this.loader.abort()},m.load=function(D,E,g){s(D),this.loader.load(D,E,g)},P(_,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),_}()},S.uuid=function(){var a=URL.createObjectURL(new Blob),s=a.toString();return URL.revokeObjectURL(a),s.substr(s.lastIndexOf("/")+1)},S.serialize=function(a){for(var s=[],u=function(B){return!Number.isNaN(B)&&B!=null&&B!==""&&B!==!1},_=function(B){return Math.round(B)},m=function(B){return _(B/100)*100},p=function(B){return encodeURIComponent(B)},D={br:_,d:_,bl:m,dl:m,mtp:m,nor:p,rtp:m,tb:_},E=Object.keys(a||{}).sort(),g=w(E),c;!(c=g()).done;){var h=c.value,o=a[h];if(!u(o))continue;if(h==="v"&&o===1)continue;if(h=="pr"&&o===1)continue;var C=D[h];C&&(o=C(o));var x=typeof o,v=void 0;h==="ot"||h==="sf"||h==="st"?v=h+"="+o:x==="boolean"?v=h:x==="number"?v=h+"="+o:v=h+"="+JSON.stringify(o),s.push(v)}return s.join(",")},S.toHeaders=function(a){for(var s=Object.keys(a),u={},_=["Object","Request","Session","Status"],m=[{},{},{},{}],p={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},D=0,E=s;D<E.length;D++){var g=E[D],c=p[g]!=null?p[g]:1;m[c][g]=a[g]}for(var h=0;h<m.length;h++){var o=S.serialize(m[h]);o&&(u["CMCD-"+_[h]]=o)}return u},S.toQuery=function(a){return"CMCD="+encodeURIComponent(S.serialize(a))},S.appendQueryToUri=function(a,s){if(!s)return a;var u=a.includes("?")?"&":"?";return""+a+u+s},S}()},"./src/controller/eme-controller.ts":function(ne,$,k){"use strict";k.r($);var X=k("./src/events.ts"),U=k("./src/errors.ts"),O=k("./src/utils/logger.ts"),W=k("./src/utils/mediakeys-helper.ts");function F(A,S){for(var T=0;T<S.length;T++){var d=S[T];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(A,d.key,d)}}function P(A,S,T){return S&&F(A.prototype,S),T&&F(A,T),A}var w=3,f=function(S,T,d){var a={audioCapabilities:[],videoCapabilities:[]};return S.forEach(function(s){a.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:d.audioRobustness||""})}),T.forEach(function(s){a.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:d.videoRobustness||""})}),[a]},b=function(S,T,d,a){switch(S){case W.KeySystems.WIDEVINE:return f(T,d,a);default:throw new Error("Unknown key-system: "+S)}},M=function(){function A(T){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=T,this._config=T.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 S=A.prototype;return S.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},S._registerListeners=function(){this.hls.on(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(X.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(X.Events.MANIFEST_PARSED,this.onManifestParsed,this)},S._unregisterListeners=function(){this.hls.off(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(X.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(X.Events.MANIFEST_PARSED,this.onManifestParsed,this)},S.getLicenseServerUrl=function(d){switch(d){case W.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+d+'"')},S._attemptKeySystemAccess=function(d,a,s){var u=this,_=b(d,a,s,this._drmSystemOptions);O.logger.log("Requesting encrypted media key-system access");var m=this.requestMediaKeySystemAccess(d,_);this.mediaKeysPromise=m.then(function(p){return u._onMediaKeySystemAccessObtained(d,p)}),m.catch(function(p){O.logger.error('Failed to obtain key-system "'+d+'" access:',p)})},S._onMediaKeySystemAccessObtained=function(d,a){var s=this;O.logger.log('Access for key-system "'+d+'" obtained');var u={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:a,mediaKeySystemDomain:d};this._mediaKeysList.push(u);var _=Promise.resolve().then(function(){return a.createMediaKeys()}).then(function(m){return u.mediaKeys=m,O.logger.log('Media-keys created for key-system "'+d+'"'),s._onMediaKeysCreated(),m});return _.catch(function(m){O.logger.error("Failed to create media-keys:",m)}),_},S._onMediaKeysCreated=function(){var d=this;this._mediaKeysList.forEach(function(a){a.mediaKeysSession||(a.mediaKeysSession=a.mediaKeys.createSession(),d._onNewMediaKeySession(a.mediaKeysSession))})},S._onNewMediaKeySession=function(d){var a=this;O.logger.log("New key-system session "+d.sessionId),d.addEventListener("message",function(s){a._onKeySessionMessage(d,s.message)},!1)},S._onKeySessionMessage=function(d,a){O.logger.log("Got EME message event, creating license request"),this._requestLicense(a,function(s){O.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),d.update(s)})},S.onMediaEncrypted=function(d){var a=this;if(O.logger.log('Media is encrypted using "'+d.initDataType+'" init data type'),!this.mediaKeysPromise){O.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(X.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(_){if(!a._media)return;a._attemptSetMediaKeys(_),a._generateRequestWithPreferredKeySession(d.initDataType,d.initData)};this.mediaKeysPromise.then(s).catch(s)},S._attemptSetMediaKeys=function(d){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var a=this._mediaKeysList[0];if(!a||!a.mediaKeys){O.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(X.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}O.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(a.mediaKeys),this._hasSetMediaKeys=!0}},S._generateRequestWithPreferredKeySession=function(d,a){var s=this,u=this._mediaKeysList[0];if(!u){O.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(X.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(u.mediaKeysSessionInitialized){O.logger.warn("Key-Session already initialized but requested again");return}var _=u.mediaKeysSession;if(!_){O.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(X.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!a){O.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(X.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}O.logger.log('Generating key-session request for "'+d+'" init data type'),u.mediaKeysSessionInitialized=!0,_.generateRequest(d,a).then(function(){O.logger.debug("Key-session generation succeeded")}).catch(function(m){O.logger.error("Error generating key-session request:",m),s.hls.trigger(X.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},S._createLicenseXhr=function(d,a,s){var u=new XMLHttpRequest;u.responseType="arraybuffer",u.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,u,d,a,s);var _=this._licenseXhrSetup;if(_)try{_.call(this.hls,u,d),_=void 0}catch(m){O.logger.error(m)}try{u.readyState||u.open("POST",d,!0),_&&_.call(this.hls,u,d)}catch(m){throw new Error("issue setting up KeySystem license XHR "+m)}return u},S._onLicenseRequestReadyStageChange=function(d,a,s,u){switch(d.readyState){case 4:if(d.status===200){this._requestLicenseFailureCount=0,O.logger.log("License request succeeded");var _=d.response,m=this._licenseResponseCallback;if(m)try{_=m.call(this.hls,d,a)}catch(D){O.logger.error(D)}u(_)}else{if(O.logger.error("License Request XHR failed ("+a+"). Status: "+d.status+" ("+d.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>w){this.hls.trigger(X.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var p=w-this._requestLicenseFailureCount+1;O.logger.warn("Retrying license request, "+p+" attempts left"),this._requestLicense(s,u)}break}},S._generateLicenseRequestChallenge=function(d,a){switch(d.mediaKeySystemDomain){case W.KeySystems.WIDEVINE:return a}throw new Error("unsupported key-system: "+d.mediaKeySystemDomain)},S._requestLicense=function(d,a){O.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){O.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(X.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var u=this.getLicenseServerUrl(s.mediaKeySystemDomain),_=this._createLicenseXhr(u,d,a);O.logger.log("Sending license request to URL: "+u);var m=this._generateLicenseRequestChallenge(s,d);_.send(m)}catch(p){O.logger.error("Failure requesting DRM license: "+p),this.hls.trigger(X.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},S.onMediaAttached=function(d,a){if(!this._emeEnabled)return;var s=a.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},S.onMediaDetached=function(){var d=this._media,a=this._mediaKeysList;if(!d)return;d.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(a.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return d.setMediaKeys(null)}).catch(function(){})},S.onManifestParsed=function(d,a){if(!this._emeEnabled)return;var s=a.levels.map(function(_){return _.audioCodec}).filter(function(_){return!!_}),u=a.levels.map(function(_){return _.videoCodec}).filter(function(_){return!!_});this._attemptKeySystemAccess(W.KeySystems.WIDEVINE,s,u)},P(A,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),A}();$.default=M},"./src/controller/fps-controller.ts":function(ne,$,k){"use strict";k.r($);var X=k("./src/events.ts"),U=k("./src/utils/logger.ts"),O=function(){function W(P){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=P,this.registerListeners()}var F=W.prototype;return F.setStreamController=function(w){this.streamController=w},F.registerListeners=function(){this.hls.on(X.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},F.unregisterListeners=function(){this.hls.off(X.Events.MEDIA_ATTACHING,this.onMediaAttaching)},F.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},F.onMediaAttaching=function(w,f){var b=this.hls.config;if(b.capLevelOnFPSDrop){var M=f.media instanceof self.HTMLVideoElement?f.media:null;this.media=M,M&&typeof M.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),b.fpsDroppedMonitoringPeriod)}},F.checkFPS=function(w,f,b){var M=performance.now();if(f){if(this.lastTime){var A=M-this.lastTime,S=b-this.lastDroppedFrames,T=f-this.lastDecodedFrames,d=1e3*S/A,a=this.hls;if(a.trigger(X.Events.FPS_DROP,{currentDropped:S,currentDecoded:T,totalDroppedFrames:b}),d>0&&S>a.config.fpsDroppedMonitoringThreshold*T){var s=a.currentLevel;U.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(a.autoLevelCapping===-1||a.autoLevelCapping>=s)&&(s=s-1,a.trigger(X.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:a.currentLevel}),a.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=M,this.lastDroppedFrames=b,this.lastDecodedFrames=f}},F.checkFPSInterval=function(){var w=this.media;if(w)if(this.isVideoPlaybackQualityAvailable){var f=w.getVideoPlaybackQuality();this.checkFPS(w,f.totalVideoFrames,f.droppedVideoFrames)}else this.checkFPS(w,w.webkitDecodedFrameCount,w.webkitDroppedFrameCount)},W}();$.default=O},"./src/controller/fragment-finders.ts":function(ne,$,k){"use strict";k.r($),k.d($,"findFragmentByPDT",function(){return O}),k.d($,"findFragmentByPTS",function(){return W}),k.d($,"fragmentWithinToleranceTest",function(){return F}),k.d($,"pdtWithinToleranceTest",function(){return P}),k.d($,"findFragWithCC",function(){return w});var X=k("./src/polyfills/number.ts"),U=k("./src/utils/binary-search.ts");function O(f,b,M){if(b===null||!Array.isArray(f)||!f.length||!Object(X.isFiniteNumber)(b))return null;var A=f[0].programDateTime;if(b<(A||0))return null;var S=f[f.length-1].endProgramDateTime;if(b>=(S||0))return null;M=M||0;for(var T=0;T<f.length;++T){var d=f[T];if(P(b,M,d))return d}return null}function W(f,b,M,A){M===void 0&&(M=0),A===void 0&&(A=0);var S=null;if(f?S=b[f.sn-b[0].sn+1]||null:M===0&&b[0].start===0&&(S=b[0]),S&&F(M,A,S)===0)return S;var T=U.default.search(b,F.bind(null,M,A));return T||S}function F(f,b,M){f===void 0&&(f=0),b===void 0&&(b=0);var A=Math.min(b,M.duration+(M.deltaPTS?M.deltaPTS:0));return M.start+M.duration-A<=f?1:M.start-A>f&&M.start?-1:0}function P(f,b,M){var A=Math.min(b,M.duration+(M.deltaPTS?M.deltaPTS:0))*1e3,S=M.endProgramDateTime||0;return S-A>f}function w(f,b){return U.default.search(f,function(M){return M.cc<b?1:M.cc>b?-1:0})}},"./src/controller/fragment-tracker.ts":function(ne,$,k){"use strict";k.r($),k.d($,"FragmentState",function(){return O}),k.d($,"FragmentTracker",function(){return W});var X=k("./src/events.ts"),U=k("./src/types/loader.ts"),O;(function(w){w.NOT_LOADED="NOT_LOADED",w.BACKTRACKED="BACKTRACKED",w.APPENDING="APPENDING",w.PARTIAL="PARTIAL",w.OK="OK"})(O||(O={}));var W=function(){function w(b){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=b,this._registerListeners()}var f=w.prototype;return f._registerListeners=function(){var M=this.hls;M.on(X.Events.BUFFER_APPENDED,this.onBufferAppended,this),M.on(X.Events.FRAG_BUFFERED,this.onFragBuffered,this),M.on(X.Events.FRAG_LOADED,this.onFragLoaded,this)},f._unregisterListeners=function(){var M=this.hls;M.off(X.Events.BUFFER_APPENDED,this.onBufferAppended,this),M.off(X.Events.FRAG_BUFFERED,this.onFragBuffered,this),M.off(X.Events.FRAG_LOADED,this.onFragLoaded,this)},f.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},f.getAppendedFrag=function(M,A){if(A===U.PlaylistLevelType.MAIN){var S=this.activeFragment,T=this.activeParts;if(!S)return null;if(T)for(var d=T.length;d--;){var a=T[d],s=a?a.end:S.appendedPTS;if(a.start<=M&&s!==void 0&&M<=s)return d>9&&(this.activeParts=T.slice(d-9)),a}else if(S.start<=M&&S.appendedPTS!==void 0&&M<=S.appendedPTS)return S}return this.getBufferedFrag(M,A)},f.getBufferedFrag=function(M,A){for(var S=this.fragments,T=Object.keys(S),d=T.length;d--;){var a=S[T[d]];if((a==null?void 0:a.body.type)===A&&a.buffered){var s=a.body;if(s.start<=M&&M<=s.end)return s}}return null},f.detectEvictedFragments=function(M,A,S){var T=this;Object.keys(this.fragments).forEach(function(d){var a=T.fragments[d];if(!a)return;if(!a.buffered){a.body.type===S&&T.removeFragment(a.body);return}var s=a.range[M];if(!s)return;s.time.some(function(u){var _=!T.isTimeBuffered(u.startPTS,u.endPTS,A);return _&&T.removeFragment(a.body),_})})},f.detectPartialFragments=function(M){var A=this,S=this.timeRanges,T=M.frag,d=M.part;if(!S||T.sn==="initSegment")return;var a=P(T),s=this.fragments[a];if(!s)return;Object.keys(S).forEach(function(u){var _=T.elementaryStreams[u];if(!_)return;var m=S[u],p=d!==null||_.partial===!0;s.range[u]=A.getBufferedTimes(T,d,p,m)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},f.fragBuffered=function(M){var A=P(M),S=this.fragments[A];S&&(S.backtrack=S.loaded=null,S.buffered=!0)},f.getBufferedTimes=function(M,A,S,T){for(var d={time:[],partial:S},a=A?A.start:M.start,s=A?A.end:M.end,u=M.minEndPTS||s,_=M.maxStartPTS||a,m=0;m<T.length;m++){var p=T.start(m)-this.bufferPadding,D=T.end(m)+this.bufferPadding;if(_>=p&&u<=D){d.time.push({startPTS:Math.max(a,T.start(m)),endPTS:Math.min(s,T.end(m))});break}else if(a<D&&s>p)d.partial=!0,d.time.push({startPTS:Math.max(a,T.start(m)),endPTS:Math.min(s,T.end(m))});else if(s<=p)break}return d},f.getPartialFragment=function(M){var A=null,S,T,d,a=0,s=this.bufferPadding,u=this.fragments;return Object.keys(u).forEach(function(_){var m=u[_];if(!m)return;F(m)&&(T=m.body.start-s,d=m.body.end+s,M>=T&&M<=d&&(S=Math.min(M-T,d-M),a<=S&&(A=m.body,a=S)))}),A},f.getState=function(M){var A=P(M),S=this.fragments[A];return S?S.buffered?F(S)?O.PARTIAL:O.OK:S.backtrack?O.BACKTRACKED:O.APPENDING:O.NOT_LOADED},f.backtrack=function(M,A){var S=P(M),T=this.fragments[S];if(!T||T.backtrack)return null;var d=T.backtrack=A||T.loaded;return T.loaded=null,d},f.getBacktrackData=function(M){var A=P(M),S=this.fragments[A];if(S){var T,d=S.backtrack;if(d!=null&&(T=d.payload)!==null&&T!==void 0&&T.byteLength)return d;this.removeFragment(M)}return null},f.isTimeBuffered=function(M,A,S){for(var T,d,a=0;a<S.length;a++){if(T=S.start(a)-this.bufferPadding,d=S.end(a)+this.bufferPadding,M>=T&&A<=d)return!0;if(A<=T)return!1}return!1},f.onFragLoaded=function(M,A){var S=A.frag,T=A.part;if(S.sn==="initSegment"||S.bitrateTest||T)return;var d=P(S);this.fragments[d]={body:S,loaded:A,backtrack:null,buffered:!1,range:Object.create(null)}},f.onBufferAppended=function(M,A){var S=this,T=A.frag,d=A.part,a=A.timeRanges;if(T.type===U.PlaylistLevelType.MAIN)if(this.activeFragment=T,d){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(d)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach(function(u){var _=a[u];if(S.detectEvictedFragments(u,_),!d)for(var m=0;m<_.length;m++)T.appendedPTS=Math.max(_.end(m),T.appendedPTS||0)})},f.onFragBuffered=function(M,A){this.detectPartialFragments(A)},f.hasFragment=function(M){var A=P(M);return!!this.fragments[A]},f.removeFragmentsInRange=function(M,A,S){var T=this;Object.keys(this.fragments).forEach(function(d){var a=T.fragments[d];if(!a)return;if(a.buffered){var s=a.body;s.type===S&&s.start<A&&s.end>M&&T.removeFragment(s)}})},f.removeFragment=function(M){var A=P(M);M.stats.loaded=0,M.clearElementaryStreamInfo(),delete this.fragments[A]},f.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},w}();function F(w){var f,b;return w.buffered&&(((f=w.range.video)===null||f===void 0?void 0:f.partial)||((b=w.range.audio)===null||b===void 0?void 0:b.partial))}function P(w){return w.type+"_"+w.level+"_"+w.urlId+"_"+w.sn}},"./src/controller/gap-controller.ts":function(ne,$,k){"use strict";k.r($),k.d($,"STALL_MINIMUM_DURATION_MS",function(){return F}),k.d($,"MAX_START_GAP_JUMP",function(){return P}),k.d($,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return w}),k.d($,"SKIP_BUFFER_RANGE_START",function(){return f}),k.d($,"default",function(){return b});var X=k("./src/utils/buffer-helper.ts"),U=k("./src/errors.ts"),O=k("./src/events.ts"),W=k("./src/utils/logger.ts"),F=250,P=2,w=.1,f=.05,b=function(){function M(S,T,d,a){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=S,this.media=T,this.fragmentTracker=d,this.hls=a}var A=M.prototype;return A.destroy=function(){this.hls=this.fragmentTracker=this.media=null},A.poll=function(T){var d=this.config,a=this.media,s=this.stalled,u=a.currentTime,_=a.seeking,m=this.seeking&&!_,p=!this.seeking&&_;if(this.seeking=_,u!==T){if(this.moved=!0,s!==null){if(this.stallReported){var D=self.performance.now()-s;W.logger.warn("playback not stuck anymore @"+u+", after "+Math.round(D)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((p||m)&&(this.stalled=null),a.paused||a.ended||a.playbackRate===0||!X.BufferHelper.getBuffered(a).length)return;var E=X.BufferHelper.bufferInfo(a,u,0),g=E.len>0,c=E.nextStart||0;if(!g&&!c)return;if(_){var h=E.len>P,o=!c||c-u>P&&!this.fragmentTracker.getPartialFragment(u);if(h||o)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var C,x=Math.max(c,E.start||0)-u,v=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,R=v==null||((C=v.details)===null||C===void 0)?void 0:C.live,B=R?v.details.targetduration*2:P;if(x>0&&x<=B){this._trySkipBufferHole(null);return}}var j=self.performance.now();if(s===null){this.stalled=j;return}var K=j-s;!_&&K>=F&&this._reportStall(E.len);var I=X.BufferHelper.bufferInfo(a,u,d.maxBufferHole);this._tryFixBufferStall(I,K)},A._tryFixBufferStall=function(T,d){var a=this.config,s=this.fragmentTracker,u=this.media,_=u.currentTime,m=s.getPartialFragment(_);if(m){var p=this._trySkipBufferHole(m);if(p)return}T.len>a.maxBufferHole&&d>a.highBufferWatchdogPeriod*1e3&&(W.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},A._reportStall=function(T){var d=this.hls,a=this.media,s=this.stallReported;s||(this.stallReported=!0,W.logger.warn("Playback stalling at @"+a.currentTime+" due to low buffer (buffer="+T+")"),d.trigger(O.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:T}))},A._trySkipBufferHole=function(T){for(var d=this.config,a=this.hls,s=this.media,u=s.currentTime,_=0,m=X.BufferHelper.getBuffered(s),p=0;p<m.length;p++){var D=m.start(p);if(u+d.maxBufferHole>=_&&u<D){var E=Math.max(D+f,s.currentTime+w);return W.logger.warn("skipping hole, adjusting currentTime from "+u+" to "+E),this.moved=!0,this.stalled=null,s.currentTime=E,T&&a.trigger(O.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+u+" to "+E,frag:T}),E}_=m.end(p)}return 0},A._tryNudgeBuffer=function(){var T=this.config,d=this.hls,a=this.media,s=a.currentTime,u=(this.nudgeRetry||0)+1;if(this.nudgeRetry=u,u<T.nudgeMaxRetry){var _=s+u*T.nudgeOffset;W.logger.warn("Nudging 'currentTime' from "+s+" to "+_),a.currentTime=_,d.trigger(O.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else W.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+T.nudgeMaxRetry+" nudges"),d.trigger(O.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},M}()},"./src/controller/id3-track-controller.ts":function(ne,$,k){"use strict";k.r($);var X=k("./src/events.ts"),U=k("./src/utils/texttrack-utils.ts"),O=k("./src/demux/id3.ts"),W=.25,F=function(){function P(f){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=f,this._registerListeners()}var w=P.prototype;return w.destroy=function(){this._unregisterListeners()},w._registerListeners=function(){var b=this.hls;b.on(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),b.on(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this),b.on(X.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),b.on(X.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},w._unregisterListeners=function(){var b=this.hls;b.off(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),b.off(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this),b.off(X.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),b.off(X.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},w.onMediaAttached=function(b,M){this.media=M.media},w.onMediaDetaching=function(){if(!this.id3Track)return;Object(U.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},w.getID3Track=function(b){if(!this.media)return;for(var M=0;M<b.length;M++){var A=b[M];if(A.kind==="metadata"&&A.label==="id3")return Object(U.sendAddTrackEvent)(A,this.media),A}return this.media.addTextTrack("metadata","id3")},w.onFragParsingMetadata=function(b,M){if(!this.media)return;var A=M.frag,S=M.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var T=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,d=0;d<S.length;d++){var a=O.getID3Frames(S[d].data);if(a){var s=S[d].pts,u=d<S.length-1?S[d+1].pts:A.end,_=u-s;_<=0&&(u=s+W);for(var m=0;m<a.length;m++){var p=a[m];if(!O.isTimeStampFrame(p)){var D=new T(s,u,"");D.value=p,this.id3Track.addCue(D)}}}}},w.onBufferFlushing=function(b,M){var A=M.startOffset,S=M.endOffset,T=M.type;if(!T||T==="audio"){var d=this.id3Track;d&&Object(U.removeCuesInRange)(d,A,S)}},P}();$.default=F},"./src/controller/latency-controller.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return P});var X=k("./src/errors.ts"),U=k("./src/events.ts"),O=k("./src/utils/logger.ts");function W(w,f){for(var b=0;b<f.length;b++){var M=f[b];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(w,M.key,M)}}function F(w,f,b){return f&&W(w.prototype,f),b&&W(w,b),w}var P=function(){function w(b){var M=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 M.timeupdate()},this.hls=b,this.config=b.config,this.registerListeners()}var f=w.prototype;return f.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},f.registerListeners=function(){this.hls.on(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(U.Events.ERROR,this.onError,this)},f.unregisterListeners=function(){this.hls.off(U.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(U.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(U.Events.ERROR,this.onError)},f.onMediaAttached=function(M,A){this.media=A.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},f.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},f.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},f.onLevelUpdated=function(M,A){var S=A.details;this.levelDetails=S,S.advanced&&this.timeupdate(),!S.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},f.onError=function(M,A){if(A.details!==X.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,O.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},f.timeupdate=function(){var M=this.media,A=this.levelDetails;if(!M||!A)return;this.currentTime=M.currentTime;var S=this.computeLatency();if(S===null)return;this._latency=S;var T=this.config,d=T.lowLatencyMode,a=T.maxLiveSyncPlaybackRate;if(!d||a===1)return;var s=this.targetLatency;if(s===null)return;var u=S-s,_=Math.min(this.maxLatency,s+A.targetduration),m=u<_;if(A.live&&m&&u>.05&&this.forwardBufferLength>1){var p=Math.min(2,Math.max(1,a)),D=Math.round(2/(1+Math.exp(-.75*u-this.edgeStalled))*20)/20;M.playbackRate=Math.min(p,Math.max(1,D))}else M.playbackRate!==1&&M.playbackRate!==0&&(M.playbackRate=1)},f.estimateLiveEdge=function(){var M=this.levelDetails;return M===null?null:M.edge+M.age},f.computeLatency=function(){var M=this.estimateLiveEdge();return M===null?null:M-this.currentTime},F(w,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var M=this.config,A=this.levelDetails;return M.liveMaxLatencyDuration!==void 0?M.liveMaxLatencyDuration:A?M.liveMaxLatencyDurationCount*A.targetduration:0}},{key:"targetLatency",get:function(){var M=this.levelDetails;if(M===null)return null;var A=M.holdBack,S=M.partHoldBack,T=M.targetduration,d=this.config,a=d.liveSyncDuration,s=d.liveSyncDurationCount,u=d.lowLatencyMode,_=this.hls.userConfig,m=u&&S||A;(_.liveSyncDuration||_.liveSyncDurationCount||m===0)&&(m=a!==void 0?a:s*T);var p=T,D=1;return m+Math.min(this.stallCount*D,p)}},{key:"liveSyncPosition",get:function(){var M=this.estimateLiveEdge(),A=this.targetLatency,S=this.levelDetails;if(M===null||A===null||S===null)return null;var T=S.edge,d=M-A-this.edgeStalled,a=T-S.totalduration,s=T-(this.config.lowLatencyMode&&S.partTarget||S.targetduration);return Math.min(Math.max(a,d),s)}},{key:"drift",get:function(){var M=this.levelDetails;return M===null?1:M.drift}},{key:"edgeStalled",get:function(){var M=this.levelDetails;if(M===null)return 0;var A=(this.config.lowLatencyMode&&M.partTarget||M.targetduration)*3;return Math.max(M.age-A,0)}},{key:"forwardBufferLength",get:function(){var M=this.media,A=this.levelDetails;if(!M||!A)return 0;var S=M.buffered.length;return S?M.buffered.end(S-1):A.edge-this.currentTime}}]),w}()},"./src/controller/level-controller.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return d});var X=k("./src/types/level.ts"),U=k("./src/events.ts"),O=k("./src/errors.ts"),W=k("./src/utils/codecs.ts"),F=k("./src/controller/level-helper.ts"),P=k("./src/controller/base-playlist-controller.ts"),w=k("./src/types/loader.ts");function f(){return f=Object.assign||function(a){for(var s=1;s<arguments.length;s++){var u=arguments[s];for(var _ in u)Object.prototype.hasOwnProperty.call(u,_)&&(a[_]=u[_])}return a},f.apply(this,arguments)}function b(a,s){for(var u=0;u<s.length;u++){var _=s[u];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(a,_.key,_)}}function M(a,s,u){return s&&b(a.prototype,s),u&&b(a,u),a}function A(a,s){a.prototype=Object.create(s.prototype),a.prototype.constructor=a,S(a,s)}function S(a,s){return S=Object.setPrototypeOf||function(_,m){return _.__proto__=m,_},S(a,s)}var T=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),d=function(a){A(s,a);function s(_){var m;return m=a.call(this,_,"[level-controller]")||this,m._levels=[],m._firstLevel=-1,m._startLevel=void 0,m.currentLevelIndex=-1,m.manualLevelIndex=-1,m.onParsedComplete=void 0,m._registerListeners(),m}var u=s.prototype;return u._registerListeners=function(){var m=this.hls;m.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),m.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.on(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),m.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),m.on(U.Events.ERROR,this.onError,this)},u._unregisterListeners=function(){var m=this.hls;m.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),m.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.off(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),m.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),m.off(U.Events.ERROR,this.onError,this)},u.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,a.prototype.destroy.call(this)},u.startLoad=function(){var m=this._levels;m.forEach(function(p){p.loadError=0}),a.prototype.startLoad.call(this)},u.onManifestLoaded=function(m,p){var D=[],E=[],g=[],c,h={},o,C=!1,x=!1,v=!1;if(p.levels.forEach(function(K){var I=K.attrs;C=C||!!(K.width&&K.height),x=x||!!K.videoCodec,v=v||!!K.audioCodec,T&&K.audioCodec&&K.audioCodec.indexOf("mp4a.40.34")!==-1&&(K.audioCodec=void 0);var N=K.bitrate+"-"+K.attrs.RESOLUTION+"-"+K.attrs.CODECS;o=h[N],o?o.url.push(K.url):(o=new X.Level(K),h[N]=o,D.push(o)),I&&(I.AUDIO&&Object(F.addGroupId)(o,"audio",I.AUDIO),I.SUBTITLES&&Object(F.addGroupId)(o,"text",I.SUBTITLES))}),(C||x)&&v&&(D=D.filter(function(K){var I=K.videoCodec,N=K.width,Y=K.height;return!!I||!!(N&&Y)})),D=D.filter(function(K){var I=K.audioCodec,N=K.videoCodec;return(!I||Object(W.isCodecSupportedInMp4)(I,"audio"))&&(!N||Object(W.isCodecSupportedInMp4)(N,"video"))}),p.audioTracks&&(E=p.audioTracks.filter(function(K){return!K.audioCodec||Object(W.isCodecSupportedInMp4)(K.audioCodec,"audio")}),Object(F.assignTrackIdsByGroup)(E)),p.subtitles&&(g=p.subtitles,Object(F.assignTrackIdsByGroup)(g)),D.length>0){c=D[0].bitrate,D.sort(function(K,I){return K.bitrate-I.bitrate}),this._levels=D;for(var R=0;R<D.length;R++)if(D[R].bitrate===c){this._firstLevel=R,this.log("manifest loaded, "+D.length+" level(s) found, first bitrate: "+c);break}var B=v&&!x,j={levels:D,audioTracks:E,subtitleTracks:g,firstLevel:this._firstLevel,stats:p.stats,audio:v,video:x,altAudio:!B&&E.some(function(K){return!!K.url})};this.hls.trigger(U.Events.MANIFEST_PARSED,j),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(U.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:p.url,reason:"no level with compatible codecs found in manifest"})},u.onError=function(m,p){if(a.prototype.onError.call(this,m,p),p.fatal)return;var D=p.context,E=this._levels[this.currentLevelIndex];if(D&&(D.type===w.PlaylistContextType.AUDIO_TRACK&&E.audioGroupIds&&D.groupId===E.audioGroupIds[E.urlId]||D.type===w.PlaylistContextType.SUBTITLE_TRACK&&E.textGroupIds&&D.groupId===E.textGroupIds[E.urlId])){this.redundantFailover(this.currentLevelIndex);return}var g=!1,c=!0,h;switch(p.details){case O.ErrorDetails.FRAG_LOAD_ERROR:case O.ErrorDetails.FRAG_LOAD_TIMEOUT:case O.ErrorDetails.KEY_LOAD_ERROR:case O.ErrorDetails.KEY_LOAD_TIMEOUT:if(p.frag){var o=this._levels[p.frag.level];o?(o.fragmentError++,o.fragmentError>this.hls.config.fragLoadingMaxRetry&&(h=p.frag.level)):h=p.frag.level}break;case O.ErrorDetails.LEVEL_LOAD_ERROR:case O.ErrorDetails.LEVEL_LOAD_TIMEOUT:D&&(D.deliveryDirectives&&(c=!1),h=D.level),g=!0;break;case O.ErrorDetails.REMUX_ALLOC_ERROR:h=p.level,g=!0;break}h!==void 0&&this.recoverLevel(p,h,g,c)},u.recoverLevel=function(m,p,D,E){var g=m.details,c=this._levels[p];if(c.loadError++,D){var h=this.retryLoadingOrFail(m);if(h)m.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(E){var o=c.url.length;if(o>1&&c.loadError<o)m.levelRetry=!0,this.redundantFailover(p);else if(this.manualLevelIndex===-1){var C=p===0?this._levels.length-1:p-1;this.currentLevelIndex!==C&&this._levels[C].loadError===0&&(this.warn(g+": switch to "+C),m.levelRetry=!0,this.hls.nextAutoLevel=C)}}},u.redundantFailover=function(m){var p=this._levels[m],D=p.url.length;if(D>1){var E=(p.urlId+1)%D;this.warn("Switching to redundant URL-id "+E),this._levels.forEach(function(g){g.urlId=E}),this.level=m}},u.onFragLoaded=function(m,p){var D=p.frag;if(D!==void 0&&D.type===w.PlaylistLevelType.MAIN){var E=this._levels[D.level];E!==void 0&&(E.fragmentError=0,E.loadError=0)}},u.onLevelLoaded=function(m,p){var D,E=p.level,g=p.details,c=this._levels[E];if(!c){var h;this.warn("Invalid level index "+E),(h=p.deliveryDirectives)!==null&&h!==void 0&&h.skip&&(g.deltaUpdateFailed=!0);return}E===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(E,p,c.details)):(D=p.deliveryDirectives)!==null&&D!==void 0&&D.skip&&(g.deltaUpdateFailed=!0)},u.onAudioTrackSwitched=function(m,p){var D=this.hls.levels[this.currentLevelIndex];if(!D)return;if(D.audioGroupIds){for(var E=-1,g=this.hls.audioTracks[p.id].groupId,c=0;c<D.audioGroupIds.length;c++)if(D.audioGroupIds[c]===g){E=c;break}E!==D.urlId&&(D.urlId=E,this.startLoad())}},u.loadPlaylist=function(m){var p=this.currentLevelIndex,D=this._levels[p];if(this.canLoad&&D&&D.url.length>0){var E=D.urlId,g=D.url[E];if(m)try{g=m.addDirectives(g)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+p+(m?" at sn "+m.msn+" part "+m.part:"")+" with URL-id "+E+" "+g),this.clearTimer(),this.hls.trigger(U.Events.LEVEL_LOADING,{url:g,level:p,id:E,deliveryDirectives:m||null})}},u.removeLevel=function(m,p){var D=function(c,h){return h!==p},E=this._levels.filter(function(g,c){return c!==m?!0:g.url.length>1&&p!==void 0?(g.url=g.url.filter(D),g.audioGroupIds&&(g.audioGroupIds=g.audioGroupIds.filter(D)),g.textGroupIds&&(g.textGroupIds=g.textGroupIds.filter(D)),g.urlId=0,!0):!1}).map(function(g,c){var h=g.details;return h!=null&&h.fragments&&h.fragments.forEach(function(o){o.level=c}),g});this._levels=E,this.hls.trigger(U.Events.LEVELS_UPDATED,{levels:E})},M(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(m){var p,D=this._levels;if(D.length===0)return;if(this.currentLevelIndex===m&&(p=D[m])!==null&&p!==void 0&&p.details)return;if(m<0||m>=D.length){var E=m<0;if(this.hls.trigger(U.Events.ERROR,{type:O.ErrorTypes.OTHER_ERROR,details:O.ErrorDetails.LEVEL_SWITCH_ERROR,level:m,fatal:E,reason:"invalid level idx"}),E)return;m=Math.min(m,D.length-1)}this.clearTimer();var g=this.currentLevelIndex,c=D[g],h=D[m];this.log("switching to level "+m+" from "+g),this.currentLevelIndex=m;var o=f({},h,{level:m,maxBitrate:h.maxBitrate,uri:h.uri,urlId:h.urlId});delete o._urlId,this.hls.trigger(U.Events.LEVEL_SWITCHING,o);var C=h.details;if(!C||C.live){var x=this.switchParams(h.uri,c==null?void 0:c.details);this.loadPlaylist(x)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(m){this.manualLevelIndex=m,this._startLevel===void 0&&(this._startLevel=m),m!==-1&&(this.level=m)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(m){this._firstLevel=m}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var m=this.hls.config.startLevel;return m!==void 0?m:this._firstLevel}else return this._startLevel},set:function(m){this._startLevel=m}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(m){this.level=m,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=m)}}]),s}(P.default)},"./src/controller/level-helper.ts":function(ne,$,k){"use strict";k.r($),k.d($,"addGroupId",function(){return O}),k.d($,"assignTrackIdsByGroup",function(){return W}),k.d($,"updatePTS",function(){return F}),k.d($,"updateFragPTSDTS",function(){return w}),k.d($,"mergeDetails",function(){return f}),k.d($,"mapPartIntersection",function(){return b}),k.d($,"mapFragmentIntersection",function(){return M}),k.d($,"adjustSliding",function(){return A}),k.d($,"addSliding",function(){return S}),k.d($,"computeReloadInterval",function(){return T}),k.d($,"getFragmentWithSN",function(){return d}),k.d($,"getPartWith",function(){return a});var X=k("./src/polyfills/number.ts"),U=k("./src/utils/logger.ts");function O(s,u,_){switch(u){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(_);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(_);break}}function W(s){var u={};s.forEach(function(_){var m=_.groupId||"";_.id=u[m]=u[m]||0,u[m]++})}function F(s,u,_){var m=s[u],p=s[_];P(m,p)}function P(s,u){var _=u.startPTS;if(Object(X.isFiniteNumber)(_)){var m=0,p;u.sn>s.sn?(m=_-s.start,p=s):(m=s.start-_,p=u),p.duration!==m&&(p.duration=m)}else if(u.sn>s.sn){var D=s.cc===u.cc;D&&s.minEndPTS?u.start=s.start+(s.minEndPTS-s.start):u.start=s.start+s.duration}else u.start=Math.max(s.start-u.duration,0)}function w(s,u,_,m,p,D){var E=m-_;E<=0&&(U.logger.warn("Fragment should have a positive duration",u),m=_+u.duration,D=p+u.duration);var g=_,c=m,h=u.startPTS,o=u.endPTS;if(Object(X.isFiniteNumber)(h)){var C=Math.abs(h-_);Object(X.isFiniteNumber)(u.deltaPTS)?u.deltaPTS=Math.max(C,u.deltaPTS):u.deltaPTS=C,g=Math.max(_,h),_=Math.min(_,h),p=Math.min(p,u.startDTS),c=Math.min(m,o),m=Math.max(m,o),D=Math.max(D,u.endDTS)}u.duration=m-_;var x=_-u.start;u.appendedPTS=m,u.start=u.startPTS=_,u.maxStartPTS=g,u.startDTS=p,u.endPTS=m,u.minEndPTS=c,u.endDTS=D;var v=u.sn;if(!s||v<s.startSN||v>s.endSN)return 0;var R,B=v-s.startSN,j=s.fragments;for(j[B]=u,R=B;R>0;R--)P(j[R],j[R-1]);for(R=B;R<j.length-1;R++)P(j[R],j[R+1]);return s.fragmentHint&&P(j[j.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,x}function f(s,u){for(var _=null,m=s.fragments,p=m.length-1;p>=0;p--){var D=m[p].initSegment;if(D){_=D;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var E=0,g;if(M(s,u,function(R,B){R.relurl&&(E=R.cc-B.cc),Object(X.isFiniteNumber)(R.startPTS)&&Object(X.isFiniteNumber)(R.endPTS)&&(B.start=B.startPTS=R.startPTS,B.startDTS=R.startDTS,B.appendedPTS=R.appendedPTS,B.maxStartPTS=R.maxStartPTS,B.endPTS=R.endPTS,B.endDTS=R.endDTS,B.minEndPTS=R.minEndPTS,B.duration=R.endPTS-R.startPTS,B.duration&&(g=B),u.PTSKnown=u.alignedSliding=!0),B.elementaryStreams=R.elementaryStreams,B.loader=R.loader,B.stats=R.stats,B.urlId=R.urlId,R.initSegment&&(B.initSegment=R.initSegment,_=R.initSegment)}),_){var c=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments;c.forEach(function(R){var B;(!R.initSegment||R.initSegment.relurl===((B=_)===null||B===void 0?void 0:B.relurl))&&(R.initSegment=_)})}if(u.skippedSegments&&(u.deltaUpdateFailed=u.fragments.some(function(R){return!R}),u.deltaUpdateFailed)){U.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var h=u.skippedSegments;h--;)u.fragments.shift();u.startSN=u.fragments[0].sn,u.startCC=u.fragments[0].cc}var o=u.fragments;if(E){U.logger.warn("discontinuity sliding from playlist, take drift into account");for(var C=0;C<o.length;C++)o[C].cc+=E}u.skippedSegments&&(u.startCC=u.fragments[0].cc),b(s.partList,u.partList,function(R,B){B.elementaryStreams=R.elementaryStreams,B.stats=R.stats}),g?w(u,g,g.startPTS,g.endPTS,g.startDTS,g.endDTS):A(s,u),o.length&&(u.totalduration=u.edge-o[0].start),u.driftStartTime=s.driftStartTime,u.driftStart=s.driftStart;var x=u.advancedDateTime;if(u.advanced&&x){var v=u.edge;u.driftStart||(u.driftStartTime=x,u.driftStart=v),u.driftEndTime=x,u.driftEnd=v}else u.driftEndTime=s.driftEndTime,u.driftEnd=s.driftEnd,u.advancedDateTime=s.advancedDateTime}function b(s,u,_){if(s&&u)for(var m=0,p=0,D=s.length;p<=D;p++){var E=s[p],g=u[p+m];E&&g&&E.index===g.index&&E.fragment.sn===g.fragment.sn?_(E,g):m--}}function M(s,u,_){for(var m=u.skippedSegments,p=Math.max(s.startSN,u.startSN)-u.startSN,D=(s.fragmentHint?1:0)+(m?u.endSN:Math.min(s.endSN,u.endSN))-u.startSN,E=u.startSN-s.startSN,g=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,c=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,h=p;h<=D;h++){var o=c[E+h],C=g[h];m&&!C&&h<m&&(C=u.fragments[h]=o),o&&C&&_(o,C)}}function A(s,u){var _=u.startSN+u.skippedSegments-s.startSN,m=s.fragments;if(_<0||_>=m.length)return;S(u,m[_].start)}function S(s,u){if(u){for(var _=s.fragments,m=s.skippedSegments;m<_.length;m++)_[m].start+=u;s.fragmentHint&&(s.fragmentHint.start+=u)}}function T(s,u){var _=1e3*s.levelTargetDuration,m=_/2,p=s.age,D=p>0&&p<_*3,E=u.loading.end-u.loading.start,g,c=s.availabilityDelay;if(s.updated===!1)if(D){var h=333*s.misses;g=Math.max(Math.min(m,E*2),h),s.availabilityDelay=(s.availabilityDelay||0)+g}else g=m;else D?(c=Math.min(c||_/2,p),s.availabilityDelay=c,g=c+_-p):g=_-E;return Math.round(g)}function d(s,u,_){if(!s||!s.details)return null;var m=s.details,p=m.fragments[u-m.startSN];return p||(p=m.fragmentHint,p&&p.sn===u?p:u<m.startSN&&_&&_.sn===u?_:null)}function a(s,u,_){if(!s||!s.details)return null;var m=s.details.partList;if(m)for(var p=m.length;p--;){var D=m[p];if(D.index===_&&D.fragment.sn===u)return D}return null}},"./src/controller/stream-controller.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return m});var X=k("./src/polyfills/number.ts"),U=k("./src/controller/base-stream-controller.ts"),O=k("./src/is-supported.ts"),W=k("./src/events.ts"),F=k("./src/utils/buffer-helper.ts"),P=k("./src/controller/fragment-tracker.ts"),w=k("./src/types/loader.ts"),f=k("./src/loader/fragment.ts"),b=k("./src/demux/transmuxer-interface.ts"),M=k("./src/types/transmuxer.ts"),A=k("./src/controller/gap-controller.ts"),S=k("./src/errors.ts"),T=k("./src/utils/logger.ts");function d(p,D){for(var E=0;E<D.length;E++){var g=D[E];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(p,g.key,g)}}function a(p,D,E){return D&&d(p.prototype,D),E&&d(p,E),p}function s(p,D){p.prototype=Object.create(D.prototype),p.prototype.constructor=p,u(p,D)}function u(p,D){return u=Object.setPrototypeOf||function(g,c){return g.__proto__=c,g},u(p,D)}var _=100,m=function(p){s(D,p);function D(g,c){var h;return h=p.call(this,g,c,"[stream-controller]")||this,h.audioCodecSwap=!1,h.gapController=null,h.level=-1,h._forceStartLoad=!1,h.altAudio=!1,h.audioOnly=!1,h.fragPlaying=null,h.onvplaying=null,h.onvseeked=null,h.fragLastKbps=0,h.stalled=!1,h.couldBacktrack=!1,h.audioCodecSwitch=!1,h.videoBuffer=null,h._registerListeners(),h}var E=D.prototype;return E._registerListeners=function(){var c=this.hls;c.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(W.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(W.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.on(W.Events.ERROR,this.onError,this),c.on(W.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(W.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(W.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(W.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(W.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.on(W.Events.FRAG_BUFFERED,this.onFragBuffered,this)},E._unregisterListeners=function(){var c=this.hls;c.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(W.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.off(W.Events.ERROR,this.onError,this),c.off(W.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(W.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(W.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(W.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(W.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.off(W.Events.FRAG_BUFFERED,this.onFragBuffered,this)},E.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},E.startLoad=function(c){if(this.levels){var h=this.lastCurrentTime,o=this.hls;if(this.stopLoad(),this.setInterval(_),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var C=o.startLevel;C===-1&&(o.config.testBandwidth?(C=0,this.bitrateTest=!0):C=o.nextAutoLevel),this.level=o.nextLoadLevel=C,this.loadedmetadata=!1}h>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+h.toFixed(3)),c=h),this.state=U.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=U.State.STOPPED},E.stopLoad=function(){this._forceStartLoad=!1,p.prototype.stopLoad.call(this)},E.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_LEVEL:{var c,h=this.levels,o=this.level,C=h==null||((c=h[o])===null||c===void 0)?void 0:c.details;if(C&&(!C.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(C))break;this.state=U.State.IDLE;break}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var x,v=self.performance.now(),R=this.retryDate;(!R||v>=R||(x=this.media)!==null&&x!==void 0&&x.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=U.State.IDLE)}break;default:break}this.onTickEnd()},E.onTickEnd=function(){p.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},E.doTickIdle=function(){var c,h,o=this.hls,C=this.levelLastLoaded,x=this.levels,v=this.media,R=o.config,B=o.nextLoadLevel;if(C===null||!v&&(this.startFragRequested||!R.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!x||!x[B])return;var j=x[B];this.level=o.nextLoadLevel=B;var K=j.details;if(!K||this.state===U.State.WAITING_LEVEL||K.live&&this.levelLastLoaded!==B){this.state=U.State.WAITING_LEVEL;return}var I=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:v,w.PlaylistLevelType.MAIN);if(I===null)return;var N=I.len,Y=this.getMaxBufferLength(j.maxBitrate);if(N>=Y)return;if(this._streamEnded(I,K)){var q={};this.altAudio&&(q.type="video"),this.hls.trigger(W.Events.BUFFER_EOS,q),this.state=U.State.ENDED;return}var ae=I.end,he=this.getNextFragment(ae,K);if(this.couldBacktrack&&!this.fragPrevious&&he&&he.sn!=="initSegment"){var _e=he.sn-K.startSN;_e>1&&(he=K.fragments[_e-1],this.fragmentTracker.removeFragment(he))}if(he&&this.fragmentTracker.getState(he)===P.FragmentState.OK&&this.nextLoadPosition>ae){var be=this.audioOnly&&!this.altAudio?f.ElementaryStreamTypes.AUDIO:f.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(v,be,w.PlaylistLevelType.MAIN),he=this.getNextFragment(this.nextLoadPosition,K)}if(!he)return;he.initSegment&&!he.initSegment.data&&!this.bitrateTest&&(he=he.initSegment),((c=he.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((h=he.decryptdata)!==null&&h!==void 0&&h.key)?this.loadKey(he,K):this.loadFragment(he,K,ae)},E.loadFragment=function(c,h,o){var C,x=this.fragmentTracker.getState(c);if(this.fragCurrent=c,x===P.FragmentState.BACKTRACKED){var v=this.fragmentTracker.getBacktrackData(c);if(v){this._handleFragmentLoadProgress(v),this._handleFragmentLoadComplete(v);return}else x=P.FragmentState.NOT_LOADED}x===P.FragmentState.NOT_LOADED||x===P.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,p.prototype.loadFragment.call(this,c,h,o)):x===P.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((C=this.media)===null||C===void 0?void 0:C.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},E.getAppendedFrag=function(c){var h=this.fragmentTracker.getAppendedFrag(c,w.PlaylistLevelType.MAIN);return h&&"fragment"in h?h.fragment:h},E.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,w.PlaylistLevelType.MAIN)},E.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},E.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},E.nextLevelSwitch=function(){var c=this.levels,h=this.media;if(h!=null&&h.readyState){var o,C=this.getAppendedFrag(h.currentTime);if(C&&C.start>1&&this.flushMainBuffer(0,C.start-1),!h.paused&&c){var x=this.hls.nextLoadLevel,v=c[x],R=this.fragLastKbps;R&&this.fragCurrent?o=this.fragCurrent.duration*v.maxBitrate/(1e3*R)+1:o=0}else o=0;var B=this.getBufferedFrag(h.currentTime+o);if(B){var j=this.followingBufferedFrag(B);if(j){this.abortCurrentFrag();var K=j.maxStartPTS?j.maxStartPTS:j.start,I=j.duration,N=Math.max(B.end,K+Math.min(Math.max(I-this.config.maxFragLookUpTolerance,I*.5),I*.75));this.flushMainBuffer(N,Number.POSITIVE_INFINITY)}}}},E.abortCurrentFrag=function(){var c=this.fragCurrent;this.fragCurrent=null,c!=null&&c.loader&&c.loader.abort(),this.state===U.State.KEY_LOADING&&(this.state=U.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},E.flushMainBuffer=function(c,h){p.prototype.flushMainBuffer.call(this,c,h,this.altAudio?"video":null)},E.onMediaAttached=function(c,h){p.prototype.onMediaAttached.call(this,c,h);var o=h.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),o.addEventListener("playing",this.onvplaying),o.addEventListener("seeked",this.onvseeked),this.gapController=new A.default(this.config,o,this.fragmentTracker,this.hls)},E.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),p.prototype.onMediaDetaching.call(this)},E.onMediaPlaying=function(){this.tick()},E.onMediaSeeked=function(){var c=this.media,h=c?c.currentTime:null;Object(X.isFiniteNumber)(h)&&this.log("Media seeked to "+h.toFixed(3)),this.tick()},E.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(W.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},E.onManifestParsed=function(c,h){var o=!1,C=!1,x;h.levels.forEach(function(v){x=v.audioCodec,x&&(x.indexOf("mp4a.40.2")!==-1&&(o=!0),x.indexOf("mp4a.40.5")!==-1&&(C=!0))}),this.audioCodecSwitch=o&&C&&!Object(O.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=h.levels,this.startFragRequested=!1},E.onLevelLoading=function(c,h){var o=this.levels;if(!o||this.state!==U.State.IDLE)return;var C=o[h.level];(!C.details||C.details.live&&this.levelLastLoaded!==h.level||this.waitForCdnTuneIn(C.details))&&(this.state=U.State.WAITING_LEVEL)},E.onLevelLoaded=function(c,h){var o,C=this.levels,x=h.level,v=h.details,R=v.totalduration;if(!C){this.warn("Levels were reset while loading level "+x);return}this.log("Level "+x+" loaded ["+v.startSN+","+v.endSN+"], cc ["+v.startCC+", "+v.endCC+"] duration:"+R);var B=this.fragCurrent;B&&(this.state===U.State.FRAG_LOADING||this.state===U.State.FRAG_LOADING_WAITING_RETRY)&&(B.level!==h.level&&B.loader&&(this.state=U.State.IDLE,B.loader.abort()));var j=C[x],K=0;if(v.live||(o=j.details)!==null&&o!==void 0&&o.live){if(v.fragments[0]||(v.deltaUpdateFailed=!0),v.deltaUpdateFailed)return;K=this.alignPlaylists(v,j.details)}if(j.details=v,this.levelLastLoaded=x,this.hls.trigger(W.Events.LEVEL_UPDATED,{details:v,level:x}),this.state===U.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(v))return;this.state=U.State.IDLE}this.startFragRequested?v.live&&this.synchronizeToLiveEdge(v):this.setStartPosition(v,K),this.tick()},E._handleFragmentLoadProgress=function(c){var h,o=c.frag,C=c.part,x=c.payload,v=this.levels;if(!v){this.warn("Levels were reset while fragment load was in progress. Fragment "+o.sn+" of level "+o.level+" will not be buffered");return}var R=v[o.level],B=R.details;if(!B){this.warn("Dropping fragment "+o.sn+" of level "+o.level+" after level details were reset");return}var j=R.videoCodec,K=B.PTSKnown||!B.live,I=(h=o.initSegment)===null||h===void 0?void 0:h.data,N=this._getAudioCodec(R),Y=this.transmuxer=this.transmuxer||new b.default(this.hls,w.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),q=C?C.index:-1,ae=q!==-1,he=new M.ChunkMetadata(o.level,o.sn,o.stats.chunkCount,x.byteLength,q,ae),_e=this.initPTS[o.cc];Y.push(x,I,N,j,o,C,B.totalduration,K,he,_e)},E.onAudioTrackSwitching=function(c,h){var o=this.altAudio,C=!!h.url,x=h.id;if(!C){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var v=this.fragCurrent;v!=null&&v.loader&&(this.log("Switching to main audio track, cancel main fragment load"),v.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var R=this.hls;o&&R.trigger(W.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),R.trigger(W.Events.AUDIO_TRACK_SWITCHED,{id:x})}},E.onAudioTrackSwitched=function(c,h){var o=h.id,C=!!this.hls.audioTracks[o].url;if(C){var x=this.videoBuffer;x&&this.mediaBuffer!==x&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=x)}this.altAudio=C,this.tick()},E.onBufferCreated=function(c,h){var o=h.tracks,C,x,v=!1;for(var R in o){var B=o[R];if(B.id==="main"){if(x=R,C=B,R==="video"){var j=o[R];j&&(this.videoBuffer=j.buffer)}}else v=!0}v&&C?(this.log("Alternate track found, use "+x+".buffered to schedule main fragment loading"),this.mediaBuffer=C.buffer):this.mediaBuffer=this.media},E.onFragBuffered=function(c,h){var o=h.frag,C=h.part;if(o&&o.type!==w.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(o)){this.warn("Fragment "+o.sn+(C?" p: "+C.index:"")+" of level "+o.level+" finished buffering, but was aborted. state: "+this.state),this.state===U.State.PARSED&&(this.state=U.State.IDLE);return}var x=C?C.stats:o.stats;this.fragLastKbps=Math.round(8*x.total/(x.buffering.end-x.loading.first)),o.sn!=="initSegment"&&(this.fragPrevious=o),this.fragBufferedComplete(o,C)},E.onError=function(c,h){switch(h.details){case S.ErrorDetails.FRAG_LOAD_ERROR:case S.ErrorDetails.FRAG_LOAD_TIMEOUT:case S.ErrorDetails.KEY_LOAD_ERROR:case S.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(w.PlaylistLevelType.MAIN,h);break;case S.ErrorDetails.LEVEL_LOAD_ERROR:case S.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==U.State.ERROR&&(h.fatal?(this.warn(""+h.details),this.state=U.State.ERROR):!h.levelRetry&&this.state===U.State.WAITING_LEVEL&&(this.state=U.State.IDLE));break;case S.ErrorDetails.BUFFER_FULL_ERROR:if(h.parent==="main"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var o=!0,C=this.getFwdBufferInfo(this.media,w.PlaylistLevelType.MAIN);C&&C.len>.5&&(o=!this.reduceMaxBufferLength(C.len)),o&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},E.checkBuffer=function(){var c=this.media,h=this.gapController;if(!c||!h||!c.readyState)return;var o=F.BufferHelper.getBuffered(c);!this.loadedmetadata&&o.length?(this.loadedmetadata=!0,this.seekToStartPos()):h.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},E.onFragLoadEmergencyAborted=function(){this.state=U.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},E.onBufferFlushed=function(c,h){var o=h.type;if(o!==f.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var C=(o===f.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(C,o,w.PlaylistLevelType.MAIN)}},E.onLevelsUpdated=function(c,h){this.levels=h.levels},E.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},E.seekToStartPos=function(){var c=this.media,h=c.currentTime,o=this.startPosition;if(o>=0&&h<o){if(c.seeking){T.logger.log("could not seek to "+o+", already seeking at "+h);return}var C=F.BufferHelper.getBuffered(c),x=C.length?C.start(0):0,v=x-o;v>0&&(v<this.config.maxBufferHole||v<this.config.maxFragLookUpTolerance)&&(T.logger.log("adjusting start position by "+v+" to match buffer start"),o+=v,this.startPosition=o),this.log("seek to target start position "+o+" from current time "+h),c.currentTime=o}},E._getAudioCodec=function(c){var h=this.config.defaultAudioCodec||c.audioCodec;return this.audioCodecSwap&&h&&(this.log("Swapping audio codec"),h.indexOf("mp4a.40.5")!==-1?h="mp4a.40.2":h="mp4a.40.5"),h},E._loadBitrateTestFrag=function(c){var h=this;this._doFragLoad(c).then(function(o){var C=h.hls;if(!o||C.nextLoadLevel||h.fragContextChanged(c))return;h.fragLoadError=0,h.state=U.State.IDLE,h.startFragRequested=!1,h.bitrateTest=!1;var x=c.stats;x.parsing.start=x.parsing.end=x.buffering.start=x.buffering.end=self.performance.now(),C.trigger(W.Events.FRAG_LOADED,o)})},E._handleTransmuxComplete=function(c){var h,o="main",C=this.hls,x=c.remuxResult,v=c.chunkMeta,R=this.getCurrentContext(v);if(!R){this.warn("The loading context changed while buffering fragment "+v.sn+" of level "+v.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(v.level);return}var B=R.frag,j=R.part,K=R.level,I=x.video,N=x.text,Y=x.id3,q=x.initSegment,ae=this.altAudio?void 0:x.audio;if(this.fragContextChanged(B))return;if(this.state=U.State.PARSING,q){q.tracks&&(this._bufferInitSegment(K,q.tracks,B,v),C.trigger(W.Events.FRAG_PARSING_INIT_SEGMENT,{frag:B,id:o,tracks:q.tracks}));var he=q.initPTS,_e=q.timescale;Object(X.isFiniteNumber)(he)&&(this.initPTS[B.cc]=he,C.trigger(W.Events.INIT_PTS_FOUND,{frag:B,id:o,initPTS:he,timescale:_e}))}if(I&&x.independent!==!1){if(K.details){var be=I.startPTS,Ce=I.endPTS,Te=I.startDTS,Ee=I.endDTS;if(j)j.elementaryStreams[I.type]={startPTS:be,endPTS:Ce,startDTS:Te,endDTS:Ee};else if(I.firstKeyFrame&&I.independent&&(this.couldBacktrack=!0),I.dropped&&I.independent){var me=this.getLoadPosition()+this.config.maxBufferHole;if(me<be){this.backtrack(B);return}B.setElementaryStreamInfo(I.type,B.start,Ce,B.start,Ee,!0)}B.setElementaryStreamInfo(I.type,be,Ce,Te,Ee),this.bufferFragmentData(I,B,j,v)}}else if(x.independent===!1){this.backtrack(B);return}if(ae){var ue=ae.startPTS,te=ae.endPTS,ce=ae.startDTS,se=ae.endDTS;j&&(j.elementaryStreams[f.ElementaryStreamTypes.AUDIO]={startPTS:ue,endPTS:te,startDTS:ce,endDTS:se}),B.setElementaryStreamInfo(f.ElementaryStreamTypes.AUDIO,ue,te,ce,se),this.bufferFragmentData(ae,B,j,v)}if(Y!=null&&(h=Y.samples)!==null&&h!==void 0&&h.length){var we={frag:B,id:o,samples:Y.samples};C.trigger(W.Events.FRAG_PARSING_METADATA,we)}if(N){var Le={frag:B,id:o,samples:N.samples};C.trigger(W.Events.FRAG_PARSING_USERDATA,Le)}},E._bufferInitSegment=function(c,h,o,C){var x=this;if(this.state!==U.State.PARSING)return;this.audioOnly=!!h.audio&&!h.video,this.altAudio&&!this.audioOnly&&delete h.audio;var v=h.audio,R=h.video,B=h.audiovideo;if(v){var j=c.audioCodec,K=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(j&&(j.indexOf("mp4a.40.5")!==-1?j="mp4a.40.2":j="mp4a.40.5"),v.metadata.channelCount!==1&&K.indexOf("firefox")===-1&&(j="mp4a.40.5")),K.indexOf("android")!==-1&&v.container!=="audio/mpeg"&&(j="mp4a.40.2",this.log("Android: force audio codec to "+j)),c.audioCodec&&c.audioCodec!==j&&this.log('Swapping manifest audio codec "'+c.audioCodec+'" for "'+j+'"'),v.levelCodec=j,v.id="main",this.log("Init audio buffer, container:"+v.container+", codecs[selected/level/parsed]=["+(j||"")+"/"+(c.audioCodec||"")+"/"+v.codec+"]")}R&&(R.levelCodec=c.videoCodec,R.id="main",this.log("Init video buffer, container:"+R.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+R.codec+"]")),B&&this.log("Init audiovideo buffer, container:"+B.container+", codecs[level/parsed]=["+(c.attrs.CODECS||"")+"/"+B.codec+"]"),this.hls.trigger(W.Events.BUFFER_CODECS,h),Object.keys(h).forEach(function(I){var N=h[I],Y=N.initSegment;Y!=null&&Y.byteLength&&x.hls.trigger(W.Events.BUFFER_APPENDING,{type:I,data:Y,frag:o,part:null,chunkMeta:C,parent:o.type})}),this.tick()},E.backtrack=function(c){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(c);var h=this.fragmentTracker.backtrack(c);this.fragPrevious=null,this.nextLoadPosition=c.start,h?this.resetFragmentLoading(c):this.state=U.State.BACKTRACKING},E.checkFragmentChanged=function(){var c=this.media,h=null;if(c&&c.readyState>1&&c.seeking===!1){var o=c.currentTime;if(F.BufferHelper.isBuffered(c,o)?h=this.getAppendedFrag(o):F.BufferHelper.isBuffered(c,o+.1)&&(h=this.getAppendedFrag(o+.1)),h){var C=this.fragPlaying,x=h.level;(!C||h.sn!==C.sn||C.level!==x||h.urlId!==C.urlId)&&(this.hls.trigger(W.Events.FRAG_CHANGED,{frag:h}),(!C||C.level!==x)&&this.hls.trigger(W.Events.LEVEL_SWITCHED,{level:x}),this.fragPlaying=h)}}},a(D,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var h=this.getAppendedFrag(c.currentTime);if(h)return h.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var h=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(h)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),D}(U.default)},"./src/controller/subtitle-stream-controller.ts":function(ne,$,k){"use strict";k.r($),k.d($,"SubtitleStreamController",function(){return s});var X=k("./src/events.ts"),U=k("./src/utils/logger.ts"),O=k("./src/utils/buffer-helper.ts"),W=k("./src/controller/fragment-finders.ts"),F=k("./src/utils/discontinuities.ts"),P=k("./src/controller/level-helper.ts"),w=k("./src/controller/fragment-tracker.ts"),f=k("./src/controller/base-stream-controller.ts"),b=k("./src/types/loader.ts"),M=k("./src/types/level.ts");function A(u,_){for(var m=0;m<_.length;m++){var p=_[m];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(u,p.key,p)}}function S(u,_,m){return _&&A(u.prototype,_),m&&A(u,m),u}function T(u,_){u.prototype=Object.create(_.prototype),u.prototype.constructor=u,d(u,_)}function d(u,_){return d=Object.setPrototypeOf||function(p,D){return p.__proto__=D,p},d(u,_)}var a=500,s=function(u){T(_,u);function _(p,D){var E;return E=u.call(this,p,D,"[subtitle-stream-controller]")||this,E.levels=[],E.currentTrackId=-1,E.tracksBuffered=[],E.mainDetails=null,E._registerListeners(),E}var m=_.prototype;return m.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},m._registerListeners=function(){var D=this.hls;D.on(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),D.on(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this),D.on(X.Events.MANIFEST_LOADING,this.onManifestLoading,this),D.on(X.Events.LEVEL_LOADED,this.onLevelLoaded,this),D.on(X.Events.ERROR,this.onError,this),D.on(X.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),D.on(X.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),D.on(X.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),D.on(X.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),D.on(X.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},m._unregisterListeners=function(){var D=this.hls;D.off(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),D.off(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this),D.off(X.Events.MANIFEST_LOADING,this.onManifestLoading,this),D.off(X.Events.LEVEL_LOADED,this.onLevelLoaded,this),D.off(X.Events.ERROR,this.onError,this),D.off(X.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),D.off(X.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),D.off(X.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),D.off(X.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),D.off(X.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},m.startLoad=function(){this.stopLoad(),this.state=f.State.IDLE,this.setInterval(a),this.tick()},m.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},m.onLevelLoaded=function(D,E){this.mainDetails=E.details},m.onSubtitleFragProcessed=function(D,E){var g=E.frag,c=E.success;if(this.fragPrevious=g,this.state=f.State.IDLE,!c)return;var h=this.tracksBuffered[this.currentTrackId];if(!h)return;for(var o,C=g.start,x=0;x<h.length;x++)if(C>=h[x].start&&C<=h[x].end){o=h[x];break}var v=g.start+g.duration;o?o.end=v:(o={start:C,end:v},h.push(o)),this.fragmentTracker.fragBuffered(g)},m.onBufferFlushing=function(D,E){var g=E.startOffset,c=E.endOffset;if(g===0&&c!==Number.POSITIVE_INFINITY){var h=this.currentTrackId,o=this.levels;if(!o.length||!o[h]||!o[h].details)return;var C=o[h].details,x=C.targetduration,v=c-x;if(v<=0)return;E.endOffsetSubtitles=Math.max(0,v),this.tracksBuffered.forEach(function(R){for(var B=0;B<R.length;){if(R[B].end<=v){R.shift();continue}else if(R[B].start<v)R[B].start=v;else break;B++}}),this.fragmentTracker.removeFragmentsInRange(g,v,b.PlaylistLevelType.SUBTITLE)}},m.onError=function(D,E){var g,c=E.frag;if(!c||c.type!==b.PlaylistLevelType.SUBTITLE)return;(g=this.fragCurrent)!==null&&g!==void 0&&g.loader&&this.fragCurrent.loader.abort(),this.state=f.State.IDLE},m.onSubtitleTracksUpdated=function(D,E){var g=this,c=E.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(h){return new M.Level(h)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(h){g.tracksBuffered[h.id]=[]}),this.mediaBuffer=null},m.onSubtitleTrackSwitch=function(D,E){if(this.currentTrackId=E.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var g=this.levels[this.currentTrackId];g!=null&&g.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,g&&this.setInterval(a)},m.onSubtitleTrackLoaded=function(D,E){var g,c=E.details,h=E.id,o=this.currentTrackId,C=this.levels;if(!C.length)return;var x=C[o];if(h>=C.length||h!==o||!x)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(g=x.details)!==null&&g!==void 0&&g.live){var v=this.mainDetails;if(c.deltaUpdateFailed||!v)return;var R=v.fragments[0];if(!x.details)c.hasProgramDateTime&&v.hasProgramDateTime?Object(F.alignMediaPlaylistByPDT)(c,v):R&&Object(P.addSliding)(c,R.start);else{var B=this.alignPlaylists(c,x.details);B===0&&R&&Object(P.addSliding)(c,R.start)}}if(x.details=c,this.levelLastLoaded=h,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===f.State.IDLE){var j=Object(W.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);j||(this.warn("Subtitle playlist not aligned with playback"),x.details=void 0)}},m._handleFragmentLoadComplete=function(D){var E=D.frag,g=D.payload,c=E.decryptdata,h=this.hls;if(this.fragContextChanged(E))return;if(g&&g.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var o=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(g),c.key.buffer,c.iv.buffer).then(function(C){var x=performance.now();h.trigger(X.Events.FRAG_DECRYPTED,{frag:E,payload:C,stats:{tstart:o,tdecrypt:x}})})}},m.doTick=function(){if(!this.media){this.state=f.State.IDLE;return}if(this.state===f.State.IDLE){var D,E=this.currentTrackId,g=this.levels;if(!g.length||!g[E]||!g[E].details)return;var c=g[E].details,h=c.targetduration,o=this.config,C=this.media,x=O.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,C.currentTime-h,o.maxBufferHole),v=x.end,R=x.len,B=this.getMaxBufferLength()+h;if(R>B)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var j=c.fragments,K=j.length,I=c.edge,N,Y=this.fragPrevious;if(v<I){var q=o.maxFragLookUpTolerance;Y&&c.hasProgramDateTime&&(N=Object(W.findFragmentByPDT)(j,Y.endProgramDateTime,q)),N||(N=Object(W.findFragmentByPTS)(Y,j,v,q),!N&&Y&&Y.start<j[0].start&&(N=j[0]))}else N=j[K-1];(D=N)!==null&&D!==void 0&&D.encrypted?(U.logger.log("Loading key for "+N.sn),this.state=f.State.KEY_LOADING,this.hls.trigger(X.Events.KEY_LOADING,{frag:N})):N&&this.fragmentTracker.getState(N)===w.FragmentState.NOT_LOADED&&this.loadFragment(N,c,v)}},m.loadFragment=function(D,E,g){this.fragCurrent=D,u.prototype.loadFragment.call(this,D,E,g)},S(_,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),_}(f.default)},"./src/controller/subtitle-track-controller.ts":function(ne,$,k){"use strict";k.r($);var X=k("./src/events.ts"),U=k("./src/utils/texttrack-utils.ts"),O=k("./src/controller/base-playlist-controller.ts"),W=k("./src/types/loader.ts");function F(A,S){for(var T=0;T<S.length;T++){var d=S[T];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(A,d.key,d)}}function P(A,S,T){return S&&F(A.prototype,S),T&&F(A,T),A}function w(A,S){A.prototype=Object.create(S.prototype),A.prototype.constructor=A,f(A,S)}function f(A,S){return f=Object.setPrototypeOf||function(d,a){return d.__proto__=a,d},f(A,S)}var b=function(A){w(S,A);function S(d){var a;return a=A.call(this,d,"[subtitle-track-controller]")||this,a.media=null,a.tracks=[],a.groupId=null,a.tracksInGroup=[],a.trackId=-1,a.selectDefaultTrack=!0,a.queuedDefaultTrack=-1,a.trackChangeListener=function(){return a.onTextTracksChanged()},a.asyncPollTrackChange=function(){return a.pollTrackChange(0)},a.useTextTrackPolling=!1,a.subtitlePollingInterval=-1,a.subtitleDisplay=!0,a.registerListeners(),a}var T=S.prototype;return T.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,A.prototype.destroy.call(this)},T.registerListeners=function(){var a=this.hls;a.on(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(X.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(X.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(X.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(X.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(X.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.on(X.Events.ERROR,this.onError,this)},T.unregisterListeners=function(){var a=this.hls;a.off(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(X.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(X.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(X.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(X.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(X.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.off(X.Events.ERROR,this.onError,this)},T.onMediaAttached=function(a,s){if(this.media=s.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},T.pollTrackChange=function(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,a)},T.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 a=M(this.media.textTracks);a.forEach(function(s){Object(U.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},T.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},T.onManifestParsed=function(a,s){this.tracks=s.subtitleTracks},T.onSubtitleTrackLoaded=function(a,s){var u=s.id,_=s.details,m=this.trackId,p=this.tracksInGroup[m];if(!p){this.warn("Invalid subtitle track id "+u);return}var D=p.details;p.details=s.details,this.log("subtitle track "+u+" loaded ["+_.startSN+"-"+_.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,s,D))},T.onLevelLoading=function(a,s){this.switchLevel(s.level)},T.onLevelSwitching=function(a,s){this.switchLevel(s.level)},T.switchLevel=function(a){var s=this.hls.levels[a];if(!(s!=null&&s.textGroupIds))return;var u=s.textGroupIds[s.urlId];if(this.groupId!==u){var _=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,m=this.tracks.filter(function(E){return!u||E.groupId===u});this.tracksInGroup=m;var p=this.findTrackId(_==null?void 0:_.name)||this.findTrackId();this.groupId=u;var D={subtitleTracks:m};this.log("Updating subtitle tracks, "+m.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(X.Events.SUBTITLE_TRACKS_UPDATED,D),p!==-1&&this.setSubtitleTrack(p,_)}},T.findTrackId=function(a){for(var s=this.tracksInGroup,u=0;u<s.length;u++){var _=s[u];if((!this.selectDefaultTrack||_.default)&&(!a||a===_.name))return _.id}return-1},T.onError=function(a,s){if(A.prototype.onError.call(this,a,s),s.fatal||!s.context)return;s.context.type===W.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},T.loadPlaylist=function(a){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var u=s.id,_=s.groupId,m=s.url;if(a)try{m=a.addDirectives(m)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("Loading subtitle playlist for id "+u),this.hls.trigger(X.Events.SUBTITLE_TRACK_LOADING,{url:m,id:u,groupId:_,deliveryDirectives:a||null})}},T.toggleTrackModes=function(a){var s=this,u=this.media,_=this.subtitleDisplay,m=this.trackId;if(!u)return;var p=M(u.textTracks),D=p.filter(function(c){return c.groupId===s.groupId});if(a===-1)[].slice.call(p).forEach(function(c){c.mode="disabled"});else{var E=D[m];E&&(E.mode="disabled")}var g=D[a];g&&(g.mode=_?"showing":"hidden")},T.setSubtitleTrack=function(a,s){var u,_=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=a;return}if(this.trackId!==a&&this.toggleTrackModes(a),this.trackId===a&&(a===-1||(u=_[a])!==null&&u!==void 0&&u.details)||a<-1||a>=_.length)return;this.clearTimer();var m=_[a];if(this.log("Switching to subtitle track "+a),this.trackId=a,m){var p=m.id,D=m.groupId,E=D===void 0?"":D,g=m.name,c=m.type,h=m.url;this.hls.trigger(X.Events.SUBTITLE_TRACK_SWITCH,{id:p,groupId:E,name:g,type:c,url:h});var o=this.switchParams(m.url,s==null?void 0:s.details);this.loadPlaylist(o)}else this.hls.trigger(X.Events.SUBTITLE_TRACK_SWITCH,{id:a})},T.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var a=-1,s=M(this.media.textTracks),u=0;u<s.length;u++)if(s[u].mode==="hidden")a=u;else if(s[u].mode==="showing"){a=u;break}this.subtitleTrack!==a&&(this.subtitleTrack=a)},P(S,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(a){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(a,s)}}]),S}(O.default);function M(A){for(var S=[],T=0;T<A.length;T++){var d=A[T];d.kind==="subtitles"&&d.label&&S.push(A[T])}return S}$.default=b},"./src/controller/timeline-controller.ts":function(ne,$,k){"use strict";k.r($),k.d($,"TimelineController",function(){return M});var X=k("./src/polyfills/number.ts"),U=k("./src/events.ts"),O=k("./src/utils/cea-608-parser.ts"),W=k("./src/utils/output-filter.ts"),F=k("./src/utils/webvtt-parser.ts"),P=k("./src/utils/texttrack-utils.ts"),w=k("./src/utils/imsc1-ttml-parser.ts"),f=k("./src/types/loader.ts"),b=k("./src/utils/logger.ts"),M=function(){function d(s){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=T(),this.captionsProperties=void 0,this.hls=s,this.config=s.config,this.Cues=s.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var u=new W.default(this,"textTrack1"),_=new W.default(this,"textTrack2"),m=new W.default(this,"textTrack3"),p=new W.default(this,"textTrack4");this.cea608Parser1=new O.default(1,u,_),this.cea608Parser2=new O.default(3,m,p)}s.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(U.Events.FRAG_LOADING,this.onFragLoading,this),s.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var a=d.prototype;return a.destroy=function(){var u=this.hls;u.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.off(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.off(U.Events.FRAG_LOADING,this.onFragLoading,this),u.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.off(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.off(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},a.addCues=function(u,_,m,p,D){for(var E=!1,g=D.length;g--;){var c=D[g],h=S(c[0],c[1],_,m);if(h>=0&&(c[0]=Math.min(c[0],_),c[1]=Math.max(c[1],m),E=!0,h/(m-_)>.5))return}if(E||D.push([_,m]),this.config.renderTextTracksNatively){var o=this.captionsTracks[u];this.Cues.newCue(o,_,m,p)}else{var C=this.Cues.newCue(null,_,m,p);this.hls.trigger(U.Events.CUES_PARSED,{type:"captions",cues:C,track:u})}},a.onInitPtsFound=function(u,_){var m=this,p=_.frag,D=_.id,E=_.initPTS,g=_.timescale,c=this.unparsedVttFrags;D==="main"&&(this.initPTS[p.cc]=E,this.timescale[p.cc]=g),c.length&&(this.unparsedVttFrags=[],c.forEach(function(h){m.onFragLoaded(U.Events.FRAG_LOADED,h)}))},a.getExistingTrack=function(u){var _=this.media;if(_)for(var m=0;m<_.textTracks.length;m++){var p=_.textTracks[m];if(p[u])return p}return null},a.createCaptionsTrack=function(u){this.config.renderTextTracksNatively?this.createNativeTrack(u):this.createNonNativeTrack(u)},a.createNativeTrack=function(u){if(this.captionsTracks[u])return;var _=this.captionsProperties,m=this.captionsTracks,p=this.media,D=_[u],E=D.label,g=D.languageCode,c=this.getExistingTrack(u);if(c)m[u]=c,Object(P.clearCurrentCues)(m[u]),Object(P.sendAddTrackEvent)(m[u],p);else{var h=this.createTextTrack("captions",E,g);h&&(h[u]=!0,m[u]=h)}},a.createNonNativeTrack=function(u){if(this.nonNativeCaptionsTracks[u])return;var _=this.captionsProperties[u];if(!_)return;var m=_.label,p={_id:u,label:m,kind:"captions",default:_.media?!!_.media.default:!1,closedCaptions:_.media};this.nonNativeCaptionsTracks[u]=p,this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[p]})},a.createTextTrack=function(u,_,m){var p=this.media;return p?p.addTextTrack(u,_,m):void 0},a.onMediaAttaching=function(u,_){this.media=_.media,this._cleanTracks()},a.onMediaDetaching=function(){var u=this.captionsTracks;Object.keys(u).forEach(function(_){Object(P.clearCurrentCues)(u[_]),delete u[_]}),this.nonNativeCaptionsTracks={}},a.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=T(),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())},a._cleanTracks=function(){var u=this.media;if(!u)return;var _=u.textTracks;if(_)for(var m=0;m<_.length;m++)Object(P.clearCurrentCues)(_[m])},a.onSubtitleTracksUpdated=function(u,_){var m=this;this.textTracks=[];var p=_.subtitleTracks||[],D=p.some(function(h){return h.textCodec===w.IMSC1_CODEC});if(this.config.enableWebVTT||D&&this.config.enableIMSC1){var E=this.tracks&&p&&this.tracks.length===p.length;if(this.tracks=p||[],this.config.renderTextTracksNatively){var g=this.media?this.media.textTracks:[];this.tracks.forEach(function(h,o){var C;if(o<g.length){for(var x=null,v=0;v<g.length;v++)if(A(g[v],h)){x=g[v];break}x&&(C=x)}C?Object(P.clearCurrentCues)(C):(C=m.createTextTrack("subtitles",h.name,h.lang),C&&(C.mode="disabled")),C&&(C.groupId=h.groupId,m.textTracks.push(C))})}else if(!E&&this.tracks&&this.tracks.length){var c=this.tracks.map(function(h){return{label:h.name,kind:h.type.toLowerCase(),default:h.default,subtitleTrack:h}});this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},a.onManifestLoaded=function(u,_){var m=this;this.config.enableCEA708Captions&&_.captions&&_.captions.forEach(function(p){var D=/(?:CC|SERVICE)([1-4])/.exec(p.instreamId);if(!D)return;var E="textTrack"+D[1],g=m.captionsProperties[E];if(!g)return;g.label=p.name,p.lang&&(g.languageCode=p.lang),g.media=p})},a.onFragLoading=function(u,_){var m=this.cea608Parser1,p=this.cea608Parser2,D=this.lastSn,E=this.lastPartIndex;if(!this.enabled||!(m&&p))return;if(_.frag.type===f.PlaylistLevelType.MAIN){var g,c,h=_.frag.sn,o=(g=_==null||((c=_.part)===null||c===void 0)?void 0:c.index)!=null?g:-1;h===D+1||h===D&&o===E+1||(m.reset(),p.reset()),this.lastSn=h,this.lastPartIndex=o}},a.onFragLoaded=function(u,_){var m=_.frag,p=_.payload,D=this.initPTS,E=this.unparsedVttFrags;if(m.type===f.PlaylistLevelType.SUBTITLE)if(p.byteLength){if(!Object(X.isFiniteNumber)(D[m.cc])){E.push(_),D.length&&this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:m,error:new Error("Missing initial subtitle PTS")});return}var g=m.decryptdata;if(g==null||g.key==null||g.method!=="AES-128"){var c=this.tracks[m.level],h=this.vttCCs;h[m.cc]||(h[m.cc]={start:m.start,prevCC:this.prevCC,new:!0},this.prevCC=m.cc),c&&c.textCodec===w.IMSC1_CODEC?this._parseIMSC1(m,p):this._parseVTTs(m,p,h)}}else this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:m,error:new Error("Empty subtitle payload")})},a._parseIMSC1=function(u,_){var m=this,p=this.hls;Object(w.parseIMSC1)(_,this.initPTS[u.cc],this.timescale[u.cc],function(D){m._appendCues(D,u.level),p.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(D){b.logger.log("Failed to parse IMSC1: "+D),p.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:D})})},a._parseVTTs=function(u,_,m){var p=this,D=this.hls;Object(F.parseWebVTT)(_,this.initPTS[u.cc],this.timescale[u.cc],m,u.cc,u.start,function(E){p._appendCues(E,u.level),D.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(E){p._fallbackToIMSC1(u,_),b.logger.log("Failed to parse VTT cue: "+E),D.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:E})})},a._fallbackToIMSC1=function(u,_){var m=this,p=this.tracks[u.level];p.textCodec||Object(w.parseIMSC1)(_,this.initPTS[u.cc],this.timescale[u.cc],function(){p.textCodec=w.IMSC1_CODEC,m._parseIMSC1(u,_)},function(){p.textCodec="wvtt"})},a._appendCues=function(u,_){var m=this.hls;if(this.config.renderTextTracksNatively){var p=this.textTracks[_];if(p.mode==="disabled")return;u.forEach(function(g){return Object(P.addCueToTrack)(p,g)})}else{var D=this.tracks[_],E=D.default?"default":"subtitles"+_;m.trigger(U.Events.CUES_PARSED,{type:"subtitles",cues:u,track:E})}},a.onFragDecrypted=function(u,_){var m=_.frag;if(m.type===f.PlaylistLevelType.SUBTITLE){if(!Object(X.isFiniteNumber)(this.initPTS[m.cc])){this.unparsedVttFrags.push(_);return}this.onFragLoaded(U.Events.FRAG_LOADED,_)}},a.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},a.onFragParsingUserdata=function(u,_){var m=this.cea608Parser1,p=this.cea608Parser2;if(!this.enabled||!(m&&p))return;for(var D=0;D<_.samples.length;D++){var E=_.samples[D].bytes;if(E){var g=this.extractCea608Data(E);m.addData(_.samples[D].pts,g[0]),p.addData(_.samples[D].pts,g[1])}}},a.onBufferFlushing=function(u,_){var m=_.startOffset,p=_.endOffset,D=_.endOffsetSubtitles,E=_.type,g=this.media;if(!g||g.currentTime<p)return;if(!E||E==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(o){return Object(P.removeCuesInRange)(c[o],m,p)})}if(this.config.renderTextTracksNatively&&(m===0&&D!==void 0)){var h=this.textTracks;Object.keys(h).forEach(function(o){return Object(P.removeCuesInRange)(h[o],m,D)})}},a.extractCea608Data=function(u){for(var _=u[0]&31,m=2,p=[[],[]],D=0;D<_;D++){var E=u[m++],g=127&u[m++],c=127&u[m++],h=(4&E)!==0,o=3&E;if(g===0&&c===0)continue;h&&((o===0||o===1)&&(p[o].push(g),p[o].push(c)))}return p},d}();function A(d,a){return d&&d.label===a.name&&!(d.textTrack1||d.textTrack2)}function S(d,a,s,u){return Math.min(a,u)-Math.max(d,s)}function T(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return X});var X=function(){function U(W,F){this.subtle=void 0,this.aesIV=void 0,this.subtle=W,this.aesIV=F}var O=U.prototype;return O.decrypt=function(F,P){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},P,F)},U}()},"./src/crypt/aes-decryptor.ts":function(ne,$,k){"use strict";k.r($),k.d($,"removePadding",function(){return U}),k.d($,"default",function(){return O});var X=k("./src/utils/typed-array.ts");function U(W){var F=W.byteLength,P=F&&new DataView(W.buffer).getUint8(F-1);return P?Object(X.sliceUint8)(W,0,F-P):W}var O=function(){function W(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var F=W.prototype;return F.uint8ArrayToUint32Array_=function(w){for(var f=new DataView(w),b=new Uint32Array(4),M=0;M<4;M++)b[M]=f.getUint32(M*4);return b},F.initTable=function(){var w=this.sBox,f=this.invSBox,b=this.subMix,M=b[0],A=b[1],S=b[2],T=b[3],d=this.invSubMix,a=d[0],s=d[1],u=d[2],_=d[3],m=new Uint32Array(256),p=0,D=0,E=0;for(E=0;E<256;E++)E<128?m[E]=E<<1:m[E]=E<<1^283;for(E=0;E<256;E++){var g=D^D<<1^D<<2^D<<3^D<<4;g=g>>>8^g&255^99,w[p]=g,f[g]=p;var c=m[p],h=m[c],o=m[h],C=m[g]*257^g*16843008;M[p]=C<<24|C>>>8,A[p]=C<<16|C>>>16,S[p]=C<<8|C>>>24,T[p]=C,C=o*16843009^h*65537^c*257^p*16843008,a[g]=C<<24|C>>>8,s[g]=C<<16|C>>>16,u[g]=C<<8|C>>>24,_[g]=C,p?(p=c^m[m[m[o^c]]],D^=m[m[D]]):p=D=1}},F.expandKey=function(w){for(var f=this.uint8ArrayToUint32Array_(w),b=!0,M=0;M<f.length&&b;)b=f[M]===this.key[M],M++;if(b)return;this.key=f;var A=this.keySize=f.length;if(A!==4&&A!==6&&A!==8)throw new Error("Invalid aes key size="+A);var S=this.ksRows=(A+6+1)*4,T,d,a=this.keySchedule=new Uint32Array(S),s=this.invKeySchedule=new Uint32Array(S),u=this.sBox,_=this.rcon,m=this.invSubMix,p=m[0],D=m[1],E=m[2],g=m[3],c,h;for(T=0;T<S;T++){if(T<A){c=a[T]=f[T];continue}h=c,T%A===0?(h=h<<8|h>>>24,h=u[h>>>24]<<24|u[h>>>16&255]<<16|u[h>>>8&255]<<8|u[h&255],h^=_[T/A|0]<<24):A>6&&T%A===4&&(h=u[h>>>24]<<24|u[h>>>16&255]<<16|u[h>>>8&255]<<8|u[h&255]),a[T]=c=(a[T-A]^h)>>>0}for(d=0;d<S;d++)T=S-d,d&3?h=a[T]:h=a[T-4],d<4||T<=4?s[d]=h:s[d]=p[u[h>>>24]]^D[u[h>>>16&255]]^E[u[h>>>8&255]]^g[u[h&255]],s[d]=s[d]>>>0},F.networkToHostOrderSwap=function(w){return w<<24|(w&65280)<<8|(w&16711680)>>8|w>>>24},F.decrypt=function(w,f,b){for(var M=this.keySize+6,A=this.invKeySchedule,S=this.invSBox,T=this.invSubMix,d=T[0],a=T[1],s=T[2],u=T[3],_=this.uint8ArrayToUint32Array_(b),m=_[0],p=_[1],D=_[2],E=_[3],g=new Int32Array(w),c=new Int32Array(g.length),h,o,C,x,v,R,B,j,K,I,N,Y,q,ae,he=this.networkToHostOrderSwap;f<g.length;){for(K=he(g[f]),I=he(g[f+1]),N=he(g[f+2]),Y=he(g[f+3]),v=K^A[0],R=Y^A[1],B=N^A[2],j=I^A[3],q=4,ae=1;ae<M;ae++)h=d[v>>>24]^a[R>>16&255]^s[B>>8&255]^u[j&255]^A[q],o=d[R>>>24]^a[B>>16&255]^s[j>>8&255]^u[v&255]^A[q+1],C=d[B>>>24]^a[j>>16&255]^s[v>>8&255]^u[R&255]^A[q+2],x=d[j>>>24]^a[v>>16&255]^s[R>>8&255]^u[B&255]^A[q+3],v=h,R=o,B=C,j=x,q=q+4;h=S[v>>>24]<<24^S[R>>16&255]<<16^S[B>>8&255]<<8^S[j&255]^A[q],o=S[R>>>24]<<24^S[B>>16&255]<<16^S[j>>8&255]<<8^S[v&255]^A[q+1],C=S[B>>>24]<<24^S[j>>16&255]<<16^S[v>>8&255]<<8^S[R&255]^A[q+2],x=S[j>>>24]<<24^S[v>>16&255]<<16^S[R>>8&255]<<8^S[B&255]^A[q+3],c[f]=he(h^m),c[f+1]=he(x^p),c[f+2]=he(C^D),c[f+3]=he(o^E),m=K,p=I,D=N,E=Y,f=f+4}return c.buffer},W}()},"./src/crypt/decrypter.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return f});var X=k("./src/crypt/aes-crypto.ts"),U=k("./src/crypt/fast-aes-key.ts"),O=k("./src/crypt/aes-decryptor.ts"),W=k("./src/utils/logger.ts"),F=k("./src/utils/mp4-tools.ts"),P=k("./src/utils/typed-array.ts"),w=16,f=function(){function b(A,S,T){var d=T===void 0?{}:T,a=d.removePKCS7Padding,s=a===void 0?!0:a;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=A,this.config=S,this.removePKCS7Padding=s,s)try{var u=self.crypto;u&&(this.subtle=u.subtle||u.webkitSubtle)}catch(_){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var M=b.prototype;return M.destroy=function(){this.observer=null},M.isSync=function(){return this.config.enableSoftwareAES},M.flush=function(){var S=this.currentResult;if(!S){this.reset();return}var T=new Uint8Array(S);return this.reset(),this.removePKCS7Padding?Object(O.removePadding)(T):T},M.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},M.decrypt=function(S,T,d,a){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(S),T,d);var s=this.flush();s&&a(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(S),T,d).then(a)},M.softwareDecrypt=function(S,T,d){var a=this.currentIV,s=this.currentResult,u=this.remainderData;this.logOnce("JS AES decrypt"),u&&(S=Object(F.appendUint8Array)(u,S),this.remainderData=null);var _=this.getValidChunk(S);if(!_.length)return null;a&&(d=a);var m=this.softwareDecrypter;m||(m=this.softwareDecrypter=new O.default),m.expandKey(T);var p=s;return this.currentResult=m.decrypt(_.buffer,0,d),this.currentIV=Object(P.sliceUint8)(_,-16).buffer,p||null},M.webCryptoDecrypt=function(S,T,d){var a=this,s=this.subtle;return(this.key!==T||!this.fastAesKey)&&(this.key=T,this.fastAesKey=new U.default(s,T)),this.fastAesKey.expandKey().then(function(u){if(!s)return Promise.reject(new Error("web crypto not initialized"));var _=new X.default(s,d);return _.decrypt(S.buffer,u)}).catch(function(u){return a.onWebCryptoError(u,S,T,d)})},M.onWebCryptoError=function(S,T,d,a){return W.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",S),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(T,d,a)},M.getValidChunk=function(S){var T=S,d=S.length-S.length%w;return d!==S.length&&(T=Object(P.sliceUint8)(S,0,d),this.remainderData=Object(P.sliceUint8)(S,d)),T},M.logOnce=function(S){if(!this.logEnabled)return;W.logger.log("[decrypter.ts]: "+S),this.logEnabled=!1},b}()},"./src/crypt/fast-aes-key.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return X});var X=function(){function U(W,F){this.subtle=void 0,this.key=void 0,this.subtle=W,this.key=F}var O=U.prototype;return O.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},U}()},"./src/demux/aacdemuxer.ts":function(ne,$,k){"use strict";k.r($);var X=k("./src/demux/base-audio-demuxer.ts"),U=k("./src/demux/adts.ts"),O=k("./src/utils/logger.ts"),W=k("./src/demux/id3.ts");function F(f,b){f.prototype=Object.create(b.prototype),f.prototype.constructor=f,P(f,b)}function P(f,b){return P=Object.setPrototypeOf||function(A,S){return A.__proto__=S,A},P(f,b)}var w=function(f){F(b,f);function b(A,S){var T;return T=f.call(this)||this,T.observer=void 0,T.config=void 0,T.observer=A,T.config=S,T}var M=b.prototype;return M.resetInitSegment=function(S,T,d){f.prototype.resetInitSegment.call(this,S,T,d),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:S,duration:d,inputTimeScale:9e4,dropped:0}},b.probe=function(S){if(!S)return!1;for(var T=W.getID3Data(S,0)||[],d=T.length,a=S.length;d<a;d++)if(U.probe(S,d))return O.logger.log("ADTS sync word found !"),!0;return!1},M.canParse=function(S,T){return U.canParse(S,T)},M.appendFrame=function(S,T,d){U.initTrackConfig(S,this.observer,T,d,S.manifestCodec);var a=U.appendFrame(S,T,d,this.initPTS,this.frameIndex);if(a&&a.missing===0)return a},b}(X.default);w.minProbeByteLength=9,$.default=w},"./src/demux/adts.ts":function(ne,$,k){"use strict";k.r($),k.d($,"getAudioConfig",function(){return W}),k.d($,"isHeaderPattern",function(){return F}),k.d($,"getHeaderLength",function(){return P}),k.d($,"getFullFrameLength",function(){return w}),k.d($,"canGetFrameLength",function(){return f}),k.d($,"isHeader",function(){return b}),k.d($,"canParse",function(){return M}),k.d($,"probe",function(){return A}),k.d($,"initTrackConfig",function(){return S}),k.d($,"getFrameDuration",function(){return T}),k.d($,"parseFrameHeader",function(){return d}),k.d($,"appendFrame",function(){return a});var X=k("./src/utils/logger.ts"),U=k("./src/errors.ts"),O=k("./src/events.ts");function W(s,u,_,m){var p,D,E,g,c=navigator.userAgent.toLowerCase(),h=m,o=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];p=((u[_+2]&192)>>>6)+1;var C=(u[_+2]&60)>>>2;if(C>o.length-1){s.trigger(O.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+C});return}return E=(u[_+2]&1)<<2,E|=(u[_+3]&192)>>>6,X.logger.log("manifest codec:"+m+", ADTS type:"+p+", samplingIndex:"+C),/firefox/i.test(c)?C>=6?(p=5,g=new Array(4),D=C-3):(p=2,g=new Array(2),D=C):c.indexOf("android")!==-1?(p=2,g=new Array(2),D=C):(p=5,g=new Array(4),m&&(m.indexOf("mp4a.40.29")!==-1||m.indexOf("mp4a.40.5")!==-1)||!m&&C>=6?D=C-3:((m&&m.indexOf("mp4a.40.2")!==-1&&(C>=6&&E===1||/vivaldi/i.test(c))||!m&&E===1)&&(p=2,g=new Array(2)),D=C)),g[0]=p<<3,g[0]|=(C&14)>>1,g[1]|=(C&1)<<7,g[1]|=E<<3,p===5&&(g[1]|=(D&14)>>1,g[2]=(D&1)<<7,g[2]|=2<<2,g[3]=0),{config:g,samplerate:o[C],channelCount:E,codec:"mp4a.40."+p,manifestCodec:h}}function F(s,u){return s[u]===255&&(s[u+1]&246)===240}function P(s,u){return s[u+1]&1?7:9}function w(s,u){return(s[u+3]&3)<<11|s[u+4]<<3|(s[u+5]&224)>>>5}function f(s,u){return u+5<s.length}function b(s,u){return u+1<s.length&&F(s,u)}function M(s,u){return f(s,u)&&F(s,u)&&w(s,u)<=s.length-u}function A(s,u){if(b(s,u)){var _=P(s,u);if(u+_>=s.length)return!1;var m=w(s,u);if(m<=_)return!1;var p=u+m;return p===s.length||b(s,p)}return!1}function S(s,u,_,m,p){if(!s.samplerate){var D=W(u,_,m,p);if(!D)return;s.config=D.config,s.samplerate=D.samplerate,s.channelCount=D.channelCount,s.codec=D.codec,s.manifestCodec=D.manifestCodec,X.logger.log("parsed codec:"+s.codec+", rate:"+D.samplerate+", channels:"+D.channelCount)}}function T(s){return 1024*9e4/s}function d(s,u,_,m,p){var D=P(s,u),E=w(s,u);if(E-=D,E>0){var g=_+m*p;return{headerLength:D,frameLength:E,stamp:g}}}function a(s,u,_,m,p){var D=T(s.samplerate),E=d(u,_,m,p,D);if(E){var g=E.frameLength,c=E.headerLength,h=E.stamp,o=c+g,C=Math.max(0,_+o-u.length),x;C?(x=new Uint8Array(o-c),x.set(u.subarray(_+c,u.length),0)):x=u.subarray(_+c,_+o);var v={unit:x,pts:h};return C||s.samples.push(v),{sample:v,length:o,missing:C}}}},"./src/demux/base-audio-demuxer.ts":function(ne,$,k){"use strict";k.r($),k.d($,"initPTSFn",function(){return w});var X=k("./src/polyfills/number.ts"),U=k("./src/demux/id3.ts"),O=k("./src/demux/dummy-demuxed-track.ts"),W=k("./src/utils/mp4-tools.ts"),F=k("./src/utils/typed-array.ts"),P=function(){function f(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var b=f.prototype;return b.resetInitSegment=function(A,S,T){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},b.resetTimeStamp=function(){},b.resetContiguity=function(){},b.canParse=function(A,S){return!1},b.appendFrame=function(A,S,T){},b.demux=function(A,S){this.cachedData&&(A=Object(W.appendUint8Array)(this.cachedData,A),this.cachedData=null);var T=U.getID3Data(A,0),d=T?T.length:0,a,s,u=this._audioTrack,_=this._id3Track,m=T?U.getTimeStamp(T):void 0,p=A.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=w(m,S)),T&&T.length>0&&_.samples.push({pts:this.initPTS,dts:this.initPTS,data:T}),s=this.initPTS;d<p;){if(this.canParse(A,d)){var D=this.appendFrame(u,A,d);D?(this.frameIndex++,s=D.sample.pts,d+=D.length,a=d):d=p}else U.canParse(A,d)?(T=U.getID3Data(A,d),_.samples.push({pts:s,dts:s,data:T}),d+=T.length,a=d):d++;if(d===p&&a!==p){var E=Object(F.sliceUint8)(A,a);this.cachedData?this.cachedData=Object(W.appendUint8Array)(this.cachedData,E):this.cachedData=E}}return{audioTrack:u,avcTrack:Object(O.dummyTrack)(),id3Track:_,textTrack:Object(O.dummyTrack)()}},b.demuxSampleAes=function(A,S,T){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},b.flush=function(A){var S=this.cachedData;return S&&(this.cachedData=null,this.demux(S,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(O.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(O.dummyTrack)()}},b.destroy=function(){},f}(),w=function(b,M){return Object(X.isFiniteNumber)(b)?b*90:M*9e4};$.default=P},"./src/demux/chunk-cache.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return X});var X=function(){function O(){this.chunks=[],this.dataLength=0}var W=O.prototype;return W.push=function(P){this.chunks.push(P),this.dataLength+=P.length},W.flush=function(){var P=this.chunks,w=this.dataLength,f;if(P.length)P.length===1?f=P[0]:f=U(P,w);else return new Uint8Array(0);return this.reset(),f},W.reset=function(){this.chunks.length=0,this.dataLength=0},O}();function U(O,W){for(var F=new Uint8Array(W),P=0,w=0;w<O.length;w++){var f=O[w];F.set(f,P),P+=f.length}return F}},"./src/demux/dummy-demuxed-track.ts":function(ne,$,k){"use strict";k.r($),k.d($,"dummyTrack",function(){return X});function X(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ne,$,k){"use strict";k.r($);var X=k("./src/utils/logger.ts"),U=function(){function O(F){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=F,this.bytesAvailable=F.byteLength,this.word=0,this.bitsAvailable=0}var W=O.prototype;return W.loadWord=function(){var P=this.data,w=this.bytesAvailable,f=P.byteLength-w,b=new Uint8Array(4),M=Math.min(4,w);if(M===0)throw new Error("no bytes available");b.set(P.subarray(f,f+M)),this.word=new DataView(b.buffer).getUint32(0),this.bitsAvailable=M*8,this.bytesAvailable-=M},W.skipBits=function(P){var w;this.bitsAvailable>P?(this.word<<=P,this.bitsAvailable-=P):(P-=this.bitsAvailable,w=P>>3,P-=w>>3,this.bytesAvailable-=w,this.loadWord(),this.word<<=P,this.bitsAvailable-=P)},W.readBits=function(P){var w=Math.min(this.bitsAvailable,P),f=this.word>>>32-w;return P>32&&X.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=w,this.bitsAvailable>0?this.word<<=w:this.bytesAvailable>0&&this.loadWord(),w=P-w,w>0&&this.bitsAvailable?f<<w|this.readBits(w):f},W.skipLZ=function(){var P;for(P=0;P<this.bitsAvailable;++P)if((this.word&2147483648>>>P)!==0)return this.word<<=P,this.bitsAvailable-=P,P;return this.loadWord(),P+this.skipLZ()},W.skipUEG=function(){this.skipBits(1+this.skipLZ())},W.skipEG=function(){this.skipBits(1+this.skipLZ())},W.readUEG=function(){var P=this.skipLZ();return this.readBits(P+1)-1},W.readEG=function(){var P=this.readUEG();return 1&P?1+P>>>1:-1*(P>>>1)},W.readBoolean=function(){return this.readBits(1)===1},W.readUByte=function(){return this.readBits(8)},W.readUShort=function(){return this.readBits(16)},W.readUInt=function(){return this.readBits(32)},W.skipScalingList=function(P){for(var w=8,f=8,b,M=0;M<P;M++)f!==0&&(b=this.readEG(),f=(w+b+256)%256),w=f===0?w:f},W.readSPS=function(){var P=0,w=0,f=0,b=0,M,A,S,T=this.readUByte.bind(this),d=this.readBits.bind(this),a=this.readUEG.bind(this),s=this.readBoolean.bind(this),u=this.skipBits.bind(this),_=this.skipEG.bind(this),m=this.skipUEG.bind(this),p=this.skipScalingList.bind(this);T();var D=T();if(d(5),u(3),T(),m(),D===100||D===110||D===122||D===244||D===44||D===83||D===86||D===118||D===128){var E=a();if(E===3&&u(1),m(),m(),u(1),s())for(A=E!==3?8:12,S=0;S<A;S++)s()&&(S<6?p(16):p(64))}m();var g=a();if(g===0)a();else if(g===1)for(u(1),_(),_(),M=a(),S=0;S<M;S++)_();m(),u(1);var c=a(),h=a(),o=d(1);o===0&&u(1),u(1),s()&&(P=a(),w=a(),f=a(),b=a());var C=[1,1];if(s()&&s()){var x=T();switch(x){case 1:C=[1,1];break;case 2:C=[12,11];break;case 3:C=[10,11];break;case 4:C=[16,11];break;case 5:C=[40,33];break;case 6:C=[24,11];break;case 7:C=[20,11];break;case 8:C=[32,11];break;case 9:C=[80,33];break;case 10:C=[18,11];break;case 11:C=[15,11];break;case 12:C=[64,33];break;case 13:C=[160,99];break;case 14:C=[4,3];break;case 15:C=[3,2];break;case 16:C=[2,1];break;case 255:{C=[T()<<8|T(),T()<<8|T()];break}}}return{width:Math.ceil((c+1)*16-P*2-w*2),height:(2-o)*(h+1)*16-(o?2:4)*(f+b),pixelRatio:C}},W.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},O}();$.default=U},"./src/demux/id3.ts":function(ne,$,k){"use strict";k.r($),k.d($,"isHeader",function(){return X}),k.d($,"isFooter",function(){return U}),k.d($,"getID3Data",function(){return O}),k.d($,"canParse",function(){return F}),k.d($,"getTimeStamp",function(){return P}),k.d($,"isTimeStampFrame",function(){return w}),k.d($,"getID3Frames",function(){return b}),k.d($,"decodeFrame",function(){return M}),k.d($,"utf8ArrayToStr",function(){return a}),k.d($,"testables",function(){return s});var X=function(p,D){return D+10<=p.length&&(p[D]===73&&p[D+1]===68&&p[D+2]===51&&(p[D+3]<255&&p[D+4]<255&&(p[D+6]<128&&p[D+7]<128&&p[D+8]<128&&p[D+9]<128)))},U=function(p,D){return D+10<=p.length&&(p[D]===51&&p[D+1]===68&&p[D+2]===73&&(p[D+3]<255&&p[D+4]<255&&(p[D+6]<128&&p[D+7]<128&&p[D+8]<128&&p[D+9]<128)))},O=function(p,D){for(var E=D,g=0;X(p,D);){g+=10;var c=W(p,D+6);g+=c,U(p,D+10)&&(g+=10),D+=g}return g>0?p.subarray(E,E+g):void 0},W=function(p,D){var E=0;return E=(p[D]&127)<<21,E|=(p[D+1]&127)<<14,E|=(p[D+2]&127)<<7,E|=p[D+3]&127,E},F=function(p,D){return X(p,D)&&W(p,D+6)+10<=p.length-D},P=function(p){for(var D=b(p),E=0;E<D.length;E++){var g=D[E];if(w(g))return d(g)}return},w=function(p){return p&&p.key==="PRIV"&&p.info==="com.apple.streaming.transportStreamTimestamp"},f=function(p){var D=String.fromCharCode(p[0],p[1],p[2],p[3]),E=W(p,4),g=10;return{type:D,size:E,data:p.subarray(g,g+E)}},b=function(p){for(var D=0,E=[];X(p,D);){var g=W(p,D+6);D+=10;for(var c=D+g;D+8<c;){var h=f(p.subarray(D)),o=M(h);o&&E.push(o),D+=h.size+10}U(p,D)&&(D+=10)}return E},M=function(p){return p.type==="PRIV"?A(p):p.type[0]==="W"?T(p):S(p)},A=function(p){if(p.size<2)return;var D=a(p.data,!0),E=new Uint8Array(p.data.subarray(D.length+1));return{key:p.type,info:D,data:E.buffer}},S=function(p){if(p.size<2)return;if(p.type==="TXXX"){var D=1,E=a(p.data.subarray(D),!0);D+=E.length+1;var g=a(p.data.subarray(D));return{key:p.type,info:E,data:g}}var c=a(p.data.subarray(1));return{key:p.type,data:c}},T=function(p){if(p.type==="WXXX"){if(p.size<2)return;var D=1,E=a(p.data.subarray(D),!0);D+=E.length+1;var g=a(p.data.subarray(D));return{key:p.type,info:E,data:g}}var c=a(p.data);return{key:p.type,data:c}},d=function(p){if(p.data.byteLength===8){var D=new Uint8Array(p.data),E=D[3]&1,g=(D[4]<<23)+(D[5]<<15)+(D[6]<<7)+D[7];return g/=45,E&&(g+=4772185884e-2),Math.round(g)}return},a=function(p,D){D===void 0&&(D=!1);var E=_();if(E){var g=E.decode(p);if(D){var c=g.indexOf("\0");return c!==-1?g.substring(0,c):g}return g.replace(/\0/g,"")}for(var h=p.length,o,C,x,v="",R=0;R<h;){if(o=p[R++],o===0&&D)return v;if(o===0||o===3)continue;switch(o>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:v+=String.fromCharCode(o);break;case 12:case 13:C=p[R++],v+=String.fromCharCode((o&31)<<6|C&63);break;case 14:C=p[R++],x=p[R++],v+=String.fromCharCode((o&15)<<12|(C&63)<<6|(x&63)<<0);break;default:}}return v},s={decodeTextFrame:S},u;function _(){return!u&&typeof self.TextDecoder!="undefined"&&(u=new self.TextDecoder("utf-8")),u}},"./src/demux/mp3demuxer.ts":function(ne,$,k){"use strict";k.r($);var X=k("./src/demux/base-audio-demuxer.ts"),U=k("./src/demux/id3.ts"),O=k("./src/utils/logger.ts"),W=k("./src/demux/mpegaudio.ts");function F(f,b){f.prototype=Object.create(b.prototype),f.prototype.constructor=f,P(f,b)}function P(f,b){return P=Object.setPrototypeOf||function(A,S){return A.__proto__=S,A},P(f,b)}var w=function(f){F(b,f);function b(){return f.apply(this,arguments)||this}var M=b.prototype;return M.resetInitSegment=function(S,T,d){f.prototype.resetInitSegment.call(this,S,T,d),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:S,duration:d,inputTimeScale:9e4,dropped:0}},b.probe=function(S){if(!S)return!1;for(var T=U.getID3Data(S,0)||[],d=T.length,a=S.length;d<a;d++)if(W.probe(S,d))return O.logger.log("MPEG Audio sync word found !"),!0;return!1},M.canParse=function(S,T){return W.canParse(S,T)},M.appendFrame=function(S,T,d){return this.initPTS===null?void 0:W.appendFrame(S,T,d,this.initPTS,this.frameIndex)},b}(X.default);w.minProbeByteLength=4,$.default=w},"./src/demux/mp4demuxer.ts":function(ne,$,k){"use strict";k.r($);var X=k("./src/utils/mp4-tools.ts"),U=k("./src/demux/dummy-demuxed-track.ts"),O=function(){function W(P,w){this.remainderData=null,this.config=void 0,this.config=w}var F=W.prototype;return F.resetTimeStamp=function(){},F.resetInitSegment=function(){},F.resetContiguity=function(){},W.probe=function(w){return Object(X.findBox)({data:w,start:0,end:Math.min(w.length,16384)},["moof"]).length>0},F.demux=function(w){var f=w,b=Object(U.dummyTrack)();if(this.config.progressive){this.remainderData&&(f=Object(X.appendUint8Array)(this.remainderData,w));var M=Object(X.segmentValidRange)(f);this.remainderData=M.remainder,b.samples=M.valid||new Uint8Array}else b.samples=f;return{audioTrack:Object(U.dummyTrack)(),avcTrack:b,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},F.flush=function(){var w=Object(U.dummyTrack)();return w.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(U.dummyTrack)(),avcTrack:w,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},F.demuxSampleAes=function(w,f,b){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},F.destroy=function(){},W}();O.minProbeByteLength=1024,$.default=O},"./src/demux/mpegaudio.ts":function(ne,$,k){"use strict";k.r($),k.d($,"appendFrame",function(){return P}),k.d($,"parseHeader",function(){return w}),k.d($,"isHeaderPattern",function(){return f}),k.d($,"isHeader",function(){return b}),k.d($,"canParse",function(){return M}),k.d($,"probe",function(){return A});var X=null,U=[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],O=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],W=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],F=[0,1,1,4];function P(S,T,d,a,s){if(d+24>T.length)return;var u=w(T,d);if(u&&d+u.frameLength<=T.length){var _=u.samplesPerFrame*9e4/u.sampleRate,m=a+s*_,p={unit:T.subarray(d,d+u.frameLength),pts:m,dts:m};return S.config=[],S.channelCount=u.channelCount,S.samplerate=u.sampleRate,S.samples.push(p),{sample:p,length:u.frameLength,missing:0}}}function w(S,T){var d=S[T+1]>>3&3,a=S[T+1]>>1&3,s=S[T+2]>>4&15,u=S[T+2]>>2&3;if(d!==1&&s!==0&&s!==15&&u!==3){var _=S[T+2]>>1&1,m=S[T+3]>>6,p=d===3?3-a:a===3?3:4,D=U[p*14+s-1]*1e3,E=d===3?0:d===2?1:2,g=O[E*3+u],c=m===3?1:2,h=W[d][a],o=F[a],C=h*8*o,x=Math.floor(h*D/g+_)*o;if(X===null){var v=navigator.userAgent||"",R=v.match(/Chrome\/(\d+)/i);X=R?parseInt(R[1]):0}var B=!!X&&X<=87;return B&&a===2&&D>=224e3&&m===0&&(S[T+3]=S[T+3]|128),{sampleRate:g,channelCount:c,frameLength:x,samplesPerFrame:C}}}function f(S,T){return S[T]===255&&(S[T+1]&224)===224&&(S[T+1]&6)!==0}function b(S,T){return T+1<S.length&&f(S,T)}function M(S,T){var d=4;return f(S,T)&&d<=S.length-T}function A(S,T){if(T+1<S.length&&f(S,T)){var d=4,a=w(S,T),s=d;a!=null&&a.frameLength&&(s=a.frameLength);var u=T+s;return u===S.length||b(S,u)}return!1}},"./src/demux/sample-aes.ts":function(ne,$,k){"use strict";k.r($);var X=k("./src/crypt/decrypter.ts"),U=k("./src/demux/tsdemuxer.ts"),O=function(){function W(P,w,f){this.keyData=void 0,this.decrypter=void 0,this.keyData=f,this.decrypter=new X.default(P,w,{removePKCS7Padding:!1})}var F=W.prototype;return F.decryptBuffer=function(w,f){this.decrypter.decrypt(w,this.keyData.key.buffer,this.keyData.iv.buffer,f)},F.decryptAacSample=function(w,f,b,M){var A=w[f].unit,S=A.subarray(16,A.length-A.length%16),T=S.buffer.slice(S.byteOffset,S.byteOffset+S.length),d=this;this.decryptBuffer(T,function(a){var s=new Uint8Array(a);A.set(s,16),M||d.decryptAacSamples(w,f+1,b)})},F.decryptAacSamples=function(w,f,b){for(;;f++){if(f>=w.length){b();return}if(w[f].unit.length<32)continue;var M=this.decrypter.isSync();if(this.decryptAacSample(w,f,b,M),!M)return}},F.getAvcEncryptedData=function(w){for(var f=Math.floor((w.length-48)/160)*16+16,b=new Int8Array(f),M=0,A=32;A<=w.length-16;A+=160,M+=16)b.set(w.subarray(A,A+16),M);return b},F.getAvcDecryptedUnit=function(w,f){for(var b=new Uint8Array(f),M=0,A=32;A<=w.length-16;A+=160,M+=16)w.set(b.subarray(M,M+16),A);return w},F.decryptAvcSample=function(w,f,b,M,A,S){var T=Object(U.discardEPB)(A.data),d=this.getAvcEncryptedData(T),a=this;this.decryptBuffer(d.buffer,function(s){A.data=a.getAvcDecryptedUnit(T,s),S||a.decryptAvcSamples(w,f,b+1,M)})},F.decryptAvcSamples=function(w,f,b,M){if(w instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;f++,b=0){if(f>=w.length){M();return}for(var A=w[f].units;!(b>=A.length);b++){var S=A[b];if(S.data.length<=48||S.type!==1&&S.type!==5)continue;var T=this.decrypter.isSync();if(this.decryptAvcSample(w,f,b,M,S,T),!T)return}}},W}();$.default=O},"./src/demux/transmuxer-interface.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return A});var X=k("./node_modules/webworkify-webpack/index.js"),U=k.n(X),O=k("./src/events.ts"),W=k("./src/demux/transmuxer.ts"),F=k("./src/utils/logger.ts"),P=k("./src/errors.ts"),w=k("./src/utils/mediasource-helper.ts"),f=k("./node_modules/eventemitter3/index.js"),b=k.n(f),M=Object(w.getMediaSource)()||{isTypeSupported:function(){return!1}},A=function(){function S(d,a,s,u){var _=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=a,this.onTransmuxComplete=s,this.onFlush=u;var m=d.config,p=function(h,o){o=o||{},o.frag=_.frag,o.id=_.id,d.trigger(h,o)};this.observer=new f.EventEmitter,this.observer.on(O.Events.FRAG_DECRYPTED,p),this.observer.on(O.Events.ERROR,p);var D={mp4:M.isTypeSupported("video/mp4"),mpeg:M.isTypeSupported("audio/mpeg"),mp3:M.isTypeSupported('audio/mp4; codecs="mp3"')},E=navigator.vendor;if(m.enableWorker&&typeof Worker!="undefined"){F.logger.log("demuxing in webworker");var g;try{g=this.worker=X("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),g.addEventListener("message",this.onwmsg),g.onerror=function(c){d.trigger(O.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},g.postMessage({cmd:"init",typeSupported:D,vendor:E,id:a,config:JSON.stringify(m)})}catch(c){F.logger.warn("Error in worker:",c),F.logger.error("Error while initializing DemuxerWorker, fallback to inline"),g&&self.URL.revokeObjectURL(g.objectURL),this.transmuxer=new W.default(this.observer,D,m,E,a),this.worker=null}}else this.transmuxer=new W.default(this.observer,D,m,E,a)}var T=S.prototype;return T.destroy=function(){var a=this.worker;if(a)a.removeEventListener("message",this.onwmsg),a.terminate(),this.worker=null;else{var s=this.transmuxer;s&&(s.destroy(),this.transmuxer=null)}var u=this.observer;u&&u.removeAllListeners(),this.observer=null},T.push=function(a,s,u,_,m,p,D,E,g,c){var h=this;g.transmuxing.start=self.performance.now();var o=this.transmuxer,C=this.worker,x=p?p.start:m.start,v=m.decryptdata,R=this.frag,B=!(R&&m.cc===R.cc),j=!(R&&g.level===R.level),K=R?g.sn-R.sn:-1,I=this.part?g.part-this.part.index:1,N=!j&&(K===1||K===0&&I===1),Y=self.performance.now();(j||K||m.stats.parsing.start===0)&&(m.stats.parsing.start=Y),p&&(I||!N)&&(p.stats.parsing.start=Y);var q=new W.TransmuxState(B,N,E,j,x);if(!N||B){F.logger.log("[transmuxer-interface, "+m.type+"]: Starting new transmux session for sn: "+g.sn+" p: "+g.part+" level: "+g.level+" id: "+g.id+`
discontinuity: `+B+`
trackSwitch: `+j+`
contiguous: `+N+`
accurateTimeOffset: `+E+`
timeOffset: `+x);var ae=new W.TransmuxConfig(u,_,s,D,c);this.configureTransmuxer(ae)}if(this.frag=m,this.part=p,C)C.postMessage({cmd:"demux",data:a,decryptdata:v,chunkMeta:g,state:q},a instanceof ArrayBuffer?[a]:[]);else if(o){var he=o.push(a,v,g,q);Object(W.isPromise)(he)?he.then(function(_e){h.handleTransmuxComplete(_e)}):this.handleTransmuxComplete(he)}},T.flush=function(a){var s=this;a.transmuxing.start=self.performance.now();var u=this.transmuxer,_=this.worker;if(_)_.postMessage({cmd:"flush",chunkMeta:a});else if(u){var m=u.flush(a);Object(W.isPromise)(m)?m.then(function(p){s.handleFlushResult(p,a)}):this.handleFlushResult(m,a)}},T.handleFlushResult=function(a,s){var u=this;a.forEach(function(_){u.handleTransmuxComplete(_)}),this.onFlush(s)},T.onWorkerMessage=function(a){var s=a.data,u=this.hls;switch(s.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(s.data);break}case"flush":{this.onFlush(s.data);break}default:{s.data=s.data||{},s.data.frag=this.frag,s.data.id=this.id,u.trigger(s.event,s.data);break}}},T.configureTransmuxer=function(a){var s=this.worker,u=this.transmuxer;s?s.postMessage({cmd:"configure",config:a}):u&&u.configure(a)},T.handleTransmuxComplete=function(a){a.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(a)},S}()},"./src/demux/transmuxer-worker.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return P});var X=k("./src/demux/transmuxer.ts"),U=k("./src/events.ts"),O=k("./src/utils/logger.ts"),W=k("./node_modules/eventemitter3/index.js"),F=k.n(W);function P(A){var S=new W.EventEmitter,T=function(a,s){A.postMessage({event:a,data:s})};S.on(U.Events.FRAG_DECRYPTED,T),S.on(U.Events.ERROR,T),A.addEventListener("message",function(d){var a=d.data;switch(a.cmd){case"init":{var s=JSON.parse(a.config);A.transmuxer=new X.default(S,a.typeSupported,s,a.vendor,a.id),Object(O.enableLogs)(s.debug),T("init",null);break}case"configure":{A.transmuxer.configure(a.config);break}case"demux":{var u=A.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Object(X.isPromise)(u)?u.then(function(p){w(A,p)}):w(A,u);break}case"flush":{var _=a.chunkMeta,m=A.transmuxer.flush(_);Object(X.isPromise)(m)?m.then(function(p){b(A,p,_)}):b(A,m,_);break}default:break}})}function w(A,S){if(M(S.remuxResult))return;var T=[],d=S.remuxResult,a=d.audio,s=d.video;a&&f(T,a),s&&f(T,s),A.postMessage({event:"transmuxComplete",data:S},T)}function f(A,S){S.data1&&A.push(S.data1.buffer),S.data2&&A.push(S.data2.buffer)}function b(A,S,T){S.forEach(function(d){w(A,d)}),A.postMessage({event:"flush",data:T})}function M(A){return!A.audio&&!A.video&&!A.text&&!A.id3&&!A.initSegment}},"./src/demux/transmuxer.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return s}),k.d($,"isPromise",function(){return m}),k.d($,"TransmuxConfig",function(){return p}),k.d($,"TransmuxState",function(){return D});var X=k("./src/events.ts"),U=k("./src/errors.ts"),O=k("./src/crypt/decrypter.ts"),W=k("./src/demux/aacdemuxer.ts"),F=k("./src/demux/mp4demuxer.ts"),P=k("./src/demux/tsdemuxer.ts"),w=k("./src/demux/mp3demuxer.ts"),f=k("./src/remux/mp4-remuxer.ts"),b=k("./src/remux/passthrough-remuxer.ts"),M=k("./src/demux/chunk-cache.ts"),A=k("./src/utils/mp4-tools.ts"),S=k("./src/utils/logger.ts"),T;try{T=self.performance.now.bind(self.performance)}catch(E){S.logger.debug("Unable to use Performance API on this environment"),T=self.Date.now}var d=[{demux:P.default,remux:f.default},{demux:F.default,remux:b.default},{demux:W.default,remux:f.default},{demux:w.default,remux:f.default}],a=1024;d.forEach(function(E){var g=E.demux;a=Math.max(a,g.minProbeByteLength)});var s=function(){function E(c,h,o,C,x){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 M.default,this.observer=c,this.typeSupported=h,this.config=o,this.vendor=C,this.id=x}var g=E.prototype;return g.configure=function(h){this.transmuxConfig=h,this.decrypter&&this.decrypter.reset()},g.push=function(h,o,C,x){var v=this,R=C.transmuxing;R.executeStart=T();var B=new Uint8Array(h),j=this.cache,K=this.config,I=this.currentTransmuxState,N=this.transmuxConfig;x&&(this.currentTransmuxState=x);var Y=u(B,o);if(Y&&Y.method==="AES-128"){var q=this.getDecrypter();if(K.enableSoftwareAES){var ae=q.softwareDecrypt(B,Y.key.buffer,Y.iv.buffer);if(!ae)return R.executeEnd=T(),_(C);B=new Uint8Array(ae)}else return this.decryptionPromise=q.webCryptoDecrypt(B,Y.key.buffer,Y.iv.buffer).then(function(Pe){var Ne=v.push(Pe,null,C);return v.decryptionPromise=null,Ne}),this.decryptionPromise}var he=x||I,_e=he.contiguous,be=he.discontinuity,Ce=he.trackSwitch,Te=he.accurateTimeOffset,Ee=he.timeOffset,me=N.audioCodec,ue=N.videoCodec,te=N.defaultInitPts,ce=N.duration,se=N.initSegmentData;if((be||Ce)&&this.resetInitSegment(se,me,ue,ce),be&&this.resetInitialTimestamp(te),_e||this.resetContiguity(),this.needsProbing(B,be,Ce)){if(j.dataLength){var we=j.flush();B=Object(A.appendUint8Array)(we,B)}this.configureTransmuxer(B,N)}var Le=this.transmux(B,Y,Ee,Te,C),xe=this.currentTransmuxState;return xe.contiguous=!0,xe.discontinuity=!1,xe.trackSwitch=!1,R.executeEnd=T(),Le},g.flush=function(h){var o=this,C=h.transmuxing;C.executeStart=T();var x=this.decrypter,v=this.cache,R=this.currentTransmuxState,B=this.decryptionPromise;if(B)return B.then(function(){return o.flush(h)});var j=[],K=R.timeOffset;if(x){var I=x.flush();I&&j.push(this.push(I,null,h))}var N=v.dataLength;v.reset();var Y=this.demuxer,q=this.remuxer;if(!Y||!q)return N>=a&&this.observer.emit(X.Events.ERROR,X.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),C.executeEnd=T(),[_(h)];var ae=Y.flush(K);return m(ae)?ae.then(function(he){return o.flushRemux(j,he,h),j}):(this.flushRemux(j,ae,h),j)},g.flushRemux=function(h,o,C){var x=o.audioTrack,v=o.avcTrack,R=o.id3Track,B=o.textTrack,j=this.currentTransmuxState,K=j.accurateTimeOffset,I=j.timeOffset;S.logger.log("[transmuxer.ts]: Flushed fragment "+C.sn+(C.part>-1?" p: "+C.part:"")+" of level "+C.level);var N=this.remuxer.remux(x,v,R,B,I,K,!0,this.id);h.push({remuxResult:N,chunkMeta:C}),C.transmuxing.executeEnd=T()},g.resetInitialTimestamp=function(h){var o=this.demuxer,C=this.remuxer;if(!o||!C)return;o.resetTimeStamp(h),C.resetTimeStamp(h)},g.resetContiguity=function(){var h=this.demuxer,o=this.remuxer;if(!h||!o)return;h.resetContiguity(),o.resetNextTimestamp()},g.resetInitSegment=function(h,o,C,x){var v=this.demuxer,R=this.remuxer;if(!v||!R)return;v.resetInitSegment(o,C,x),R.resetInitSegment(h,o,C)},g.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},g.transmux=function(h,o,C,x,v){var R;return o&&o.method==="SAMPLE-AES"?R=this.transmuxSampleAes(h,o,C,x,v):R=this.transmuxUnencrypted(h,C,x,v),R},g.transmuxUnencrypted=function(h,o,C,x){var v=this.demuxer.demux(h,o,!1,!this.config.progressive),R=v.audioTrack,B=v.avcTrack,j=v.id3Track,K=v.textTrack,I=this.remuxer.remux(R,B,j,K,o,C,!1,this.id);return{remuxResult:I,chunkMeta:x}},g.transmuxSampleAes=function(h,o,C,x,v){var R=this;return this.demuxer.demuxSampleAes(h,o,C).then(function(B){var j=R.remuxer.remux(B.audioTrack,B.avcTrack,B.id3Track,B.textTrack,C,x,!1,R.id);return{remuxResult:j,chunkMeta:v}})},g.configureTransmuxer=function(h,o){for(var C=this.config,x=this.observer,v=this.typeSupported,R=this.vendor,B=o.audioCodec,j=o.defaultInitPts,K=o.duration,I=o.initSegmentData,N=o.videoCodec,Y,q=0,ae=d.length;q<ae;q++)if(d[q].demux.probe(h)){Y=d[q];break}Y||(S.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),Y={demux:F.default,remux:b.default});var he=this.demuxer,_e=this.remuxer,be=Y.remux,Ce=Y.demux;(!_e||!(_e instanceof be))&&(this.remuxer=new be(x,C,v,R)),(!he||!(he instanceof Ce))&&(this.demuxer=new Ce(x,C,v),this.probe=Ce.probe),this.resetInitSegment(I,B,N,K),this.resetInitialTimestamp(j)},g.needsProbing=function(h,o,C){return!this.demuxer||!this.remuxer||o||C},g.getDecrypter=function(){var h=this.decrypter;return h||(h=this.decrypter=new O.default(this.observer,this.config)),h},E}();function u(E,g){var c=null;return E.byteLength>0&&g!=null&&g.key!=null&&g.iv!==null&&g.method!=null&&(c=g),c}var _=function(g){return{remuxResult:{},chunkMeta:g}};function m(E){return"then"in E&&E.then instanceof Function}var p=function(g,c,h,o,C){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=g,this.videoCodec=c,this.initSegmentData=h,this.duration=o,this.defaultInitPts=C},D=function(g,c,h,o,C){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=g,this.contiguous=c,this.accurateTimeOffset=h,this.trackSwitch=o,this.timeOffset=C}},"./src/demux/tsdemuxer.ts":function(ne,$,k){"use strict";k.r($),k.d($,"discardEPB",function(){return _});var X=k("./src/demux/adts.ts"),U=k("./src/demux/mpegaudio.ts"),O=k("./src/demux/exp-golomb.ts"),W=k("./src/demux/id3.ts"),F=k("./src/demux/sample-aes.ts"),P=k("./src/events.ts"),w=k("./src/utils/mp4-tools.ts"),f=k("./src/utils/logger.ts"),b=k("./src/errors.ts"),M={video:1,audio:2,id3:3,text:4},A=function(){function m(D,E,g){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=D,this.config=E,this.typeSupported=g}m.probe=function(E){var g=m.syncOffset(E);return g<0?!1:(g&&f.logger.warn("MPEG2-TS detected but first sync word found @ offset "+g+", junk ahead ?"),!0)},m.syncOffset=function(E){for(var g=Math.min(1e3,E.length-3*188),c=0;c<g;){if(E[c]===71&&E[c+188]===71&&E[c+2*188]===71)return c;c++}return-1},m.createTrack=function(E,g){return{container:E==="video"||E==="audio"?"video/mp2t":void 0,type:E,id:M[E],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:E==="audio"?g:void 0}};var p=m.prototype;return p.resetInitSegment=function(E,g,c){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=m.createTrack("video",c),this._audioTrack=m.createTrack("audio",c),this._id3Track=m.createTrack("id3",c),this._txtTrack=m.createTrack("text",c),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=E,this.videoCodec=g,this._duration=c},p.resetTimeStamp=function(){},p.resetContiguity=function(){var E=this._audioTrack,g=this._avcTrack,c=this._id3Track;E&&(E.pesData=null),g&&(g.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},p.demux=function(E,g,c,h){c===void 0&&(c=!1),h===void 0&&(h=!1),c||(this.sampleAes=null);var o,C=this._avcTrack,x=this._audioTrack,v=this._id3Track,R=C.pid,B=C.pesData,j=x.pid,K=v.pid,I=x.pesData,N=v.pesData,Y=!1,q=this.pmtParsed,ae=this._pmtId,he=E.length;if(this.remainderData&&(E=Object(w.appendUint8Array)(this.remainderData,E),he=E.length,this.remainderData=null),he<188&&!h)return this.remainderData=E,{audioTrack:x,avcTrack:C,id3Track:v,textTrack:this._txtTrack};var _e=Math.max(0,m.syncOffset(E));he-=(he+_e)%188,he<E.byteLength&&!h&&(this.remainderData=new Uint8Array(E.buffer,he,E.buffer.byteLength-he));for(var be=_e;be<he;be+=188)if(E[be]===71){var Ce=!!(E[be+1]&64),Te=((E[be+1]&31)<<8)+E[be+2],Ee=(E[be+3]&48)>>4,me=void 0;if(Ee>1){if(me=be+5+E[be+4],me===be+188)continue}else me=be+4;switch(Te){case R:Ce&&(B&&(o=a(B))&&this.parseAVCPES(o,!1),B={data:[],size:0}),B&&(B.data.push(E.subarray(me,be+188)),B.size+=be+188-me);break;case j:Ce&&(I&&(o=a(I))&&(x.isAAC?this.parseAACPES(o):this.parseMPEGPES(o)),I={data:[],size:0}),I&&(I.data.push(E.subarray(me,be+188)),I.size+=be+188-me);break;case K:Ce&&(N&&(o=a(N))&&this.parseID3PES(o),N={data:[],size:0}),N&&(N.data.push(E.subarray(me,be+188)),N.size+=be+188-me);break;case 0:Ce&&(me+=E[me]+1),ae=this._pmtId=T(E,me);break;case ae:{Ce&&(me+=E[me]+1);var ue=d(E,me,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);R=ue.avc,R>0&&(C.pid=R),j=ue.audio,j>0&&(x.pid=j,x.isAAC=ue.isAAC),K=ue.id3,K>0&&(v.pid=K),Y&&!q&&(f.logger.log("reparse from beginning"),Y=!1,be=_e-188),q=this.pmtParsed=!0;break}case 17:case 8191:break;default:Y=!0;break}}else this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:b.ErrorTypes.MEDIA_ERROR,details:b.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});C.pesData=B,x.pesData=I,v.pesData=N;var te={audioTrack:x,avcTrack:C,id3Track:v,textTrack:this._txtTrack};return h&&this.extractRemainingSamples(te),te},p.flush=function(){var E=this.remainderData;this.remainderData=null;var g;return E?g=this.demux(E,-1,!1,!0):g={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(g),this.sampleAes?this.decrypt(g,this.sampleAes):g},p.extractRemainingSamples=function(E){var g=E.audioTrack,c=E.avcTrack,h=E.id3Track,o=c.pesData,C=g.pesData,x=h.pesData,v;o&&(v=a(o))?(this.parseAVCPES(v,!0),c.pesData=null):c.pesData=o,C&&(v=a(C))?(g.isAAC?this.parseAACPES(v):this.parseMPEGPES(v),g.pesData=null):(C!=null&&C.size&&f.logger.log("last AAC PES packet truncated,might overlap between fragments"),g.pesData=C),x&&(v=a(x))?(this.parseID3PES(v),h.pesData=null):h.pesData=x},p.demuxSampleAes=function(E,g,c){var h=this.demux(E,c,!0,!this.config.progressive),o=this.sampleAes=new F.default(this.observer,this.config,g);return this.decrypt(h,o)},p.decrypt=function(E,g){return new Promise(function(c){var h=E.audioTrack,o=E.avcTrack;h.samples&&h.isAAC?g.decryptAacSamples(h.samples,0,function(){o.samples?g.decryptAvcSamples(o.samples,0,0,function(){c(E)}):c(E)}):o.samples&&g.decryptAvcSamples(o.samples,0,0,function(){c(E)})})},p.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},p.parseAVCPES=function(E,g){var c=this,h=this._avcTrack,o=this.parseAVCNALu(E.data),C=!1,x=this.avcSample,v,R=!1;E.data=null,x&&o.length&&!h.audFound&&(s(x,h),x=this.avcSample=S(!1,E.pts,E.dts,"")),o.forEach(function(B){switch(B.type){case 1:{v=!0,x||(x=c.avcSample=S(!0,E.pts,E.dts,"")),C&&(x.debug+="NDR "),x.frame=!0;var j=B.data;if(R&&j.length>4){var K=new O.default(j).readSliceType();(K===2||K===4||K===7||K===9)&&(x.key=!0)}break}case 5:v=!0,x||(x=c.avcSample=S(!0,E.pts,E.dts,"")),C&&(x.debug+="IDR "),x.key=!0,x.frame=!0;break;case 6:{v=!0,C&&x&&(x.debug+="SEI ");var I=new O.default(_(B.data));I.readUByte();for(var N=0,Y=0,q=!1,ae=0;!q&&I.bytesAvailable>1;){N=0;do ae=I.readUByte(),N+=ae;while(ae===255);Y=0;do ae=I.readUByte(),Y+=ae;while(ae===255);if(N===4&&I.bytesAvailable!==0){q=!0;var he=I.readUByte();if(he===181){var _e=I.readUShort();if(_e===49){var be=I.readUInt();if(be===1195456820){var Ce=I.readUByte();if(Ce===3){for(var Te=I.readUByte(),Ee=I.readUByte(),me=31&Te,ue=[Te,Ee],te=0;te<me;te++)ue.push(I.readUByte()),ue.push(I.readUByte()),ue.push(I.readUByte());u(c._txtTrack.samples,{type:3,pts:E.pts,bytes:ue})}}}}}else if(N===5&&I.bytesAvailable!==0){if(q=!0,Y>16){for(var ce=[],se=0;se<16;se++)ce.push(I.readUByte().toString(16)),(se===3||se===5||se===7||se===9)&&ce.push("-");for(var we=Y-16,Le=new Uint8Array(we),xe=0;xe<we;xe++)Le[xe]=I.readUByte();u(c._txtTrack.samples,{pts:E.pts,payloadType:N,uuid:ce.join(""),userData:Object(W.utf8ArrayToStr)(Le),userDataBytes:Le})}}else if(Y<I.bytesAvailable)for(var Pe=0;Pe<Y;Pe++)I.readUByte()}break}case 7:if(v=!0,R=!0,C&&x&&(x.debug+="SPS "),!h.sps){var Ne=new O.default(B.data),Be=Ne.readSPS();h.width=Be.width,h.height=Be.height,h.pixelRatio=Be.pixelRatio,h.sps=[B.data],h.duration=c._duration;for(var We=B.data.subarray(1,4),Ue="avc1.",Fe=0;Fe<3;Fe++){var at=We[Fe].toString(16);at.length<2&&(at="0"+at),Ue+=at}h.codec=Ue}break;case 8:v=!0,C&&x&&(x.debug+="PPS "),h.pps||(h.pps=[B.data]);break;case 9:v=!1,h.audFound=!0,x&&s(x,h),x=c.avcSample=S(!1,E.pts,E.dts,C?"AUD ":"");break;case 12:v=!1;break;default:v=!1,x&&(x.debug+="unknown NAL "+B.type+" ");break}if(x&&v){var it=x.units;it.push(B)}}),g&&x&&(s(x,h),this.avcSample=null)},p.getLastNalUnit=function(){var E,g=this.avcSample,c;if(!g||g.units.length===0){var h=this._avcTrack.samples;g=h[h.length-1]}if((E=g)!==null&&E!==void 0&&E.units){var o=g.units;c=o[o.length-1]}return c},p.parseAVCNALu=function(E){var g=E.byteLength,c=this._avcTrack,h=c.naluState||0,o=h,C=[],x=0,v,R,B,j=-1,K=0;for(h===-1&&(j=0,K=E[0]&31,h=0,x=1);x<g;){if(v=E[x++],!h){h=v?0:1;continue}if(h===1){h=v?0:2;continue}if(!v)h=3;else if(v===1){if(j>=0){var I={data:E.subarray(j,x-h-1),type:K};C.push(I)}else{var N=this.getLastNalUnit();if(N&&(o&&x<=4-o&&(N.state&&(N.data=N.data.subarray(0,N.data.byteLength-o))),R=x-h-1,R>0)){var Y=new Uint8Array(N.data.byteLength+R);Y.set(N.data,0),Y.set(E.subarray(0,R),N.data.byteLength),N.data=Y,N.state=0}}x<g?(B=E[x]&31,j=x,K=B,h=0):h=-1}else h=0}if(j>=0&&h>=0){var q={data:E.subarray(j,g),type:K,state:h};C.push(q)}if(C.length===0){var ae=this.getLastNalUnit();if(ae){var he=new Uint8Array(ae.data.byteLength+E.byteLength);he.set(ae.data,0),he.set(E,ae.data.byteLength),ae.data=he}}return c.naluState=h,C},p.parseAACPES=function(E){var g=0,c=this._audioTrack,h=this.aacOverFlow,o=E.data;if(h){this.aacOverFlow=null;var C=h.sample.unit.byteLength,x=Math.min(h.missing,C),v=C-x;h.sample.unit.set(o.subarray(0,x),v),c.samples.push(h.sample),g=h.missing}var R,B;for(R=g,B=o.length;R<B-1&&!X.isHeader(o,R);R++);if(R!==g){var j,K;if(R<B-1?(j="AAC PES did not start with ADTS header,offset:"+R,K=!1):(j="no ADTS header found in AAC PES",K=!0),f.logger.warn("parsing error:"+j),this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:b.ErrorTypes.MEDIA_ERROR,details:b.ErrorDetails.FRAG_PARSING_ERROR,fatal:K,reason:j}),K)return}X.initTrackConfig(c,this.observer,o,R,this.audioCodec);var I;if(E.pts!==void 0)I=E.pts;else if(h){var N=X.getFrameDuration(c.samplerate);I=h.sample.pts+N}else{f.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var Y=0;R<B;)if(X.isHeader(o,R)){if(R+5<B){var q=X.appendFrame(c,o,R,I,Y);if(q)if(q.missing)this.aacOverFlow=q;else{R+=q.length,Y++;continue}}break}else R++},p.parseMPEGPES=function(E){var g=E.data,c=g.length,h=0,o=0,C=E.pts;if(C===void 0){f.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<c;)if(U.isHeader(g,o)){var x=U.appendFrame(this._audioTrack,g,o,C,h);if(x)o+=x.length,h++;else break}else o++},p.parseID3PES=function(E){if(E.pts===void 0){f.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(E)},m}();A.minProbeByteLength=188;function S(m,p,D,E){return{key:m,frame:!1,pts:p,dts:D,units:[],debug:E,length:0}}function T(m,p){return(m[p+10]&31)<<8|m[p+11]}function d(m,p,D,E){var g={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(m[p+1]&15)<<8|m[p+2],h=p+3+c-4,o=(m[p+10]&15)<<8|m[p+11];for(p+=12+o;p<h;){var C=(m[p+1]&31)<<8|m[p+2];switch(m[p]){case 207:if(!E){f.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:g.audio===-1&&(g.audio=C);break;case 21:g.id3===-1&&(g.id3=C);break;case 219:if(!E){f.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:g.avc===-1&&(g.avc=C);break;case 3:case 4:D?g.audio===-1&&(g.audio=C,g.isAAC=!1):f.logger.log("MPEG audio found, not supported in this browser");break;case 36:f.logger.warn("Unsupported HEVC stream type found");break;default:break}p+=((m[p+3]&15)<<8|m[p+4])+5}return g}function a(m){var p=0,D,E,g,c,h,o=m.data;if(!m||m.size===0)return null;for(;o[0].length<19&&o.length>1;){var C=new Uint8Array(o[0].length+o[1].length);C.set(o[0]),C.set(o[1],o[0].length),o[0]=C,o.splice(1,1)}D=o[0];var x=(D[0]<<16)+(D[1]<<8)+D[2];if(x===1){if(E=(D[4]<<8)+D[5],E&&E>m.size-6)return null;var v=D[7];v&192&&(c=(D[9]&14)*536870912+(D[10]&255)*4194304+(D[11]&254)*16384+(D[12]&255)*128+(D[13]&254)/2,v&64?(h=(D[14]&14)*536870912+(D[15]&255)*4194304+(D[16]&254)*16384+(D[17]&255)*128+(D[18]&254)/2,c-h>60*9e4&&(f.logger.warn(Math.round((c-h)/9e4)+"s delta between PTS and DTS, align them"),c=h)):h=c),g=D[8];var R=g+9;if(m.size<=R)return null;m.size-=R;for(var B=new Uint8Array(m.size),j=0,K=o.length;j<K;j++){D=o[j];var I=D.byteLength;if(R)if(R>I){R-=I;continue}else D=D.subarray(R),I-=R,R=0;B.set(D,p),p+=I}return E&&(E-=g+3),{data:B,pts:c,dts:h,len:E}}return null}function s(m,p){if(m.units.length&&m.frame){if(m.pts===void 0){var D=p.samples,E=D.length;if(E){var g=D[E-1];m.pts=g.pts,m.dts=g.dts}else{p.dropped++;return}}p.samples.push(m)}m.debug.length&&f.logger.log(m.pts+"/"+m.dts+":"+m.debug)}function u(m,p){var D=m.length;if(D>0){if(p.pts>=m[D-1].pts)m.push(p);else for(var E=D-1;E>=0;E--)if(p.pts<m[E].pts){m.splice(E,0,p);break}}else m.push(p)}function _(m){for(var p=m.byteLength,D=[],E=1;E<p-2;)m[E]===0&&m[E+1]===0&&m[E+2]===3?(D.push(E+2),E+=2):E++;if(D.length===0)return m;var g=p-D.length,c=new Uint8Array(g),h=0;for(E=0;E<g;h++,E++)h===D[0]&&(h++,D.shift()),c[E]=m[h];return c}$.default=A},"./src/errors.ts":function(ne,$,k){"use strict";k.r($),k.d($,"ErrorTypes",function(){return X}),k.d($,"ErrorDetails",function(){return U});var X;(function(O){O.NETWORK_ERROR="networkError",O.MEDIA_ERROR="mediaError",O.KEY_SYSTEM_ERROR="keySystemError",O.MUX_ERROR="muxError",O.OTHER_ERROR="otherError"})(X||(X={}));var U;(function(O){O.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",O.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",O.KEY_SYSTEM_NO_SESSION="keySystemNoSession",O.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",O.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",O.MANIFEST_LOAD_ERROR="manifestLoadError",O.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",O.MANIFEST_PARSING_ERROR="manifestParsingError",O.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",O.LEVEL_EMPTY_ERROR="levelEmptyError",O.LEVEL_LOAD_ERROR="levelLoadError",O.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",O.LEVEL_SWITCH_ERROR="levelSwitchError",O.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",O.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",O.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",O.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",O.FRAG_LOAD_ERROR="fragLoadError",O.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",O.FRAG_DECRYPT_ERROR="fragDecryptError",O.FRAG_PARSING_ERROR="fragParsingError",O.REMUX_ALLOC_ERROR="remuxAllocError",O.KEY_LOAD_ERROR="keyLoadError",O.KEY_LOAD_TIMEOUT="keyLoadTimeOut",O.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",O.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",O.BUFFER_APPEND_ERROR="bufferAppendError",O.BUFFER_APPENDING_ERROR="bufferAppendingError",O.BUFFER_STALLED_ERROR="bufferStalledError",O.BUFFER_FULL_ERROR="bufferFullError",O.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",O.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",O.INTERNAL_EXCEPTION="internalException",O.INTERNAL_ABORTED="aborted",O.UNKNOWN="unknown"})(U||(U={}))},"./src/events.ts":function(ne,$,k){"use strict";k.r($),k.d($,"Events",function(){return X});var X;(function(U){U.MEDIA_ATTACHING="hlsMediaAttaching",U.MEDIA_ATTACHED="hlsMediaAttached",U.MEDIA_DETACHING="hlsMediaDetaching",U.MEDIA_DETACHED="hlsMediaDetached",U.BUFFER_RESET="hlsBufferReset",U.BUFFER_CODECS="hlsBufferCodecs",U.BUFFER_CREATED="hlsBufferCreated",U.BUFFER_APPENDING="hlsBufferAppending",U.BUFFER_APPENDED="hlsBufferAppended",U.BUFFER_EOS="hlsBufferEos",U.BUFFER_FLUSHING="hlsBufferFlushing",U.BUFFER_FLUSHED="hlsBufferFlushed",U.MANIFEST_LOADING="hlsManifestLoading",U.MANIFEST_LOADED="hlsManifestLoaded",U.MANIFEST_PARSED="hlsManifestParsed",U.LEVEL_SWITCHING="hlsLevelSwitching",U.LEVEL_SWITCHED="hlsLevelSwitched",U.LEVEL_LOADING="hlsLevelLoading",U.LEVEL_LOADED="hlsLevelLoaded",U.LEVEL_UPDATED="hlsLevelUpdated",U.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",U.LEVELS_UPDATED="hlsLevelsUpdated",U.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",U.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",U.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",U.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",U.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",U.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",U.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",U.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",U.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",U.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",U.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",U.CUES_PARSED="hlsCuesParsed",U.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",U.INIT_PTS_FOUND="hlsInitPtsFound",U.FRAG_LOADING="hlsFragLoading",U.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",U.FRAG_LOADED="hlsFragLoaded",U.FRAG_DECRYPTED="hlsFragDecrypted",U.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",U.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",U.FRAG_PARSING_METADATA="hlsFragParsingMetadata",U.FRAG_PARSED="hlsFragParsed",U.FRAG_BUFFERED="hlsFragBuffered",U.FRAG_CHANGED="hlsFragChanged",U.FPS_DROP="hlsFpsDrop",U.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",U.ERROR="hlsError",U.DESTROYING="hlsDestroying",U.KEY_LOADING="hlsKeyLoading",U.KEY_LOADED="hlsKeyLoaded",U.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",U.BACK_BUFFER_REACHED="hlsBackBufferReached"})(X||(X={}))},"./src/hls.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return m});var X=k("./node_modules/url-toolkit/src/url-toolkit.js"),U=k.n(X),O=k("./src/loader/playlist-loader.ts"),W=k("./src/loader/key-loader.ts"),F=k("./src/controller/id3-track-controller.ts"),P=k("./src/controller/latency-controller.ts"),w=k("./src/controller/level-controller.ts"),f=k("./src/controller/fragment-tracker.ts"),b=k("./src/controller/stream-controller.ts"),M=k("./src/is-supported.ts"),A=k("./src/utils/logger.ts"),S=k("./src/config.ts"),T=k("./node_modules/eventemitter3/index.js"),d=k.n(T),a=k("./src/events.ts"),s=k("./src/errors.ts");function u(p,D){for(var E=0;E<D.length;E++){var g=D[E];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(p,g.key,g)}}function _(p,D,E){return D&&u(p.prototype,D),E&&u(p,E),p}var m=function(){p.isSupported=function(){return Object(M.isSupported)()};function p(E){E===void 0&&(E={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new T.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 g=this.config=Object(S.mergeConfig)(p.DefaultConfig,E);this.userConfig=E,Object(A.enableLogs)(g.debug),this._autoLevelCapping=-1,g.progressive&&Object(S.enableStreamingMode)(g);var c=g.abrController,h=g.bufferController,o=g.capLevelController,C=g.fpsController,x=this.abrController=new c(this),v=this.bufferController=new h(this),R=this.capLevelController=new o(this),B=new C(this),j=new O.default(this),K=new W.default(this),I=new F.default(this),N=this.levelController=new w.default(this),Y=new f.FragmentTracker(this),q=this.streamController=new b.default(this,Y);R.setStreamController(q),B.setStreamController(q);var ae=[N,q];this.networkControllers=ae;var he=[j,K,x,v,R,B,I,Y];this.audioTrackController=this.createController(g.audioTrackController,null,ae),this.createController(g.audioStreamController,Y,ae),this.subtitleTrackController=this.createController(g.subtitleTrackController,null,ae),this.createController(g.subtitleStreamController,Y,ae),this.createController(g.timelineController,null,he),this.emeController=this.createController(g.emeController,null,he),this.cmcdController=this.createController(g.cmcdController,null,he),this.latencyController=this.createController(P.default,null,he),this.coreComponents=he}var D=p.prototype;return D.createController=function(g,c,h){if(g){var o=c?new g(this,c):new g(this);return h&&h.push(o),o}return null},D.on=function(g,c,h){h===void 0&&(h=this),this._emitter.on(g,c,h)},D.once=function(g,c,h){h===void 0&&(h=this),this._emitter.once(g,c,h)},D.removeAllListeners=function(g){this._emitter.removeAllListeners(g)},D.off=function(g,c,h,o){h===void 0&&(h=this),this._emitter.off(g,c,h,o)},D.listeners=function(g){return this._emitter.listeners(g)},D.emit=function(g,c,h){return this._emitter.emit(g,c,h)},D.trigger=function(g,c){if(this.config.debug)return this.emit(g,g,c);try{return this.emit(g,g,c)}catch(h){A.logger.error("An internal error happened while handling event "+g+'. Error message: "'+h.message+'". Here is a stacktrace:',h),this.trigger(a.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:g,error:h})}return!1},D.listenerCount=function(g){return this._emitter.listenerCount(g)},D.destroy=function(){A.logger.log("destroy"),this.trigger(a.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(g){return g.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(g){return g.destroy()}),this.coreComponents.length=0},D.attachMedia=function(g){A.logger.log("attachMedia"),this._media=g,this.trigger(a.Events.MEDIA_ATTACHING,{media:g})},D.detachMedia=function(){A.logger.log("detachMedia"),this.trigger(a.Events.MEDIA_DETACHING,void 0),this._media=null},D.loadSource=function(g){this.stopLoad();var c=this.media,h=this.url,o=this.url=X.buildAbsoluteURL(self.location.href,g,{alwaysNormalize:!0});A.logger.log("loadSource:"+o),c&&h&&h!==o&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(a.Events.MANIFEST_LOADING,{url:g})},D.startLoad=function(g){g===void 0&&(g=-1),A.logger.log("startLoad("+g+")"),this.networkControllers.forEach(function(c){c.startLoad(g)})},D.stopLoad=function(){A.logger.log("stopLoad"),this.networkControllers.forEach(function(g){g.stopLoad()})},D.swapAudioCodec=function(){A.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},D.recoverMediaError=function(){A.logger.log("recoverMediaError");var g=this._media;this.detachMedia(),g&&this.attachMedia(g)},D.removeLevel=function(g,c){c===void 0&&(c=0),this.levelController.removeLevel(g,c)},_(p,[{key:"levels",get:function(){var g=this.levelController.levels;return g||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(g){A.logger.log("set currentLevel:"+g),this.loadLevel=g,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(g){A.logger.log("set nextLevel:"+g),this.levelController.manualLevel=g,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(g){A.logger.log("set loadLevel:"+g),this.levelController.manualLevel=g}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(g){this.levelController.nextLoadLevel=g}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(g){A.logger.log("set firstLevel:"+g),this.levelController.firstLevel=g}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(g){A.logger.log("set startLevel:"+g),g!==-1&&(g=Math.max(g,this.minAutoLevel)),this.levelController.startLevel=g}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(g){var c=!!g;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(g){this._autoLevelCapping!==g&&(A.logger.log("set autoLevelCapping:"+g),this._autoLevelCapping=g)}},{key:"bandwidthEstimate",get:function(){var g=this.abrController.bwEstimator;return g?g.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var g=this.levels,c=this.config.minAutoBitrate;if(!g)return 0;for(var h=g.length,o=0;o<h;o++)if(g[o].maxBitrate>c)return o;return 0}},{key:"maxAutoLevel",get:function(){var g=this.levels,c=this.autoLevelCapping,h;return c===-1&&g&&g.length?h=g.length-1:h=c,h}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(g){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,g)}},{key:"audioTracks",get:function(){var g=this.audioTrackController;return g?g.audioTracks:[]}},{key:"audioTrack",get:function(){var g=this.audioTrackController;return g?g.audioTrack:-1},set:function(g){var c=this.audioTrackController;c&&(c.audioTrack=g)}},{key:"subtitleTracks",get:function(){var g=this.subtitleTrackController;return g?g.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var g=this.subtitleTrackController;return g?g.subtitleTrack:-1},set:function(g){var c=this.subtitleTrackController;c&&(c.subtitleTrack=g)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var g=this.subtitleTrackController;return g?g.subtitleDisplay:!1},set:function(g){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=g)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(g){this.config.lowLatencyMode=g}},{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 a.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return p.defaultConfig?p.defaultConfig:S.hlsDefaultConfig},set:function(g){p.defaultConfig=g}}]),p}();m.defaultConfig=void 0},"./src/is-supported.ts":function(ne,$,k){"use strict";k.r($),k.d($,"isSupported",function(){return O}),k.d($,"changeTypeSupported",function(){return W});var X=k("./src/utils/mediasource-helper.ts");function U(){return self.SourceBuffer||self.WebKitSourceBuffer}function O(){var F=Object(X.getMediaSource)();if(!F)return!1;var P=U(),w=F&&typeof F.isTypeSupported=="function"&&F.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),f=!P||P.prototype&&typeof P.prototype.appendBuffer=="function"&&typeof P.prototype.remove=="function";return!!w&&!!f}function W(){var F,P=U();return typeof(P==null||((F=P.prototype)===null||F===void 0)?void 0:F.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return A}),k.d($,"LoadError",function(){return T});var X=k("./src/polyfills/number.ts"),U=k("./src/errors.ts");function O(d,a){d.prototype=Object.create(a.prototype),d.prototype.constructor=d,f(d,a)}function W(d){var a=typeof Map=="function"?new Map:void 0;return W=function(u){if(u===null||!w(u))return u;if(typeof u!="function")throw new TypeError("Super expression must either be null or a function");if(typeof a!="undefined"){if(a.has(u))return a.get(u);a.set(u,_)}function _(){return F(u,arguments,b(this).constructor)}return _.prototype=Object.create(u.prototype,{constructor:{value:_,enumerable:!1,writable:!0,configurable:!0}}),f(_,u)},W(d)}function F(d,a,s){return P()?F=Reflect.construct:F=function(_,m,p){var D=[null];D.push.apply(D,m);var E=Function.bind.apply(_,D),g=new E;return p&&f(g,p.prototype),g},F.apply(null,arguments)}function P(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(d){return!1}}function w(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function f(d,a){return f=Object.setPrototypeOf||function(u,_){return u.__proto__=_,u},f(d,a)}function b(d){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},b(d)}var M=Math.pow(2,17),A=function(){function d(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var a=d.prototype;return a.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},a.abort=function(){this.loader&&this.loader.abort()},a.load=function(u,_){var m=this,p=u.url;if(!p)return Promise.reject(new T({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,networkDetails:null},"Fragment does not have a "+(p?"part list":"url")));this.abort();var D=this.config,E=D.fLoader,g=D.loader;return new Promise(function(c,h){m.loader&&m.loader.destroy();var o=m.loader=u.loader=E?new E(D):new g(D),C=S(u),x={timeout:D.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:D.fragLoadingMaxRetryTimeout,highWaterMark:M};u.stats=o.stats,o.load(C,x,{onSuccess:function(R,B,j,K){m.resetLoader(u,o),c({frag:u,part:null,payload:R.data,networkDetails:K})},onError:function(R,B,j){m.resetLoader(u,o),h(new T({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,response:R,networkDetails:j}))},onAbort:function(R,B,j){m.resetLoader(u,o),h(new T({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,networkDetails:j}))},onTimeout:function(R,B,j){m.resetLoader(u,o),h(new T({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,networkDetails:j}))},onProgress:function(R,B,j,K){_&&_({frag:u,part:null,payload:j,networkDetails:K})}})})},a.loadPart=function(u,_,m){var p=this;this.abort();var D=this.config,E=D.fLoader,g=D.loader;return new Promise(function(c,h){p.loader&&p.loader.destroy();var o=p.loader=u.loader=E?new E(D):new g(D),C=S(u,_),x={timeout:D.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:D.fragLoadingMaxRetryTimeout,highWaterMark:M};_.stats=o.stats,o.load(C,x,{onSuccess:function(R,B,j,K){p.resetLoader(u,o),p.updateStatsFromPart(u,_);var I={frag:u,part:_,payload:R.data,networkDetails:K};m(I),c(I)},onError:function(R,B,j){p.resetLoader(u,o),h(new T({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,part:_,response:R,networkDetails:j}))},onAbort:function(R,B,j){u.stats.aborted=_.stats.aborted,p.resetLoader(u,o),h(new T({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,part:_,networkDetails:j}))},onTimeout:function(R,B,j){p.resetLoader(u,o),h(new T({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,part:_,networkDetails:j}))}})})},a.updateStatsFromPart=function(u,_){var m=u.stats,p=_.stats,D=p.total;if(m.loaded+=p.loaded,D){var E=Math.round(u.duration/_.duration),g=Math.min(Math.round(m.loaded/D),E),c=E-g,h=c*Math.round(m.loaded/g);m.total=m.loaded+h}else m.total=Math.max(m.loaded,m.total);var o=m.loading,C=p.loading;o.start?o.first+=C.first-C.start:(o.start=C.start,o.first=C.first),o.end=C.end},a.resetLoader=function(u,_){u.loader=null,this.loader===_&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),_.destroy()},d}();function S(d,a){a===void 0&&(a=null);var s=a||d,u={frag:d,part:a,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},_=s.byteRangeStartOffset,m=s.byteRangeEndOffset;return Object(X.isFiniteNumber)(_)&&Object(X.isFiniteNumber)(m)&&(u.rangeStart=_,u.rangeEnd=m),u}var T=function(d){O(a,d);function a(s){for(var u,_=arguments.length,m=new Array(_>1?_-1:0),p=1;p<_;p++)m[p-1]=arguments[p];return u=d.call.apply(d,[this].concat(m))||this,u.data=void 0,u.data=s,u}return a}(W(Error))},"./src/loader/fragment.ts":function(ne,$,k){"use strict";k.r($),k.d($,"ElementaryStreamTypes",function(){return A}),k.d($,"BaseSegment",function(){return S}),k.d($,"Fragment",function(){return T}),k.d($,"Part",function(){return d});var X=k("./src/polyfills/number.ts"),U=k("./node_modules/url-toolkit/src/url-toolkit.js"),O=k.n(U),W=k("./src/utils/logger.ts"),F=k("./src/loader/level-key.ts"),P=k("./src/loader/load-stats.ts");function w(a,s){a.prototype=Object.create(s.prototype),a.prototype.constructor=a,f(a,s)}function f(a,s){return f=Object.setPrototypeOf||function(_,m){return _.__proto__=m,_},f(a,s)}function b(a,s){for(var u=0;u<s.length;u++){var _=s[u];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(a,_.key,_)}}function M(a,s,u){return s&&b(a.prototype,s),u&&b(a,u),a}var A;(function(a){a.AUDIO="audio",a.VIDEO="video",a.AUDIOVIDEO="audiovideo"})(A||(A={}));var S=function(){function a(u){var _;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(_={},_[A.AUDIO]=null,_[A.VIDEO]=null,_[A.AUDIOVIDEO]=null,_),this.baseurl=u}var s=a.prototype;return s.setByteRange=function(_,m){var p=_.split("@",2),D=[];p.length===1?D[0]=m?m.byteRangeEndOffset:0:D[0]=parseInt(p[1]),D[1]=parseInt(p[0])+D[0],this._byteRange=D},M(a,[{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(U.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(_){this._url=_}}]),a}(),T=function(a){w(s,a);function s(_,m){var p;return p=a.call(this,m)||this,p._decryptdata=null,p.rawProgramDateTime=null,p.programDateTime=null,p.tagList=[],p.duration=0,p.sn=0,p.levelkey=void 0,p.type=void 0,p.loader=null,p.level=-1,p.cc=0,p.startPTS=void 0,p.endPTS=void 0,p.appendedPTS=void 0,p.startDTS=void 0,p.endDTS=void 0,p.start=0,p.deltaPTS=void 0,p.maxStartPTS=void 0,p.minEndPTS=void 0,p.stats=new P.LoadStats,p.urlId=0,p.data=void 0,p.bitrateTest=!1,p.title=null,p.initSegment=null,p.type=_,p}var u=s.prototype;return u.createInitializationVector=function(m){for(var p=new Uint8Array(16),D=12;D<16;D++)p[D]=m>>8*(15-D)&255;return p},u.setDecryptDataFromLevelKey=function(m,p){var D=m;return(m==null?void 0:m.method)==="AES-128"&&m.uri&&!m.iv&&(D=F.LevelKey.fromURI(m.uri),D.method=m.method,D.iv=this.createInitializationVector(p),D.keyFormat="identity"),D},u.setElementaryStreamInfo=function(m,p,D,E,g,c){c===void 0&&(c=!1);var h=this.elementaryStreams,o=h[m];if(!o){h[m]={startPTS:p,endPTS:D,startDTS:E,endDTS:g,partial:c};return}o.startPTS=Math.min(o.startPTS,p),o.endPTS=Math.max(o.endPTS,D),o.startDTS=Math.min(o.startDTS,E),o.endDTS=Math.max(o.endDTS,g)},u.clearElementaryStreamInfo=function(){var m=this.elementaryStreams;m[A.AUDIO]=null,m[A.VIDEO]=null,m[A.AUDIOVIDEO]=null},M(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var m=this.sn;typeof m!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&W.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),m=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,m)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(X.isFiniteNumber)(this.programDateTime))return null;var m=Object(X.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+m*1e3}},{key:"encrypted",get:function(){var m;return!!((m=this.decryptdata)!==null&&m!==void 0&&m.keyFormat&&this.decryptdata.uri)}}]),s}(S),d=function(a){w(s,a);function s(u,_,m,p,D){var E;E=a.call(this,m)||this,E.fragOffset=0,E.duration=0,E.gap=!1,E.independent=!1,E.relurl=void 0,E.fragment=void 0,E.index=void 0,E.stats=new P.LoadStats,E.duration=u.decimalFloatingPoint("DURATION"),E.gap=u.bool("GAP"),E.independent=u.bool("INDEPENDENT"),E.relurl=u.enumeratedString("URI"),E.fragment=_,E.index=p;var g=u.enumeratedString("BYTERANGE");return g&&E.setByteRange(g,D),D&&(E.fragOffset=D.fragOffset+D.duration),E}return M(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var _=this.elementaryStreams;return!!(_.audio||_.video||_.audiovideo)}}]),s}(S)},"./src/loader/key-loader.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return W});var X=k("./src/events.ts"),U=k("./src/errors.ts"),O=k("./src/utils/logger.ts"),W=function(){function F(w){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=w,this._registerListeners()}var P=F.prototype;return P._registerListeners=function(){this.hls.on(X.Events.KEY_LOADING,this.onKeyLoading,this)},P._unregisterListeners=function(){this.hls.off(X.Events.KEY_LOADING,this.onKeyLoading)},P.destroy=function(){this._unregisterListeners();for(var f in this.loaders){var b=this.loaders[f];b&&b.destroy()}this.loaders={}},P.onKeyLoading=function(f,b){var M=b.frag,A=M.type,S=this.loaders[A];if(!M.decryptdata){O.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var T=M.decryptdata.uri;if(T!==this.decrypturl||this.decryptkey===null){var d=this.hls.config;if(S&&(O.logger.warn("abort previous key loader for type:"+A),S.abort()),!T){O.logger.warn("key uri is falsy");return}var a=d.loader,s=M.loader=this.loaders[A]=new a(d);this.decrypturl=T,this.decryptkey=null;var u={url:T,frag:M,responseType:"arraybuffer"},_={timeout:d.fragLoadingTimeOut,maxRetry:0,retryDelay:d.fragLoadingRetryDelay,maxRetryDelay:d.fragLoadingMaxRetryTimeout,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(u,_,m)}else this.decryptkey&&(M.decryptdata.key=this.decryptkey,this.hls.trigger(X.Events.KEY_LOADED,{frag:M}))},P.loadsuccess=function(f,b,M){var A=M.frag;if(!A.decryptdata){O.logger.error("after key load, decryptdata unset");return}this.decryptkey=A.decryptdata.key=new Uint8Array(f.data),A.loader=null,delete this.loaders[A.type],this.hls.trigger(X.Events.KEY_LOADED,{frag:A})},P.loaderror=function(f,b){var M=b.frag,A=M.loader;A&&A.abort(),delete this.loaders[M.type],this.hls.trigger(X.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:M,response:f})},P.loadtimeout=function(f,b){var M=b.frag,A=M.loader;A&&A.abort(),delete this.loaders[M.type],this.hls.trigger(X.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:M})},F}()},"./src/loader/level-details.ts":function(ne,$,k){"use strict";k.r($),k.d($,"LevelDetails",function(){return F});var X=k("./src/polyfills/number.ts");function U(P,w){for(var f=0;f<w.length;f++){var b=w[f];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(P,b.key,b)}}function O(P,w,f){return w&&U(P.prototype,w),f&&U(P,f),P}var W=10,F=function(){function P(f){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=f}var w=P.prototype;return w.reloaded=function(b){if(!b){this.advanced=!0,this.updated=!0;return}var M=this.lastPartSn-b.lastPartSn,A=this.lastPartIndex-b.lastPartIndex;this.updated=this.endSN!==b.endSN||!!A||!!M,this.advanced=this.endSN>b.endSN||M>0||M===0&&A>0,this.updated||this.advanced?this.misses=Math.floor(b.misses*.6):this.misses=b.misses+1,this.availabilityDelay=b.availabilityDelay},O(P,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(X.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||W}},{key:"drift",get:function(){var b=this.driftEndTime-this.driftStartTime;if(b>0){var M=this.driftEnd-this.driftStart;return M*1e3/b}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var b;return(b=this.partList)!==null&&b!==void 0&&b.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var b;return(b=this.fragments)!==null&&b!==void 0&&b.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 b;return(b=this.partList)!==null&&b!==void 0&&b.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var b;return(b=this.partList)!==null&&b!==void 0&&b.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),P}()},"./src/loader/level-key.ts":function(ne,$,k){"use strict";k.r($),k.d($,"LevelKey",function(){return F});var X=k("./node_modules/url-toolkit/src/url-toolkit.js"),U=k.n(X);function O(P,w){for(var f=0;f<w.length;f++){var b=w[f];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(P,b.key,b)}}function W(P,w,f){return w&&O(P.prototype,w),f&&O(P,f),P}var F=function(){P.fromURL=function(f,b){return new P(f,b)},P.fromURI=function(f){return new P(f)};function P(w,f){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,f?this._uri=Object(X.buildAbsoluteURL)(w,f,{alwaysNormalize:!0}):this._uri=w}return W(P,[{key:"uri",get:function(){return this._uri}}]),P}()},"./src/loader/load-stats.ts":function(ne,$,k){"use strict";k.r($),k.d($,"LoadStats",function(){return X});var X=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return s});var X=k("./src/polyfills/number.ts"),U=k("./node_modules/url-toolkit/src/url-toolkit.js"),O=k.n(U),W=k("./src/loader/fragment.ts"),F=k("./src/loader/level-details.ts"),P=k("./src/loader/level-key.ts"),w=k("./src/utils/attr-list.ts"),f=k("./src/utils/logger.ts"),b=k("./src/utils/codecs.ts"),M=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,A=/#EXT-X-MEDIA:(.*)/g,S=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),T=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 a(D){var E,g;return d.test((E=(g=U.parseURL(D))===null||g===void 0?void 0:g.path)!=null?E:"")}var s=function(){function D(){}return D.findGroup=function(g,c){for(var h=0;h<g.length;h++){var o=g[h];if(o.id===c)return o}},D.convertAVC1ToAVCOTI=function(g){var c=g.split(".");if(c.length>2){var h=c.shift()+".";return h+=parseInt(c.shift()).toString(16),h+=("000"+parseInt(c.shift()).toString(16)).substr(-4),h}return g},D.resolve=function(g,c){return U.buildAbsoluteURL(c,g,{alwaysNormalize:!0})},D.parseMasterPlaylist=function(g,c){var h=[],o={},C=!1;M.lastIndex=0;for(var x;(x=M.exec(g))!=null;)if(x[1]){var v=new w.AttrList(x[1]),R={attrs:v,bitrate:v.decimalInteger("AVERAGE-BANDWIDTH")||v.decimalInteger("BANDWIDTH"),name:v.NAME,url:D.resolve(x[2],c)},B=v.decimalResolution("RESOLUTION");B&&(R.width=B.width,R.height=B.height),u((v.CODECS||"").split(/[ ,]+/).filter(function(K){return K}),R),R.videoCodec&&R.videoCodec.indexOf("avc1")!==-1&&(R.videoCodec=D.convertAVC1ToAVCOTI(R.videoCodec)),h.push(R)}else if(x[3]){var j=new w.AttrList(x[3]);j["DATA-ID"]&&(C=!0,o[j["DATA-ID"]]=j)}return{levels:h,sessionData:C?o:null}},D.parseMasterPlaylistMedia=function(g,c,h,o){o===void 0&&(o=[]);var C,x=[],v=0;for(A.lastIndex=0;(C=A.exec(g))!==null;){var R=new w.AttrList(C[1]);if(R.TYPE===h){var B={attrs:R,bitrate:0,id:v++,groupId:R["GROUP-ID"],instreamId:R["INSTREAM-ID"],name:R.NAME||R.LANGUAGE||"",type:h,default:R.bool("DEFAULT"),autoselect:R.bool("AUTOSELECT"),forced:R.bool("FORCED"),lang:R.LANGUAGE,url:R.URI?D.resolve(R.URI,c):""};if(o.length){var j=D.findGroup(o,B.groupId)||o[0];_(B,j,"audioCodec"),_(B,j,"textCodec")}x.push(B)}}return x},D.parseLevelPlaylist=function(g,c,h,o,C){var x=new F.LevelDetails(c),v=x.fragments,R=null,B=0,j=0,K=0,I=0,N=null,Y=new W.Fragment(o,c),q,ae,he,_e=-1,be=!1;for(S.lastIndex=0,x.m3u8=g;(q=S.exec(g))!==null;){be&&(be=!1,Y=new W.Fragment(o,c),Y.start=K,Y.sn=B,Y.cc=I,Y.level=h,R&&(Y.initSegment=R,Y.rawProgramDateTime=R.rawProgramDateTime));var Ce=q[1];if(Ce){Y.duration=parseFloat(Ce);var Te=(" "+q[2]).slice(1);Y.title=Te||null,Y.tagList.push(Te?["INF",Ce,Te]:["INF",Ce])}else if(q[3])Object(X.isFiniteNumber)(Y.duration)&&(Y.start=K,he&&(Y.levelkey=he),Y.sn=B,Y.level=h,Y.cc=I,Y.urlId=C,v.push(Y),Y.relurl=(" "+q[3]).slice(1),p(Y,N),N=Y,K+=Y.duration,B++,j=0,be=!0);else if(q[4]){var Ee=(" "+q[4]).slice(1);N?Y.setByteRange(Ee,N):Y.setByteRange(Ee)}else if(q[5])Y.rawProgramDateTime=(" "+q[5]).slice(1),Y.tagList.push(["PROGRAM-DATE-TIME",Y.rawProgramDateTime]),_e===-1&&(_e=v.length);else{if(q=q[0].match(T),!q){f.logger.warn("No matches on slow regex match for level playlist!");continue}for(ae=1;ae<q.length&&!(typeof q[ae]!="undefined");ae++);var me=(" "+q[ae]).slice(1),ue=(" "+q[ae+1]).slice(1),te=q[ae+2]?(" "+q[ae+2]).slice(1):"";switch(me){case"PLAYLIST-TYPE":x.type=ue.toUpperCase();break;case"MEDIA-SEQUENCE":B=x.startSN=parseInt(ue);break;case"SKIP":{var ce=new w.AttrList(ue),se=ce.decimalInteger("SKIPPED-SEGMENTS");if(Object(X.isFiniteNumber)(se)){x.skippedSegments=se;for(var we=se;we--;)v.unshift(null);B+=se}var Le=ce.enumeratedString("RECENTLY-REMOVED-DATERANGES");Le&&(x.recentlyRemovedDateranges=Le.split(" "));break}case"TARGETDURATION":x.targetduration=parseFloat(ue);break;case"VERSION":x.version=parseInt(ue);break;case"EXTM3U":break;case"ENDLIST":x.live=!1;break;case"#":(ue||te)&&Y.tagList.push(te?[ue,te]:[ue]);break;case"DIS":I++;case"GAP":Y.tagList.push([me]);break;case"BITRATE":Y.tagList.push([me,ue]);break;case"DISCONTINUITY-SEQ":I=parseInt(ue);break;case"KEY":{var xe,Pe=new w.AttrList(ue),Ne=Pe.enumeratedString("METHOD"),Be=Pe.URI,We=Pe.hexadecimalInteger("IV"),Ue=Pe.enumeratedString("KEYFORMATVERSIONS"),Fe=Pe.enumeratedString("KEYID"),at=(xe=Pe.enumeratedString("KEYFORMAT"))!=null?xe:"identity",it=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(it.indexOf(at)>-1){f.logger.warn("Keyformat "+at+" is not supported from the manifest");continue}else if(at!=="identity")continue;Ne&&(he=P.LevelKey.fromURL(c,Be),Be&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Ne)>=0&&(he.method=Ne,he.keyFormat=at,Fe&&(he.keyID=Fe),Ue&&(he.keyFormatVersions=Ue),he.iv=We));break}case"START":{var et=new w.AttrList(ue),Ze=et.decimalFloatingPoint("TIME-OFFSET");Object(X.isFiniteNumber)(Ze)&&(x.startTimeOffset=Ze);break}case"MAP":{var ut=new w.AttrList(ue);Y.relurl=ut.URI,ut.BYTERANGE&&Y.setByteRange(ut.BYTERANGE),Y.level=h,Y.sn="initSegment",he&&(Y.levelkey=he),Y.initSegment=null,R=Y,be=!0;break}case"SERVER-CONTROL":{var Je=new w.AttrList(ue);x.canBlockReload=Je.bool("CAN-BLOCK-RELOAD"),x.canSkipUntil=Je.optionalFloat("CAN-SKIP-UNTIL",0),x.canSkipDateRanges=x.canSkipUntil>0&&Je.bool("CAN-SKIP-DATERANGES"),x.partHoldBack=Je.optionalFloat("PART-HOLD-BACK",0),x.holdBack=Je.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var st=new w.AttrList(ue);x.partTarget=st.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Re=x.partList;Re||(Re=x.partList=[]);var nt=j>0?Re[Re.length-1]:void 0,qe=j++,Ie=new W.Part(new w.AttrList(ue),Y,c,qe,nt);Re.push(Ie),Y.duration+=Ie.duration;break}case"PRELOAD-HINT":{var He=new w.AttrList(ue);x.preloadHint=He;break}case"RENDITION-REPORT":{var Se=new w.AttrList(ue);x.renditionReports=x.renditionReports||[],x.renditionReports.push(Se);break}default:f.logger.warn("line parsed but not handled: "+q);break}}}N&&!N.relurl?(v.pop(),K-=N.duration,x.partList&&(x.fragmentHint=N)):x.partList&&(p(Y,N),Y.cc=I,x.fragmentHint=Y);var pe=v.length,ye=v[0],re=v[pe-1];if(K+=x.skippedSegments*x.targetduration,K>0&&pe&&re){x.averagetargetduration=K/pe;var oe=re.sn;x.endSN=oe!=="initSegment"?oe:0,ye&&(x.startCC=ye.cc,ye.initSegment||x.fragments.every(function(le){return le.relurl&&a(le.relurl)})&&(f.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),Y=new W.Fragment(o,c),Y.relurl=re.relurl,Y.level=h,Y.sn="initSegment",ye.initSegment=Y,x.needSidxRanges=!0))}else x.endSN=0,x.startCC=0;return x.fragmentHint&&(K+=x.fragmentHint.duration),x.totalduration=K,x.endCC=I,_e>0&&m(v,_e),x},D}();function u(D,E){["video","audio","text"].forEach(function(g){var c=D.filter(function(o){return Object(b.isCodecType)(o,g)});if(c.length){var h=c.filter(function(o){return o.lastIndexOf("avc1",0)===0||o.lastIndexOf("mp4a",0)===0});E[g+"Codec"]=h.length>0?h[0]:c[0],D=D.filter(function(o){return c.indexOf(o)===-1})}}),E.unknownCodecs=D}function _(D,E,g){var c=E[g];c&&(D[g]=c)}function m(D,E){for(var g=D[E],c=E;c--;){var h=D[c];if(!h)return;h.programDateTime=g.programDateTime-h.duration*1e3,g=h}}function p(D,E){D.rawProgramDateTime?D.programDateTime=Date.parse(D.rawProgramDateTime):E!=null&&E.programDateTime&&(D.programDateTime=E.endProgramDateTime),Object(X.isFiniteNumber)(D.programDateTime)||(D.programDateTime=null,D.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ne,$,k){"use strict";k.r($);var X=k("./src/polyfills/number.ts"),U=k("./src/events.ts"),O=k("./src/errors.ts"),W=k("./src/utils/logger.ts"),F=k("./src/utils/mp4-tools.ts"),P=k("./src/loader/m3u8-parser.ts"),w=k("./src/types/loader.ts"),f=k("./src/utils/attr-list.ts");function b(S){var T=S.type;switch(T){case w.PlaylistContextType.AUDIO_TRACK:return w.PlaylistLevelType.AUDIO;case w.PlaylistContextType.SUBTITLE_TRACK:return w.PlaylistLevelType.SUBTITLE;default:return w.PlaylistLevelType.MAIN}}function M(S,T){var d=S.url;return(d===void 0||d.indexOf("data:")===0)&&(d=T.url),d}var A=function(){function S(d){this.hls=void 0,this.loaders=Object.create(null),this.hls=d,this.registerListeners()}var T=S.prototype;return T.registerListeners=function(){var a=this.hls;a.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(U.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.on(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},T.unregisterListeners=function(){var a=this.hls;a.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(U.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.off(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},T.createInternalLoader=function(a){var s=this.hls.config,u=s.pLoader,_=s.loader,m=u||_,p=new m(s);return a.loader=p,this.loaders[a.type]=p,p},T.getInternalLoader=function(a){return this.loaders[a.type]},T.resetInternalLoader=function(a){this.loaders[a]&&delete this.loaders[a]},T.destroyInternalLoaders=function(){for(var a in this.loaders){var s=this.loaders[a];s&&s.destroy(),this.resetInternalLoader(a)}},T.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},T.onManifestLoading=function(a,s){var u=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:w.PlaylistContextType.MANIFEST,url:u,deliveryDirectives:null})},T.onLevelLoading=function(a,s){var u=s.id,_=s.level,m=s.url,p=s.deliveryDirectives;this.load({id:u,groupId:null,level:_,responseType:"text",type:w.PlaylistContextType.LEVEL,url:m,deliveryDirectives:p})},T.onAudioTrackLoading=function(a,s){var u=s.id,_=s.groupId,m=s.url,p=s.deliveryDirectives;this.load({id:u,groupId:_,level:null,responseType:"text",type:w.PlaylistContextType.AUDIO_TRACK,url:m,deliveryDirectives:p})},T.onSubtitleTrackLoading=function(a,s){var u=s.id,_=s.groupId,m=s.url,p=s.deliveryDirectives;this.load({id:u,groupId:_,level:null,responseType:"text",type:w.PlaylistContextType.SUBTITLE_TRACK,url:m,deliveryDirectives:p})},T.load=function(a){var s,u=this.hls.config,_=this.getInternalLoader(a);if(_){var m=_.context;if(m&&m.url===a.url){W.logger.trace("[playlist-loader]: playlist request ongoing");return}W.logger.log("[playlist-loader]: aborting previous loader for type: "+a.type),_.abort()}var p,D,E,g;switch(a.type){case w.PlaylistContextType.MANIFEST:p=u.manifestLoadingMaxRetry,D=u.manifestLoadingTimeOut,E=u.manifestLoadingRetryDelay,g=u.manifestLoadingMaxRetryTimeout;break;case w.PlaylistContextType.LEVEL:case w.PlaylistContextType.AUDIO_TRACK:case w.PlaylistContextType.SUBTITLE_TRACK:p=0,D=u.levelLoadingTimeOut;break;default:p=u.levelLoadingMaxRetry,D=u.levelLoadingTimeOut,E=u.levelLoadingRetryDelay,g=u.levelLoadingMaxRetryTimeout;break}if(_=this.createInternalLoader(a),(s=a.deliveryDirectives)!==null&&s!==void 0&&s.part){var c;if(a.type===w.PlaylistContextType.LEVEL&&a.level!==null?c=this.hls.levels[a.level].details:a.type===w.PlaylistContextType.AUDIO_TRACK&&a.id!==null?c=this.hls.audioTracks[a.id].details:a.type===w.PlaylistContextType.SUBTITLE_TRACK&&a.id!==null&&(c=this.hls.subtitleTracks[a.id].details),c){var h=c.partTarget,o=c.targetduration;h&&o&&(D=Math.min(Math.max(h*3,o*.8)*1e3,D))}}var C={timeout:D,maxRetry:p,retryDelay:E,maxRetryDelay:g,highWaterMark:0},x={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};_.load(a,C,x)},T.loadsuccess=function(a,s,u,_){if(_===void 0&&(_=null),u.isSidxRequest){this.handleSidxRequest(a,u),this.handlePlaylistLoaded(a,s,u,_);return}this.resetInternalLoader(u.type);var m=a.data;if(m.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(a,u,"no EXTM3U delimiter",_);return}s.parsing.start=performance.now(),m.indexOf("#EXTINF:")>0||m.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(a,s,u,_):this.handleMasterPlaylist(a,s,u,_)},T.loaderror=function(a,s,u){u===void 0&&(u=null),this.handleNetworkError(s,u,!1,a)},T.loadtimeout=function(a,s,u){u===void 0&&(u=null),this.handleNetworkError(s,u,!0)},T.handleMasterPlaylist=function(a,s,u,_){var m=this.hls,p=a.data,D=M(a,u),E=P.default.parseMasterPlaylist(p,D),g=E.levels,c=E.sessionData;if(!g.length){this.handleManifestParsingError(a,u,"no level found in manifest",_);return}var h=g.map(function(B){return{id:B.attrs.AUDIO,audioCodec:B.audioCodec}}),o=g.map(function(B){return{id:B.attrs.SUBTITLES,textCodec:B.textCodec}}),C=P.default.parseMasterPlaylistMedia(p,D,"AUDIO",h),x=P.default.parseMasterPlaylistMedia(p,D,"SUBTITLES",o),v=P.default.parseMasterPlaylistMedia(p,D,"CLOSED-CAPTIONS");if(C.length){var R=C.some(function(B){return!B.url});!R&&g[0].audioCodec&&!g[0].attrs.AUDIO&&(W.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),C.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new f.AttrList({}),bitrate:0,url:""}))}m.trigger(U.Events.MANIFEST_LOADED,{levels:g,audioTracks:C,subtitles:x,captions:v,url:D,stats:s,networkDetails:_,sessionData:c})},T.handleTrackOrLevelPlaylist=function(a,s,u,_){var m=this.hls,p=u.id,D=u.level,E=u.type,g=M(a,u),c=Object(X.isFiniteNumber)(p)?p:0,h=Object(X.isFiniteNumber)(D)?D:c,o=b(u),C=P.default.parseLevelPlaylist(a.data,g,h,o,c);if(!C.fragments.length){m.trigger(U.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:g,reason:"no fragments found in level",level:typeof u.level=="number"?u.level:void 0});return}if(E===w.PlaylistContextType.MANIFEST){var x={attrs:new f.AttrList({}),bitrate:0,details:C,name:"",url:g};m.trigger(U.Events.MANIFEST_LOADED,{levels:[x],audioTracks:[],url:g,stats:s,networkDetails:_,sessionData:null})}if(s.parsing.end=performance.now(),C.needSidxRanges){var v,R=(v=C.fragments[0].initSegment)===null||v===void 0?void 0:v.url;this.load({url:R,isSidxRequest:!0,type:E,level:D,levelDetails:C,id:p,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}u.levelDetails=C,this.handlePlaylistLoaded(a,s,u,_)},T.handleSidxRequest=function(a,s){var u=Object(F.parseSegmentIndex)(new Uint8Array(a.data));if(!u)return;var _=u.references,m=s.levelDetails;_.forEach(function(p,D){var E=p.info,g=m.fragments[D];g.byteRange.length===0&&g.setByteRange(String(1+E.end-E.start)+"@"+String(E.start)),g.initSegment&&g.initSegment.setByteRange(String(u.moovEndOffset)+"@0")})},T.handleManifestParsingError=function(a,s,u,_){this.hls.trigger(U.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===w.PlaylistContextType.MANIFEST,url:a.url,reason:u,response:a,context:s,networkDetails:_})},T.handleNetworkError=function(a,s,u,_){u===void 0&&(u=!1),W.logger.warn("[playlist-loader]: A network "+(u?"timeout":"error")+" occurred while loading "+a.type+" level: "+a.level+" id: "+a.id+' group-id: "'+a.groupId+'"');var m=O.ErrorDetails.UNKNOWN,p=!1,D=this.getInternalLoader(a);switch(a.type){case w.PlaylistContextType.MANIFEST:m=u?O.ErrorDetails.MANIFEST_LOAD_TIMEOUT:O.ErrorDetails.MANIFEST_LOAD_ERROR,p=!0;break;case w.PlaylistContextType.LEVEL:m=u?O.ErrorDetails.LEVEL_LOAD_TIMEOUT:O.ErrorDetails.LEVEL_LOAD_ERROR,p=!1;break;case w.PlaylistContextType.AUDIO_TRACK:m=u?O.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:O.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,p=!1;break;case w.PlaylistContextType.SUBTITLE_TRACK:m=u?O.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:O.ErrorDetails.SUBTITLE_LOAD_ERROR,p=!1;break}D&&this.resetInternalLoader(a.type);var E={type:O.ErrorTypes.NETWORK_ERROR,details:m,fatal:p,url:a.url,loader:D,context:a,networkDetails:s};_&&(E.response=_),this.hls.trigger(U.Events.ERROR,E)},T.handlePlaylistLoaded=function(a,s,u,_){var m=u.type,p=u.level,D=u.id,E=u.groupId,g=u.loader,c=u.levelDetails,h=u.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(a,u,"invalid target duration",_);return}if(!g)return;c.live&&(g.getCacheAge&&(c.ageHeader=g.getCacheAge()||0),(!g.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(m){case w.PlaylistContextType.MANIFEST:case w.PlaylistContextType.LEVEL:this.hls.trigger(U.Events.LEVEL_LOADED,{details:c,level:p||0,id:D||0,stats:s,networkDetails:_,deliveryDirectives:h});break;case w.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(U.Events.AUDIO_TRACK_LOADED,{details:c,id:D||0,groupId:E||"",stats:s,networkDetails:_,deliveryDirectives:h});break;case w.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(U.Events.SUBTITLE_TRACK_LOADED,{details:c,id:D||0,groupId:E||"",stats:s,networkDetails:_,deliveryDirectives:h});break}},S}();$.default=A},"./src/polyfills/number.ts":function(ne,$,k){"use strict";k.r($),k.d($,"isFiniteNumber",function(){return X}),k.d($,"MAX_SAFE_INTEGER",function(){return U});var X=Number.isFinite||function(O){return typeof O=="number"&&isFinite(O)},U=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ne,$,k){"use strict";k.r($);var X=function(){function U(){}return U.getSilentFrame=function(W,F){switch(W){case"mp4a.40.2":if(F===1)return new Uint8Array([0,200,0,128,35,128]);if(F===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(F===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(F===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(F===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(F===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(F===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(F===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(F===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},U}();$.default=X},"./src/remux/mp4-generator.ts":function(ne,$,k){"use strict";k.r($);var X=Math.pow(2,32)-1,U=function(){function O(){}return O.init=function(){O.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 F;for(F in O.types)O.types.hasOwnProperty(F)&&(O.types[F]=[F.charCodeAt(0),F.charCodeAt(1),F.charCodeAt(2),F.charCodeAt(3)]);var P=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),w=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]);O.HDLR_TYPES={video:P,audio:w};var f=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),b=new Uint8Array([0,0,0,0,0,0,0,0]);O.STTS=O.STSC=O.STCO=b,O.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),O.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),O.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),O.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var M=new Uint8Array([105,115,111,109]),A=new Uint8Array([97,118,99,49]),S=new Uint8Array([0,0,0,1]);O.FTYP=O.box(O.types.ftyp,M,S,M,A),O.DINF=O.box(O.types.dinf,O.box(O.types.dref,f))},O.box=function(F){for(var P=8,w=arguments.length,f=new Array(w>1?w-1:0),b=1;b<w;b++)f[b-1]=arguments[b];for(var M=f.length,A=M;M--;)P+=f[M].byteLength;var S=new Uint8Array(P);for(S[0]=P>>24&255,S[1]=P>>16&255,S[2]=P>>8&255,S[3]=P&255,S.set(F,4),M=0,P=8;M<A;M++)S.set(f[M],P),P+=f[M].byteLength;return S},O.hdlr=function(F){return O.box(O.types.hdlr,O.HDLR_TYPES[F])},O.mdat=function(F){return O.box(O.types.mdat,F)},O.mdhd=function(F,P){P*=F;var w=Math.floor(P/(X+1)),f=Math.floor(P%(X+1));return O.box(O.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,F>>24&255,F>>16&255,F>>8&255,F&255,w>>24,w>>16&255,w>>8&255,w&255,f>>24,f>>16&255,f>>8&255,f&255,85,196,0,0]))},O.mdia=function(F){return O.box(O.types.mdia,O.mdhd(F.timescale,F.duration),O.hdlr(F.type),O.minf(F))},O.mfhd=function(F){return O.box(O.types.mfhd,new Uint8Array([0,0,0,0,F>>24,F>>16&255,F>>8&255,F&255]))},O.minf=function(F){return F.type==="audio"?O.box(O.types.minf,O.box(O.types.smhd,O.SMHD),O.DINF,O.stbl(F)):O.box(O.types.minf,O.box(O.types.vmhd,O.VMHD),O.DINF,O.stbl(F))},O.moof=function(F,P,w){return O.box(O.types.moof,O.mfhd(F),O.traf(w,P))},O.moov=function(F){for(var P=F.length,w=[];P--;)w[P]=O.trak(F[P]);return O.box.apply(null,[O.types.moov,O.mvhd(F[0].timescale,F[0].duration)].concat(w).concat(O.mvex(F)))},O.mvex=function(F){for(var P=F.length,w=[];P--;)w[P]=O.trex(F[P]);return O.box.apply(null,[O.types.mvex].concat(w))},O.mvhd=function(F,P){P*=F;var w=Math.floor(P/(X+1)),f=Math.floor(P%(X+1)),b=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,F>>24&255,F>>16&255,F>>8&255,F&255,w>>24,w>>16&255,w>>8&255,w&255,f>>24,f>>16&255,f>>8&255,f&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 O.box(O.types.mvhd,b)},O.sdtp=function(F){var P=F.samples||[],w=new Uint8Array(4+P.length),f,b;for(f=0;f<P.length;f++)b=P[f].flags,w[f+4]=b.dependsOn<<4|b.isDependedOn<<2|b.hasRedundancy;return O.box(O.types.sdtp,w)},O.stbl=function(F){return O.box(O.types.stbl,O.stsd(F),O.box(O.types.stts,O.STTS),O.box(O.types.stsc,O.STSC),O.box(O.types.stsz,O.STSZ),O.box(O.types.stco,O.STCO))},O.avc1=function(F){var P=[],w=[],f,b,M;for(f=0;f<F.sps.length;f++)b=F.sps[f],M=b.byteLength,P.push(M>>>8&255),P.push(M&255),P=P.concat(Array.prototype.slice.call(b));for(f=0;f<F.pps.length;f++)b=F.pps[f],M=b.byteLength,w.push(M>>>8&255),w.push(M&255),w=w.concat(Array.prototype.slice.call(b));var A=O.box(O.types.avcC,new Uint8Array([1,P[3],P[4],P[5],252|3,224|F.sps.length].concat(P).concat([F.pps.length]).concat(w))),S=F.width,T=F.height,d=F.pixelRatio[0],a=F.pixelRatio[1];return O.box(O.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,S>>8&255,S&255,T>>8&255,T&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]),A,O.box(O.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),O.box(O.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,a>>24,a>>16&255,a>>8&255,a&255])))},O.esds=function(F){var P=F.config.length;return new Uint8Array([0,0,0,0,3,23+P,0,1,0,4,15+P,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([P]).concat(F.config).concat([6,1,2]))},O.mp4a=function(F){var P=F.samplerate;return O.box(O.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,F.channelCount,0,16,0,0,0,0,P>>8&255,P&255,0,0]),O.box(O.types.esds,O.esds(F)))},O.mp3=function(F){var P=F.samplerate;return O.box(O.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,F.channelCount,0,16,0,0,0,0,P>>8&255,P&255,0,0]))},O.stsd=function(F){return F.type==="audio"?!F.isAAC&&F.codec==="mp3"?O.box(O.types.stsd,O.STSD,O.mp3(F)):O.box(O.types.stsd,O.STSD,O.mp4a(F)):O.box(O.types.stsd,O.STSD,O.avc1(F))},O.tkhd=function(F){var P=F.id,w=F.duration*F.timescale,f=F.width,b=F.height,M=Math.floor(w/(X+1)),A=Math.floor(w%(X+1));return O.box(O.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,P>>24&255,P>>16&255,P>>8&255,P&255,0,0,0,0,M>>24,M>>16&255,M>>8&255,M&255,A>>24,A>>16&255,A>>8&255,A&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,f>>8&255,f&255,0,0,b>>8&255,b&255,0,0]))},O.traf=function(F,P){var w=O.sdtp(F),f=F.id,b=Math.floor(P/(X+1)),M=Math.floor(P%(X+1));return O.box(O.types.traf,O.box(O.types.tfhd,new Uint8Array([0,0,0,0,f>>24,f>>16&255,f>>8&255,f&255])),O.box(O.types.tfdt,new Uint8Array([1,0,0,0,b>>24,b>>16&255,b>>8&255,b&255,M>>24,M>>16&255,M>>8&255,M&255])),O.trun(F,w.length+16+20+8+16+8+8),w)},O.trak=function(F){return F.duration=F.duration||4294967295,O.box(O.types.trak,O.tkhd(F),O.mdia(F))},O.trex=function(F){var P=F.id;return O.box(O.types.trex,new Uint8Array([0,0,0,0,P>>24,P>>16&255,P>>8&255,P&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},O.trun=function(F,P){var w=F.samples||[],f=w.length,b=12+16*f,M=new Uint8Array(b),A,S,T,d,a,s;for(P+=8+b,M.set([0,0,15,1,f>>>24&255,f>>>16&255,f>>>8&255,f&255,P>>>24&255,P>>>16&255,P>>>8&255,P&255],0),A=0;A<f;A++)S=w[A],T=S.duration,d=S.size,a=S.flags,s=S.cts,M.set([T>>>24&255,T>>>16&255,T>>>8&255,T&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.paddingValue<<1|a.isNonSync,a.degradPrio&240<<8,a.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*A);return O.box(O.types.trun,M)},O.initSegment=function(F){O.types||O.init();var P=O.moov(F),w=new Uint8Array(O.FTYP.byteLength+P.byteLength);return w.set(O.FTYP),w.set(P,O.FTYP.byteLength),w},O}();U.types=void 0,U.HDLR_TYPES=void 0,U.STTS=void 0,U.STSC=void 0,U.STCO=void 0,U.STSZ=void 0,U.VMHD=void 0,U.SMHD=void 0,U.STSD=void 0,U.FTYP=void 0,U.DINF=void 0,$.default=U},"./src/remux/mp4-remuxer.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return s}),k.d($,"normalizePts",function(){return u});var X=k("./src/polyfills/number.ts"),U=k("./src/remux/aac-helper.ts"),O=k("./src/remux/mp4-generator.ts"),W=k("./src/events.ts"),F=k("./src/errors.ts"),P=k("./src/utils/logger.ts"),w=k("./src/types/loader.ts"),f=k("./src/utils/timescale-conversion.ts");function b(){return b=Object.assign||function(D){for(var E=1;E<arguments.length;E++){var g=arguments[E];for(var c in g)Object.prototype.hasOwnProperty.call(g,c)&&(D[c]=g[c])}return D},b.apply(this,arguments)}var M=10*1e3,A=1024,S=1152,T=null,d=null,a=!1,s=function(){function D(g,c,h,o){if(o===void 0&&(o=""),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=g,this.config=c,this.typeSupported=h,this.ISGenerated=!1,T===null){var C=navigator.userAgent||"",x=C.match(/Chrome\/(\d+)/i);T=x?parseInt(x[1]):0}if(d===null){var v=navigator.userAgent.match(/Safari\/(\d+)/i);d=v?parseInt(v[1]):0}a=!!T&&T<75||!!d&&d<600}var E=D.prototype;return E.destroy=function(){},E.resetTimeStamp=function(c){P.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},E.resetNextTimestamp=function(){P.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},E.resetInitSegment=function(){P.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},E.getVideoStartPts=function(c){var h=!1,o=c.reduce(function(C,x){var v=x.pts-C;return v<-4294967296?(h=!0,u(C,x.pts)):v>0?C:x.pts},c[0].pts);return h&&P.logger.debug("PTS rollover detected"),o},E.remux=function(c,h,o,C,x,v,R,B){var j,K,I,N,Y,q,ae=x,he=x,_e=c.pid>-1,be=h.pid>-1,Ce=h.samples.length,Te=c.samples.length>0,Ee=Ce>1,me=(!_e||Te)&&(!be||Ee)||this.ISGenerated||R;if(me){this.ISGenerated||(I=this.generateIS(c,h,x));var ue=this.isVideoContiguous,te=-1;if(Ee&&(te=_(h.samples),!ue&&this.config.forceKeyFrameOnDiscontinuity))if(q=!0,te>0){P.logger.warn("[mp4-remuxer]: Dropped "+te+" out of "+Ce+" video samples due to a missing keyframe");var ce=this.getVideoStartPts(h.samples);h.samples=h.samples.slice(te),h.dropped+=te,he+=(h.samples[0].pts-ce)/(h.timescale||9e4)}else te===-1&&(P.logger.warn("[mp4-remuxer]: No keyframe found out of "+Ce+" video samples"),q=!1);if(this.ISGenerated){if(Te&&Ee){var se=this.getVideoStartPts(h.samples),we=u(c.samples[0].pts,se)-se,Le=we/h.inputTimeScale;ae+=Math.max(0,Le),he+=Math.max(0,-Le)}if(Te){if(c.samplerate||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),I=this.generateIS(c,h,x)),K=this.remuxAudio(c,ae,this.isAudioContiguous,v,be||Ee||B===w.PlaylistLevelType.AUDIO?he:void 0),Ee){var xe=K?K.endPTS-K.startPTS:0;h.inputTimeScale||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),I=this.generateIS(c,h,x)),j=this.remuxVideo(h,he,ue,xe)}}else Ee&&(j=this.remuxVideo(h,he,ue,0));j&&(j.firstKeyFrame=te,j.independent=te!==-1)}}return this.ISGenerated&&(o.samples.length&&(Y=this.remuxID3(o,x)),C.samples.length&&(N=this.remuxText(C,x))),{audio:K,video:j,initSegment:I,independent:q,text:N,id3:Y}},E.generateIS=function(c,h,o){var C=c.samples,x=h.samples,v=this.typeSupported,R={},B=!Object(X.isFiniteNumber)(this._initPTS),j="audio/mp4",K,I,N;if(B&&(K=I=Infinity),c.config&&C.length&&(c.timescale=c.samplerate,c.isAAC||(v.mpeg?(j="audio/mpeg",c.codec=""):v.mp3&&(c.codec="mp3")),R.audio={id:"audio",container:j,codec:c.codec,initSegment:!c.isAAC&&v.mpeg?new Uint8Array(0):O.default.initSegment([c]),metadata:{channelCount:c.channelCount}},B&&(N=c.inputTimeScale,K=I=C[0].pts-Math.round(N*o))),h.sps&&h.pps&&x.length&&(h.timescale=h.inputTimeScale,R.video={id:"main",container:"video/mp4",codec:h.codec,initSegment:O.default.initSegment([h]),metadata:{width:h.width,height:h.height}},B)){N=h.inputTimeScale;var Y=this.getVideoStartPts(x),q=Math.round(N*o);I=Math.min(I,u(x[0].dts,Y)-q),K=Math.min(K,Y-q)}if(Object.keys(R).length)return this.ISGenerated=!0,B&&(this._initPTS=K,this._initDTS=I),{tracks:R,initPTS:K,timescale:N}},E.remuxVideo=function(c,h,o,C){var x=c.inputTimeScale,v=c.samples,R=[],B=v.length,j=this._initPTS,K=this.nextAvcDts,I=8,N,Y,q,ae=Number.POSITIVE_INFINITY,he=Number.NEGATIVE_INFINITY,_e=0,be=!1;if(!o||K===null){var Ce=h*x,Te=v[0].pts-u(v[0].dts,v[0].pts);K=Ce-Te}for(var Ee=0;Ee<B;Ee++){var me=v[Ee];if(me.pts=u(me.pts-j,K),me.dts=u(me.dts-j,K),me.dts>me.pts){var ue=9e4*.2;_e=Math.max(Math.min(_e,me.pts-me.dts),-1*ue)}me.dts<v[Ee>0?Ee-1:Ee].dts&&(be=!0)}be&&v.sort(function(xt,mt){var ot=xt.dts-mt.dts,Rt=xt.pts-mt.pts;return ot||Rt}),Y=v[0].dts,q=v[v.length-1].dts;var te=Math.round((q-Y)/(B-1));if(_e<0){if(_e<te*-2){P.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(f.toMsFromMpegTsClock)(-te,!0)+" ms");for(var ce=_e,se=0;se<B;se++)v[se].dts=ce=Math.max(ce,v[se].pts-te),v[se].pts=Math.max(ce,v[se].pts)}else{P.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(f.toMsFromMpegTsClock)(_e,!0)+" ms to overcome this issue");for(var we=0;we<B;we++)v[we].dts=v[we].dts+_e}Y=v[0].dts}if(o){var Le=Y-K,xe=Le>te,Pe=Le<-1;if(xe||Pe){xe?P.logger.warn("AVC: "+Object(f.toMsFromMpegTsClock)(Le,!0)+" ms ("+Le+"dts) hole between fragments detected, filling it"):P.logger.warn("AVC: "+Object(f.toMsFromMpegTsClock)(-Le,!0)+" ms ("+Le+"dts) overlapping between fragments detected"),Y=K;var Ne=v[0].pts-Le;v[0].dts=Y,v[0].pts=Ne,P.logger.log("Video: First PTS/DTS adjusted: "+Object(f.toMsFromMpegTsClock)(Ne,!0)+"/"+Object(f.toMsFromMpegTsClock)(Y,!0)+", delta: "+Object(f.toMsFromMpegTsClock)(Le,!0)+" ms")}}a&&(Y=Math.max(0,Y));for(var Be=0,We=0,Ue=0;Ue<B;Ue++){for(var Fe=v[Ue],at=Fe.units,it=at.length,et=0,Ze=0;Ze<it;Ze++)et+=at[Ze].data.length;We+=et,Be+=it,Fe.length=et,Fe.dts=Math.max(Fe.dts,Y),Fe.pts=Math.max(Fe.pts,Fe.dts,0),ae=Math.min(Fe.pts,ae),he=Math.max(Fe.pts,he)}q=v[B-1].dts;var ut=We+4*Be+8,Je;try{Je=new Uint8Array(ut)}catch(xt){this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:F.ErrorTypes.MUX_ERROR,details:F.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ut,reason:"fail allocating video mdat "+ut});return}var st=new DataView(Je.buffer);st.setUint32(0,ut),Je.set(O.default.types.mdat,4);for(var Re=0;Re<B;Re++){for(var nt=v[Re],qe=nt.units,Ie=0,He=0,Se=qe.length;He<Se;He++){var pe=qe[He],ye=pe.data,re=pe.data.byteLength;st.setUint32(I,re),I+=4,Je.set(ye,I),I+=re,Ie+=4+re}if(Re<B-1)N=v[Re+1].dts-nt.dts;else{var oe=this.config,le=nt.dts-v[Re>0?Re-1:Re].dts;if(oe.stretchShortVideoTrack&&this.nextAudioPts!==null){var de=Math.floor(oe.maxBufferHole*x),De=(C?ae+C*x:this.nextAudioPts)-nt.pts;De>de?(N=De-le,N<0&&(N=le),P.logger.log("[mp4-remuxer]: It is approximately "+De/90+" ms to the next segment; using duration "+N/90+" ms for the last video frame.")):N=le}else N=le}var Me=Math.round(nt.pts-nt.dts);R.push(new m(nt.key,N,Ie,Me))}if(R.length&&T&&T<70){var Ye=R[0].flags;Ye.dependsOn=2,Ye.isNonSync=0}console.assert(N!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=K=q+N,this.isVideoContiguous=!0;var yt=O.default.moof(c.sequenceNumber++,Y,b({},c,{samples:R})),At="video",Ke={data1:yt,data2:Je,startPTS:ae/x,endPTS:(he+N)/x,startDTS:Y/x,endDTS:K/x,type:At,hasAudio:!1,hasVideo:!0,nb:R.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(Je.length,"MDAT length must not be zero"),Ke},E.remuxAudio=function(c,h,o,C,x){var v=c.inputTimeScale,R=c.samplerate?c.samplerate:v,B=v/R,j=c.isAAC?A:S,K=j*B,I=this._initPTS,N=!c.isAAC&&this.typeSupported.mpeg,Y=[],q=c.samples,ae=N?0:8,he=this.nextAudioPts||-1,_e=h*v;if(this.isAudioContiguous=o=o||q.length&&he>0&&(C&&Math.abs(_e-he)<9e3||Math.abs(u(q[0].pts-I,_e)-he)<20*K),q.forEach(function(ye){ye.pts=u(ye.pts-I,_e)}),!o||he<0){if(q=q.filter(function(ye){return ye.pts>=0}),!q.length)return;x===0?he=0:C?he=Math.max(0,_e):he=q[0].pts}if(c.isAAC)for(var be=x!==void 0,Ce=this.config.maxAudioFramesDrift,Te=0,Ee=he;Te<q.length;Te++){var me=q[Te],ue=me.pts,te=ue-Ee,ce=Math.abs(1e3*te/v);if(te<=-Ce*K&&be)Te===0&&(P.logger.warn("Audio frame @ "+(ue/v).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*te/v)+" ms."),this.nextAudioPts=he=Ee=ue);else if(te>=Ce*K&&ce<M&&be){var se=Math.round(te/K);Ee=ue-se*K,Ee<0&&(se--,Ee+=K),Te===0&&(this.nextAudioPts=he=Ee),P.logger.warn("[mp4-remuxer]: Injecting "+se+" audio frame @ "+(Ee/v).toFixed(3)+"s due to "+Math.round(1e3*te/v)+" ms gap.");for(var we=0;we<se;we++){var Le=Math.max(Ee,0),xe=U.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);xe||(P.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),xe=me.unit.subarray()),q.splice(Te,0,{unit:xe,pts:Le}),Ee+=K,Te++}}me.pts=Ee,Ee+=K}for(var Pe=null,Ne=null,Be,We=0,Ue=q.length;Ue--;)We+=q[Ue].unit.byteLength;for(var Fe=0,at=q.length;Fe<at;Fe++){var it=q[Fe],et=it.unit,Ze=it.pts;if(Ne!==null){var ut=Y[Fe-1];ut.duration=Math.round((Ze-Ne)/B)}else if(o&&c.isAAC&&(Ze=he),Pe=Ze,We>0){We+=ae;try{Be=new Uint8Array(We)}catch(ye){this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:F.ErrorTypes.MUX_ERROR,details:F.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:We,reason:"fail allocating audio mdat "+We});return}if(!N){var Je=new DataView(Be.buffer);Je.setUint32(0,We),Be.set(O.default.types.mdat,4)}}else return;Be.set(et,ae);var st=et.byteLength;ae+=st,Y.push(new m(!0,j,st,0)),Ne=Ze}var Re=Y.length;if(!Re)return;var nt=Y[Y.length-1];this.nextAudioPts=he=Ne+B*nt.duration;var qe=N?new Uint8Array(0):O.default.moof(c.sequenceNumber++,Pe/B,b({},c,{samples:Y}));c.samples=[];var Ie=Pe/v,He=he/v,Se="audio",pe={data1:qe,data2:Be,startPTS:Ie,endPTS:He,startDTS:Ie,endDTS:He,type:Se,hasAudio:!0,hasVideo:!1,nb:Re};return this.isAudioContiguous=!0,console.assert(Be.length,"MDAT length must not be zero"),pe},E.remuxEmptyAudio=function(c,h,o,C){var x=c.inputTimeScale,v=c.samplerate?c.samplerate:x,R=x/v,B=this.nextAudioPts,j=(B!==null?B:C.startDTS*x)+this._initDTS,K=C.endDTS*x+this._initDTS,I=R*A,N=Math.ceil((K-j)/I),Y=U.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(P.logger.warn("[mp4-remuxer]: remux empty Audio"),!Y){P.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var q=[],ae=0;ae<N;ae++){var he=j+ae*I;q.push({unit:Y,pts:he,dts:he})}return c.samples=q,this.remuxAudio(c,h,o,!1)},E.remuxID3=function(c,h){var o=c.samples.length;if(!o)return;for(var C=c.inputTimeScale,x=this._initPTS,v=this._initDTS,R=0;R<o;R++){var B=c.samples[R];B.pts=u(B.pts-x,h*C)/C,B.dts=u(B.dts-v,h*C)/C}var j=c.samples;return c.samples=[],{samples:j}},E.remuxText=function(c,h){var o=c.samples.length;if(!o)return;for(var C=c.inputTimeScale,x=this._initPTS,v=0;v<o;v++){var R=c.samples[v];R.pts=u(R.pts-x,h*C)/C}c.samples.sort(function(j,K){return j.pts-K.pts});var B=c.samples;return c.samples=[],{samples:B}},D}();function u(D,E){var g;if(E===null)return D;for(E<D?g=-8589934592:g=8589934592;Math.abs(D-E)>4294967296;)D+=g;return D}function _(D){for(var E=0;E<D.length;E++)if(D[E].key)return E;return-1}var m=function(E,g,c,h){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=g,this.size=c,this.cts=h,this.flags=new p(E)},p=function(E){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=E?2:1,this.isNonSync=E?0:1}},"./src/remux/passthrough-remuxer.ts":function(ne,$,k){"use strict";k.r($);var X=k("./src/polyfills/number.ts"),U=k("./src/utils/mp4-tools.ts"),O=k("./src/loader/fragment.ts"),W=k("./src/utils/logger.ts"),F=function(){function f(){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 b=f.prototype;return b.destroy=function(){},b.resetTimeStamp=function(A){this.initPTS=A,this.lastEndDTS=null},b.resetNextTimestamp=function(){this.lastEndDTS=null},b.resetInitSegment=function(A,S,T){this.audioCodec=S,this.videoCodec=T,this.generateInitSegment(A),this.emitInitSegment=!0},b.generateInitSegment=function(A){var S=this.audioCodec,T=this.videoCodec;if(!A||!A.byteLength){this.initTracks=void 0,this.initData=void 0;return}var d=this.initData=Object(U.parseInitSegment)(A);S||(S=w(d.audio,O.ElementaryStreamTypes.AUDIO)),T||(T=w(d.video,O.ElementaryStreamTypes.VIDEO));var a={};d.audio&&d.video?a.audiovideo={container:"video/mp4",codec:S+","+T,initSegment:A,id:"main"}:d.audio?a.audio={container:"audio/mp4",codec:S,initSegment:A,id:"audio"}:d.video?a.video={container:"video/mp4",codec:T,initSegment:A,id:"main"}:W.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a},b.remux=function(A,S,T,d,a){var s=this.initPTS,u=this.lastEndDTS,_={audio:void 0,video:void 0,text:d,id3:T,initSegment:void 0};Object(X.isFiniteNumber)(u)||(u=this.lastEndDTS=a||0);var m=S.samples;if(!m||!m.length)return _;var p={initPTS:void 0,timescale:1},D=this.initData;if((!D||!D.length)&&(this.generateInitSegment(m),D=this.initData),!D||!D.length)return W.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),_;this.emitInitSegment&&(p.tracks=this.initTracks,this.emitInitSegment=!1),Object(X.isFiniteNumber)(s)||(this.initPTS=p.initPTS=s=P(D,m,u));var E=Object(U.getDuration)(m,D),g=u,c=E+g;Object(U.offsetStartDTS)(D,m,s),E>0?this.lastEndDTS=c:(W.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var h=!!D.audio,o=!!D.video,C="";h&&(C+="audio"),o&&(C+="video");var x={data1:m,startPTS:g,startDTS:g,endPTS:c,endDTS:c,type:C,hasAudio:h,hasVideo:o,nb:1,dropped:0};return _.audio=x.type==="audio"?x:void 0,_.video=x.type!=="audio"?x:void 0,_.text=d,_.id3=T,_.initSegment=p,_},f}(),P=function(b,M,A){return Object(U.getStartDTS)(b,M)-A};function w(f,b){var M=f==null?void 0:f.codec;return M&&M.length>4?M:M==="hvc1"?"hvc1.1.c.L120.90":M==="av01"?"av01.0.04M.08":M==="avc1"||b===O.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}$.default=F},"./src/task-loop.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return X});var X=function(){function U(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var O=U.prototype;return O.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},O.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},O.onHandlerDestroyed=function(){},O.hasInterval=function(){return!!this._tickInterval},O.hasNextTick=function(){return!!this._tickTimer},O.setInterval=function(F){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,F),!0)},O.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},O.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},O.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},O.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},O.doTick=function(){},U}()},"./src/types/cmcd.ts":function(ne,$,k){"use strict";k.r($),k.d($,"CMCDVersion",function(){return X}),k.d($,"CMCDObjectType",function(){return U}),k.d($,"CMCDStreamingFormat",function(){return O}),k.d($,"CMCDStreamType",function(){return W});var X=1,U;(function(F){F.MANIFEST="m",F.AUDIO="a",F.VIDEO="v",F.MUXED="av",F.INIT="i",F.CAPTION="c",F.TIMED_TEXT="tt",F.KEY="k",F.OTHER="o"})(U||(U={}));var O;(function(F){F.DASH="d",F.HLS="h",F.SMOOTH="s",F.OTHER="o"})(O||(O={}));var W;(function(F){F.VOD="v",F.LIVE="l"})(W||(W={}))},"./src/types/level.ts":function(ne,$,k){"use strict";k.r($),k.d($,"HlsSkip",function(){return O}),k.d($,"getSkipValue",function(){return W}),k.d($,"HlsUrlParameters",function(){return F}),k.d($,"Level",function(){return P});function X(w,f){for(var b=0;b<f.length;b++){var M=f[b];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(w,M.key,M)}}function U(w,f,b){return f&&X(w.prototype,f),b&&X(w,b),w}var O;(function(w){w.No="",w.Yes="YES",w.v2="v2"})(O||(O={}));function W(w,f){var b=w.canSkipUntil,M=w.canSkipDateRanges,A=w.endSN,S=f!==void 0?f-A:0;return b&&S<b?M?O.v2:O.Yes:O.No}var F=function(){function w(b,M,A){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=b,this.part=M,this.skip=A}var f=w.prototype;return f.addDirectives=function(M){var A=new self.URL(M);return this.msn!==void 0&&A.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&A.searchParams.set("_HLS_part",this.part.toString()),this.skip&&A.searchParams.set("_HLS_skip",this.skip),A.toString()},w}(),P=function(){function w(f){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=[f.url],this.attrs=f.attrs,this.bitrate=f.bitrate,f.details&&(this.details=f.details),this.id=f.id||0,this.name=f.name,this.width=f.width||0,this.height=f.height||0,this.audioCodec=f.audioCodec,this.videoCodec=f.videoCodec,this.unknownCodecs=f.unknownCodecs,this.codecSet=[f.videoCodec,f.audioCodec].filter(function(b){return b}).join(",").replace(/\.[^.,]+/g,"")}return U(w,[{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(b){var M=b%this.url.length;this._urlId!==M&&(this.details=void 0,this._urlId=M)}}]),w}()},"./src/types/loader.ts":function(ne,$,k){"use strict";k.r($),k.d($,"PlaylistContextType",function(){return X}),k.d($,"PlaylistLevelType",function(){return U});var X;(function(O){O.MANIFEST="manifest",O.LEVEL="level",O.AUDIO_TRACK="audioTrack",O.SUBTITLE_TRACK="subtitleTrack"})(X||(X={}));var U;(function(O){O.MAIN="main",O.AUDIO="audio",O.SUBTITLE="subtitle"})(U||(U={}))},"./src/types/transmuxer.ts":function(ne,$,k){"use strict";k.r($),k.d($,"ChunkMetadata",function(){return X});var X=function(W,F,P,w,f,b){w===void 0&&(w=0),f===void 0&&(f=-1),b===void 0&&(b=!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=U(),this.buffering={audio:U(),video:U(),audiovideo:U()},this.level=W,this.sn=F,this.id=P,this.size=w,this.part=f,this.partial=b};function U(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ne,$,k){"use strict";k.r($),k.d($,"AttrList",function(){return O});var X=/^(\d+)x(\d+)$/,U=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,O=function(){function W(P){typeof P=="string"&&(P=W.parseAttrList(P));for(var w in P)P.hasOwnProperty(w)&&(this[w]=P[w])}var F=W.prototype;return F.decimalInteger=function(w){var f=parseInt(this[w],10);return f>Number.MAX_SAFE_INTEGER?Infinity:f},F.hexadecimalInteger=function(w){if(this[w]){var f=(this[w]||"0x").slice(2);f=(f.length&1?"0":"")+f;for(var b=new Uint8Array(f.length/2),M=0;M<f.length/2;M++)b[M]=parseInt(f.slice(M*2,M*2+2),16);return b}else return null},F.hexadecimalIntegerAsNumber=function(w){var f=parseInt(this[w],16);return f>Number.MAX_SAFE_INTEGER?Infinity:f},F.decimalFloatingPoint=function(w){return parseFloat(this[w])},F.optionalFloat=function(w,f){var b=this[w];return b?parseFloat(b):f},F.enumeratedString=function(w){return this[w]},F.bool=function(w){return this[w]==="YES"},F.decimalResolution=function(w){var f=X.exec(this[w]);return f===null?void 0:{width:parseInt(f[1],10),height:parseInt(f[2],10)}},W.parseAttrList=function(w){var f,b={},M='"';for(U.lastIndex=0;(f=U.exec(w))!==null;){var A=f[2];A.indexOf(M)===0&&A.lastIndexOf(M)===A.length-1&&(A=A.slice(1,-1)),b[f[1]]=A}return b},W}()},"./src/utils/binary-search.ts":function(ne,$,k){"use strict";k.r($);var X={search:function(O,W){for(var F=0,P=O.length-1,w=null,f=null;F<=P;){w=(F+P)/2|0,f=O[w];var b=W(f);if(b>0)F=w+1;else if(b<0)P=w-1;else return f}return null}};$.default=X},"./src/utils/buffer-helper.ts":function(ne,$,k){"use strict";k.r($),k.d($,"BufferHelper",function(){return O});var X=k("./src/utils/logger.ts"),U={length:0,start:function(){return 0},end:function(){return 0}},O=function(){function W(){}return W.isBuffered=function(P,w){try{if(P){for(var f=W.getBuffered(P),b=0;b<f.length;b++)if(w>=f.start(b)&&w<=f.end(b))return!0}}catch(M){}return!1},W.bufferInfo=function(P,w,f){try{if(P){var b=W.getBuffered(P),M=[],A;for(A=0;A<b.length;A++)M.push({start:b.start(A),end:b.end(A)});return this.bufferedInfo(M,w,f)}}catch(S){}return{len:0,start:w,end:w,nextStart:void 0}},W.bufferedInfo=function(P,w,f){w=Math.max(0,w),P.sort(function(p,D){var E=p.start-D.start;return E||D.end-p.end});var b=[];if(f)for(var M=0;M<P.length;M++){var A=b.length;if(A){var S=b[A-1].end;P[M].start-S<f?P[M].end>S&&(b[A-1].end=P[M].end):b.push(P[M])}else b.push(P[M])}else b=P;for(var T=0,d,a=w,s=w,u=0;u<b.length;u++){var _=b[u].start,m=b[u].end;if(w+f>=_&&w<m)a=_,s=m,T=s-w;else if(w+f<_){d=_;break}}return{len:T,start:a||0,end:s||0,nextStart:d}},W.getBuffered=function(P){try{return P.buffered}catch(w){return X.logger.log("failed to get media.buffered",w),U}},W}()},"./src/utils/cea-608-parser.ts":function(ne,$,k){"use strict";k.r($),k.d($,"Row",function(){return s}),k.d($,"CaptionScreen",function(){return u});var X=k("./src/utils/logger.ts"),U={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},O=function(c){var h=c;return U.hasOwnProperty(c)&&(h=U[c]),String.fromCharCode(h)},W=15,F=100,P={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},w={17:2,18:4,21:6,22:8,23:10,19:13,20:15},f={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},b={25:2,26:4,29:6,30:8,31:10,27:13,28:15},M=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],A;(function(g){g[g.ERROR=0]="ERROR",g[g.TEXT=1]="TEXT",g[g.WARNING=2]="WARNING",g[g.INFO=2]="INFO",g[g.DEBUG=3]="DEBUG",g[g.DATA=3]="DATA"})(A||(A={}));var S=function(){function g(){this.time=null,this.verboseLevel=A.ERROR}var c=g.prototype;return c.log=function(o,C){this.verboseLevel>=o&&X.logger.log(this.time+" ["+o+"] "+C)},g}(),T=function(c){for(var h=[],o=0;o<c.length;o++)h.push(c[o].toString(16));return h},d=function(){function g(h,o,C,x,v){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=h||"white",this.underline=o||!1,this.italics=C||!1,this.background=x||"black",this.flash=v||!1}var c=g.prototype;return c.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},c.setStyles=function(o){for(var C=["foreground","underline","italics","background","flash"],x=0;x<C.length;x++){var v=C[x];o.hasOwnProperty(v)&&(this[v]=o[v])}},c.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},c.equals=function(o){return this.foreground===o.foreground&&this.underline===o.underline&&this.italics===o.italics&&this.background===o.background&&this.flash===o.flash},c.copy=function(o){this.foreground=o.foreground,this.underline=o.underline,this.italics=o.italics,this.background=o.background,this.flash=o.flash},c.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},g}(),a=function(){function g(h,o,C,x,v,R){this.uchar=void 0,this.penState=void 0,this.uchar=h||" ",this.penState=new d(o,C,x,v,R)}var c=g.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(o,C){this.uchar=o,this.penState.copy(C)},c.setPenState=function(o){this.penState.copy(o)},c.equals=function(o){return this.uchar===o.uchar&&this.penState.equals(o.penState)},c.copy=function(o){this.uchar=o.uchar,this.penState.copy(o.penState)},c.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},g}(),s=function(){function g(h){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var o=0;o<F;o++)this.chars.push(new a);this.logger=h,this.pos=0,this.currPenState=new d}var c=g.prototype;return c.equals=function(o){for(var C=!0,x=0;x<F;x++)if(!this.chars[x].equals(o.chars[x])){C=!1;break}return C},c.copy=function(o){for(var C=0;C<F;C++)this.chars[C].copy(o.chars[C])},c.isEmpty=function(){for(var o=!0,C=0;C<F;C++)if(!this.chars[C].isEmpty()){o=!1;break}return o},c.setCursor=function(o){this.pos!==o&&(this.pos=o),this.pos<0?(this.logger.log(A.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>F&&(this.logger.log(A.DEBUG,"Too large cursor position "+this.pos),this.pos=F)},c.moveCursor=function(o){var C=this.pos+o;if(o>1)for(var x=this.pos+1;x<C+1;x++)this.chars[x].setPenState(this.currPenState);this.setCursor(C)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(o){o>=144&&this.backSpace();var C=O(o);if(this.pos>=F){this.logger.log(A.ERROR,"Cannot insert "+o.toString(16)+" ("+C+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(C,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(o){var C;for(C=o;C<F;C++)this.chars[C].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 o=[],C=!0,x=0;x<F;x++){var v=this.chars[x].uchar;v!==" "&&(C=!1),o.push(v)}return C?"":o.join("")},c.setPenStyles=function(o){this.currPenState.setStyles(o);var C=this.chars[this.pos];C.setPenState(this.currPenState)},g}(),u=function(){function g(h){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var o=0;o<W;o++)this.rows.push(new s(h));this.logger=h,this.currRow=W-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=g.prototype;return c.reset=function(){for(var o=0;o<W;o++)this.rows[o].clear();this.currRow=W-1},c.equals=function(o){for(var C=!0,x=0;x<W;x++)if(!this.rows[x].equals(o.rows[x])){C=!1;break}return C},c.copy=function(o){for(var C=0;C<W;C++)this.rows[C].copy(o.rows[C])},c.isEmpty=function(){for(var o=!0,C=0;C<W;C++)if(!this.rows[C].isEmpty()){o=!1;break}return o},c.backSpace=function(){var o=this.rows[this.currRow];o.backSpace()},c.clearToEndOfRow=function(){var o=this.rows[this.currRow];o.clearToEndOfRow()},c.insertChar=function(o){var C=this.rows[this.currRow];C.insertChar(o)},c.setPen=function(o){var C=this.rows[this.currRow];C.setPenStyles(o)},c.moveCursor=function(o){var C=this.rows[this.currRow];C.moveCursor(o)},c.setCursor=function(o){this.logger.log(A.INFO,"setCursor: "+o);var C=this.rows[this.currRow];C.setCursor(o)},c.setPAC=function(o){this.logger.log(A.INFO,"pacData = "+JSON.stringify(o));var C=o.row-1;if(this.nrRollUpRows&&C<this.nrRollUpRows-1&&(C=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==C){for(var x=0;x<W;x++)this.rows[x].clear();var v=this.currRow+1-this.nrRollUpRows,R=this.lastOutputScreen;if(R){var B=R.rows[v].cueStartTime,j=this.logger.time;if(B&&j!==null&&B<j)for(var K=0;K<this.nrRollUpRows;K++)this.rows[C-this.nrRollUpRows+K+1].copy(R.rows[v+K])}}this.currRow=C;var I=this.rows[this.currRow];if(o.indent!==null){var N=o.indent,Y=Math.max(N-1,0);I.setCursor(o.indent),o.color=I.chars[Y].penState.foreground}var q={foreground:o.color,underline:o.underline,italics:o.italics,background:"black",flash:!1};this.setPen(q)},c.setBkgData=function(o){this.logger.log(A.INFO,"bkgData = "+JSON.stringify(o)),this.backSpace(),this.setPen(o),this.insertChar(32)},c.setRollUpRows=function(o){this.nrRollUpRows=o},c.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(A.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(A.TEXT,this.getDisplayText());var o=this.currRow+1-this.nrRollUpRows,C=this.rows.splice(o,1)[0];C.clear(),this.rows.splice(this.currRow,0,C),this.logger.log(A.INFO,"Rolling up")},c.getDisplayText=function(o){o=o||!1;for(var C=[],x="",v=-1,R=0;R<W;R++){var B=this.rows[R].getTextString();B&&(v=R+1,o?C.push("Row "+v+": '"+B+"'"):C.push(B.trim()))}return C.length>0&&(o?x="["+C.join(" | ")+"]":x=C.join(`
`)),x},c.getTextAndFormat=function(){return this.rows},g}(),_=function(){function g(h,o,C){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=h,this.outputFilter=o,this.mode=null,this.verbose=0,this.displayedMemory=new u(C),this.nonDisplayedMemory=new u(C),this.lastOutputScreen=new u(C),this.currRollUpRow=this.displayedMemory.rows[W-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=C}var c=g.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[W-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},c.getHandler=function(){return this.outputFilter},c.setHandler=function(o){this.outputFilter=o},c.setPAC=function(o){this.writeScreen.setPAC(o)},c.setBkgData=function(o){this.writeScreen.setBkgData(o)},c.setMode=function(o){if(o===this.mode)return;this.mode=o,this.logger.log(A.INFO,"MODE="+o),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=o},c.insertChars=function(o){for(var C=0;C<o.length;C++)this.writeScreen.insertChar(o[C]);var x=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(A.INFO,x+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(A.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},c.ccRCL=function(){this.logger.log(A.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},c.ccBS=function(){if(this.logger.log(A.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(A.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},c.ccRU=function(o){this.logger.log(A.INFO,"RU("+o+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(o)},c.ccFON=function(){this.logger.log(A.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},c.ccRDC=function(){this.logger.log(A.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},c.ccTR=function(){this.logger.log(A.INFO,"TR"),this.setMode("MODE_TEXT")},c.ccRTD=function(){this.logger.log(A.INFO,"RTD"),this.setMode("MODE_TEXT")},c.ccEDM=function(){this.logger.log(A.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},c.ccCR=function(){this.logger.log(A.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},c.ccENM=function(){this.logger.log(A.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},c.ccEOC=function(){if(this.logger.log(A.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var o=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=o,this.writeScreen=this.nonDisplayedMemory,this.logger.log(A.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},c.ccTO=function(o){this.logger.log(A.INFO,"TO("+o+") - Tab Offset"),this.writeScreen.moveCursor(o)},c.ccMIDROW=function(o){var C={flash:!1};if(C.underline=o%2===1,C.italics=o>=46,C.italics)C.foreground="white";else{var x=Math.floor(o/2)-16,v=["white","green","blue","cyan","red","yellow","magenta"];C.foreground=v[x]}this.logger.log(A.INFO,"MIDROW: "+JSON.stringify(C)),this.writeScreen.setPen(C)},c.outputDataUpdate=function(o){o===void 0&&(o=!1);var C=this.logger.time;if(C===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=C:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,C,this.lastOutputScreen),o&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:C),this.lastOutputScreen.copy(this.displayedMemory))},c.cueSplitAtTime=function(o){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,o,this.displayedMemory),this.cueStartTime=o))},g}(),m=function(){function g(h,o,C){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var x=new S;this.channels=[null,new _(h,o,x),new _(h+1,C,x)],this.cmdHistory=E(),this.logger=x}var c=g.prototype;return c.getHandler=function(o){return this.channels[o].getHandler()},c.setHandler=function(o,C){this.channels[o].setHandler(C)},c.addData=function(o,C){var x,v,R,B=!1;this.logger.time=o;for(var j=0;j<C.length;j+=2){if(v=C[j]&127,R=C[j+1]&127,v===0&&R===0)continue;if(this.logger.log(A.DATA,"["+T([C[j],C[j+1]])+"] -> ("+T([v,R])+")"),x=this.parseCmd(v,R),x||(x=this.parseMidrow(v,R)),x||(x=this.parsePAC(v,R)),x||(x=this.parseBackgroundAttributes(v,R)),!x&&(B=this.parseChars(v,R),B)){var K=this.currentChannel;if(K&&K>0){var I=this.channels[K];I.insertChars(B)}else this.logger.log(A.WARNING,"No channel found yet. TEXT-MODE?")}!x&&!B&&this.logger.log(A.WARNING,"Couldn't parse cleaned data "+T([v,R])+" orig: "+T([C[j],C[j+1]]))}},c.parseCmd=function(o,C){var x=this.cmdHistory,v=(o===20||o===28||o===21||o===29)&&C>=32&&C<=47,R=(o===23||o===31)&&C>=33&&C<=35;if(!(v||R))return!1;if(D(o,C,x))return p(null,null,x),this.logger.log(A.DEBUG,"Repeated command ("+T([o,C])+") is dropped"),!0;var B=o===20||o===21||o===23?1:2,j=this.channels[B];return o===20||o===21||o===28||o===29?C===32?j.ccRCL():C===33?j.ccBS():C===34?j.ccAOF():C===35?j.ccAON():C===36?j.ccDER():C===37?j.ccRU(2):C===38?j.ccRU(3):C===39?j.ccRU(4):C===40?j.ccFON():C===41?j.ccRDC():C===42?j.ccTR():C===43?j.ccRTD():C===44?j.ccEDM():C===45?j.ccCR():C===46?j.ccENM():C===47&&j.ccEOC():j.ccTO(C-32),p(o,C,x),this.currentChannel=B,!0},c.parseMidrow=function(o,C){var x=0;if((o===17||o===25)&&C>=32&&C<=47){if(o===17?x=1:x=2,x!==this.currentChannel)return this.logger.log(A.ERROR,"Mismatch channel in midrow parsing"),!1;var v=this.channels[x];return v?(v.ccMIDROW(C),this.logger.log(A.DEBUG,"MIDROW ("+T([o,C])+")"),!0):!1}return!1},c.parsePAC=function(o,C){var x,v=this.cmdHistory,R=(o>=17&&o<=23||o>=25&&o<=31)&&C>=64&&C<=127,B=(o===16||o===24)&&C>=64&&C<=95;if(!(R||B))return!1;if(D(o,C,v))return p(null,null,v),!0;var j=o<=23?1:2;C>=64&&C<=95?x=j===1?P[o]:f[o]:x=j===1?w[o]:b[o];var K=this.channels[j];return K?(K.setPAC(this.interpretPAC(x,C)),p(o,C,v),this.currentChannel=j,!0):!1},c.interpretPAC=function(o,C){var x,v={color:null,italics:!1,indent:null,underline:!1,row:o};return C>95?x=C-96:x=C-64,v.underline=(x&1)===1,x<=13?v.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(x/2)]:x<=15?(v.italics=!0,v.color="white"):v.indent=Math.floor((x-16)/2)*4,v},c.parseChars=function(o,C){var x,v=null,R=null;if(o>=25?(x=2,R=o-8):(x=1,R=o),R>=17&&R<=19){var B;R===17?B=C+80:R===18?B=C+112:B=C+144,this.logger.log(A.INFO,"Special char '"+O(B)+"' in channel "+x),v=[B]}else o>=32&&o<=127&&(v=C===0?[o]:[o,C]);if(v){var j=T(v);this.logger.log(A.DEBUG,"Char codes = "+j.join(",")),p(o,C,this.cmdHistory)}return v},c.parseBackgroundAttributes=function(o,C){var x=(o===16||o===24)&&C>=32&&C<=47,v=(o===23||o===31)&&C>=45&&C<=47;if(!(x||v))return!1;var R,B={};o===16||o===24?(R=Math.floor((C-32)/2),B.background=M[R],C%2===1&&(B.background=B.background+"_semi")):C===45?B.background="transparent":(B.foreground="black",C===47&&(B.underline=!0));var j=o<=23?1:2,K=this.channels[j];return K.setBkgData(B),p(o,C,this.cmdHistory),!0},c.reset=function(){for(var o=0;o<Object.keys(this.channels).length;o++){var C=this.channels[o];C&&C.reset()}this.cmdHistory=E()},c.cueSplitAtTime=function(o){for(var C=0;C<this.channels.length;C++){var x=this.channels[C];x&&x.cueSplitAtTime(o)}},g}();function p(g,c,h){h.a=g,h.b=c}function D(g,c,h){return h.a===g&&h.b===c}function E(){return{a:null,b:null}}$.default=m},"./src/utils/codecs.ts":function(ne,$,k){"use strict";k.r($),k.d($,"isCodecType",function(){return U}),k.d($,"isCodecSupportedInMp4",function(){return O});var X={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 U(W,F){var P=X[F];return!!P&&P[W.slice(0,4)]===!0}function O(W,F){return MediaSource.isTypeSupported((F||"video")+'/mp4;codecs="'+W+'"')}},"./src/utils/cues.ts":function(ne,$,k){"use strict";k.r($);var X=k("./src/utils/vttparser.ts"),U=k("./src/utils/webvtt-parser.ts"),O=k("./src/utils/texttrack-utils.ts"),W=/\s/,F={newCue:function(w,f,b,M){for(var A=[],S,T,d,a,s,u=self.VTTCue||self.TextTrackCue,_=0;_<M.rows.length;_++)if(S=M.rows[_],d=!0,a=0,s="",!S.isEmpty()){for(var m=0;m<S.chars.length;m++)W.test(S.chars[m].uchar)&&d?a++:(s+=S.chars[m].uchar,d=!1);S.cueStartTime=f,f===b&&(b+=1e-4),a>=16?a--:a++;var p=Object(X.fixLineBreaks)(s.trim()),D=Object(U.generateCueId)(f,b,p);(!w||!w.cues||!w.cues.getCueById(D))&&(T=new u(f,b,p),T.id=D,T.line=_+1,T.align="left",T.position=10+Math.min(80,Math.floor(a*8/32)*10),A.push(T))}return w&&A.length&&(A.sort(function(E,g){return E.line==="auto"||g.line==="auto"?0:E.line>8&&g.line>8?g.line-E.line:E.line-g.line}),A.forEach(function(E){return Object(O.addCueToTrack)(w,E)})),A}};$.default=F},"./src/utils/discontinuities.ts":function(ne,$,k){"use strict";k.r($),k.d($,"findFirstFragWithCC",function(){return W}),k.d($,"shouldAlignOnDiscontinuities",function(){return F}),k.d($,"findDiscontinuousReferenceFrag",function(){return P}),k.d($,"adjustSlidingStart",function(){return f}),k.d($,"alignStream",function(){return b}),k.d($,"alignPDT",function(){return A}),k.d($,"alignFragmentByPDTDelta",function(){return S}),k.d($,"alignMediaPlaylistByPDT",function(){return T});var X=k("./src/polyfills/number.ts"),U=k("./src/utils/logger.ts"),O=k("./src/controller/level-helper.ts");function W(d,a){for(var s=null,u=0,_=d.length;u<_;u++){var m=d[u];if(m&&m.cc===a){s=m;break}}return s}function F(d,a,s){return!!(a.details&&(s.endCC>s.startCC||d&&d.cc<s.startCC))}function P(d,a){var s=d.fragments,u=a.fragments;if(!u.length||!s.length){U.logger.log("No fragments to align");return}var _=W(s,u[0].cc);if(!_||_&&!_.startPTS){U.logger.log("No frag in previous level to align on");return}return _}function w(d,a){if(d){var s=d.start+a;d.start=d.startPTS=s,d.endPTS=s+d.duration}}function f(d,a){for(var s=a.fragments,u=0,_=s.length;u<_;u++)w(s[u],d);a.fragmentHint&&w(a.fragmentHint,d),a.alignedSliding=!0}function b(d,a,s){if(!a)return;M(d,s,a),!s.alignedSliding&&a.details&&A(s,a.details),!s.alignedSliding&&a.details&&!s.skippedSegments&&Object(O.adjustSliding)(a.details,s)}function M(d,a,s){if(F(d,s,a)){var u=P(s.details,a);u&&Object(X.isFiniteNumber)(u.start)&&(U.logger.log("Adjusting PTS using last level due to CC increase within current level "+a.url),f(u.start,a))}}function A(d,a){if(!a.fragments.length||!d.hasProgramDateTime||!a.hasProgramDateTime)return;var s=a.fragments[0].programDateTime,u=d.fragments[0].programDateTime,_=(u-s)/1e3+a.fragments[0].start;_&&Object(X.isFiniteNumber)(_)&&(U.logger.log("Adjusting PTS using programDateTime delta "+(u-s)+"ms, sliding:"+_.toFixed(3)+" "+d.url+" "),f(_,d))}function S(d,a){var s=d.programDateTime;if(!s)return;var u=(s-a)/1e3;d.start=d.startPTS=u,d.endPTS=u+d.duration}function T(d,a){if(!a.fragments.length||!d.hasProgramDateTime||!a.hasProgramDateTime)return;var s=a.fragments[0].programDateTime,u=a.fragments[0].start,_=s-u*1e3;d.fragments.forEach(function(m){S(m,_)}),d.fragmentHint&&S(d.fragmentHint,_),d.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ne,$,k){"use strict";k.r($);var X=k("./src/utils/ewma.ts"),U=function(){function O(F,P,w){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=w,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new X.default(F),this.fast_=new X.default(P)}var W=O.prototype;return W.update=function(P,w){var f=this.slow_,b=this.fast_;this.slow_.halfLife!==P&&(this.slow_=new X.default(P,f.getEstimate(),f.getTotalWeight())),this.fast_.halfLife!==w&&(this.fast_=new X.default(w,b.getEstimate(),b.getTotalWeight()))},W.sample=function(P,w){P=Math.max(P,this.minDelayMs_);var f=8*w,b=P/1e3,M=f/b;this.fast_.sample(b,M),this.slow_.sample(b,M)},W.canEstimate=function(){var P=this.fast_;return P&&P.getTotalWeight()>=this.minWeight_},W.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},W.destroy=function(){},O}();$.default=U},"./src/utils/ewma.ts":function(ne,$,k){"use strict";k.r($);var X=function(){function U(W,F,P){F===void 0&&(F=0),P===void 0&&(P=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=W,this.alpha_=W?Math.exp(Math.log(.5)/W):0,this.estimate_=F,this.totalWeight_=P}var O=U.prototype;return O.sample=function(F,P){var w=Math.pow(this.alpha_,F);this.estimate_=P*(1-w)+w*this.estimate_,this.totalWeight_+=F},O.getTotalWeight=function(){return this.totalWeight_},O.getEstimate=function(){if(this.alpha_){var F=1-Math.pow(this.alpha_,this.totalWeight_);if(F)return this.estimate_/F}return this.estimate_},U}();$.default=X},"./src/utils/fetch-loader.ts":function(ne,$,k){"use strict";k.r($),k.d($,"fetchSupported",function(){return S});var X=k("./src/polyfills/number.ts"),U=k("./src/loader/load-stats.ts"),O=k("./src/demux/chunk-cache.ts");function W(u,_){u.prototype=Object.create(_.prototype),u.prototype.constructor=u,b(u,_)}function F(u){var _=typeof Map=="function"?new Map:void 0;return F=function(p){if(p===null||!f(p))return p;if(typeof p!="function")throw new TypeError("Super expression must either be null or a function");if(typeof _!="undefined"){if(_.has(p))return _.get(p);_.set(p,D)}function D(){return P(p,arguments,M(this).constructor)}return D.prototype=Object.create(p.prototype,{constructor:{value:D,enumerable:!1,writable:!0,configurable:!0}}),b(D,p)},F(u)}function P(u,_,m){return w()?P=Reflect.construct:P=function(D,E,g){var c=[null];c.push.apply(c,E);var h=Function.bind.apply(D,c),o=new h;return g&&b(o,g.prototype),o},P.apply(null,arguments)}function w(){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(u){return!1}}function f(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function b(u,_){return b=Object.setPrototypeOf||function(p,D){return p.__proto__=D,p},b(u,_)}function M(u){return M=Object.setPrototypeOf?Object.getPrototypeOf:function(m){return m.__proto__||Object.getPrototypeOf(m)},M(u)}function A(){return A=Object.assign||function(u){for(var _=1;_<arguments.length;_++){var m=arguments[_];for(var p in m)Object.prototype.hasOwnProperty.call(m,p)&&(u[p]=m[p])}return u},A.apply(this,arguments)}function S(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(u){}return!1}var T=function(){function u(m){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=m.fetchSetup||a,this.controller=new self.AbortController,this.stats=new U.LoadStats}var _=u.prototype;return _.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},_.abortInternal=function(){var p=this.response;(!p||!p.ok)&&(this.stats.aborted=!0,this.controller.abort())},_.abort=function(){var p;this.abortInternal(),(p=this.callbacks)!==null&&p!==void 0&&p.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},_.load=function(p,D,E){var g=this,c=this.stats;if(c.loading.start)throw new Error("Loader can only be used once.");c.loading.start=self.performance.now();var h=d(p,this.controller.signal),o=E.onProgress,C=p.responseType==="arraybuffer",x=C?"byteLength":"length";this.context=p,this.config=D,this.callbacks=E,this.request=this.fetchSetup(p,h),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){g.abortInternal(),E.onTimeout(c,p,g.response)},D.timeout),self.fetch(this.request).then(function(v){if(g.response=g.loader=v,!v.ok){var R=v.status,B=v.statusText;throw new s(B||"fetch, bad network response",R,v)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(v.headers.get("Content-Length")||"0"),o&&Object(X.isFiniteNumber)(D.highWaterMark)?g.loadProgressively(v,c,p,D.highWaterMark,o):C?v.arrayBuffer():v.text()}).then(function(v){var R=g.response;self.clearTimeout(g.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=v[x];var B={url:R.url,data:v};o&&!Object(X.isFiniteNumber)(D.highWaterMark)&&o(c,p,v,R),E.onSuccess(B,c,p,R)}).catch(function(v){if(self.clearTimeout(g.requestTimeout),c.aborted)return;var R=v.code||0;E.onError({code:R,text:v.message},p,v.details)})},_.getCacheAge=function(){var p=null;if(this.response){var D=this.response.headers.get("age");p=D?parseFloat(D):null}return p},_.loadProgressively=function(p,D,E,g,c){g===void 0&&(g=0);var h=new O.default,o=p.body.getReader(),C=function x(){return o.read().then(function(v){if(v.done)return h.dataLength&&c(D,E,h.flush(),p),Promise.resolve(new ArrayBuffer(0));var R=v.value,B=R.length;return D.loaded+=B,B<g||h.dataLength?(h.push(R),h.dataLength>=g&&c(D,E,h.flush(),p)):c(D,E,R,p),x()}).catch(function(){return Promise.reject()})};return C()},u}();function d(u,_){var m={method:"GET",mode:"cors",credentials:"same-origin",signal:_,headers:new self.Headers(A({},u.headers))};return u.rangeEnd&&m.headers.set("Range","bytes="+u.rangeStart+"-"+String(u.rangeEnd-1)),m}function a(u,_){return new self.Request(u.url,_)}var s=function(u){W(_,u);function _(m,p,D){var E;return E=u.call(this,m)||this,E.code=void 0,E.details=void 0,E.code=p,E.details=D,E}return _}(F(Error));$.default=T},"./src/utils/imsc1-ttml-parser.ts":function(ne,$,k){"use strict";k.r($),k.d($,"IMSC1_CODEC",function(){return f}),k.d($,"parseIMSC1",function(){return S});var X=k("./src/utils/mp4-tools.ts"),U=k("./src/utils/vttparser.ts"),O=k("./src/utils/vttcue.ts"),W=k("./src/demux/id3.ts"),F=k("./src/utils/timescale-conversion.ts"),P=k("./src/utils/webvtt-parser.ts");function w(){return w=Object.assign||function(g){for(var c=1;c<arguments.length;c++){var h=arguments[c];for(var o in h)Object.prototype.hasOwnProperty.call(h,o)&&(g[o]=h[o])}return g},w.apply(this,arguments)}var f="stpp.ttml.im1t",b=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,M=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,A={left:"start",center:"center",right:"end",start:"start",end:"end"};function S(g,c,h,o,C){var x=Object(X.findBox)(new Uint8Array(g),["mdat"]);if(x.length===0){C(new Error("Could not parse IMSC1 mdat"));return}var v=x[0],R=Object(W.utf8ArrayToStr)(new Uint8Array(g,v.start,v.end-v.start)),B=Object(F.toTimescaleFromScale)(c,1,h);try{o(T(R,B))}catch(j){C(j)}}function T(g,c){var h=new DOMParser,o=h.parseFromString(g,"text/xml"),C=o.getElementsByTagName("tt")[0];if(!C)throw new Error("Invalid ttml");var x={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},v=Object.keys(x).reduce(function(I,N){return I[N]=C.getAttribute("ttp:"+N)||x[N],I},{}),R=C.getAttribute("xml:space")!=="preserve",B=a(d(C,"styling","style")),j=a(d(C,"layout","region")),K=d(C,"body","[begin]");return[].map.call(K,function(I){var N=s(I,R);if(!N||!I.hasAttribute("begin"))return null;var Y=p(I.getAttribute("begin"),v),q=p(I.getAttribute("dur"),v),ae=p(I.getAttribute("end"),v);if(Y===null)throw m(I);if(ae===null){if(q===null)throw m(I);ae=Y+q}var he=new O.default(Y-c,ae-c,N);he.id=Object(P.generateCueId)(he.startTime,he.endTime,he.text);var _e=j[I.getAttribute("region")],be=B[I.getAttribute("style")];he.position=10,he.size=80;var Ce=u(_e,be),Te=Ce.textAlign;if(Te){var Ee=A[Te];Ee&&(he.lineAlign=Ee),he.align=Te}return w(he,Ce),he}).filter(function(I){return I!==null})}function d(g,c,h){var o=g.getElementsByTagName(c)[0];return o?[].slice.call(o.querySelectorAll(h)):[]}function a(g){return g.reduce(function(c,h){var o=h.getAttribute("xml:id");return o&&(c[o]=h),c},{})}function s(g,c){return[].slice.call(g.childNodes).reduce(function(h,o,C){var x;return o.nodeName==="br"&&C?h+`
`:(x=o.childNodes)!==null&&x!==void 0&&x.length?s(o,c):c?h+o.textContent.trim().replace(/\s+/g," "):h+o.textContent},"")}function u(g,c){var h="http://www.w3.org/ns/ttml#styling",o=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return o.reduce(function(C,x){var v=_(c,h,x)||_(g,h,x);return v&&(C[x]=v),C},{})}function _(g,c,h){return g.hasAttributeNS(c,h)?g.getAttributeNS(c,h):null}function m(g){return new Error("Could not parse ttml timestamp "+g)}function p(g,c){if(!g)return null;var h=Object(U.parseTimeStamp)(g);return h===null&&(b.test(g)?h=D(g,c):M.test(g)&&(h=E(g,c))),h}function D(g,c){var h=b.exec(g),o=(h[4]|0)+(h[5]|0)/c.subFrameRate;return(h[1]|0)*3600+(h[2]|0)*60+(h[3]|0)+o/c.frameRate}function E(g,c){var h=M.exec(g),o=Number(h[1]),C=h[2];switch(C){case"h":return o*3600;case"m":return o*60;case"ms":return o*1e3;case"f":return o/c.frameRate;case"t":return o/c.tickRate}return o}},"./src/utils/logger.ts":function(ne,$,k){"use strict";k.r($),k.d($,"enableLogs",function(){return P}),k.d($,"logger",function(){return w});var X=function(){},U={trace:X,debug:X,log:X,warn:X,info:X,error:X},O=U;function W(f){var b=self.console[f];return b?b.bind(self.console,"["+f+"] >"):X}function F(f){for(var b=arguments.length,M=new Array(b>1?b-1:0),A=1;A<b;A++)M[A-1]=arguments[A];M.forEach(function(S){O[S]=f[S]?f[S].bind(f):W(S)})}function P(f){if(self.console&&f===!0||typeof f=="object"){F(f,"debug","log","info","warn","error");try{O.log()}catch(b){O=U}}else O=U}var w=O},"./src/utils/mediakeys-helper.ts":function(ne,$,k){"use strict";k.r($),k.d($,"KeySystems",function(){return X}),k.d($,"requestMediaKeySystemAccess",function(){return U});var X;(function(O){O.WIDEVINE="com.widevine.alpha",O.PLAYREADY="com.microsoft.playready"})(X||(X={}));var U=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ne,$,k){"use strict";k.r($),k.d($,"getMediaSource",function(){return X});function X(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ne,$,k){"use strict";k.r($),k.d($,"bin2str",function(){return F}),k.d($,"readUint16",function(){return P}),k.d($,"readUint32",function(){return w}),k.d($,"writeUint32",function(){return f}),k.d($,"findBox",function(){return b}),k.d($,"parseSegmentIndex",function(){return M}),k.d($,"parseInitSegment",function(){return A}),k.d($,"getStartDTS",function(){return S}),k.d($,"getDuration",function(){return T}),k.d($,"computeRawDurationFromSamples",function(){return d}),k.d($,"offsetStartDTS",function(){return a}),k.d($,"segmentValidRange",function(){return s}),k.d($,"appendUint8Array",function(){return u});var X=k("./src/utils/typed-array.ts"),U=k("./src/loader/fragment.ts"),O=Math.pow(2,32)-1,W=[].push;function F(_){return String.fromCharCode.apply(null,_)}function P(_,m){"data"in _&&(m+=_.start,_=_.data);var p=_[m]<<8|_[m+1];return p<0?65536+p:p}function w(_,m){"data"in _&&(m+=_.start,_=_.data);var p=_[m]<<24|_[m+1]<<16|_[m+2]<<8|_[m+3];return p<0?4294967296+p:p}function f(_,m,p){"data"in _&&(m+=_.start,_=_.data),_[m]=p>>24,_[m+1]=p>>16&255,_[m+2]=p>>8&255,_[m+3]=p&255}function b(_,m){var p=[];if(!m.length)return p;var D,E,g;"data"in _?(D=_.data,E=_.start,g=_.end):(D=_,E=0,g=D.byteLength);for(var c=E;c<g;){var h=w(D,c),o=F(D.subarray(c+4,c+8)),C=h>1?c+h:g;if(o===m[0])if(m.length===1)p.push({data:D,start:c+8,end:C});else{var x=b({data:D,start:c+8,end:C},m.slice(1));x.length&&W.apply(p,x)}c=C}return p}function M(_){var m=b(_,["moov"]),p=m[0],D=p?p.end:null,E=b(_,["sidx"]);if(!E||!E[0])return null;var g=[],c=E[0],h=c.data[0],o=h===0?8:16,C=w(c,o);o+=4;var x=0,v=0;h===0?o+=8:o+=16,o+=2;var R=c.end+v,B=P(c,o);o+=2;for(var j=0;j<B;j++){var K=o,I=w(c,K);K+=4;var N=I&2147483647,Y=(I&2147483648)>>>31;if(Y===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var q=w(c,K);K+=4,g.push({referenceSize:N,subsegmentDuration:q,info:{duration:q/C,start:R,end:R+N-1}}),R+=N,K+=4,o=K}return{earliestPresentationTime:x,timescale:C,version:h,referencesCount:B,references:g,moovEndOffset:D}}function A(_){for(var m=[],p=b(_,["moov","trak"]),D=0;D<p.length;D++){var E=p[D],g=b(E,["tkhd"])[0];if(g){var c=g.data[g.start],h=c===0?12:20,o=w(g,h),C=b(E,["mdia","mdhd"])[0];if(C){c=C.data[C.start],h=c===0?12:20;var x=w(C,h),v=b(E,["mdia","hdlr"])[0];if(v){var R=F(v.data.subarray(v.start+8,v.start+12)),B={soun:U.ElementaryStreamTypes.AUDIO,vide:U.ElementaryStreamTypes.VIDEO}[R];if(B){var j=b(E,["mdia","minf","stbl","stsd"])[0],K=void 0;j&&(K=F(j.data.subarray(j.start+12,j.start+16))),m[o]={timescale:x,type:B},m[B]={timescale:x,id:o,codec:K}}}}}}var I=b(_,["moov","mvex","trex"]);return I.forEach(function(N){var Y=w(N,4),q=m[Y];q&&(q.default={duration:w(N,12),flags:w(N,20)})}),m}function S(_,m){return b(m,["moof","traf"]).reduce(function(p,D){var E=b(D,["tfdt"])[0],g=E.data[E.start],c=b(D,["tfhd"]).reduce(function(h,o){var C=w(o,4),x=_[C];if(x){var v=w(E,4);g===1&&(v*=Math.pow(2,32),v+=w(E,8));var R=x.timescale||9e4,B=v/R;if(isFinite(B)&&(h===null||B<h))return B}return h},null);return c!==null&&isFinite(c)&&(p===null||c<p)?c:p},null)||0}function T(_,m){for(var p=0,D=0,E=0,g=b(_,["moof","traf"]),c=0;c<g.length;c++){var h=g[c],o=b(h,["tfhd"])[0],C=w(o,4),x=m[C];if(!x)continue;var v=x.default,R=w(o,0)|(v==null?void 0:v.flags),B=v==null?void 0:v.duration;R&8&&(R&2?B=w(o,12):B=w(o,8));for(var j=x.timescale||9e4,K=b(h,["trun"]),I=0;I<K.length;I++){if(B){var N=w(K[I],4);p=B*N}else p=d(K[I]);x.type===U.ElementaryStreamTypes.VIDEO?D+=p/j:x.type===U.ElementaryStreamTypes.AUDIO&&(E+=p/j)}}if(D===0&&E===0){var Y=M(_);if(Y!=null&&Y.references)return Y.references.reduce(function(q,ae){return q+ae.info.duration||0},0)}return D||E}function d(_){var m=w(_,0),p=8;m&1&&(p+=4),m&4&&(p+=4);for(var D=0,E=w(_,4),g=0;g<E;g++){if(m&256){var c=w(_,p);D+=c,p+=4}m&512&&(p+=4),m&1024&&(p+=4),m&2048&&(p+=4)}return D}function a(_,m,p){b(m,["moof","traf"]).forEach(function(D){b(D,["tfhd"]).forEach(function(E){var g=w(E,4),c=_[g];if(!c)return;var h=c.timescale||9e4;b(D,["tfdt"]).forEach(function(o){var C=o.data[o.start],x=w(o,4);if(C===0)f(o,4,x-p*h);else{x*=Math.pow(2,32),x+=w(o,8),x-=p*h,x=Math.max(x,0);var v=Math.floor(x/(O+1)),R=Math.floor(x%(O+1));f(o,4,v),f(o,8,R)}})})})}function s(_){var m={valid:null,remainder:null},p=b(_,["moof"]);if(p){if(p.length<2)return m.remainder=_,m}else return m;var D=p[p.length-1];return m.valid=Object(X.sliceUint8)(_,0,D.start-8),m.remainder=Object(X.sliceUint8)(_,D.start-8),m}function u(_,m){var p=new Uint8Array(_.length+m.length);return p.set(_),p.set(m,_.length),p}},"./src/utils/output-filter.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return X});var X=function(){function U(W,F){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=W,this.trackName=F}var O=U.prototype;return O.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},O.newCue=function(F,P,w){(this.startTime===null||this.startTime>F)&&(this.startTime=F),this.endTime=P,this.screen=w,this.timelineController.createCaptionsTrack(this.trackName)},O.reset=function(){this.cueRanges=[]},U}()},"./src/utils/texttrack-utils.ts":function(ne,$,k){"use strict";k.r($),k.d($,"sendAddTrackEvent",function(){return U}),k.d($,"addCueToTrack",function(){return O}),k.d($,"clearCurrentCues",function(){return W}),k.d($,"removeCuesInRange",function(){return F}),k.d($,"getCuesInRange",function(){return w});var X=k("./src/utils/logger.ts");function U(f,b){var M;try{M=new Event("addtrack")}catch(A){M=document.createEvent("Event"),M.initEvent("addtrack",!1,!1)}M.track=f,b.dispatchEvent(M)}function O(f,b){var M=f.mode;if(M==="disabled"&&(f.mode="hidden"),f.cues&&!f.cues.getCueById(b.id))try{if(f.addCue(b),!f.cues.getCueById(b.id))throw new Error("addCue is failed for: "+b)}catch(S){X.logger.debug("[texttrack-utils]: "+S);var A=new self.TextTrackCue(b.startTime,b.endTime,b.text);A.id=b.id,f.addCue(A)}M==="disabled"&&(f.mode=M)}function W(f){var b=f.mode;if(b==="disabled"&&(f.mode="hidden"),f.cues)for(var M=f.cues.length;M--;)f.removeCue(f.cues[M]);b==="disabled"&&(f.mode=b)}function F(f,b,M){var A=f.mode;if(A==="disabled"&&(f.mode="hidden"),f.cues&&f.cues.length>0)for(var S=w(f.cues,b,M),T=0;T<S.length;T++)f.removeCue(S[T]);A==="disabled"&&(f.mode=A)}function P(f,b){if(b<f[0].startTime)return 0;var M=f.length-1;if(b>f[M].endTime)return-1;for(var A=0,S=M;A<=S;){var T=Math.floor((S+A)/2);if(b<f[T].startTime)S=T-1;else if(b>f[T].startTime&&A<M)A=T+1;else return T}return f[A].startTime-b<b-f[S].startTime?A:S}function w(f,b,M){var A=[],S=P(f,b);if(S>-1)for(var T=S,d=f.length;T<d;T++){var a=f[T];if(a.startTime>=b&&a.endTime<=M)A.push(a);else if(a.startTime>M)return A}return A}},"./src/utils/time-ranges.ts":function(ne,$,k){"use strict";k.r($);var X={toString:function(O){for(var W="",F=O.length,P=0;P<F;P++)W+="["+O.start(P).toFixed(3)+","+O.end(P).toFixed(3)+"]";return W}};$.default=X},"./src/utils/timescale-conversion.ts":function(ne,$,k){"use strict";k.r($),k.d($,"toTimescaleFromBase",function(){return U}),k.d($,"toTimescaleFromScale",function(){return O}),k.d($,"toMsFromMpegTsClock",function(){return W}),k.d($,"toMpegTsClockFromTimescale",function(){return F});var X=9e4;function U(P,w,f,b){f===void 0&&(f=1),b===void 0&&(b=!1);var M=P*w*f;return b?Math.round(M):M}function O(P,w,f,b){return f===void 0&&(f=1),b===void 0&&(b=!1),U(P,w,1/f,b)}function W(P,w){return w===void 0&&(w=!1),U(P,1e3,1/X,w)}function F(P,w){return w===void 0&&(w=1),U(P,X,1/w)}},"./src/utils/typed-array.ts":function(ne,$,k){"use strict";k.r($),k.d($,"sliceUint8",function(){return X});function X(U,O,W){return Uint8Array.prototype.slice?U.slice(O,W):new Uint8Array(Array.prototype.slice.call(U,O,W))}},"./src/utils/vttcue.ts":function(ne,$,k){"use strict";k.r($),$.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var X=["","lr","rl"],U=["start","middle","end","left","right"];function O(f,b){if(typeof b!="string")return!1;if(!Array.isArray(f))return!1;var M=b.toLowerCase();return~f.indexOf(M)?M:!1}function W(f){return O(X,f)}function F(f){return O(U,f)}function P(f){for(var b=arguments.length,M=new Array(b>1?b-1:0),A=1;A<b;A++)M[A-1]=arguments[A];for(var S=1;S<arguments.length;S++){var T=arguments[S];for(var d in T)f[d]=T[d]}return f}function w(f,b,M){var A=this,S={enumerable:!0};A.hasBeenReset=!1;var T="",d=!1,a=f,s=b,u=M,_=null,m="",p=!0,D="auto",E="start",g=50,c="middle",h=50,o="middle";Object.defineProperty(A,"id",P({},S,{get:function(){return T},set:function(x){T=""+x}})),Object.defineProperty(A,"pauseOnExit",P({},S,{get:function(){return d},set:function(x){d=!!x}})),Object.defineProperty(A,"startTime",P({},S,{get:function(){return a},set:function(x){if(typeof x!="number")throw new TypeError("Start time must be set to a number.");a=x,this.hasBeenReset=!0}})),Object.defineProperty(A,"endTime",P({},S,{get:function(){return s},set:function(x){if(typeof x!="number")throw new TypeError("End time must be set to a number.");s=x,this.hasBeenReset=!0}})),Object.defineProperty(A,"text",P({},S,{get:function(){return u},set:function(x){u=""+x,this.hasBeenReset=!0}})),Object.defineProperty(A,"region",P({},S,{get:function(){return _},set:function(x){_=x,this.hasBeenReset=!0}})),Object.defineProperty(A,"vertical",P({},S,{get:function(){return m},set:function(x){var v=W(x);if(v===!1)throw new SyntaxError("An invalid or illegal string was specified.");m=v,this.hasBeenReset=!0}})),Object.defineProperty(A,"snapToLines",P({},S,{get:function(){return p},set:function(x){p=!!x,this.hasBeenReset=!0}})),Object.defineProperty(A,"line",P({},S,{get:function(){return D},set:function(x){if(typeof x!="number"&&x!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");D=x,this.hasBeenReset=!0}})),Object.defineProperty(A,"lineAlign",P({},S,{get:function(){return E},set:function(x){var v=F(x);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");E=v,this.hasBeenReset=!0}})),Object.defineProperty(A,"position",P({},S,{get:function(){return g},set:function(x){if(x<0||x>100)throw new Error("Position must be between 0 and 100.");g=x,this.hasBeenReset=!0}})),Object.defineProperty(A,"positionAlign",P({},S,{get:function(){return c},set:function(x){var v=F(x);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");c=v,this.hasBeenReset=!0}})),Object.defineProperty(A,"size",P({},S,{get:function(){return h},set:function(x){if(x<0||x>100)throw new Error("Size must be between 0 and 100.");h=x,this.hasBeenReset=!0}})),Object.defineProperty(A,"align",P({},S,{get:function(){return o},set:function(x){var v=F(x);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");o=v,this.hasBeenReset=!0}})),A.displayState=void 0}return w.prototype.getCueAsHTML=function(){var f=self.WebVTT;return f.convertCueToDOMTree(self,this.text)},w}()},"./src/utils/vttparser.ts":function(ne,$,k){"use strict";k.r($),k.d($,"parseTimeStamp",function(){return O}),k.d($,"fixLineBreaks",function(){return b}),k.d($,"VTTParser",function(){return M});var X=k("./src/utils/vttcue.ts"),U=function(){function A(){}var S=A.prototype;return S.decode=function(d,a){if(!d)return"";if(typeof d!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(d))},A}();function O(A){function S(d,a,s,u){return(d|0)*3600+(a|0)*60+(s|0)+parseFloat(u||0)}var T=A.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return T?parseFloat(T[2])>59?S(T[2],T[3],0,T[4]):S(T[1],T[2],T[3],T[4]):null}var W=function(){function A(){this.values=Object.create(null)}var S=A.prototype;return S.set=function(d,a){!this.get(d)&&a!==""&&(this.values[d]=a)},S.get=function(d,a,s){return s?this.has(d)?this.values[d]:a[s]:this.has(d)?this.values[d]:a},S.has=function(d){return d in this.values},S.alt=function(d,a,s){for(var u=0;u<s.length;++u)if(a===s[u]){this.set(d,a);break}},S.integer=function(d,a){/^-?\d+$/.test(a)&&this.set(d,parseInt(a,10))},S.percent=function(d,a){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(a)){var s=parseFloat(a);if(s>=0&&s<=100)return this.set(d,s),!0}return!1},A}();function F(A,S,T,d){var a=d?A.split(d):[A];for(var s in a){if(typeof a[s]!="string")continue;var u=a[s].split(T);if(u.length!==2)continue;var _=u[0],m=u[1];S(_,m)}}var P=new X.default(0,0,""),w=P.align==="middle"?"middle":"center";function f(A,S,T){var d=A;function a(){var _=O(A);if(_===null)throw new Error("Malformed timestamp: "+d);return A=A.replace(/^[^\sa-zA-Z-]+/,""),_}function s(_,m){var p=new W;F(_,function(g,c){var h;switch(g){case"region":for(var o=T.length-1;o>=0;o--)if(T[o].id===c){p.set(g,T[o].region);break}break;case"vertical":p.alt(g,c,["rl","lr"]);break;case"line":h=c.split(","),p.integer(g,h[0]),p.percent(g,h[0])&&p.set("snapToLines",!1),p.alt(g,h[0],["auto"]),h.length===2&&p.alt("lineAlign",h[1],["start",w,"end"]);break;case"position":h=c.split(","),p.percent(g,h[0]),h.length===2&&p.alt("positionAlign",h[1],["start",w,"end","line-left","line-right","auto"]);break;case"size":p.percent(g,c);break;case"align":p.alt(g,c,["start",w,"end","left","right"]);break}},/:/,/\s/),m.region=p.get("region",null),m.vertical=p.get("vertical","");var D=p.get("line","auto");D==="auto"&&P.line===-1&&(D=-1),m.line=D,m.lineAlign=p.get("lineAlign","start"),m.snapToLines=p.get("snapToLines",!0),m.size=p.get("size",100),m.align=p.get("align",w);var E=p.get("position","auto");E==="auto"&&P.position===50&&(E=m.align==="start"||m.align==="left"?0:m.align==="end"||m.align==="right"?100:50),m.position=E}function u(){A=A.replace(/^\s+/,"")}if(u(),S.startTime=a(),u(),A.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);A=A.substr(3),u(),S.endTime=a(),u(),s(A,S)}function b(A){return A.replace(/<br(?: \/)?>/gi,`
`)}var M=function(){function A(){this.state="INITIAL",this.buffer="",this.decoder=new U,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var S=A.prototype;return S.parse=function(d){var a=this;d&&(a.buffer+=a.decoder.decode(d,{stream:!0}));function s(){var E=a.buffer,g=0;for(E=b(E);g<E.length&&E[g]!=="\r"&&E[g]!==`
`;)++g;var c=E.substr(0,g);return E[g]==="\r"&&++g,E[g]===`
`&&++g,a.buffer=E.substr(g),c}function u(E){F(E,function(g,c){},/:/)}try{var _="";if(a.state==="INITIAL"){if(!/\r\n|\n/.test(a.buffer))return this;_=s();var m=_.match(/^()?WEBVTT([ \t].*)?$/);if(!m||!m[0])throw new Error("Malformed WebVTT signature.");a.state="HEADER"}for(var p=!1;a.buffer;){if(!/\r\n|\n/.test(a.buffer))return this;p?p=!1:_=s();switch(a.state){case"HEADER":/:/.test(_)?u(_):_||(a.state="ID");continue;case"NOTE":_||(a.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(_)){a.state="NOTE";break}if(!_)continue;if(a.cue=new X.default(0,0,""),a.state="CUE",_.indexOf("-->")===-1){a.cue.id=_;continue}case"CUE":if(!a.cue){a.state="BADCUE";continue}try{f(_,a.cue,a.regionList)}catch(E){a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":{var D=_.indexOf("-->")!==-1;if(!_||D&&(p=!0)){a.oncue&&a.cue&&a.oncue(a.cue),a.cue=null,a.state="ID";continue}if(a.cue===null)continue;a.cue.text&&(a.cue.text+=`
`),a.cue.text+=_}continue;case"BADCUE":_||(a.state="ID")}}}catch(E){a.state==="CUETEXT"&&a.cue&&a.oncue&&a.oncue(a.cue),a.cue=null,a.state=a.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},S.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(a){d.onparsingerror&&d.onparsingerror(a)}return d.onflush&&d.onflush(),this},A}()},"./src/utils/webvtt-parser.ts":function(ne,$,k){"use strict";k.r($),k.d($,"generateCueId",function(){return M}),k.d($,"parseWebVTT",function(){return S});var X=k("./src/polyfills/number.ts"),U=k("./src/utils/vttparser.ts"),O=k("./src/demux/id3.ts"),W=k("./src/utils/timescale-conversion.ts"),F=k("./src/remux/mp4-remuxer.ts"),P=/\r\n|\n\r|\n|\r/g,w=function(d,a,s){return s===void 0&&(s=0),d.substr(s,a.length)===a},f=function(d){var a=parseInt(d.substr(-3)),s=parseInt(d.substr(-6,2)),u=parseInt(d.substr(-9,2)),_=d.length>9?parseInt(d.substr(0,d.indexOf(":"))):0;if(!Object(X.isFiniteNumber)(a)||!Object(X.isFiniteNumber)(s)||!Object(X.isFiniteNumber)(u)||!Object(X.isFiniteNumber)(_))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return a+=1e3*s,a+=60*1e3*u,a+=60*60*1e3*_,a},b=function(d){for(var a=5381,s=d.length;s;)a=a*33^d.charCodeAt(--s);return(a>>>0).toString()};function M(T,d,a){return b(T.toString())+b(d.toString())+b(a)}var A=function(d,a,s){var u=d[a],_=d[u.prevCC];if(!_||!_.new&&u.new){d.ccOffset=d.presentationOffset=u.start,u.new=!1;return}for(;(m=_)!==null&&m!==void 0&&m.new;){var m;d.ccOffset+=u.start-_.start,u.new=!1,u=_,_=d[u.prevCC]}d.presentationOffset=s};function S(T,d,a,s,u,_,m,p){var D=new U.VTTParser,E=Object(O.utf8ArrayToStr)(new Uint8Array(T)).trim().replace(P,`
`).split(`
`),g=[],c=Object(W.toMpegTsClockFromTimescale)(d,a),h="00:00.000",o=0,C=0,x,v=!0,R=!1;D.oncue=function(B){var j=s[u],K=s.ccOffset,I=(o-c)/9e4;if(j!=null&&j.new&&(C!==void 0?K=s.ccOffset=j.start:A(s,u,I)),I&&(K=I-s.presentationOffset),R){var N=B.endTime-B.startTime,Y=Object(F.normalizePts)((B.startTime+K-C)*9e4,_*9e4)/9e4;B.startTime=Y,B.endTime=Y+N}var q=B.text.trim();B.text=decodeURIComponent(encodeURIComponent(q)),B.id||(B.id=M(B.startTime,B.endTime,q)),B.endTime>0&&g.push(B)},D.onparsingerror=function(B){x=B},D.onflush=function(){if(x){p(x);return}m(g)},E.forEach(function(B){if(v)if(w(B,"X-TIMESTAMP-MAP=")){v=!1,R=!0,B.substr(16).split(",").forEach(function(j){w(j,"LOCAL:")?h=j.substr(6):w(j,"MPEGTS:")&&(o=parseInt(j.substr(7)))});try{C=f(h)/1e3}catch(j){R=!1,x=j}return}else B===""&&(v=!1);D.parse(B+`
`)}),D.flush()}},"./src/utils/xhr-loader.ts":function(ne,$,k){"use strict";k.r($);var X=k("./src/utils/logger.ts"),U=k("./src/loader/load-stats.ts"),O=/^age:\s*[\d.]+\s*$/m,W=function(){function F(w){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=w?w.xhrSetup:null,this.stats=new U.LoadStats,this.retryDelay=0}var P=F.prototype;return P.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},P.abortInternal=function(){var f=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),f&&(f.onreadystatechange=null,f.onprogress=null,f.readyState!==4&&(this.stats.aborted=!0,f.abort()))},P.abort=function(){var f;this.abortInternal(),(f=this.callbacks)!==null&&f!==void 0&&f.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},P.load=function(f,b,M){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=f,this.config=b,this.callbacks=M,this.retryDelay=b.retryDelay,this.loadInternal()},P.loadInternal=function(){var f=this.config,b=this.context;if(!f)return;var M=this.loader=new self.XMLHttpRequest,A=this.stats;A.loading.first=0,A.loaded=0;var S=this.xhrSetup;try{if(S)try{S(M,b.url)}catch(a){M.open("GET",b.url,!0),S(M,b.url)}M.readyState||M.open("GET",b.url,!0);var T=this.context.headers;if(T)for(var d in T)M.setRequestHeader(d,T[d])}catch(a){this.callbacks.onError({code:M.status,text:a.message},b,M);return}b.rangeEnd&&M.setRequestHeader("Range","bytes="+b.rangeStart+"-"+(b.rangeEnd-1)),M.onreadystatechange=this.readystatechange.bind(this),M.onprogress=this.loadprogress.bind(this),M.responseType=b.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),f.timeout),M.send()},P.readystatechange=function(){var f=this.context,b=this.loader,M=this.stats;if(!f||!b)return;var A=b.readyState,S=this.config;if(M.aborted)return;if(A>=2)if(self.clearTimeout(this.requestTimeout),M.loading.first===0&&(M.loading.first=Math.max(self.performance.now(),M.loading.start)),A===4){b.onreadystatechange=null,b.onprogress=null;var T=b.status;if(T>=200&&T<300){M.loading.end=Math.max(self.performance.now(),M.loading.first);var d,a;if(f.responseType==="arraybuffer"?(d=b.response,a=d.byteLength):(d=b.responseText,a=d.length),M.loaded=M.total=a,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(M,f,d,b),!this.callbacks)return;var u={url:b.responseURL,data:d};this.callbacks.onSuccess(u,M,f,b)}else M.retry>=S.maxRetry||T>=400&&T<499?(X.logger.error(T+" while loading "+f.url),this.callbacks.onError({code:T,text:b.statusText},f,b)):(X.logger.warn(T+" while loading "+f.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,S.maxRetryDelay),M.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),S.timeout)},P.loadtimeout=function(){X.logger.warn("timeout while loading "+this.context.url);var f=this.callbacks;f&&(this.abortInternal(),f.onTimeout(this.stats,this.context,this.loader))},P.loadprogress=function(f){var b=this.stats;b.loaded=f.loaded,f.lengthComputable&&(b.total=f.total)},P.getCacheAge=function(){var f=null;if(this.loader&&O.test(this.loader.getAllResponseHeaders())){var b=this.loader.getResponseHeader("age");f=b?parseFloat(b):null}return f},F}();$.default=W}}).default})},vHTk:function(lt,$e,ie){lt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wU8J:function(lt,$e){function ie(){this.buffer=new Array,this.length=0}ie.prototype={get:function(ne){var $=Math.floor(ne/8);return(this.buffer[$]>>>7-ne%8&1)==1},put:function(ne,$){for(var k=0;k<$;k++)this.putBit((ne>>>$-k-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(ne){var $=Math.floor(this.length/8);this.buffer.length<=$&&this.buffer.push(0),ne&&(this.buffer[$]|=128>>>this.length%8),this.length++}},lt.exports=ie},wzkS:function(lt,$e,ie){"use strict";ie.d($e,"c",function(){return U}),ie.d($e,"b",function(){return O}),ie.d($e,"d",function(){return W}),ie.d($e,"a",function(){return P}),ie.d($e,"e",function(){return w});var ne=ie("9og8"),$=ie("WmNS"),k=ie.n($),X=ie("ErOA");function U(f){return Object(X.c)("libraries/".concat(f,".json"))}function O(){return Object(X.c)("library_tags.json")}function W(f){return F.apply(this,arguments)}function F(){return F=Object(ne.a)(k.a.mark(function f(b){var M;return k.a.wrap(function(S){for(;;)switch(S.prev=S.next){case 0:return S.next=2,Object(X.b)("attachments/".concat(b,".json"));case 2:return M=S.sent,S.abrupt("return",M.status===0);case 4:case"end":return S.stop()}},f)})),F.apply(this,arguments)}function P(f){return Object(X.f)("libraries.json",f)}function w(f,b){return Object(X.g)("libraries/".concat(f,".json"),b)}},y5JW:function(lt,$e,ie){"use strict";ie.d($e,"c",function(){return T}),ie.d($e,"a",function(){return d});var ne=ie("DZo9"),$=ie("8z0m"),k=ie("+L6B"),X=ie("2/Rp"),U=ie("9og8"),O=ie("k1fw"),W=ie("oBTY"),F=ie("miYZ"),P=ie("tsqr"),w=ie("WmNS"),f=ie.n(w),b=ie("q1tI"),M=ie.n(b),A=ie("m3rI"),S=ie("wzkS"),T="\u3000\u3000";function d(a){var s=["Bytes","KB","MB","GB","TB"];if(a==0)return"0 Byte";var u=parseInt(""+Math.floor(Math.log(a)/Math.log(1024)),10);return(a/Math.pow(1024,u)).toFixed(1)+" "+s[u]}$e.b=function(a){var s=a.value,u=s===void 0?[]:s,_=a.action,m=a.onChange,p=a.className,D=a.maxSize,E=D===void 0?150:D,g=a.title,c=g===void 0?"\u6587\u4EF6\u4E0A\u4F20":g,h=a.accept,o=h===void 0?null:h,C={multiple:!1,fileList:u,accept:o,withCredentials:!0,beforeUpload:function(R){var B=R.size/1024/1024;return B<E?!0:(P.b.error("\u8BE5\u6587\u4EF6\u65E0\u6CD5\u4E0A\u4F20\u3002\u8D85\u8FC7\u6587\u4EF6\u5927\u5C0F\u9650\u5236(".concat(E,"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.a.API_SERVER,"/api/attachments.json"),onChange:function(R){var B=Object(W.a)(R.fileList);B=B.map(function(j){return j.name.indexOf(T)===-1&&(j.name="".concat(j.name).concat(T).concat(d(j.size))),Object(O.a)({},j)}),m(B)},onRemove:function(){var v=Object(U.a)(f.a.mark(function B(j){var K,I,N;return f.a.wrap(function(q){for(;;)switch(q.prev=q.next){case 0:if(K=j.size/1024/1024,!(j.status==="uploading")){q.next=3;break}return q.abrupt("return",!0);case 3:if(K<E){q.next=7;break}return q.abrupt("return",!0);case 7:if(I=j.response?j.response.id:j.uid,!I){q.next=15;break}return q.next=11,Object(S.d)(j.response?j.response.id:j.id);case 11:return N=q.sent,q.abrupt("return",N);case 15:return q.abrupt("return",!0);case 16:case"end":return q.stop()}},B)}));function R(B){return v.apply(this,arguments)}return R}()};function x(v){v.preventDefault(),v.stopPropagation()}return M.a.createElement("div",{className:"single-upload ".concat(p||"")},M.a.createElement($.a,C,M.a.createElement(X.a,{type:"primary",title:u.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:u.length>0,ghost:!0},c),M.a.createElement("span",{onClick:x,style:{marginLeft:10}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",E,"M) ")))}}}]);